Coverage Report - org.codehaus.classworlds.Configurator
 
Classes in this File Line Coverage Branch Coverage Complexity
Configurator
0 %
0/17
N/A
1
 
 1  
 package org.codehaus.classworlds;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2010 Codehaus Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *      http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.io.FileNotFoundException;
 20  
 import java.io.IOException;
 21  
 import java.io.InputStream;
 22  
 import java.net.MalformedURLException;
 23  
 
 24  
 /**
 25  
  * A compatibility wrapper for org.codehaus.plexus.classworlds.launcher.Configurator
 26  
  * provided for legacy code
 27  
  *
 28  
  * @author Andrew Williams
 29  
  */
 30  
 @Deprecated
 31  
 public class Configurator
 32  
 {
 33  
     private ConfiguratorAdapter config;
 34  
 
 35  
     /** Construct.
 36  
      *
 37  
      *  @param launcher The launcher to configure.
 38  
      */
 39  
     public Configurator( Launcher launcher )
 40  0
     {
 41  0
         config = ConfiguratorAdapter.getInstance(
 42  
             new org.codehaus.plexus.classworlds.launcher.Configurator( launcher ), launcher );
 43  0
     }
 44  
 
 45  
     /** Construct.
 46  
      *
 47  
      *  @param world The classWorld to configure.
 48  
      */
 49  
     public Configurator( ClassWorld world )
 50  0
     {
 51  0
         config = ConfiguratorAdapter.getInstance(
 52  
             new org.codehaus.plexus.classworlds.launcher.Configurator(
 53  
                 ClassWorldReverseAdapter.getInstance( world ) ), world );
 54  0
     }
 55  
 
 56  
     /** set world.
 57  
      *  this setter is provided so you can use the same configurator to configure several "worlds"
 58  
      *
 59  
      *  @param world The classWorld to configure.
 60  
      */
 61  
     public void setClassWorld( ClassWorld world )
 62  
     {
 63  0
         config.setClassWorld( world );
 64  0
     }
 65  
 
 66  
     /**
 67  
      * Configure from a file.
 68  
      *
 69  
      * @param is The config input stream
 70  
      * @throws IOException             If an error occurs reading the config file.
 71  
      * @throws MalformedURLException   If the config file contains invalid URLs.
 72  
      * @throws ConfigurationException  If the config file is corrupt.
 73  
      * @throws DuplicateRealmException If the config file defines two realms with the same id.
 74  
      * @throws NoSuchRealmException    If the config file defines a main entry point in
 75  
      *                                 a non-existent realm.
 76  
      */
 77  
     public void configure( InputStream is )
 78  
         throws IOException, MalformedURLException, ConfigurationException, DuplicateRealmException, NoSuchRealmException
 79  
     {
 80  0
         config.configureAdapter( is );
 81  0
     }
 82  
 
 83  
     /**
 84  
      * Associate parent realms with their children.
 85  
      */
 86  
     protected void associateRealms()
 87  
     {
 88  0
         config.associateRealms();
 89  0
     }
 90  
 
 91  
     /**
 92  
      * Load a glob into the specified classloader.
 93  
      *
 94  
      * @param line  The path configuration line.
 95  
      * @param realm The realm to populate
 96  
      * @throws MalformedURLException If the line does not represent
 97  
      *                               a valid path element.
 98  
      * @throws FileNotFoundException If the line does not represent
 99  
      *                               a valid path element in the filesystem.
 100  
      */
 101  
     protected void loadGlob( String line, ClassRealm realm )
 102  
         throws MalformedURLException, FileNotFoundException
 103  
     {
 104  0
         loadGlob( line, realm, false );
 105  0
     }
 106  
 
 107  
     /**
 108  
      * Load a glob into the specified classloader.
 109  
      *
 110  
      * @param line  The path configuration line.
 111  
      * @param realm The realm to populate
 112  
      * @param optionally Whether the path is optional or required
 113  
      * @throws MalformedURLException If the line does not represent
 114  
      *                               a valid path element.
 115  
      * @throws FileNotFoundException If the line does not represent
 116  
      *                               a valid path element in the filesystem.
 117  
      */
 118  
     protected void loadGlob( String line, ClassRealm realm, boolean optionally )
 119  
         throws MalformedURLException, FileNotFoundException
 120  
     {
 121  0
         config.loadGlob( line, realm, optionally );
 122  0
     }
 123  
 
 124  
     /**
 125  
      * Filter a string for system properties.
 126  
      *
 127  
      * @param text The text to filter.
 128  
      * @return The filtered text.
 129  
      * @throws ConfigurationException If the property does not
 130  
      *                                exist or if there is a syntax error.
 131  
      */
 132  
     protected String filter( String text )
 133  
         throws ConfigurationException
 134  
     {
 135  0
         return config.filter( text );
 136  
     }
 137  
 
 138  
 }
 139