classworlds-1.1-final.orig/ 0000755 0001750 0001750 00000000000 10724631543 014420 5 ustar doko doko classworlds-1.1-final.orig/xdocs/ 0000755 0001750 0001750 00000000000 10724631543 015540 5 ustar doko doko classworlds-1.1-final.orig/xdocs/stylesheets/ 0000755 0001750 0001750 00000000000 10724631543 020114 5 ustar doko doko classworlds-1.1-final.orig/xdocs/stylesheets/clover-style.css 0000644 0001750 0001750 00000007326 10724631434 023265 0 ustar doko doko
BODY {
FONT-FAMILY: verdana, arial, sans-serif
}
a:link.selfref, a:visited.selfref {
color: #555 !important;
}
a:link, a:visited {
font-family: sans-serif;
color:#000099;
text-decoration: none;
}
a:active, a:hover {
color:#990000;
text-decoration: underline;
}
TABLE {
FONT-SIZE: 9px;
border-spacing: 2px;
}
TD {
border: 1px solid #555555;
}
TD.hbreak {
border: none;
}
.navBar {
Font-weight: normal; Font-size: 12px;
}
TD.itemList {
Font-weight: normal; Font-size: 12px; FONT-FAMILY: arial, sans-serif;
padding:2px;
border: none;
}
TD.itemList a {
line-height: 1.4em;
}
DIV.navBar {
font-size: 8pt;
padding-top:4px;
color:#222222;
}
DIV.navBar a {
color:#222222;
}
FONT.navBarCurrent {
padding: 4px; font-weight: bold; color: #FFFFFF; background-color:#990000;
}
TD.reportHeader {
BACKGROUND: #eeeeee;
PADDING: 5px;
FONT-WEIGHT: bold;
FONT-SIZE: 12px;
BORDER: #555555 1px solid;
border: none;
}
.titleText {
font-weight: bold;
font-size: normal;
font-family: sans-serif;
color:#990000;
line-height: 2em;
border: 1px solid #aaaaaa;
padding-left:4px;
padding-right:4px;
padding-top:2px;
padding-bottom:2px;
}
TD.titleText {
BACKGROUND: #eff7ff; PADDING-left: 5px;
background: #dddddd;
font-size: 10pt;
}
TD.headerStats {
border: none;
}
TD.headerStats table td {
border: none;
color:#555555;
}
TD.graphHeaderLeft {
BACKGROUND: #cccccc;
BORDER: #777777 1px solid;
color: #990000;
font-size: 8pt;
}
TD.graphHeader {
BACKGROUND: #cccccc;
BORDER-BOTTOM: #777777 1px solid;
BORDER-TOP: #777777 1px solid;
BORDER-RIGHT: #777777 1px solid;
color: #990000;
font-size: 8pt;
}
TD.graphItem {
BACKGROUND: #eeeeee;
BORDER-BOTTOM: #777777 1px solid;
BORDER-LEFT: #777777 1px solid;
BORDER-RIGHT: #777777 1px solid;
PADDING-LEFT: 15px;
PADDING-RIGHT: 15px;
FONT-WEIGHT: bold; FONT-SIZE: 12px;
}
TD.graphPercent {
font-size:8pt;
BACKGROUND: #eeeeee;
border-bottom: 1px solid #777777;
border-right: 1px solid #777777;
}
TD.graphBarLeft {
font-size:8pt;
BACKGROUND: #eeeeee;
border-bottom: 1px solid #777777;
border-right: 1px solid #777777;
}
TD.graphBar {
BACKGROUND: white;
border: none;
padding:2px;
width: 80%;
}
TD.hspacer {
BORDER-BOTTOM:#dcdcdc 1px solid; BORDER-TOP:#dcdcdc 1px solid;
}
TABLE.barGraph {
WIDTH: 100%;
}
TD.empty {
FONT-SIZE: 2px; BACKGROUND: #c0c0c0; BORDER:#9c9c9c 1px solid;
}
TD.fullcover {
FONT-SIZE: 2px; BACKGROUND: #00df00; BORDER:#9c9c9c 1px solid;
}
TD.covered {
FONT-SIZE: 2px; BACKGROUND: #009900;
border:1px solid black;
}
TD.uncovered {
FONT-SIZE: 2px; BACKGROUND: #990000;
border:none;
border:1px solid black;
}
TD.tabText {
PADDING-RIGHT: 12px;
}
DIV.timestamp {
FONT-SIZE: 10px; font-weight: normal; padding-left: 1px;
color:#555555;
}
SPAN.srcFile {
FONT-SIZE: 9px
}
TABLE.srcView {
FONT-SIZE: 12px;
BORDER:#555555 1px solid;
}
TD.lineCount {
border: 1px solid #999999;
BACKGROUND: #F0F0F0;
PADDING-RIGHT: 3px;
}
TD.lineCountHilight {
border: 1px solid #999999;
BACKGROUND: #C8C8F0;
PADDING-RIGHT: 3px;
}
SPAN.Hilight {
BACKGROUND: #C8C8F0;
}
SPAN.srcHilight pre {
BACKGROUND: #ddaaaa;
}
TD.coverageCount {
border: 1px solid #999999;
BACKGROUND: #F0F0F0;
PADDING-RIGHT: 3px;
}
TD.coverageCountHilight {
border: 1px solid #999999;
BACKGROUND: #F0C8C8;
PADDING-RIGHT: 3px;
}
TD.srcLine {
border: none;
WIDTH: 100%
}
TD.srcLineClassStart {
border: none;
WIDTH: 100%; BORDER-TOP:#dcdcdc 1px solid; FONT-WEIGHT: bold;
}
PRE.srcLine {
BACKGROUND: #ffffff; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px;
}
TD.footer {
FONT-SIZE: 9px;
background-color:#dddddd;
}
TD.footer td {
color:#777777;
}
classworlds-1.1-final.orig/xdocs/stylesheets/maven_ns4_only.css 0000644 0001750 0001750 00000000702 10724631434 023557 0 ustar doko doko body {
background: #fff;
color: #000;
}
a:active, a:hover, #leftcol a:active, #leftcol a:hover {
color: #f30;
}
#leftcol a:link, #leftcol a:visited {
color: blue;
}
.a td {
background: #ddd;
color: #000;
}
.b td {
background: #efefef;
color: #000;
}
body .app th {
background-color: #bbb;
color: #fff;
}
#navcolumn div strong {
background: #fff;
color: #555;
}
#banner, #banner td {
background: white;
color: #fff;
}
classworlds-1.1-final.orig/xdocs/stylesheets/print.css 0000644 0001750 0001750 00000000250 10724631434 021756 0 ustar doko doko #banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks {
display: none;
}
body.docs div.docs {
margin: 0 !important;
border: none !important
}
classworlds-1.1-final.orig/xdocs/stylesheets/tigris.css 0000644 0001750 0001750 00000020111 10724631434 022121 0 ustar doko doko /* contains rules unsuitable for Netscape 4.x; simpler rules are in ns4_only.css. see
Official builds can be found in the classworlds distribution directory.
The latest official build is 1.0.
The
In a application container environment, the container may
have a realm capable of loading on the container/component
contract interfaces and classes. Another realm is created
for each component which imports the contract classes from
the container realm.
This model allows for fine-grained control of which
classloader loads any particular class. This form of
partial isolation can reduce the myriad strange errors
that are produced by loading classes from multiple
loaders.
Pete Kazmier has written the
uberjar plugin for maven.
Simply set (in your project.properties) the
An uberjar containing your project's jar and all dependencies will be created for you.
To create a standalone jar (aka, an uberjar), simply build your application's
jar as normal. Gather up all dependent jars and create a to contain all jars required by your application. to hold your classworlds
is a framework for container developers
who require complex manipulation of Java's ClassLoaders. Java's
native ClassLoader
mechanims and classes can cause
much headache and confusion for certain types of application
developers. Projects which involve dynamic loading of components
or otherwise represent a 'container' can benefit from the classloading
control provided by classworlds
.
classworlds
provides a richer set of semantics for
class loading than Java's normal mechanisms, while still being
able to provide a ClassLoader
interface to integrate
seamlessly with the Java environment.
classworlds
model does away with the hierarchy
normally associated with ClassLoaders. Instead, there is a
pool of ClassRealms
which can import arbitrary packages from other ClassRealms.
Effectively, classworlds
turns the old-style
hierarchy into a directed graph.
This is subject to change and will probably be configurable in
the future.
maven.uberjar.main
property to
the name of your "main" class, and type:
classworlds
allows the creation of a single standalone
jar for your project which may internally include any other additional
jars that are required for your application. This allows for easy
java -jar myapp.jar
type of execution.
classworlds.conf
for your application. Similar to other jar formats, a meta-directory is
created within the uberjar, named WORLDS-INF/
. It contains
two directories:
WORLDS-INF/lib/
WORLDS-INF/conf/
classworld.conf
file.
The classworlds.conf
should be created as normal, with the special
exception that the property ${classworlds.lib}
points to the internal
library directory WORLDS-INF/lib/
so that jars can be loaded from
within the uberjar:
The core classworlds
jar needs to be placed at the root of the
WORLDS-INF
directory, named exactly classworlds.jar
Create the required directory structure, and populate it with the appropriate files. For example:
All that remains is unjaring the classes from classworlds-boot.jar
into
your assembly directory and creating your final jar. The final layout should appear like:
Now, simply create and distribute your standalone uberjar:
This project's CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. When prompted for a password for anonymous, simply press the Enter key.
Updates from within the module's directory do not need the -d parameter.
Only project developers can access the CVS tree via this method. SSH1 must be installed on your client machine. Substitute developername with the proper value. Enter your site password when prompted.
The Werken Company runs an IRC server to support the interactive efforts of project members.
To access the IRC server, point an appropriate IRC client at:
server: irc.werken.com port: 6667
You may find folks hanging out in either #werken
or #classworlds
.
The Java API can be used to create new realms and connect realms together through importation of specific packages.
The core of the classworlds
infrastructure is
the
ClassWorld
class. An application must create a ClassWorld
instance.
It is advisable to store the instance as a singleton or some other
handy location.
Once a ClassWorld
is created, realms within it
can be created. These realms effectively only allow loading
of the core JVM classes.
In order to make each ClassRealm
useful, constituent
must be added to that each can provide certain classes.
Now, links between the various realms need to be created to allow classes loaded from one to be available to classes loaded in another.
The container implementation can then be loaded from it's realm and used.
Ideally, the container itself would be responsible for creating
a ClassRealm
for each component that's loaded, and
importing the component contract interfaces into the component's
ClassRealm
and using loadClass(..)
to gain entry into the sandboxed component realm.
In order to reduce the number of classloading projects,
classworlds
replaces forehead
for application launching.
The main problems to solve in application launching include
locating all of application's JARs, configuring the initial
classloaders, and invoking the main
entry method.
The launcher facilities of classworlds
simplify
the process of locating application jars. A common idiom is
to have a script which starts the JVM with only the
classworlds.jar
in the classpath and a system
property to specify the location of a launcher configuration.
Additionally, typically a property specifying the installation
location is passed on the command-line.
The entry-point class and realm must be specified
using the main is
directive before
specifying realm definitions.
At least one classworlds
realm must be defined
within the configuration file. The syntax for starting a
realm definition is [realm.name]
. All lines
following the realm header are considered directives for
that realm. The realm definition continues either until
another realm is defined or until the end of the file is
reached.
Within a realm definition, two directives are available:
load
and import
.
The load
directive specifies a class source to be used for loading
classes in the realm. Any loaded source that ends with
the /
character is considered a directory
hierarchy of classes and resources and all others are
considered to be JAR files. System properties may be
referred to using ${propname}
notation.
The load
directive is equivelent to the
addConstituent(..)
method of ClassRealm
.
The import
directive specifies that certain
packages should be imported and loaded by way of another
realm. The import
directive is equivelent
to the importFrom(..)
method of
ClassRealm
.
classworlds
can be used to invoke any existing
application's main()
method. Using the standard
entry point does not allow for gaining access to the
ClassWorld
of the application, but not all
applications will need it at run-time.
For those applications that do require the ClassWorld
instance, an alternative entry-point method signature can be
provide. Simply add a ClassWorld
parameter to
the standard main
parameter list.
URLConnection
capable of handling multiply-nested jars.
*
* @author bob mcwhirter
* @version $Id: JarUrlConnection.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class JarUrlConnection
extends JarURLConnection
{
// ----------------------------------------------------------------------
// Instance members
// ----------------------------------------------------------------------
/**
* Base resource.
*/
private URL baseResource;
/**
* Additional nested segments.
*/
private String[] segments;
/**
* Terminal input-stream.
*/
private InputStream in;
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
/**
* Construct.
*
* @param url Target URL of the connections.
* @throws java.io.IOException If an error occurs while attempting to initialize
* the connection.
*/
JarUrlConnection( URL url )
throws IOException
{
super( url = normaliseURL( url ) );
String baseText = url.getPath();
int bangLoc = baseText.indexOf( "!" );
String baseResourceText = baseText.substring( 0, bangLoc );
String extraText = "";
if ( bangLoc <= ( baseText.length() - 2 )
&&
baseText.charAt( bangLoc + 1 ) == '/' )
{
if ( bangLoc + 2 == baseText.length() )
{
extraText = "";
}
else
{
extraText = baseText.substring( bangLoc + 1 );
}
}
else
{
throw new MalformedURLException( "No !/ in url: " + url.toExternalForm() );
}
List segments = new ArrayList();
StringTokenizer tokens = new StringTokenizer( extraText, "!" );
while ( tokens.hasMoreTokens() )
{
segments.add( tokens.nextToken() );
}
this.segments = (String[]) segments.toArray( new String[segments.size()] );
this.baseResource = new URL( baseResourceText );
}
protected static URL normaliseURL( URL url ) throws MalformedURLException
{
String text = UrlUtils.normalizeUrlPath( url.toString() );
if ( !text.startsWith( "jar:" ) )
{
text = "jar:" + text;
}
if ( text.indexOf( '!' ) < 0 )
{
text = text + "!/";
}
return new URL( text );
}
// ----------------------------------------------------------------------
// Instance methods
// ----------------------------------------------------------------------
/**
* Retrieve the nesting path segments.
*
* @return The segments.
*/
protected String[] getSegments()
{
return this.segments;
}
/**
* Retrieve the base resource URL
.
*
* @return The base resource url.
*/
protected URL getBaseResource()
{
return this.baseResource;
}
/**
* @see java.net.URLConnection
*/
public void connect()
throws IOException
{
if ( this.segments.length == 0 )
{
setupBaseResourceInputStream();
}
else
{
setupPathedInputStream();
}
}
/**
* Setup the InputStream
purely from the base resource.
*
* @throws java.io.IOException If an I/O error occurs.
*/
protected void setupBaseResourceInputStream()
throws IOException
{
this.in = getBaseResource().openStream();
}
/**
* Setup the InputStream
for URL with nested segments.
*
* @throws java.io.IOException If an I/O error occurs.
*/
protected void setupPathedInputStream()
throws IOException
{
InputStream curIn = getBaseResource().openStream();
for ( int i = 0; i < this.segments.length; ++i )
{
curIn = getSegmentInputStream( curIn,
segments[i] );
}
this.in = curIn;
}
/**
* Retrieve the InputStream
for the nesting
* segment relative to a base InputStream
.
*
* @param baseIn The base input-stream.
* @param segment The nesting segment path.
* @return The input-stream to the segment.
* @throws java.io.IOException If an I/O error occurs.
*/
protected InputStream getSegmentInputStream( InputStream baseIn,
String segment )
throws IOException
{
JarInputStream jarIn = new JarInputStream( baseIn );
JarEntry entry = null;
while ( jarIn.available() != 0 )
{
entry = jarIn.getNextJarEntry();
if ( entry == null )
{
break;
}
if ( ( "/" + entry.getName() ).equals( segment ) )
{
return jarIn;
}
}
throw new IOException( "unable to locate segment: " + segment );
}
/**
* @see java.net.URLConnection
*/
public InputStream getInputStream()
throws IOException
{
if ( this.in == null )
{
connect();
}
return this.in;
}
/**
* @return JarFile
* @throws java.io.IOException
* @see java.net.JarURLConnection#getJarFile()
*/
public JarFile getJarFile() throws IOException
{
String url = baseResource.toExternalForm();
if ( url.startsWith( "file:/" ) )
{
url = url.substring( 6 );
}
return new JarFile( URLDecoder.decode( url, "UTF-8" ) );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/uberjar/protocol/jar/Handler.java 0000644 0001750 0001750 00000012474 10724631435 032275 0 ustar doko doko package org.codehaus.classworlds.uberjar.protocol.jar;
/*
$Id: Handler.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
/**
* URLStreamHandler
for jar:
protocol URL
s.
*
* @author bob mcwhirter
* @version $Id: Handler.java 126 2006-01-12 04:17:51Z $
*/
public class Handler
extends URLStreamHandler
{
// ----------------------------------------------------------------------
// Class members
// ----------------------------------------------------------------------
/**
* Singleton instance.
*/
private static final Handler INSTANCE = new Handler();
// ----------------------------------------------------------------------
// Class methods
// ----------------------------------------------------------------------
/**
* Retrieve the singleton instance.
*
* @return The singleton instance.
*/
public static Handler getInstance()
{
return INSTANCE;
}
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
/**
* Construct.
*/
public Handler()
{
// intentionally left blank
}
// ----------------------------------------------------------------------
// Instance methods
// ----------------------------------------------------------------------
/**
* @see java.net.URLStreamHandler
*/
public URLConnection openConnection( URL url )
throws IOException
{
return new JarUrlConnection( url );
}
/**
* @see java.net.URLStreamHandler
*/
public void parseURL( URL url,
String spec,
int start,
int limit )
{
String specPath = spec.substring( start,
limit );
String urlPath = null;
if ( specPath.charAt( 0 ) == '/' )
{
urlPath = specPath;
}
else if ( specPath.charAt( 0 ) == '!' )
{
String relPath = url.getFile();
int bangLoc = relPath.lastIndexOf( "!" );
if ( bangLoc < 0 )
{
urlPath = relPath + specPath;
}
else
{
urlPath = relPath.substring( 0,
bangLoc ) + specPath;
}
}
else
{
String relPath = url.getFile();
if ( relPath != null )
{
int lastSlashLoc = relPath.lastIndexOf( "/" );
if ( lastSlashLoc < 0 )
{
urlPath = "/" + specPath;
}
else
{
urlPath = relPath.substring( 0,
lastSlashLoc + 1 ) + specPath;
}
}
else
{
urlPath = specPath;
}
}
setURL( url,
"jar",
"",
0,
null,
null,
urlPath,
null,
null );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/uberjar/boot/ 0000755 0001750 0001750 00000000000 10724631543 026373 5 ustar doko doko classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/uberjar/boot/Bootstrapper.java 0000644 0001750 0001750 00000015177 10724631435 031735 0 ustar doko doko package org.codehaus.classworlds.uberjar.boot;
/*
$Id: Bootstrapper.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/**
* Bootstrapping entry-point.
*
*
* The Bootstrapper
is to be used for standalone jars
* which carry all dependency jars within them. The layout for
* the dependency jar should be similar to:
*
*
* * myjar/ * classworlds.conf * org/ * codehaus/ * classworlds/ * boot/ * protocol/ * lib/ * myapp.jar * depOne.jar * depTwo.jar ** * @author Jason van Zyl * @author bob mcwhirter * @version $Id: Bootstrapper.java 78 2004-07-01 13:59:13Z jvanzyl $ */ public class Bootstrapper { // ---------------------------------------------------------------------- // Constants // ---------------------------------------------------------------------- /** * Main classworlds entry class. */ public static final String LAUNCHER_CLASS_NAME = "org.codehaus.classworlds.Launcher"; // ---------------------------------------------------------------------- // Instance members // ---------------------------------------------------------------------- /** * Command-line args. */ private String[] args; /** * Initial bootstrapping classloader. */ private InitialClassLoader classLoader; // ---------------------------------------------------------------------- // Class methods // ---------------------------------------------------------------------- /** * Main entry-point. * * @param args Command-line arguments. * @throws Exception If an error occurs. */ public static void main( String[] args ) throws Exception { System.setProperty( "java.protocol.handler.pkgs", "org.codehaus.classworlds.uberjar.protocol" ); Bootstrapper bootstrapper = new Bootstrapper( args ); bootstrapper.bootstrap(); } // ---------------------------------------------------------------------- // Constructors // ---------------------------------------------------------------------- /** * Construct. * * @param args Command-line arguments. * @throws Exception If an error occurs attempting to perform * bootstrap initialization. */ public Bootstrapper( String[] args ) throws Exception { this.args = args; this.classLoader = new InitialClassLoader(); } // ---------------------------------------------------------------------- // Instance methods // ---------------------------------------------------------------------- /** * Retrieve the initial bootstrapping
ClassLoader
.
*
* @return The classloader.
*/
protected ClassLoader getInitialClassLoader()
{
return this.classLoader;
}
/**
* Perform bootstrap.
*
* @throws Exception If an error occurs while bootstrapping.
*/
public void bootstrap()
throws Exception
{
ClassLoader cl = getInitialClassLoader();
Class launcherClass = cl.loadClass( LAUNCHER_CLASS_NAME );
Method[] methods = launcherClass.getMethods();
Method mainMethod = null;
for ( int i = 0; i < methods.length; ++i )
{
if ( !"main".equals( methods[i].getName() ) )
{
continue;
}
int modifiers = methods[i].getModifiers();
if ( !( Modifier.isStatic( modifiers )
&&
Modifier.isPublic( modifiers ) ) )
{
continue;
}
if ( methods[i].getReturnType() != Void.TYPE )
{
continue;
}
Class[] paramTypes = methods[i].getParameterTypes();
if ( paramTypes.length != 1 )
{
continue;
}
if ( paramTypes[0] != String[].class )
{
continue;
}
mainMethod = methods[i];
break;
}
if ( mainMethod == null )
{
throw new NoSuchMethodException( LAUNCHER_CLASS_NAME + "::main(String[] args)" );
}
System.setProperty( "classworlds.bootstrapped",
"true" );
mainMethod.invoke( launcherClass,
new Object[]{this.args} );
}
}
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/uberjar/boot/InitialClassLoader.java classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/uberjar/boot/InitialClassLoader.ja0000644 0001750 0001750 00000015150 10724631435 032417 0 ustar doko doko package org.codehaus.classworlds.uberjar.boot;
/*
$Id: InitialClassLoader.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.security.SecureClassLoader;
import java.util.Map;
import java.util.HashMap;
import java.util.jar.JarInputStream;
import java.util.jar.JarEntry;
/**
* Initial bootstrapping ClassLoader
.
*
* @author Jason van Zyl
* @author bob mcwhirter
* @version $Id: InitialClassLoader.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class InitialClassLoader
extends SecureClassLoader
{
// ----------------------------------------------------------------------
// Instance members
// ----------------------------------------------------------------------
/**
* Class index.
*/
private Map index;
/**
* Classworlds jar URL.
*/
private URL classworldsJarUrl;
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
/**
* Construct.
*
* @throws Exception If an error occurs while attempting to perform
* bootstrap initialization.
*/
public InitialClassLoader()
throws Exception
{
this.index = new HashMap();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL classUrl = getClass().getResource( "InitialClassLoader.class" );
String urlText = classUrl.toExternalForm();
int bangLoc = urlText.indexOf( "!" );
System.setProperty( "classworlds.lib",
urlText.substring( 0,
bangLoc ) + "!/WORLDS-INF/lib" );
this.classworldsJarUrl = new URL( urlText.substring( 0,
bangLoc ) + "!/WORLDS-INF/classworlds.jar" );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
* @see ClassLoader
*/
public synchronized Class findClass( String className )
throws ClassNotFoundException
{
String classPath = className.replace( '.',
'/' ) + ".class";
if ( this.index.containsKey( classPath ) )
{
return (Class) this.index.get( classPath );
}
try
{
JarInputStream in = new JarInputStream( this.classworldsJarUrl.openStream() );
try
{
JarEntry entry = null;
while ( ( entry = in.getNextJarEntry() ) != null )
{
if ( entry.getName().equals( classPath ) )
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
try
{
byte[] buffer = new byte[2048];
int read = 0;
while ( in.available() > 0 )
{
read = in.read( buffer,
0,
buffer.length );
if ( read < 0 )
{
break;
}
out.write( buffer,
0,
read );
}
buffer = out.toByteArray();
Class cls = defineClass( className,
buffer,
0,
buffer.length );
this.index.put( className,
cls );
return cls;
}
finally
{
out.close();
}
}
}
}
finally
{
in.close();
}
}
catch ( IOException e )
{
e.printStackTrace();
throw new ClassNotFoundException( "io error reading stream for: " + className );
}
throw new ClassNotFoundException( className );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/NoSuchRealmException.java 0000644 0001750 0001750 00000006447 10724631435 030713 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: NoSuchRealmException.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Indicates an attempt to retrieve a ClassRealm
from a
* ClassWorld
with an invalid id.
*
* @author bob mcwhirter
* @version $Id: NoSuchRealmException.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class NoSuchRealmException extends ClassWorldException
{
// ------------------------------------------------------------
// Instance members
// ------------------------------------------------------------
/**
* The realm id.
*/
private String id;
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
/**
* Construct.
*
* @param world The world.
* @param id The realm id.
*/
public NoSuchRealmException( ClassWorld world,
String id )
{
super( world, id );
this.id = id;
}
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
/**
* Retrieve the invalid realm id.
*
* @return The id.
*/
public String getId()
{
return this.id;
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/RealmDelegatingClassLoader.java 0000644 0001750 0001750 00000001543 10724631435 032005 0 ustar doko doko package org.codehaus.classworlds;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
/**
* @author jdcasey
*/
public class RealmDelegatingClassLoader
extends ClassLoader
{
private final ClassRealm realm;
public RealmDelegatingClassLoader(ClassRealm realm)
{
this.realm = realm;
}
protected Enumeration findResources( String name ) throws IOException
{
return realm.findResources( name );
}
public URL getResource( String name )
{
return realm.getResource( name );
}
public InputStream getResourceAsStream( String name )
{
return realm.getResourceAsStream( name );
}
public Class loadClass( String name ) throws ClassNotFoundException
{
return realm.loadClass( name );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/Launcher.java 0000644 0001750 0001750 00000035656 10724631435 026421 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: Launcher.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Command-line invokable application launcher.
*
*
* This launcher class assists in the creation of classloaders and ClassRealm
s
* from a configuration file and the launching of the application's main
* method from the correct class loaded through the correct classloader.
*
*
*
* The path to the configuration file is specified using the classworlds.conf
* system property, typically specified using the -D
switch to
* java
.
*
*
* @author bob mcwhirter
* @version $Id: Launcher.java 126 2006-01-12 04:17:51Z $
*/
public class Launcher
{
protected static final String CLASSWORLDS_CONF = "classworlds.conf";
protected static final String UBERJAR_CONF_DIR = "WORLDS-INF/conf/";
protected ClassLoader systemClassLoader;
protected String mainClassName;
protected String mainRealmName;
protected ClassWorld world;
private int exitCode = 0;
public Launcher()
{
}
public void setSystemClassLoader( ClassLoader loader )
{
this.systemClassLoader = loader;
}
public ClassLoader getSystemClassLoader()
{
return this.systemClassLoader;
}
public int getExitCode()
{
return exitCode;
}
public void setAppMain( String mainClassName, String mainRealmName )
{
this.mainClassName = mainClassName;
this.mainRealmName = mainRealmName;
}
public String getMainRealmName()
{
return this.mainRealmName;
}
public String getMainClassName()
{
return this.mainClassName;
}
public void setWorld( ClassWorld world )
{
this.world = world;
}
public ClassWorld getWorld()
{
return this.world;
}
/**
* Configure from a file.
*
* @param is The config input stream.
* @throws IOException If an error occurs reading the config file.
* @throws MalformedURLException If the config file contains invalid URLs.
* @throws ConfigurationException If the config file is corrupt.
* @throws DuplicateRealmException If the config file defines two realms
* with the same id.
* @throws NoSuchRealmException If the config file defines a main entry
* point in a non-existent realm.
*/
public void configure( InputStream is )
throws IOException, MalformedURLException, ConfigurationException,
DuplicateRealmException, NoSuchRealmException
{
Configurator configurator = new Configurator( this );
configurator.configure( is );
}
/**
* Retrieve the main entry class.
*
* @return The main entry class.
* @throws ClassNotFoundException If the class cannot be found.
* @throws NoSuchRealmException If the specified main entry realm does not exist.
*/
public Class getMainClass()
throws ClassNotFoundException, NoSuchRealmException
{
return getMainRealm().loadClass( getMainClassName() );
}
/**
* Retrieve the main entry realm.
*
* @return The main entry realm.
* @throws NoSuchRealmException If the specified main entry realm does not exist.
*/
public ClassRealm getMainRealm()
throws NoSuchRealmException
{
return getWorld().getRealm( getMainRealmName() );
}
/**
* Retrieve the enhanced main entry method.
*
* @return The enhanced main entry method.
* @throws ClassNotFoundException If the main entry class cannot be found.
* @throws NoSuchMethodException If the main entry method cannot be found.
* @throws NoSuchRealmException If the main entry realm cannot be found.
*/
protected Method getEnhancedMainMethod()
throws ClassNotFoundException, NoSuchMethodException, NoSuchRealmException
{
Method[] methods = getMainClass().getMethods();
Class cwClass = getMainRealm().loadClass( ClassWorld.class.getName() );
Method m = getMainClass().getMethod( "main", new Class[] { String[].class, cwClass } );
int modifiers = m.getModifiers();
if ( Modifier.isStatic( modifiers ) && Modifier.isPublic( modifiers ) )
{
if ( m.getReturnType() == Integer.TYPE || m.getReturnType() == Void.TYPE )
{
return m;
}
}
throw new NoSuchMethodException( "public static void main(String[] args, ClassWorld world)" );
}
/**
* Retrieve the main entry method.
*
* @return The main entry method.
* @throws ClassNotFoundException If the main entry class cannot be found.
* @throws NoSuchMethodException If the main entry method cannot be found.
* @throws NoSuchRealmException If the main entry realm cannot be found.
*/
protected Method getMainMethod()
throws ClassNotFoundException, NoSuchMethodException, NoSuchRealmException
{
Method m = getMainClass().getMethod( "main", new Class[] { String[].class } );
int modifiers = m.getModifiers();
if ( Modifier.isStatic( modifiers ) && Modifier.isPublic( modifiers ) )
{
if ( m.getReturnType() == Integer.TYPE || m.getReturnType() == Void.TYPE )
{
return m;
}
}
throw new NoSuchMethodException( "public static void main(String[] args) in " + getMainClass() );
}
/**
* Launch the application.
*
* @param args The application args.
* @throws ClassNotFoundException If the main entry class cannot be found.
* @throws IllegalAccessException If the method cannot be accessed.
* @throws InvocationTargetException If the target of the invokation is invalid.
* @throws NoSuchMethodException If the main entry method cannot be found.
* @throws NoSuchRealmException If the main entry realm cannot be found.
*/
public void launch( String[] args )
throws ClassNotFoundException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException, NoSuchRealmException
{
try
{
launchEnhanced( args );
return;
}
catch ( NoSuchMethodException e )
{
// ignore
}
launchStandard( args );
}
/**
* Attempt to launch the application through the enhanced main method.
*
*
* This will seek a method with the exact signature of:
*
*
* * public static void main(String[] args, ClassWorld world) ** * @param args The application args. * @throws ClassNotFoundException If the main entry class cannot be found. * @throws IllegalAccessException If the method cannot be accessed. * @throws InvocationTargetException If the target of the invokation is * invalid. * @throws NoSuchMethodException If the main entry method cannot be found. * @throws NoSuchRealmException If the main entry realm cannot be found. */ protected void launchEnhanced( String[] args ) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NoSuchRealmException { ClassRealm mainRealm = getMainRealm(); Class mainClass = getMainClass(); Method mainMethod = getEnhancedMainMethod(); ClassLoader cl = mainRealm.getClassLoader(); // ---------------------------------------------------------------------- // This is what the classloader for the main realm looks like when we // boot from the command line: // ---------------------------------------------------------------------- // [ AppLauncher$AppClassLoader ] : $CLASSPATH envar // ^ // | // | // [ AppLauncher$ExtClassLoader ] : ${java.home}/jre/lib/ext/*.jar // ^ // | // | // [ RealmClassLoader ] // ---------------------------------------------------------------------- Thread.currentThread().setContextClassLoader( cl ); Object ret = mainMethod.invoke( mainClass, new Object[]{args, getWorld()} ); if ( ret instanceof Integer ) { exitCode = ( ( Integer ) ret ).intValue(); } } /** * Attempt to launch the application through the standard main method. * * * This will seek a method with the exact signature of: * * *
* public static void main(String[] args) ** * @param args The application args. * @throws ClassNotFoundException If the main entry class cannot be found. * @throws IllegalAccessException If the method cannot be accessed. * @throws InvocationTargetException If the target of the invokation is * invalid. * @throws NoSuchMethodException If the main entry method cannot be found. * @throws NoSuchRealmException If the main entry realm cannot be found. */ protected void launchStandard( String[] args ) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NoSuchRealmException { ClassRealm mainRealm = getMainRealm(); Class mainClass = getMainClass(); Method mainMethod = getMainMethod(); Thread.currentThread().setContextClassLoader( mainRealm.getClassLoader() ); Object ret = mainMethod.invoke( mainClass, new Object[]{args} ); if ( ret instanceof Integer ) { exitCode = ( ( Integer ) ret ).intValue(); } } // ------------------------------------------------------------ // Class methods // ------------------------------------------------------------ /** * Launch the launcher from the command line. * Will exit using System.exit with an exit code of 0 for success, 100 if there was an unknown exception, * or some other code for an application error. * * @param args The application command-line arguments. */ public static void main( String[] args ) { try { int exitCode = mainWithExitCode( args ); System.exit( exitCode ); } catch ( Exception e ) { e.printStackTrace(); System.exit( 100 ); } } /** * Launch the launcher. * * @param args The application command-line arguments. * @return an integer exit code * @throws Exception If an error occurs. */ public static int mainWithExitCode( String[] args ) throws Exception { String classworldsConf = System.getProperty( CLASSWORLDS_CONF ); InputStream is = null; Launcher launcher = new Launcher(); ClassLoader cl = Thread.currentThread().getContextClassLoader(); launcher.setSystemClassLoader( cl ); if ( classworldsConf != null ) { is = new FileInputStream( classworldsConf ); } else { if ( "true".equals( System.getProperty( "classworlds.bootstrapped" ) ) ) { is = cl.getResourceAsStream( UBERJAR_CONF_DIR + CLASSWORLDS_CONF ); } else { is = cl.getResourceAsStream( CLASSWORLDS_CONF ); } } if ( is == null ) { throw new Exception( "classworlds configuration not specified nor found in the classpath" ); } launcher.configure( is ); try { launcher.launch( args ); } catch ( InvocationTargetException e ) { ClassRealm realm = launcher.getWorld().getRealm( launcher.getMainRealmName() ); URL[] constituents = realm.getConstituents(); System.out.println( "---------------------------------------------------" ); for ( int i = 0; i < constituents.length; i++ ) { System.out.println( "constituent[" + i + "]: " + constituents[i] ); } System.out.println( "---------------------------------------------------" ); // Decode ITE (if we can) Throwable t = e.getTargetException(); if ( t instanceof Exception ) { throw (Exception) t; } if ( t instanceof Error ) { throw (Error) t; } // Else just toss the ITE throw e; } return launcher.getExitCode(); } } classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/Entry.java 0000644 0001750 0001750 00000012003 10724631435 025736 0 ustar doko doko package org.codehaus.classworlds; /* $Id: Entry.java 126 2006-01-12 04:17:51Z $ Copyright 2002 (C) The Werken Company. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "classworlds" must not be used to endorse or promote products derived from this Software without prior written permission of The Werken Company. For written permission, please contact bob@werken.com. 4. Products derived from this Software may not be called "classworlds" nor may "classworlds" appear in their names without prior written permission of The Werken Company. "classworlds" is a registered trademark of The Werken Company. 5. Due credit should be given to The Werken Company. (http://classworlds.werken.com/). THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * Import description entry. * * @author bob mcwhirter */ class Entry implements Comparable { private final ClassRealm realm; private final String pkgName; Entry( ClassRealm realm, String pkgName ) { this.realm = realm; this.pkgName = pkgName; } // ------------------------------------------------------------ // Instance methods // ------------------------------------------------------------ /** * Retrieve the realm. * * @return The realm. */ ClassRealm getRealm() { return this.realm; } /** * Retrieve the page name. * * @return The package name. */ String getPackageName() { return this.pkgName; } /** * Determine if the classname matches the package * described by this entry. * * @param classname The class name to test. * @return
true
if this entry matches the
* classname, otherwise false
.
*/
boolean matches( String classname )
{
return classname.startsWith( getPackageName() );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// java.lang.Comparable
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
* Compare this entry to another for relative ordering.
*
*
* The natural ordering of Entry objects is reverse-alphabetical
* based upon package name.
*
*
* @param thatObj The object to compare.
* @return -1 if this object sorts before that object, 0
* if they are equal, or 1 if this object sorts
* after that object.
*/
public int compareTo( Object thatObj )
{
Entry that = (Entry) thatObj;
// We are reverse sorting this list, so that
// we get longer matches first:
//
// com.werken.foo.bar
// com.werken.foo
// com.werken
return ( getPackageName().compareTo( that.getPackageName() ) ) * -1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// java.lang.Object
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
* Test this entry for equality to another.
*
*
* Consistent with {@link #compareTo}, this method tests
* for equality purely on the package name.
*
*
* @param thatObj The object to compare
* @return true
if the two objects are
* semantically equivalent, otherwise false
.
*/
public boolean equals( Object thatObj )
{
Entry that = (Entry) thatObj;
return getPackageName().equals( that.getPackageName() );
}
/**
*
* Consistent with {@link #equals}, this method creates a hashCode
* based on the packagename.
*
*/
public int hashCode()
{
return getPackageName().hashCode();
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/Configurator.java 0000644 0001750 0001750 00000043607 10724631435 027315 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: Configurator.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* Launcher
configurator.
*
* @author bob mcwhirter
* @author Jason van Zyl
* @version $Id: Configurator.java 126 2006-01-12 04:17:51Z $
*/
public class Configurator
{
public static final String MAIN_PREFIX = "main is";
public static final String SET_PREFIX = "set";
public static final String IMPORT_PREFIX = "import";
public static final String LOAD_PREFIX = "load";
/** Optionally spec prefix. */
public static final String OPTIONALLY_PREFIX = "optionally";
/** The launcher to configure. */
private Launcher launcher;
private ClassWorld world;
/** Processed Realms. */
private Map configuredRealms;
/** Construct.
*
* @param launcher The launcher to configure.
*/
public Configurator( Launcher launcher )
{
this.launcher = launcher;
configuredRealms = new HashMap();
}
/** Construct.
*
* @param classWorld The classWorld to configure.
*/
public Configurator( ClassWorld world )
{
setClassWorld( world );
}
/** set world.
* this setter is provided so you can use the same configurator to configure several "worlds"
*
* @param classWorld The classWorld to configure.
*/
public void setClassWorld( ClassWorld world )
{
this.world = world;
configuredRealms = new HashMap();
}
/**
* Configure from a file.
*
* @param is The config input stream
* @throws IOException If an error occurs reading the config file.
* @throws MalformedURLException If the config file contains invalid URLs.
* @throws ConfigurationException If the config file is corrupt.
* @throws DuplicateRealmException If the config file defines two realms with the same id.
* @throws NoSuchRealmException If the config file defines a main entry point in
* a non-existent realm.
*/
public void configure( InputStream is )
throws IOException, MalformedURLException, ConfigurationException, DuplicateRealmException, NoSuchRealmException
{
BufferedReader reader = new BufferedReader( new InputStreamReader( is ) );
if ( world == null )
{
world = new ClassWorld();
}
ClassLoader foreignClassLoader = null;
if ( this.launcher != null ) foreignClassLoader = this.launcher.getSystemClassLoader();
ClassRealm curRealm = null;
String line = null;
int lineNo = 0;
boolean mainSet = false;
while ( true )
{
line = reader.readLine();
if ( line == null )
{
break;
}
++lineNo;
line = line.trim();
if ( canIgnore( line ) )
{
continue;
}
if ( line.startsWith( MAIN_PREFIX ) )
{
if ( mainSet )
{
throw new ConfigurationException( "Duplicate main configuration", lineNo, line );
}
String conf = line.substring( MAIN_PREFIX.length() ).trim();
int fromLoc = conf.indexOf( "from" );
if ( fromLoc < 0 )
{
throw new ConfigurationException( "Missing from clause", lineNo, line );
}
String mainClassName = conf.substring( 0, fromLoc ).trim();
String mainRealmName = conf.substring( fromLoc + 4 ).trim();
if ( this.launcher != null )
{
this.launcher.setAppMain( mainClassName, mainRealmName );
}
mainSet = true;
}
else if ( line.startsWith( SET_PREFIX ) )
{
String conf = line.substring( SET_PREFIX.length() ).trim();
int usingLoc = conf.indexOf( " using" ) + 1;
String property = null;
String propertiesFileName = null;
if ( usingLoc > 0 )
{
property = conf.substring( 0, usingLoc ).trim();
propertiesFileName = filter( conf.substring( usingLoc + 5 ).trim() );
conf = propertiesFileName;
}
String defaultValue = null;
int defaultLoc = conf.indexOf( " default" ) + 1;
if ( defaultLoc > 0 )
{
defaultValue = conf.substring( defaultLoc + 7 ).trim();
if ( property == null )
{
property = conf.substring( 0, defaultLoc ).trim();
}
else
{
propertiesFileName = conf.substring( 0, defaultLoc ).trim();
}
}
String value = System.getProperty( property );
if ( value != null )
{
continue;
}
if ( propertiesFileName != null )
{
File propertiesFile = new File( propertiesFileName );
if ( propertiesFile.exists() )
{
Properties properties = new Properties();
try
{
properties.load( new FileInputStream( propertiesFileName ) );
value = properties.getProperty( property );
}
catch ( Exception e )
{
// do nothing
}
}
}
if ( value == null && defaultValue != null )
{
value = defaultValue;
}
if ( value != null )
{
value = filter( value );
System.setProperty( property, value );
}
}
else if ( line.startsWith( "[" ) )
{
int rbrack = line.indexOf( "]" );
if ( rbrack < 0 )
{
throw new ConfigurationException( "Invalid realm specifier", lineNo, line );
}
String realmName = line.substring( 1, rbrack );
curRealm = world.newRealm( realmName, foreignClassLoader );
// Stash the configured realm for subsequent association processing.
configuredRealms.put( realmName, curRealm );
}
else if ( line.startsWith( IMPORT_PREFIX ) )
{
if ( curRealm == null )
{
throw new ConfigurationException( "Unhandled import", lineNo, line );
}
String conf = line.substring( IMPORT_PREFIX.length() ).trim();
int fromLoc = conf.indexOf( "from" );
if ( fromLoc < 0 )
{
throw new ConfigurationException( "Missing from clause", lineNo, line );
}
String importSpec = conf.substring( 0, fromLoc ).trim();
String relamName = conf.substring( fromLoc + 4 ).trim();
curRealm.importFrom( relamName, importSpec );
}
else if ( line.startsWith( LOAD_PREFIX ) )
{
String constituent = line.substring( LOAD_PREFIX.length() ).trim();
constituent = filter( constituent );
if ( constituent.indexOf( "*" ) >= 0 )
{
loadGlob( constituent, curRealm );
}
else
{
File file = new File( constituent );
if ( file.exists() )
{
curRealm.addConstituent( file.toURL() );
}
else
{
try
{
curRealm.addConstituent( new URL( constituent ) );
}
catch ( MalformedURLException e )
{
throw new FileNotFoundException( constituent );
}
}
}
}
else if ( line.startsWith( OPTIONALLY_PREFIX ) )
{
String constituent = line.substring( OPTIONALLY_PREFIX.length() ).trim();
constituent = filter( constituent );
if ( constituent.indexOf( "*" ) >= 0 )
{
loadGlob( constituent, curRealm, true );
}
else
{
File file = new File( constituent );
if ( file.exists() )
{
curRealm.addConstituent( file.toURL() );
}
else
{
try
{
curRealm.addConstituent( new URL( constituent ) );
}
catch (MalformedURLException e)
{
// swallow
}
}
}
}
else
{
throw new ConfigurationException( "Unhandled configuration", lineNo, line );
}
}
// Associate child realms to their parents.
associateRealms();
if ( this.launcher != null ) this.launcher.setWorld( world );
reader.close();
}
/**
* Associate parent realms with their children.
*/
protected void associateRealms()
{
List sortRealmNames = new ArrayList( configuredRealms.keySet() );
// sort by name
Comparator comparator = new Comparator()
{
public int compare( Object o1, Object o2 )
{
String g1 = (String) o1;
String g2 = (String) o2;
return g1.compareTo( g2 );
}
};
Collections.sort( sortRealmNames, comparator );
// So now we have something like the following for defined
// realms:
//
// root
// root.maven
// root.maven.plugin
//
// Now if the name of a realm is a superset of an existing realm
// the we want to make child/parent associations.
for ( Iterator i = sortRealmNames.iterator(); i.hasNext(); )
{
String realmName = (String) i.next();
int j = realmName.lastIndexOf( '.' );
if ( j > 0 )
{
String parentRealmName = realmName.substring( 0, j );
ClassRealm parentRealm = (ClassRealm) configuredRealms.get( parentRealmName );
if ( parentRealm != null )
{
ClassRealm realm = (ClassRealm) configuredRealms.get( realmName );
realm.setParent( parentRealm );
}
}
}
}
/**
* Load a glob into the specified classloader.
*
* @param line The path configuration line.
* @param realm The realm to populate
* @throws MalformedURLException If the line does not represent
* a valid path element.
* @throws FileNotFoundException If the line does not represent
* a valid path element in the filesystem.
*/
protected void loadGlob( String line, ClassRealm realm )
throws MalformedURLException, FileNotFoundException
{
loadGlob( line, realm, false );
}
/**
* Load a glob into the specified classloader.
*
* @param line The path configuration line.
* @param realm The realm to populate
* @param optionally Whether the path is optional or required
* @throws MalformedURLException If the line does not represent
* a valid path element.
* @throws FileNotFoundException If the line does not represent
* a valid path element in the filesystem.
*/
protected void loadGlob( String line, ClassRealm realm, boolean optionally )
throws MalformedURLException, FileNotFoundException
{
File globFile = new File( line );
File dir = globFile.getParentFile();
if ( ! dir.exists() )
{
if ( optionally )
{
return;
}
else
{
throw new FileNotFoundException( dir.toString() );
}
}
String localName = globFile.getName();
int starLoc = localName.indexOf( "*" );
final String prefix = localName.substring( 0, starLoc );
final String suffix = localName.substring( starLoc + 1 );
File[] matches = dir.listFiles( new FilenameFilter()
{
public boolean accept( File dir, String name )
{
if ( !name.startsWith( prefix ) )
{
return false;
}
if ( !name.endsWith( suffix ) )
{
return false;
}
return true;
}
} );
for ( int i = 0; i < matches.length; ++i )
{
realm.addConstituent( matches[i].toURL() );
}
}
/**
* Filter a string for system properties.
*
* @param text The text to filter.
* @return The filtered text.
* @throws ConfigurationException If the property does not
* exist or if there is a syntax error.
*/
protected String filter( String text )
throws ConfigurationException
{
String result = "";
int cur = 0;
int textLen = text.length();
int propStart = -1;
int propStop = -1;
String propName = null;
String propValue = null;
while ( cur < textLen )
{
propStart = text.indexOf( "${", cur );
if ( propStart < 0 )
{
break;
}
result += text.substring( cur, propStart );
propStop = text.indexOf( "}", propStart );
if ( propStop < 0 )
{
throw new ConfigurationException( "Unterminated property: " + text.substring( propStart ) );
}
propName = text.substring( propStart + 2, propStop );
propValue = System.getProperty( propName );
if ( propValue == null )
{
throw new ConfigurationException( "No such property: " + propName );
}
result += propValue;
cur = propStop + 1;
}
result += text.substring( cur );
return result;
}
/**
* Determine if a line can be ignored because it is
* a comment or simply blank.
*
* @param line The line to test.
* @return true
if the line is ignorable,
* otherwise false
.
*/
private boolean canIgnore( String line )
{
return ( line.length() == 0
||
line.startsWith( "#" ) );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/DuplicateRealmException.java 0000644 0001750 0001750 00000006462 10724631435 031423 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: DuplicateRealmException.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Indicates an attempt to add a ClassRealm
to a
* ClassWorld
with a duplicate id.
*
* @author bob mcwhirter
* @version $Id: DuplicateRealmException.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class DuplicateRealmException extends ClassWorldException
{
// ------------------------------------------------------------
// Instance members
// ------------------------------------------------------------
/**
* The realm id.
*/
private String id;
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
/**
* Construct.
*
* @param world The world.
* @param id The realm id.
*/
public DuplicateRealmException( ClassWorld world,
String id )
{
super( world, id );
this.id = id;
}
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
/**
* Retrieve the duplicate realm id.
*
* @return The id.
*/
public String getId()
{
return this.id;
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/EmbeddedLauncher.java 0000644 0001750 0001750 00000021676 10724631435 030030 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: EmbeddedLauncher.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.FileInputStream;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/**
* Command-line invokable application launcher.
*
*
* This launcher class assists in the creation of classloaders and ClassRealm
s
* from a configuration file and the launching of the application's main
* method from the correct class loaded through the correct classloader.
*
*
*
* The path to the configuration file is specified using the classworlds.conf
* system property, typically specified using the -D
switch to
* java
.
*
*
* @author bob mcwhirter
* @version $Id: EmbeddedLauncher.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class EmbeddedLauncher
extends Launcher
{
private static String LAUNCH_METHOD = "execute";
public EmbeddedLauncher()
{
super();
}
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
/**
* Set the application's main entrypoint.
*
* @param mainClassName The main class name.
* @param mainRealmName The realm to load the class from.
*/
public void setAppMain( String mainClassName,
String mainRealmName )
{
this.mainClassName = mainClassName;
this.mainRealmName = mainRealmName;
}
/**
* Retrieve the main entry realm name.
*
* @return The main entry realm name.
*/
public String getMainRealmName()
{
return this.mainRealmName;
}
/**
* Retrieve the main entry class name.
*
* @return The main entry class name.
*/
public String getMainClassName()
{
return this.mainClassName;
}
/**
* Retrieve the main entry class.
*
* @return The main entry class.
* @throws ClassNotFoundException If the class cannot be found.
* @throws NoSuchRealmException If the specified main entry realm does not exist.
*/
public Class getMainClass()
throws ClassNotFoundException, NoSuchRealmException
{
return getMainRealm().loadClass( getMainClassName() );
}
/**
* Retrieve the main entry realm.
*
* @return The main entry realm.
* @throws NoSuchRealmException If the specified main entry realm does not exist.
*/
public ClassRealm getMainRealm()
throws NoSuchRealmException
{
return getWorld().getRealm( getMainRealmName() );
}
/**
* Retrieve the enhanced main entry method.
*
* @return The enhanced main entry method.
* @throws ClassNotFoundException If the main entry class cannot be found.
* @throws NoSuchMethodException If the main entry method cannot be found.
* @throws NoSuchRealmException If the main entry realm cannot be found.
*/
protected Method getEnhancedMainMethod()
throws ClassNotFoundException, NoSuchMethodException, NoSuchRealmException
{
Method[] methods = getMainClass().getMethods();
for ( int i = 0; i < methods.length; ++i )
{
final Method method = methods[i];
if ( !LAUNCH_METHOD.equals( method.getName() ) )
{
continue;
}
int modifiers = method.getModifiers();
if ( !( Modifier.isPublic( modifiers ) ) )
{
continue;
}
if ( method.getReturnType() != Void.TYPE )
{
continue;
}
Class[] paramTypes = method.getParameterTypes();
if ( paramTypes.length != 2 )
{
continue;
}
if ( paramTypes[0] != String[].class )
{
continue;
}
if ( paramTypes[1] != ClassWorld.class )
{
continue;
}
return method;
}
throw new NoSuchMethodException( "public void execute(ClassWorld world)" );
}
/**
* Attempt to launch the application through the enhanced main method.
*
*
* This will seek a method with the exact signature of:
*
*
* * public static void main(String[] args, ClassWorld world) ** * @throws ClassNotFoundException If the main entry class cannot be found. * @throws IllegalAccessException If the method cannot be accessed. * @throws java.lang.reflect.InvocationTargetException * If the target of the invokation is * invalid. * @throws NoSuchMethodException If the main entry method cannot be found. * @throws NoSuchRealmException If the main entry realm cannot be found. */ protected void launchX() throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NoSuchRealmException { ClassRealm mainRealm = getMainRealm(); Class mainClass = getMainClass(); Method mainMethod = getEnhancedMainMethod(); Thread.currentThread().setContextClassLoader( mainRealm.getClassLoader() ); mainMethod.invoke( mainClass, new Object[]{getWorld()} ); } // ------------------------------------------------------------ // Class methods // ------------------------------------------------------------ public void launch() throws Exception { String classworldsConf = System.getProperty( CLASSWORLDS_CONF ); InputStream is = null; if ( classworldsConf != null ) { is = new FileInputStream( classworldsConf ); } else { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if ( "true".equals( System.getProperty( "classworlds.bootstrapped" ) ) ) { is = cl.getResourceAsStream( UBERJAR_CONF_DIR + CLASSWORLDS_CONF ); } else { is = cl.getResourceAsStream( CLASSWORLDS_CONF ); } } if ( is == null ) { throw new Exception( "classworlds configuration not specified nor found " + "in the classpath" ); } configure( is ); try { launchX(); } catch ( InvocationTargetException e ) { // Decode ITE (if we can) Throwable t = e.getTargetException(); if ( t instanceof Exception ) { throw (Exception) t; } if ( t instanceof Error ) { throw (Error) t; } // Else just toss the ITE throw e; } } } classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/RealmClassLoader.java 0000644 0001750 0001750 00000020277 10724631435 030026 0 ustar doko doko package org.codehaus.classworlds; /* $Id: RealmClassLoader.java 126 2006-01-12 04:17:51Z $ Copyright 2002 (C) The Werken Company. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "classworlds" must not be used to endorse or promote products derived from this Software without prior written permission of The Werken Company. For written permission, please contact bob@werken.com. 4. Products derived from this Software may not be called "classworlds" nor may "classworlds" appear in their names without prior written permission of The Werken Company. "classworlds" is a registered trademark of The Werken Company. 5. Due credit should be given to The Werken Company. (http://classworlds.werken.com/). THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.Enumeration; /** Classloader for
ClassRealm
s.
*
* @author bob mcwhirter
*
* @version $Id: RealmClassLoader.java 126 2006-01-12 04:17:51Z $
*/
class RealmClassLoader
extends URLClassLoader
{
// ------------------------------------------------------------
// Instance members
// ------------------------------------------------------------
/** The realm. */
protected DefaultClassRealm realm;
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
/** Construct.
*
* @param realm The realm for which this loads.
*/
RealmClassLoader(DefaultClassRealm realm)
{
this( realm, null );
}
/** Construct.
*
* @param realm The realm for which this loads.
*
* @param classLoader The parent ClassLoader.
*/
RealmClassLoader(DefaultClassRealm realm, ClassLoader classLoader)
{
super( new URL[0], classLoader );
this.realm = realm;
}
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
/** Retrieve the realm.
*
* @return The realm.
*/
DefaultClassRealm getRealm()
{
return this.realm;
}
/** Add a constituent to this realm for locating classes.
* If the url definition ends in .class its a BytesURLStreamHandler
* so use defineClass insead. addURL is still called for byte[]
* even though it has no affect and we use defineClass instead,
* this is for consistentency and to allow access to the class
* with getURLs()
*
* @param constituent URL to contituent jar or directory.
*/
void addConstituent(URL constituent)
{
String urlStr = constituent.toExternalForm();
if (!urlStr.endsWith(".class"))
{
if ( urlStr.startsWith( "jar:" )
&&
urlStr.endsWith( "!/" ) )
{
urlStr = urlStr.substring( 4,
urlStr.length() - 2 );
try
{
constituent = new URL( urlStr );
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
}
addURL( constituent );
}
else
{
try
{
byte[] b = getBytesToEndOfStream( new DataInputStream( constituent.openStream() ) );
int start = urlStr.lastIndexOf("byteclass") + 10;
int end = urlStr.lastIndexOf(".class");
String className = urlStr.substring(start, end);
super.defineClass(className, b, 0, b.length);
addURL(constituent);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
/**
* Helper method for addConstituent that reads in a DataInputStream and returns it as a byte[]
* It attempts to use in.available - the size of the file - else defaults to 2048
*/
public byte[] getBytesToEndOfStream(DataInputStream in) throws IOException
{
final int chunkSize = (in.available() > 0) ? in.available() : 2048;
byte[] buf = new byte[chunkSize];
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(chunkSize);
int count;
while ((count=in.read(buf)) != -1)
{
byteStream.write(buf, 0, count);
}
return byteStream.toByteArray();
}
/** Load a class directly from this classloader without
* defering through any other ClassRealm
.
*
* @param name The name of the class to load.
*
* @return The loaded class.
*
* @throws ClassNotFoundException If the class could not be found.
*/
Class loadClassDirect(String name) throws ClassNotFoundException
{
return super.loadClass( name, false );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// java.lang.ClassLoader
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/** Load a class.
*
* @param name The name of the class to load.
* @param resolve If true
then resolve the class.
*
* @return The loaded class.
*
* @throws ClassNotFoundException If the class cannot be found.
*/
protected Class loadClass(String name,
boolean resolve) throws ClassNotFoundException
{
return getRealm().loadClass( name );
}
/** Retrieve the URL
s used by this ClassLoader
.
*
* @return The urls.
*/
public URL[] getURLs()
{
return super.getURLs();
}
/** Find a resource within this ClassLoader only (don't delegate to the parent).
*
* @return The resource.
*/
public URL findResource( String name )
{
return super.findResource( name );
}
public URL getResource(String name)
{
return getRealm().getResource( name );
}
/** Get a resource from this ClassLoader, and don't search the realm.
* Otherwise we'd recurse indefinitely.
*
* @return The resource.
*/
public URL getResourceDirect(String name)
{
return super.getResource( name );
}
public Enumeration findResources(String name) throws IOException
{
return getRealm().findResources( name );
}
/** Find resources from this ClassLoader, and don't search the realm.
* Otherwise we'd recurse indefinitely.
*
* @return The resource.
*/
public Enumeration findResourcesDirect(String name)
throws IOException
{
return super.findResources( name );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/ClassWorld.java 0000644 0001750 0001750 00000010207 10724631435 026716 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: ClassWorld.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
/**
* A collection of ClassRealm
s, indexed by id.
*
* @author bob mcwhirter
* @version $Id: ClassWorld.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class ClassWorld
{
private Map realms;
public ClassWorld( String realmId, ClassLoader classLoader )
{
this();
try
{
newRealm( realmId, classLoader );
}
catch ( DuplicateRealmException e )
{
// Will never happen as we are just creating the world.
}
}
public ClassWorld()
{
this.realms = new HashMap();
}
public ClassRealm newRealm( String id )
throws DuplicateRealmException
{
return newRealm( id, null );
}
public ClassRealm newRealm( String id, ClassLoader classLoader )
throws DuplicateRealmException
{
if ( realms.containsKey( id ) )
{
throw new DuplicateRealmException( this, id );
}
ClassRealm realm = null;
if ( classLoader != null )
{
realm = new DefaultClassRealm( this, id, classLoader );
realms.put( id, realm );
}
else
{
realm = new DefaultClassRealm( this, id );
}
realms.put( id, realm );
return realm;
}
public void disposeRealm( String id )
throws NoSuchRealmException
{
realms.remove( id );
}
public ClassRealm getRealm( String id )
throws NoSuchRealmException
{
if ( realms.containsKey( id ) )
{
return (ClassRealm) realms.get( id );
}
throw new NoSuchRealmException( this, id );
}
public Collection getRealms()
{
return realms.values();
}
Class loadClass( String name )
throws ClassNotFoundException
{
// Use the classloader that was used to load classworlds itself to
// load anything classes within org.codehaus.classworlds.*
return getClass().getClassLoader().loadClass( name );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/BytesURLStreamHandler.java 0000644 0001750 0001750 00000001067 10724631435 030770 0 ustar doko doko package org.codehaus.classworlds;
import java.net.URLStreamHandler;
import java.net.URLConnection;
import java.net.URL;
/**
* @author Hani Suleiman (hani@formicary.net)
* Date: Oct 20, 2003
* Time: 12:45:18 AM
*/
public class BytesURLStreamHandler extends URLStreamHandler
{
byte[] content;
int offset;
int length;
public BytesURLStreamHandler( byte[] content )
{
this.content = content;
}
public URLConnection openConnection( URL url )
{
return new BytesURLConnection( url, content );
}
} classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/UrlUtils.java 0000644 0001750 0001750 00000001644 10724631435 026431 0 ustar doko doko package org.codehaus.classworlds;
/**
* @author Jason van Zyl
* @version $Id: UrlUtils.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class UrlUtils
{
public static String normalizeUrlPath( String name )
{
if ( name.startsWith( "/" ) )
{
name = name.substring( 1 );
}
// Looking for org/codehaus/werkflow/personality/basic/../common/core-idioms.xml
// | i |
// +-------+ remove
//
int i = name.indexOf( "/.." );
// Can't be at the beginning because we have no root to refer to so
// we start at 1.
if ( i > 0 )
{
int j = name.lastIndexOf( "/", i - 1 );
name = name.substring( 0, j ) + name.substring( i + 3 );
}
return name;
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/ConfigurationException.java 0000644 0001750 0001750 00000005465 10724631435 031341 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: ConfigurationException.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Indicates an error during Launcher
configuration.
*
* @author bob mcwhirter
* @version $Id: ConfigurationException.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class ConfigurationException extends Exception
{
/**
* Construct.
*
* @param msg The message.
*/
public ConfigurationException( String msg )
{
super( msg );
}
/**
* Construct.
*
* @param msg The message.
* @param lineNo The number of configuraton line where the problem occured.
* @param line The configuration line where the problem occured.
*/
public ConfigurationException( String msg, int lineNo, String line )
{
super( msg + " (" + lineNo + "): " + line );
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/ClassRealm.java 0000644 0001750 0001750 00000007226 10724631435 026676 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: ClassRealm.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
/**
* Autonomous sub-portion of a ClassWorld
.
*
*
* This class most closed maps to the ClassLoader
* role from Java and in facts can provide a ClassLoader
* view of itself using {@link #getClassLoader}.
*
*
* @author bob mcwhirter
* @author Jason van Zyl
* @version $Id: ClassRealm.java 126 2006-01-12 04:17:51Z $
*/
public interface ClassRealm
{
String getId();
ClassWorld getWorld();
void importFrom( String realmId, String pkgName )
throws NoSuchRealmException;
void addConstituent( URL constituent );
ClassRealm locateSourceRealm( String className );
void setParent( ClassRealm classRealm );
ClassRealm createChildRealm( String id )
throws DuplicateRealmException;
ClassLoader getClassLoader();
ClassRealm getParent();
URL[] getConstituents();
// ----------------------------------------------------------------------
// Classloading
// ----------------------------------------------------------------------
Class loadClass( String name )
throws ClassNotFoundException;
// ----------------------------------------------------------------------
// Resource handling
// ----------------------------------------------------------------------
URL getResource( String name );
Enumeration findResources( String name )
throws IOException;
InputStream getResourceAsStream( String name );
void display();
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/UberJarRealmClassLoader.java 0000644 0001750 0001750 00000021660 10724631435 031276 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: UberJarRealmClassLoader.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
/**
* Classloader for ClassRealm
s.
*
* Loads classes from an "uberjar".
*
* @author bob mcwhirter
* @version $Id: UberJarRealmClassLoader.java 126 2006-01-12 04:17:51Z $
*/
public class UberJarRealmClassLoader
extends RealmClassLoader
{
private Map classIndex;
private List urls;
private Map jarIndexes;
public UberJarRealmClassLoader( DefaultClassRealm realm )
{
super( realm );
this.urls = new ArrayList();
this.classIndex = new HashMap();
this.jarIndexes = new HashMap();
}
public void addConstituent( URL constituent )
{
// If the constituent is a jar, build an index for it.
if ( "jar".equals( constituent.getProtocol() ) || constituent.toExternalForm().endsWith( ".jar" ) )
{
buildIndexForJar( constituent );
}
// Add the constituent to the urls collection
this.urls.add( constituent );
super.addConstituent( constituent );
}
private void buildIndexForJar( URL inUrl )
{
HashMap index = new HashMap();
String urlText = null;
if ( inUrl.getProtocol().equals( "jar" ) )
{
urlText = inUrl.toExternalForm();
}
else
{
urlText = "jar:" + inUrl.toExternalForm();
}
String resourceName;
URL resourceUrl = null;
try
{
JarInputStream in = new JarInputStream( inUrl.openStream() );
try
{
JarEntry entry = null;
while ( ( entry = in.getNextJarEntry() ) != null )
{
resourceName = entry.getName();
resourceUrl = new URL( urlText + "!/" + resourceName );
index.put( resourceName, resourceUrl );
}
}
finally
{
in.close();
}
}
catch ( IOException e )
{
// swallow
}
jarIndexes.put( inUrl, index );
}
/**
* Load a class directly from this classloader without
* defering through any other ClassRealm
.
*
* @param className The name of the class to load.
* @return The loaded class.
* @throws ClassNotFoundException If the class could not be found.
*/
public Class loadClassDirect( String className )
throws ClassNotFoundException
{
String classPath = className.replace( '.', '/' ) + ".class";
if ( this.classIndex.containsKey( classPath ) )
{
return (Class) this.classIndex.get( classPath );
}
Iterator urlIter = this.urls.iterator();
URL eachUrl = null;
byte[] classBytes = null;
while ( ( classBytes == null ) && ( urlIter.hasNext() ) )
{
eachUrl = (URL) urlIter.next();
if ( "jar".equals( eachUrl.getProtocol() ) || eachUrl.toExternalForm().endsWith( ".jar" ) )
{
classBytes = findClassInJarStream( eachUrl, classPath );
}
else
{
classBytes = findClassInDirectoryUrl( eachUrl, classPath );
}
}
if ( classBytes == null )
{
//!!!return super.loadClassDirect( className );
return null;
}
else
{
Class cls = defineClass( className, classBytes, 0, classBytes.length );
this.classIndex.put( classPath, cls );
return cls;
}
}
public URL findResource( String name )
{
URL resourceUrl = null;
Iterator urlIter = this.urls.iterator();
URL eachUrl = null;
while ( urlIter.hasNext() )
{
eachUrl = (URL) urlIter.next();
if ( "jar".equals( eachUrl.getProtocol() ) || eachUrl.toExternalForm().endsWith( ".jar" ) )
{
resourceUrl = findResourceInJarStream( eachUrl, name );
}
else
{
resourceUrl = findResourceInDirectoryUrl( eachUrl, name );
}
if ( resourceUrl != null )
{
return resourceUrl;
}
}
return null;
}
public Enumeration findResourcesDirect( String name )
{
Vector list = new Vector();
URL resourceUrl = null;
Iterator urlIter = this.urls.iterator();
URL eachUrl = null;
while ( urlIter.hasNext() )
{
eachUrl = (URL) urlIter.next();
if ( "jar".equals( eachUrl.getProtocol() ) || eachUrl.toExternalForm().endsWith( ".jar" ) )
{
resourceUrl = findResourceInJarStream( eachUrl, name );
}
else
{
resourceUrl = findResourceInDirectoryUrl( eachUrl, name );
}
if ( resourceUrl != null )
{
list.add( resourceUrl );
}
}
return list.elements();
}
protected URL findResourceInJarStream( URL inUrl, String path )
{
return (URL) ( (Map) jarIndexes.get( inUrl ) ).get( path );
}
protected URL findResourceInDirectoryUrl( URL inUrl, String path )
{
return null;
}
protected byte[] findClassInJarStream( URL inUrl, String path )
{
URL classUrl = (URL) ( (Map) jarIndexes.get( inUrl ) ).get( path );
if ( classUrl != null )
{
try
{
return readStream( classUrl.openStream() );
}
catch ( IOException e )
{
// Swallow
}
}
return null;
}
protected byte[] findClassInDirectoryUrl( URL url, String path )
{
try
{
URL classUrl = new URL( url, path );
}
catch ( IOException e )
{
// swallow
}
return null;
}
private byte[] readStream( InputStream in ) throws IOException
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
try
{
byte[] buffer = new byte[2048];
int read = 0;
while ( in.available() > 0 )
{
read = in.read( buffer, 0, buffer.length );
if ( read < 0 )
{
break;
}
out.write( buffer, 0, read );
}
return out.toByteArray();
}
finally
{
out.close();
}
}
}
classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/BytesURLConnection.java 0000644 0001750 0001750 00000001263 10724631435 030334 0 ustar doko doko package org.codehaus.classworlds;
import java.net.URLConnection;
import java.net.URL;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
/**
* @author Hani Suleiman (hani@formicary.net)
*
* Date: Oct 20, 2003
* Time: 12:46:01 AM
*/
public class BytesURLConnection extends URLConnection
{
protected byte[] content;
protected int offset;
protected int length;
public BytesURLConnection( URL url, byte[] content )
{
super( url );
this.content = content;
}
public void connect()
{
}
public InputStream getInputStream()
{
return new ByteArrayInputStream( content );
}
} classworlds-1.1-final.orig/src/java/main/org/codehaus/classworlds/DefaultClassRealm.java 0000644 0001750 0001750 00000027317 10724631435 030206 0 ustar doko doko package org.codehaus.classworlds;
/*
$Id: DefaultClassRealm.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.TreeSet;
import java.util.Vector;
/**
* Implementation of ClassRealm
. The realm is the class loading gateway.
* The search is proceded as follows:
* ClassWorld
errors.
*
* @author bob mcwhirter
* @version $Id: ClassWorldException.java 78 2004-07-01 13:59:13Z jvanzyl $
*/
public class ClassWorldException extends Exception
{
// ------------------------------------------------------------
// Instance members
// ------------------------------------------------------------
/**
* The world.
*/
private ClassWorld world;
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
/**
* Construct.
*
* @param world The world.
*/
public ClassWorldException( final ClassWorld world )
{
this.world = world;
}
/**
* Construct.
*
* @param world The world.
* @param msg The detail message.
*/
public ClassWorldException( final ClassWorld world, final String msg )
{
super( msg );
this.world = world;
}
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
/**
* Retrieve the world.
*
* @return The world.
*/
public ClassWorld getWorld()
{
return this.world;
}
}
classworlds-1.1-final.orig/src/java/abcd/ 0000755 0001750 0001750 00000000000 10724631543 017021 5 ustar doko doko classworlds-1.1-final.orig/src/java/abcd/a/ 0000755 0001750 0001750 00000000000 10724631543 017241 5 ustar doko doko classworlds-1.1-final.orig/src/java/abcd/a/A.java 0000644 0001750 0001750 00000004130 10724631435 020262 0 ustar doko doko package a;
/*
$Id: A.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public class A
{
public static void main(String[] args)
{
System.err.println( "A.a.main()" );
}
}
classworlds-1.1-final.orig/src/java/abcd/a/Aa.java 0000644 0001750 0001750 00000004144 10724631435 020430 0 ustar doko doko package a;
/*
$Id: Aa.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public class Aa
{
public static int main(String[] args)
{
System.err.println( "a.Aa.main()" );
return 15;
}
}
classworlds-1.1-final.orig/src/java/abcd/b/ 0000755 0001750 0001750 00000000000 10724631543 017242 5 ustar doko doko classworlds-1.1-final.orig/src/java/abcd/b/B.java 0000644 0001750 0001750 00000004226 10724631435 020272 0 ustar doko doko package b;
/*
$Id: B.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import org.codehaus.classworlds.ClassWorld;
public class B
{
public B()
{
}
public static void main(String args[], ClassWorld classworld)
{
}
}
classworlds-1.1-final.orig/src/java/abcd/b/Bb.java 0000644 0001750 0001750 00000004245 10724631435 020435 0 ustar doko doko package b;
/*
$Id: Bb.java 126 2006-01-12 04:17:51Z $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import org.codehaus.classworlds.ClassWorld;
public class Bb
{
public Bb()
{
}
public static int main(String args[], ClassWorld classworld)
{
return 45;
}
}
classworlds-1.1-final.orig/src/java/abcd/c/ 0000755 0001750 0001750 00000000000 10724631543 017243 5 ustar doko doko classworlds-1.1-final.orig/src/java/abcd/c/C.java 0000644 0001750 0001750 00000004032 10724631435 020267 0 ustar doko doko package c;
/*
$Id: C.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public class C
{
public C()
{
}
}
classworlds-1.1-final.orig/src/java/abcd/d/ 0000755 0001750 0001750 00000000000 10724631543 017244 5 ustar doko doko classworlds-1.1-final.orig/src/java/abcd/d/D.java 0000644 0001750 0001750 00000003776 10724631435 020307 0 ustar doko doko package d;
/*
$Id: D.java 78 2004-07-01 13:59:13Z jvanzyl $
Copyright 2002 (C) The Werken Company. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "classworlds" must not be used to endorse or promote
products derived from this Software without prior written
permission of The Werken Company. For written permission,
please contact bob@werken.com.
4. Products derived from this Software may not be called "classworlds"
nor may "classworlds" appear in their names without prior written
permission of The Werken Company. "classworlds" is a registered
trademark of The Werken Company.
5. Due credit should be given to The Werken Company.
(http://classworlds.werken.com/).
THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public class D
{
}
classworlds-1.1-final.orig/src/java/revolt/ 0000755 0001750 0001750 00000000000 10724631543 017443 5 ustar doko doko classworlds-1.1-final.orig/src/java/revolt/revolt/ 0000755 0001750 0001750 00000000000 10724631543 020756 5 ustar doko doko classworlds-1.1-final.orig/src/java/revolt/revolt/Main1.java 0000644 0001750 0001750 00000002167 10724631435 022574 0 ustar doko doko package revolt;
import java.util.Properties;
public class Main1
{
public static void main(String[] args)
throws Exception
{
try
{
System.err.println( Main1.class.getClassLoader().getResource( "revolt/revolt.properties" ) );
System.err.println( Main1.class.getResource("revolt.properties"));
{
Properties props = new Properties();
props.load( Main1.class.getClassLoader().getResourceAsStream( "revolt/revolt.properties" ) );
System.err.println( "bob -> " + props.getProperty( "bob" ) );
System.err.println( "jason -> " + props.getProperty( "jason" ) );
}
{
Properties props = new Properties();
props.load( Main1.class.getResourceAsStream( "revolt.properties" ) );
System.err.println( "bob -> " + props.getProperty( "bob" ) );
System.err.println( "jason -> " + props.getProperty( "jason" ) );
}
}
catch (Throwable e)
{
e.printStackTrace();
}
}
}
classworlds-1.1-final.orig/src/java/revolt/revolt/revolt.properties 0000644 0001750 0001750 00000000034 10724631435 024404 0 ustar doko doko bob=mcwhirter
jason=van zyl
classworlds-1.1-final.orig/src/test-data/ 0000755 0001750 0001750 00000000000 10724631543 017075 5 ustar doko doko classworlds-1.1-final.orig/src/test-data/uberjar/ 0000755 0001750 0001750 00000000000 10724631543 020527 5 ustar doko doko classworlds-1.1-final.orig/src/test-data/uberjar/WORLDS-INF/ 0000755 0001750 0001750 00000000000 10724631543 022153 5 ustar doko doko classworlds-1.1-final.orig/src/test-data/uberjar/WORLDS-INF/conf/ 0000755 0001750 0001750 00000000000 10724631543 023100 5 ustar doko doko classworlds-1.1-final.orig/src/test-data/uberjar/WORLDS-INF/conf/classworlds.conf 0000644 0001750 0001750 00000000364 10724631435 026312 0 ustar doko doko main is revolt.Main1 from app
[app]
load ${classworlds.lib}/revolt.jar
load ${classworlds.lib}/a.jar
load ${classworlds.lib}/b.jar
load ${classworlds.lib}/c.jar
load ${classworlds.lib}/d.jar
classworlds-1.1-final.orig/src/test-data/resources/ 0000755 0001750 0001750 00000000000 10724631543 021107 5 ustar doko doko classworlds-1.1-final.orig/src/test-data/resources/classworlds.conf 0000644 0001750 0001750 00000000607 10724631435 024321 0 ustar doko doko # ------------------------------------------------------------
# Define the main entry-point
# ------------------------------------------------------------
main is foo from root
# ------------------------------------------------------------
# Start defining realms
# ------------------------------------------------------------
[root]
load ${basedir}/src/test-data/resources/werkflow.jar
classworlds-1.1-final.orig/src/test-data/resources/werkflow.jar 0000644 0001750 0001750 00000012416 10724631435 023451 0 ustar doko doko PK
k5/ META-INF/PK k5/ META-INF/MANIFEST.MFuAn0E|#hi$PvY
$qƑc"
gljzZ9SH
A|Ay dԬ?%V"
R_u@+,)L{C;ܷYG*N$&s 1juҶ@϶r$Ǐ4&]CLnAO1IE8@:RD|sfU-#)~ PKd PK
k5/ org/PK
k5/
org/codehaus/PK
k5/ org/codehaus/werkflow/PK
k5/ " org/codehaus/werkflow/personality/PK
k5/ ( org/codehaus/werkflow/personality/basic/PK
k5/ * org/codehaus/werkflow/personality/bpel4ws/PK
k5/ ) org/codehaus/werkflow/personality/common/PK k5/ 8 org/codehaus/werkflow/personality/basic/basic-syntax.xmlWn SXV/QiŸ!4;`:-/(L^]~!T7}B.^چqI\1Bf!B]rh0V2
,:v\(EQbCrs .DJF*yG3Zv'W+}i
TFA#\E3_axִaa5Sx.0_H"(Q/H0[ZgHS/'LP YW^.b,Ve?t?Zi*Z U)j f3#"f5m2FM8J ?.H84@,&",&)bSZÇYL)ۮ݆jEDKR5,qTgjO5$欢cLYa `*| 2;{|+L:(|_ IC$MA6Un#
m#Ϟ(
GK3h̬q0ck=_7&\,z4|E nIxD\h dX[%QG? 7U.V?Zy).F-xƍtsu þ{ƍtsU(Z %akUzGl7n`O.&>wʮ1&@T.ܿSy2XE}3KGH6 څ
Gp?Epi4ԫ@ܶ>oЫq
K0ݻk }tP
VҡC;znP.aPK\8 PK k5/ <