You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/05/11 08:30:56 UTC
cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader DefaultClassLoaderManager.java PolicyClassLoader.java Resources.properties SarURLConnection.java SarURLStreamHandlerFactory.java
donaldp 02/05/10 23:30:56
Modified: src/java/org/apache/avalon/phoenix/components/classloader
DefaultClassLoaderManager.java
PolicyClassLoader.java Resources.properties
Removed: src/java/org/apache/avalon/phoenix/components/classloader
SarURLConnection.java
SarURLStreamHandlerFactory.java
Log:
Removed the java files for SarURL* as it was not currently being used.
Revision Changes Path
1.32 +7 -13 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/DefaultClassLoaderManager.java
Index: DefaultClassLoaderManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/DefaultClassLoaderManager.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- DefaultClassLoaderManager.java 11 May 2002 02:05:13 -0000 1.31
+++ DefaultClassLoaderManager.java 11 May 2002 06:30:56 -0000 1.32
@@ -115,7 +115,8 @@
if( getLogger().isDebugEnabled() )
{
final String message =
- REZ.getString( "classpath-entries", Arrays.asList( classPath ) );
+ REZ.getString( "classpath-entries",
+ Arrays.asList( classPath ) );
getLogger().debug( message );
}
@@ -132,17 +133,8 @@
getLogger().debug( message );
}
- //If source is not a file then there will be no need to pass in
- //a URLStreamHandler factory anyway so we can just pass in null
- //SarURLStreamHandlerFactory factory = null;
- //if( source.isFile() )
- //{
- //final JarFile archive = new JarFile( source, true, JarFile.OPEN_READ );
- //factory = new SarURLStreamHandlerFactory( archive );
- //URL.setURLStreamHandlerFactory( factory );
- //}
final PolicyClassLoader classLoader =
- new PolicyClassLoader( classPath, m_commonClassLoader, null, policy );
+ new PolicyClassLoader( classPath, m_commonClassLoader, policy );
setupLogger( classLoader, "classloader" );
for( int i = 0; i < extensions.length; i++ )
@@ -171,10 +163,12 @@
if( getLogger().isDebugEnabled() )
{
final String message1 =
- REZ.getString( "available-extensions", Arrays.asList( available ) );
+ REZ.getString( "available-extensions",
+ Arrays.asList( available ) );
getLogger().debug( message1 );
final String message2 =
- REZ.getString( "required-extensions", Arrays.asList( required ) );
+ REZ.getString( "required-extensions",
+ Arrays.asList( required ) );
getLogger().debug( message2 );
}
1.16 +22 -93 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/PolicyClassLoader.java
Index: PolicyClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/PolicyClassLoader.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PolicyClassLoader.java 10 May 2002 02:43:03 -0000 1.15
+++ PolicyClassLoader.java 11 May 2002 06:30:56 -0000 1.16
@@ -11,12 +11,9 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
-import java.util.ArrayList;
import java.util.Enumeration;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
@@ -36,9 +33,6 @@
///Policy to use to define permissions for classes loaded in classloader
private final Policy m_policy;
- ///Factory that used to create URLStreamHandlers
- private final URLStreamHandlerFactory m_factory;
-
///Logger to use when reporting information
private Logger m_logger;
@@ -47,27 +41,25 @@
* ClassLoader and Policy object.
*
* @param urls the URLs to load resources from
- * @param classLoader the parent ClassLoader
+ * @param parent the parent ClassLoader
* @param policy the Policy object
*/
PolicyClassLoader( final String[] urls,
final ClassLoader parent,
- final URLStreamHandlerFactory factory,
final Policy policy )
throws MalformedURLException
{
- super( new URL[ 0 ], parent, factory );
+ super( new URL[ 0 ], parent );
if( null == policy )
{
throw new NullPointerException( "policy" );
}
m_policy = policy;
- m_factory = factory;
for( int i = 0; i < urls.length; i++ )
{
- final URL url = createURL( urls[ i ] );
+ final URL url = new URL( urls[ i ] );
addURL( url );
}
}
@@ -88,6 +80,25 @@
}
/**
+ * Overide findClass to log debugging information
+ * indicating that a class is being loaded from application
+ * ClassLoader.
+ *
+ * @param name the name of class ot load
+ * @return the Class loaded
+ * @throws ClassNotFoundException if can not find class
+ */
+ protected Class findClass( final String name )
+ throws ClassNotFoundException
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "findClass(" + name + ")" );
+ }
+ return super.findClass( name );
+ }
+
+ /**
* Overide so we can have a per-application security policy with
* no side-effects to other applications.
*
@@ -159,87 +170,5 @@
}
return url;
- }
-
- /**
- * Create an array of URL objects from strings, using specified URLHandlerFactory.
- *
- * @param classPath the string representation of urls
- * @return the URL array
- * @throws MalformedURLException if an error occurs
- */
- private URL[] createURLs( final String[] classPath )
- throws MalformedURLException
- {
- final ArrayList urls = new ArrayList();
-
- for( int i = 0; i < classPath.length; i++ )
- {
- final URL url = createURL( classPath[ i ] );
- urls.add( url );
- }
-
- return (URL[])urls.toArray( new URL[ 0 ] );
- }
-
- /**
- * Utility method to create a URL from string representation
- * using our <code>URLStreamHandlerFactory</code> object.
- *
- * @param url the string representation of URL
- * @throws MalformedURLException if URL is badly formed or
- * protocol can not be found
- */
- private URL createURL( final String url )
- throws MalformedURLException
- {
- if( null == url )
- {
- throw new NullPointerException( "url" );
- }
-
- final String scheme = parseScheme( url );
- final URLStreamHandler handler = createHandler( scheme );
-
- return new URL( null, url, handler );
- }
-
- /**
- * Create a URLStreamHandler for protocol if it needs one.
- *
- * @param scheme the scheme/protocol to create handler for
- * @return the created URLStreamHandler or null
- * @throws MalformedURLException if an error occurs
- */
- private URLStreamHandler createHandler( final String scheme )
- throws MalformedURLException
- {
- if( null != m_factory )
- {
- return m_factory.createURLStreamHandler( scheme );
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Utility method to parse out the scheme of a URL.
- *
- * @param url the full string representation of url
- * @return the scheme part of URL
- * @throws MalformedURLException if an error occurs
- */
- private String parseScheme( final String url )
- throws MalformedURLException
- {
- final int index = url.indexOf( ':' );
- if( -1 == index )
- {
- throw new MalformedURLException( "No scheme specified for url " + url );
- }
-
- return url.substring( 0, index );
}
}
1.9 +1 -4 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/Resources.properties
Index: Resources.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/classloader/Resources.properties,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Resources.properties 2 Dec 2001 03:45:58 -0000 1.8
+++ Resources.properties 11 May 2002 06:30:56 -0000 1.9
@@ -7,12 +7,9 @@
policy.error.certificate.aquire=Error aquiring certificate {0}.
policy.error.alias.missing=Unable to locate alias {0} in keystore named {1}.
-create-connection=Cannot create connection using {0} protocol.
-parse-url=No {0}/ found in url spec: {1}
-
missing.extension=Unable to locate an extension that is required by application.\nExtension Name: {0}\nSpecification Vendor: {1}\nSpecification Version: {2}\nImplementation Vendor: {3}\nImplementation Vendor-Id: {4}\nImplementation Version: {5}\nImplementation URL: {6}
unsatisfied.extensions=Missing {0} extensions and thus can not build ClassLoader for application.
-bad-classpath-entry=There is a bad entry ("{0}") on classpath that made it impossible to load a manifest.
+bad-classpath-entry=There is a bad entry ("{0}") on classpath that made it impossible to load a manifest.
available-extensions=The list of available extensions for application includes; {0}
required-extensions=The list of required extensions for application includes; {0}
optional-packages-added=The list of "Optional Packages" added to the application includes; {0}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>