donaldp 02/05/12 06:41:29
Modified: merlin/src/java/org/apache/excalibur/merlin
AbstractManager.java DefaultComponentManager.java
DefaultServiceManager.java DependencyInfo.java
PipelineException.java
PipelineRuntimeException.java PipelineService.java
ServiceContext.java ServiceFactory.java
ServiceInfo.java ServiceLoader.java
ServiceLoaderContext.java ServiceProvider.java
SingletonProvider.java TransientProvider.java
merlin/src/java/org/apache/excalibur/merlin/ant Load.java
Log:
Run styler over codebase to get rid of whitespace at end of lines because
the spurious diffs in commits were annoying me ;)
Revision Changes Path
1.2 +75 -79
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/AbstractManager.java
Index: AbstractManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/AbstractManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractManager.java 10 May 2002 17:53:09 -0000 1.1
+++ AbstractManager.java 12 May 2002 13:41:28 -0000 1.2
@@ -7,58 +7,55 @@
*
* Original contribution by OSM SARL, http://www.osm.net
*/
-
package org.apache.excalibur.merlin;
import java.util.Map;
import org.apache.avalon.framework.service.ServiceException;
-
/**
- * Internal helper class the handles the functional requirements of
+ * Internal helper class the handles the functional requirements of
* both ComponetManager and ServiceManager.
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-class AbstractManager
+class AbstractManager
{
-
- /**
- * Hashtable containing service providers keyed by role name.
- * The manager use the providers in this table to aquire services
- * in response to <code>lookup</code> invocations. Provider
- * types fall into one of the following three catagories:
- *
- * <table>
- * <tr><td><b>Policy</b></td><td><b>Description</b></td><tr>
- * <tr><td>SINGLETON_LIFETIME_POLICY</td><td>
- * Service of the type singleton are distinguished by the fact
- * that they do not inherit from Pool or Transient. The singleton
- * provider object is a reference to the singleton service and is
- * return directly by the implemetation on invocation of lookup.
- * </td>
- * <tr><td>POOLED_LIFETIME_POLICY</td><td>
- * Not supported - pending finalization of fortess package.
- * Pooled services implement the Pool interface. The service
- * resolves lookup aquires the pooled service by invoking
- * <code>checkout</code> on the pool implementation. Clients
- * using pooled services are required to release services using
- * the manager <code>release</code> method. The implementation will
- * attempt to locate the issuing pool and release the object on
- * behalf of the client.
- * </td>
- * <tr><td>TRANSIENT_LIFETIME_POLICY</td><td>
- * A transient provider is factory from which new instances are
- * created and pipelined following a invocation of <code>lookup</code>.
- * The invocing client is totally responsible for service disposal.
- * </td>
- */
+ /**
+ * Hashtable containing service providers keyed by role name.
+ * The manager use the providers in this table to aquire services
+ * in response to <code>lookup</code> invocations. Provider
+ * types fall into one of the following three catagories:
+ *
+ * <table>
+ * <tr><td><b>Policy</b></td><td><b>Description</b></td><tr>
+ * <tr><td>SINGLETON_LIFETIME_POLICY</td><td>
+ * Service of the type singleton are distinguished by the fact
+ * that they do not inherit from Pool or Transient. The singleton
+ * provider object is a reference to the singleton service and is
+ * return directly by the implemetation on invocation of lookup.
+ * </td>
+ * <tr><td>POOLED_LIFETIME_POLICY</td><td>
+ * Not supported - pending finalization of fortess package.
+ * Pooled services implement the Pool interface. The service
+ * resolves lookup aquires the pooled service by invoking
+ * <code>checkout</code> on the pool implementation. Clients
+ * using pooled services are required to release services using
+ * the manager <code>release</code> method. The implementation will
+ * attempt to locate the issuing pool and release the object on
+ * behalf of the client.
+ * </td>
+ * <tr><td>TRANSIENT_LIFETIME_POLICY</td><td>
+ * A transient provider is factory from which new instances are
+ * created and pipelined following a invocation of <code>lookup</code>.
+ * The invocing client is totally responsible for service disposal.
+ * </td>
+ */
private Map m_providers;
- /**
- * Internal table that maintains a mapping betyween pooled objects and
- * the issuing pool. The object is used as the key to lookup the pool
- * when handling object release.
- */
+ /**
+ * Internal table that maintains a mapping betyween pooled objects and
+ * the issuing pool. The object is used as the key to lookup the pool
+ * when handling object release.
+ */
//private Hashtable m_pooledTable = new Hashtable();
public AbstractManager( Map providers )
@@ -68,16 +65,16 @@
public boolean has( String role )
{
- return (m_providers.get( role ) != null );
+ return ( m_providers.get( role ) != null );
}
public Object resolve( String role ) throws ServiceException
{
Object provider = m_providers.get( role );
- if( provider == null )
+ if( provider == null )
{
throw new ServiceException(
- "Could not locate a provider for the role: " + role );
+ "Could not locate a provider for the role: " + role );
}
if( provider instanceof TransientProvider )
@@ -86,39 +83,39 @@
// return a transient instance
//
- return ((TransientProvider)provider).create( );
+ return ( (TransientProvider)provider ).create();
}
//else if( provider instanceof PooledProvider )
//{
- //
- // return a pooled service after registering the usage
- //
+ //
+ // return a pooled service after registering the usage
+ //
- //Object object = null;
- //try
- //{
- // object = ((PooledProvider)provider).acquire( );
- //}
- //catch( Throwable e )
- //{
- // final String error = "Pool implementation error.";
- // throw new ServiceException( error, e );
- //}
- //finally
- //{
- // it is invalid for a pool to provide the same object
without
- // it being released beforehand
-
- // if( m_pooledTable.get( object ) != null )
- // {
- // final String error =
- // "Manager has an existing reference to an aquired
object from '"
- // + role + "'.";
- // throw new ServiceException( error );
- // }
- // m_pooledTable.put( object, provider );
- // return object;
- //}
+ //Object object = null;
+ //try
+ //{
+ // object = ((PooledProvider)provider).acquire( );
+ //}
+ //catch( Throwable e )
+ //{
+ // final String error = "Pool implementation error.";
+ // throw new ServiceException( error, e );
+ //}
+ //finally
+ //{
+ // it is invalid for a pool to provide the same object without
+ // it being released beforehand
+
+ // if( m_pooledTable.get( object ) != null )
+ // {
+ // final String error =
+ // "Manager has an existing reference to an aquired object
from '"
+ // + role + "'.";
+ // throw new ServiceException( error );
+ // }
+ // m_pooledTable.put( object, provider );
+ // return object;
+ //}
//}
else
{
@@ -126,14 +123,14 @@
// return a singleton service
//
- return ((SingletonProvider)provider).provide( );
+ return ( (SingletonProvider)provider ).provide();
}
}
- /**
- * Release a pooled object.
- * @param object a pooled object
- */
+ /**
+ * Release a pooled object.
+ * @param object a pooled object
+ */
public void disgard( Object object )
{
//
@@ -143,5 +140,4 @@
//PooledProvider provider = (PooledProvider) m_pooledTable.get(
object );
//if( provider != null ) provider.release( object );
}
-}
-
+}
\ No newline at end of file
1.3 +7 -7
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultComponentManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultComponentManager.java 12 May 2002 13:11:45 -0000 1.2
+++ DefaultComponentManager.java 12 May 2002 13:41:28 -0000 1.3
@@ -11,8 +11,8 @@
import java.util.Map;
import org.apache.avalon.framework.component.Component;
-import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentException;
+import org.apache.avalon.framework.component.ComponentManager;
/**
* Internal helper class the implements the <code>ComponentManager</code>
interface and
@@ -49,17 +49,17 @@
{
if( object instanceof Component )
{
- return (Component) object;
+ return (Component)object;
}
throw new ComponentException( "Service provider returned a
non-Component." );
}
}
- /**
- * Release a pooled object.
- *
- * @param component a pooled object
- */
+ /**
+ * Release a pooled object.
+ *
+ * @param component a pooled object
+ */
public void release( Component component )
{
super.disgard( component );
1.2 +15 -16
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultServiceManager.java
Index: DefaultServiceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DefaultServiceManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultServiceManager.java 10 May 2002 17:53:09 -0000 1.1
+++ DefaultServiceManager.java 12 May 2002 13:41:28 -0000 1.2
@@ -7,20 +7,20 @@
*
* Original contribution by OSM SARL, http://www.osm.net
*/
-
package org.apache.excalibur.merlin;
import java.util.Map;
-import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
-
+import org.apache.avalon.framework.service.ServiceManager;
/**
- * Internal helper class the implements the <code>ServiceManager</code>
interface and
+ * Internal helper class the implements the <code>ServiceManager</code>
interface and
* is supplied to dynamically created componets during lifecyle pipeline
processing.
* @author Stephen McConnell <[EMAIL PROTECTED]>
*/
-class DefaultServiceManager extends AbstractManager implements ServiceManager
+class DefaultServiceManager
+ extends AbstractManager
+ implements ServiceManager
{
/**
* Construct ServiceManager.
@@ -30,11 +30,11 @@
super( providers );
}
- /**
- * Returns true if a provider exists for the supplied role.
- * @param role the service identifier
- * @return boolean TRUE if the service is available else FALSE
- */
+ /**
+ * Returns true if a provider exists for the supplied role.
+ * @param role the service identifier
+ * @return boolean TRUE if the service is available else FALSE
+ */
public boolean hasService( String role )
{
return super.has( role );
@@ -51,13 +51,12 @@
return super.resolve( role );
}
- /**
- * Release a pooled object.
- * @param object a pooled object
- */
+ /**
+ * Release a pooled object.
+ * @param object a pooled object
+ */
public void release( Object object )
{
super.disgard( object );
}
-}
-
+}
\ No newline at end of file
1.2 +16 -16
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DependencyInfo.java
Index: DependencyInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/DependencyInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DependencyInfo.java 10 May 2002 17:53:09 -0000 1.1
+++ DependencyInfo.java 12 May 2002 13:41:28 -0000 1.2
@@ -13,8 +13,8 @@
import org.apache.avalon.framework.configuration.Configuration;
/**
- * Abstract meta-information that describes a single dependancy that a
- * <code>Serviceable</code> object may have towards other
+ * Abstract meta-information that describes a single dependancy that a
+ * <code>Serviceable</code> object may have towards other
* components.
* @author Stephen McConnell <[EMAIL PROTECTED]>
*/
@@ -25,24 +25,24 @@
private ServiceInfo m_service;
private Configuration m_config;
- /**
- * Creation of a new <code<DependencyInfo</code> instance.
- * @param config a configuration corresponding to a <depends>
statement
- */
+ /**
+ * Creation of a new <code<DependencyInfo</code> instance.
+ * @param config a configuration corresponding to a <depends>
statement
+ */
public DependencyInfo( final Configuration config ) throws Exception
{
- m_role = config.getChild("role").getValue();
- m_service = new ServiceInfo( config.getChild("service") );
- m_config = config.getChild("configuration");
+ m_role = config.getChild( "role" ).getValue();
+ m_service = new ServiceInfo( config.getChild( "service" ) );
+ m_config = config.getChild( "configuration" );
}
- /**
- * Returns the role name that the component uses to lookup a
- * the dependency.
- * @return the dependecy role name
- * @see org.apache.avalon.framework.service.ServiceManager
- * @see org.apache.avalon.framework.service.Serviceable
- */
+ /**
+ * Returns the role name that the component uses to lookup a
+ * the dependency.
+ * @return the dependecy role name
+ * @see org.apache.avalon.framework.service.ServiceManager
+ * @see org.apache.avalon.framework.service.Serviceable
+ */
public String getRole()
{
return m_role;
1.2 +36 -37
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineException.java
Index: PipelineException.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PipelineException.java 10 May 2002 17:53:09 -0000 1.1
+++ PipelineException.java 12 May 2002 13:41:28 -0000 1.2
@@ -10,57 +10,56 @@
package org.apache.excalibur.merlin;
-import java.io.StringWriter;
-import java.util.StringTokenizer;
import java.io.PrintWriter;
+import java.io.StringWriter;
import java.lang.reflect.Method;
-
+import java.util.StringTokenizer;
import org.apache.avalon.framework.CascadingException;
import org.apache.avalon.framework.CascadingThrowable;
/**
- * Thrown by an Pipeline as a result of an unexpected error
+ * Thrown by an Pipeline as a result of an unexpected error
* during execution.
* @author Stephen McConnell <[EMAIL PROTECTED]>
* @version 1.0
*/
-public class PipelineException extends CascadingException
+public class PipelineException
+ extends CascadingException
{
-
- /**
- * Construct a new <code>PipelineRuntimeException</code> instance with
the
- * supplied message parameter and a null value for the cause exception.
- *
- * @param message Message summarising the exception.
- */
- public PipelineException( final String message )
+ /**
+ * Construct a new <code>PipelineRuntimeException</code> instance with
the
+ * supplied message parameter and a null value for the cause exception.
+ *
+ * @param message Message summarising the exception.
+ */
+ public PipelineException( final String message )
{
this( message, null );
}
- /**
- * Construct a new <code>PipelineRuntimeException</code> instance with
the
- * supplied message parameter and a supplied cause exception.
- *
- * @param message The detail message for this exception.
- * @param cause the root cause of the exception
- */
- public PipelineException( final String message, final Throwable cause )
+ /**
+ * Construct a new <code>PipelineRuntimeException</code> instance with
the
+ * supplied message parameter and a supplied cause exception.
+ *
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
+ */
+ public PipelineException( final String message, final Throwable cause )
{
super( message, cause );
}
- /**
- * Returns a stringified representation of the exception.
- * @return String the stringified representation of the exception
- */
+ /**
+ * Returns a stringified representation of the exception.
+ * @return String the stringified representation of the exception
+ */
public String toString()
{
final StringBuffer sb = new StringBuffer();
sb.append( "\n=================================================" );
- sb.append( "\nException: " + this.getClass().getName() + ", " +
getMessage());
- if( this.getCause() != null )
+ sb.append( "\nException: " + this.getClass().getName() + ", " +
getMessage() );
+ if( this.getCause() != null )
{
appendCause( sb, this.getCause() );
}
@@ -74,8 +73,8 @@
{
return;
}
- buffer.append( "\nCause: " + cause.getClass().getName()
- + ", " + cause.getMessage() );
+ buffer.append( "\nCause: " + cause.getClass().getName()
+ + ", " + cause.getMessage() );
Throwable subCause = resolveCause( cause );
if( subCause != null )
{
@@ -85,9 +84,9 @@
{
buffer.append(
"\n-------------------------------------------------" );
String[] stack = captureStackTrace( cause );
- for( int i=0; i<stack.length; i++ )
+ for( int i = 0; i < stack.length; i++ )
{
- buffer.append( "\n" + stack[i] );
+ buffer.append( "\n" + stack[ i ] );
}
}
}
@@ -114,17 +113,17 @@
private static Throwable resolveCause( Throwable target )
{
- if( target instanceof CascadingThrowable )
+ if( target instanceof CascadingThrowable )
{
- return ((CascadingThrowable)target).getCause();
+ return ( (CascadingThrowable)target ).getCause();
}
-
+
try
{
- Method method = target.getClass().getMethod( "getCause", new
Class[0] );
- if( method != null )
+ Method method = target.getClass().getMethod( "getCause", new
Class[ 0 ] );
+ if( method != null )
{
- return (Throwable) method.invoke( target, new Object[0] );
+ return (Throwable)method.invoke( target, new Object[ 0 ] );
}
return null;
}
1.2 +25 -26
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineRuntimeException.java
Index: PipelineRuntimeException.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineRuntimeException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PipelineRuntimeException.java 10 May 2002 17:53:09 -0000 1.1
+++ PipelineRuntimeException.java 12 May 2002 13:41:28 -0000 1.2
@@ -10,56 +10,55 @@
package org.apache.excalibur.merlin;
-import java.io.StringWriter;
-import java.util.StringTokenizer;
import java.io.PrintWriter;
+import java.io.StringWriter;
import java.lang.reflect.Method;
-
+import java.util.StringTokenizer;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.CascadingThrowable;
/**
- * Thrown by an Pipeline as a result of an unexpected runtime error
+ * Thrown by an Pipeline as a result of an unexpected runtime error
* during execution.
* @author Stephen McConnell <[EMAIL PROTECTED]>
* @version 1.0
*/
-public class PipelineRuntimeException extends CascadingRuntimeException
+public class PipelineRuntimeException
+ extends CascadingRuntimeException
{
-
/**
- * Construct a new <code>PipelineRuntimeException</code> instance with
the
+ * Construct a new <code>PipelineRuntimeException</code> instance with
the
* supplied message parameter and a null value for the cause exception.
*
* @param message Message summarising the exception.
*/
- public PipelineRuntimeException( final String message )
+ public PipelineRuntimeException( final String message )
{
this( message, null );
}
/**
- * Construct a new <code>PipelineRuntimeException</code> instance with
the
+ * Construct a new <code>PipelineRuntimeException</code> instance with
the
* supplied message parameter and a supplied cause exception.
*
* @param message The detail message for this exception.
* @param cause the root cause of the exception
*/
- public PipelineRuntimeException( final String message, final Throwable
cause )
+ public PipelineRuntimeException( final String message, final Throwable
cause )
{
super( message, cause );
}
- /**
- * Returns a stringified representation of the exception.
- * @return String the stringified representation of the exception
- */
+ /**
+ * Returns a stringified representation of the exception.
+ * @return String the stringified representation of the exception
+ */
public String toString()
{
final StringBuffer sb = new StringBuffer();
sb.append( "\n=================================================" );
- sb.append( "\nException: " + this.getClass().getName() + ", " +
getMessage());
- if( this.getCause() != null )
+ sb.append( "\nException: " + this.getClass().getName() + ", " +
getMessage() );
+ if( this.getCause() != null )
{
appendCause( sb, this.getCause() );
}
@@ -69,12 +68,12 @@
private void appendCause( StringBuffer buffer, Throwable cause )
{
- if( cause == null )
+ if( cause == null )
{
return;
}
- buffer.append( "\nCause: " + cause.getClass().getName()
- + ", " + cause.getMessage() );
+ buffer.append( "\nCause: " + cause.getClass().getName()
+ + ", " + cause.getMessage() );
Throwable subCause = resolveCause( cause );
if( subCause != null )
{
@@ -84,9 +83,9 @@
{
buffer.append(
"\n-------------------------------------------------" );
String[] stack = captureStackTrace( cause );
- for( int i=0; i<stack.length; i++ )
+ for( int i = 0; i < stack.length; i++ )
{
- buffer.append( "\n" + stack[i] );
+ buffer.append( "\n" + stack[ i ] );
}
}
}
@@ -112,16 +111,16 @@
private static Throwable resolveCause( Throwable target )
{
- if( target instanceof CascadingThrowable )
+ if( target instanceof CascadingThrowable )
{
- return ((CascadingThrowable)target).getCause();
+ return ( (CascadingThrowable)target ).getCause();
}
try
{
- Method method = target.getClass().getMethod( "getCause", new
Class[0] );
- if( method != null )
+ Method method = target.getClass().getMethod( "getCause", new
Class[ 0 ] );
+ if( method != null )
{
- return (Throwable) method.invoke( target, new Object[0] );
+ return (Throwable)method.invoke( target, new Object[ 0 ] );
}
return null;
}
1.3 +16 -16
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineService.java
Index: PipelineService.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/PipelineService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelineService.java 12 May 2002 13:13:57 -0000 1.2
+++ PipelineService.java 12 May 2002 13:41:28 -0000 1.3
@@ -9,35 +9,35 @@
*/
package org.apache.excalibur.merlin;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Disposable;
/**
* Interface supporting service loading and execution.
* @author Stephen McConnell <[EMAIL PROTECTED]>
*/
public interface PipelineService
- extends Component, Configurable, Contextualizable, Initializable,
Disposable
+ extends Component, Configurable, Contextualizable, Initializable,
Disposable
{
- /**
- * Service lookup key.
- */
+ /**
+ * Service lookup key.
+ */
String PIPELINE_SERVICE_KEY = "PIPELINE_SERVICE_KEY";
- /**
- * Applies sercies logging, contextulization, configuration, initalization
- * and disposal, including dependent service composition and pipline
exeecution.
- * @param target the name of the implementation class of the the
component to
- * load into the pipeline
- * @return Object the initalized service
- * @exception Exception if no corresponding [class-name].xinfo file can
be found,
- * or if a service pipeline general execution is encountered
- */
+ /**
+ * Applies sercies logging, contextulization, configuration,
initalization
+ * and disposal, including dependent service composition and pipline
exeecution.
+ * @param target the name of the implementation class of the the
component to
+ * load into the pipeline
+ * @return Object the initalized service
+ * @exception Exception if no corresponding [class-name].xinfo file can
be found,
+ * or if a service pipeline general execution is encountered
+ */
Object pipeline( String target )
- throws Exception;
+ throws Exception;
}
1.3 +20 -20
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceContext.java
Index: ServiceContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServiceContext.java 12 May 2002 13:08:47 -0000 1.2
+++ ServiceContext.java 12 May 2002 13:41:28 -0000 1.3
@@ -22,25 +22,25 @@
public class ServiceContext
extends DefaultContext
{
- /**
- * Argument lookup key.
- */
+ /**
+ * Argument lookup key.
+ */
public static final String ARGS_KEY = "ARGS";
- /**
- * Base directory lookup key.
- */
+ /**
+ * Base directory lookup key.
+ */
public static final String BASE_DIRECTORY_KEY = "app.home";
private String[] m_args;
private File m_root;
- /**
- * Creation of a new ServiceContext.
- *
- * @param args command line arguments
- * @param base the base directory
- */
+ /**
+ * Creation of a new ServiceContext.
+ *
+ * @param args command line arguments
+ * @param base the base directory
+ */
public ServiceContext( String[] args, File base )
{
m_args = args;
@@ -50,19 +50,19 @@
super.put( BASE_DIRECTORY_KEY, m_root );
}
- /**
- * Returns the command line argument array
- * @return String[] the command line arguments
- */
+ /**
+ * Returns the command line argument array
+ * @return String[] the command line arguments
+ */
public String[] getArgs()
{
return m_args;
}
- /**
- * Returns the base directory.
- * @return File the base directory
- */
+ /**
+ * Returns the base directory.
+ * @return File the base directory
+ */
public File getBaseDirectory()
{
return m_root;
1.3 +227 -236
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceFactory.java
Index: ServiceFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServiceFactory.java 12 May 2002 00:25:17 -0000 1.2
+++ ServiceFactory.java 12 May 2002 13:41:28 -0000 1.3
@@ -7,74 +7,66 @@
*
* Original contribution by OSM SARL, http://www.osm.net
*/
-
package org.apache.excalibur.merlin;
import java.io.File;
-import java.util.Map;
-import java.util.Hashtable;
import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
import java.util.Vector;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Startable;
+import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Startable;
-import org.apache.avalon.framework.activity.Disposable;
-
-import org.apache.excalibur.configuration.ConfigurationUtil;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.configuration.CascadingConfiguration;
+import org.apache.excalibur.configuration.ConfigurationUtil;
/**
- * The <code>ServiceFactory</code> class provides support for the
+ * The <code>ServiceFactory</code> class provides support for the
* instantiation of objects based on supplied service meta-info.
* @author Stephen McConnell <[EMAIL PROTECTED]>
*/
-class ServiceFactory extends AbstractLogEnabled
- implements Configurable, Initializable, Disposable
+class ServiceFactory
+ extends AbstractLogEnabled
+ implements Configurable, Initializable, Disposable
{
private File m_root;
private boolean m_verbose;
private Configuration m_config;
private Logger m_baseLogger;
-
private ServiceRegistry m_registry;
- private Hashtable m_table = new Hashtable();
private Hashtable m_singletons = new Hashtable();
private Hashtable m_transients = new Hashtable();
- //private Hashtable m_pools = new Hashtable();
-
- private Hashtable m_services = new Hashtable();
- private Hashtable m_lookup = new Hashtable();
- /**
- * Creation of a new service factory.
- * @param root the base directory
- * @param verbose if TRUE then logging of internal service activity is
enabled
- */
+ /**
+ * Creation of a new service factory.
+ * @param root the base directory
+ * @param verbose if TRUE then logging of internal service activity is
enabled
+ */
public ServiceFactory( File root, boolean verbose ) throws Exception
{
m_root = root;
m_verbose = verbose;
}
- /**
- * Configuration of the factory.
- * @param config the configuration object
- * @exception ConfigurationException if an configuration related error
occurs
- */
+ /**
+ * Configuration of the factory.
+ * @param config the configuration object
+ * @exception ConfigurationException if an configuration related error
occurs
+ */
public void configure( Configuration config ) throws
ConfigurationException
{
m_config = config;
@@ -84,18 +76,18 @@
// Initializable
//=======================================================================
- /**
- * Initialize the factory.
- * @exception Exception if an initialization related error occurs
- */
+ /**
+ * Initialize the factory.
+ * @exception Exception if an initialization related error occurs
+ */
public void initialize() throws Exception
{
m_baseLogger = getLogger();
- super.enableLogging(
- m_baseLogger.getChildLogger( "loader" ).getChildLogger( "factory"
) );
+ super.enableLogging(
+ m_baseLogger.getChildLogger( "loader" ).getChildLogger(
"factory" ) );
m_registry = new ServiceRegistry( m_root, m_verbose );
- m_registry.enableLogging( getLogger().getChildLogger("registry") );
+ m_registry.enableLogging( getLogger().getChildLogger( "registry" ) );
m_registry.configure( m_config );
m_registry.initialize();
}
@@ -104,110 +96,109 @@
// ServiceFactory
//=======================================================================
- /**
- * Populates the set of available services based on a supplied
- * vector of jar files. The implementation delegates registration
- * actions to the factories registry.
- * @param list a list of jar files
- */
+ /**
+ * Populates the set of available services based on a supplied
+ * vector of jar files. The implementation delegates registration
+ * actions to the factories registry.
+ * @param list a list of jar files
+ */
public void register( Vector list ) throws PipelineException
{
m_registry.register( list );
}
- /**
- * Validates that the set of dependecies declared for a given
- * implementation can be resolved and that all dependencies
- * can be validated.
- * @param info the <code>UnitInfo</code> to validate
- */
+ /**
+ * Validates that the set of dependecies declared for a given
+ * implementation can be resolved and that all dependencies
+ * can be validated.
+ * @param info the <code>UnitInfo</code> to validate
+ */
public void validate( UnitInfo info ) throws Exception
{
DependencyInfo[] dependencies = info.getDependencies();
- for( int i=0; i<dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyInfo d = dependencies[i];
- if( m_registry.lookup( d ) == null )
+ DependencyInfo d = dependencies[ i ];
+ if( m_registry.lookup( d ) == null )
{
- throw new Exception(
- "Could not resolve dependent service '" + d.getRole()
- + "' with service: '" +
d.getService().getInterface().getName()
- + "' for block '" + info.getName() + "'" );
+ throw new Exception(
+ "Could not resolve dependent service '" + d.getRole()
+ + "' with service: '" +
d.getService().getInterface().getName()
+ + "' for block '" + info.getName() + "'" );
}
}
}
- /**
- * Dynamic creation of a <code>ServiceManager</code> based on a set of
- * supplied dependencies and container configuration.
- * @param info meta information about the service
- * @param base the base logger
- * @return ServiceManager a new service manager
- */
- private ServiceManager createServiceManager( UnitInfo info, Logger base
)
- throws ServiceException
+ /**
+ * Dynamic creation of a <code>ServiceManager</code> based on a set of
+ * supplied dependencies and container configuration.
+ * @param info meta information about the service
+ * @param base the base logger
+ * @return ServiceManager a new service manager
+ */
+ private ServiceManager createServiceManager( UnitInfo info, Logger base )
+ throws ServiceException
{
return new DefaultServiceManager( getProviders( info, base ) );
}
- /**
- * Dynamic creation of a <code>ComponentManager</code> based on a set of
- * supplied dependencies and container configuration.
- * @param info meta information about the component
- * @param base the base logger
- * @return ComponentManager a new component manager
- */
- private ComponentManager createComponentManager( UnitInfo info, Logger
base )
- throws ServiceException
+ /**
+ * Dynamic creation of a <code>ComponentManager</code> based on a set of
+ * supplied dependencies and container configuration.
+ * @param info meta information about the component
+ * @param base the base logger
+ * @return ComponentManager a new component manager
+ */
+ private ComponentManager createComponentManager( UnitInfo info, Logger
base )
+ throws ServiceException
{
return new DefaultComponentManager( getProviders( info, base ) );
}
- /**
- * Returns a table of providers based on the supplied meta-info and
- * container configuration.
- * @param info meta-info about the service
- * @param composition the container composition configuration
- * @return Map provider table
- */
- private Map getProviders( UnitInfo unit, Logger base )
- throws ServiceException
+ /**
+ * Returns a table of providers based on the supplied meta-info and
+ * container configuration.
+ * @param unit meta-info about the service
+ * @return Map provider table
+ */
+ private Map getProviders( UnitInfo unit, Logger base )
+ throws ServiceException
{
DependencyInfo[] dependencies = unit.getDependencies();
Hashtable providers = new Hashtable();
try
{
- for( int i=0; i<dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyInfo dependency = dependencies[i];
+ final DependencyInfo dependency = dependencies[ i ];
providers.put( dependency.getRole(), getProvider( unit,
dependency, base ) );
}
return providers;
}
catch( Throwable e )
{
- final String error =
- "Unexpected exception while attempting to create a
ServiceManager.";
+ final String error =
+ "Unexpected exception while attempting to create a
ServiceManager.";
throw new ServiceException( error, e );
}
}
- /**
- * Create a provider implementation.
- * @param info the dependecy declaration
- * @param profile the configuration profile
- * @return Object the service provider
- */
+ /**
+ * Create a provider implementation.
+ * @param info the dependecy declaration
+ * @param unit the configuration profile
+ * @return Object the service provider
+ */
private Object getProvider( UnitInfo unit, DependencyInfo info, Logger
base )
- throws Exception
+ throws Exception
{
UnitInfo blockInfo = m_registry.lookup( info );
- if( blockInfo == null )
+ if( blockInfo == null )
{
throw new IllegalStateException(
- "Registry returned a null block info.");
+ "Registry returned a null block info." );
}
//
@@ -226,114 +217,114 @@
switch( policy )
{
- case UnitInfo.SINGLETON_LIFETIME_POLICY :
+ case UnitInfo.SINGLETON_LIFETIME_POLICY:
+
+ //
+ // return a singleton instance
+ //
+
+ provider = m_singletons.get( providerClass );
+ if( provider == null )
+ {
+ if( m_verbose && getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "generating singleton provider" );
+ }
+
+ // create and pipeline the singleton instance and
+ // add it to the list of singletons
+
+ Object object = execute( unit, blockInfo,
info.getRole(), base );
+ provider = new SingletonProvider( object, info.getRole()
);
+ m_singletons.put( providerClass, provider );
+ }
+ return provider;
+
+ //case UnitInfo.POOLED_LIFETIME_POLICY :
+
+ //provider = m_pools.get( providerClass );
+ //if( provider == null )
+ //{
+ // if( m_verbose ) if( getLogger().isDebugEnabled() )
getLogger().debug(
+ // "generating pooled provider" );
+ // create and pipeline the singleton instance and
+ // add it to the list of singletons
+ // Object object = execute( unit, blockInfo,
info.getRole(), base );
+ // provider = new PooledProvider( (Pool) object,
info.getRole() );
+ // m_pools.put( providerClass, provider );
+ //}
+ //return provider;
+
+ case UnitInfo.TRANSIENT_LIFETIME_POLICY:
+
+ //
+ // UnitInfo.TRANSIENT_LIFETIME_POLICY :
+ // new service instances are always created on invocation of
+ // a service lookup
+ //
- //
- // return a singleton instance
- //
-
- provider = m_singletons.get( providerClass );
- if( provider == null )
- {
- if( m_verbose && getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "generating singleton provider" );
- }
-
- // create and pipeline the singleton instance and
- // add it to the list of singletons
-
- Object object = execute( unit, blockInfo, info.getRole(),
base );
- provider = new SingletonProvider( object, info.getRole() );
- m_singletons.put( providerClass, provider );
- }
- return provider;
-
- //case UnitInfo.POOLED_LIFETIME_POLICY :
-
- //provider = m_pools.get( providerClass );
- //if( provider == null )
- //{
- // if( m_verbose ) if( getLogger().isDebugEnabled() )
getLogger().debug(
- // "generating pooled provider" );
- // create and pipeline the singleton instance and
- // add it to the list of singletons
- // Object object = execute( unit, blockInfo,
info.getRole(), base );
- // provider = new PooledProvider( (Pool) object,
info.getRole() );
- // m_pools.put( providerClass, provider );
- //}
- //return provider;
-
- case UnitInfo.TRANSIENT_LIFETIME_POLICY :
-
- //
- // UnitInfo.TRANSIENT_LIFETIME_POLICY :
- // new service instances are always created on invocation of
- // a service lookup
- //
-
- provider = m_transients.get( providerClass );
- if( provider == null )
- {
- if( m_verbose && getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "generating transient provider" );
- }
-
- // create and pipeline the singleton instance and
- // add it to the list of singletons
-
- provider = new TransientProvider( this, blockInfo,
info.getRole() );
- m_transients.put( providerClass, provider );
- }
- return provider;
+ provider = m_transients.get( providerClass );
+ if( provider == null )
+ {
+ if( m_verbose && getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "generating transient provider" );
+ }
+
+ // create and pipeline the singleton instance and
+ // add it to the list of singletons
+
+ provider = new TransientProvider( this, blockInfo,
info.getRole() );
+ m_transients.put( providerClass, provider );
+ }
+ return provider;
default :
- throw new PipelineException("Unsupported lifecycle policy: " +
policy );
- }
+ throw new PipelineException( "Unsupported lifecycle policy:
" + policy );
+ }
}
- /**
- * Applies lifecycle pipeline processing to an object described by a
supplied
- * service meta description.
- * @param info service meta-information
- * @return Object the service
- */
+ /**
+ * Applies lifecycle pipeline processing to an object described by a
supplied
+ * service meta description.
+ * @param info service meta-information
+ * @return Object the service
+ */
public Object pipeline( UnitInfo info ) throws Exception
{
return pipeline( info, info.getName() );
}
- /**
- * Applies lifecycle pipeline processing to an object described by a
supplied
- * service meta description and role.
- * @param info service meta-information
- * @param role service role
- * @return Object the service
- */
+ /**
+ * Applies lifecycle pipeline processing to an object described by a
supplied
+ * service meta description and role.
+ * @param info service meta-information
+ * @param role service role
+ * @return Object the service
+ */
public Object pipeline( UnitInfo info, String role ) throws Exception
{
- return execute( null, info, role, m_baseLogger );
+ return execute( null, info, role, m_baseLogger );
}
- private Object execute( UnitInfo container, UnitInfo info,
- String role, Logger logger )
- throws Exception
+ private Object execute( UnitInfo container, UnitInfo info,
+ String role, Logger logger )
+ throws Exception
{
- if( m_verbose && getLogger().isDebugEnabled() )
+ if( m_verbose && getLogger().isDebugEnabled() )
{
getLogger().debug(
- "pipelining " + role + " (" + info.getClassName() + ")");
+ "pipelining " + role + " (" + info.getClassName() + ")" );
}
Configuration config = null;
if( container != null )
{
- config = new CascadingConfiguration(
- container.getConfiguration().getChild(role),
info.getConfiguration());
+ config = new CascadingConfiguration(
+ container.getConfiguration().getChild( role ),
info.getConfiguration() );
}
else
{
@@ -360,7 +351,7 @@
//
Logger base = logger.getChildLogger( role );
- if( object instanceof LogEnabled )
+ if( object instanceof LogEnabled )
{
try
{
@@ -368,7 +359,7 @@
{
getLogger().debug( "applying logger" );
}
- ((LogEnabled)object).enableLogging( base );
+ ( (LogEnabled)object ).enableLogging( base );
}
catch( Throwable e )
{
@@ -383,17 +374,17 @@
// configure the object
//
- if( object instanceof Configurable )
+ if( object instanceof Configurable )
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug(
- "applying configuration to " + info.getName() + "\n"
- + ConfigurationUtil.list( config ));
+ "applying configuration to " + info.getName() + "\n"
+ + ConfigurationUtil.list( config ) );
}
- ((Configurable)object).configure( config );
+ ( (Configurable)object ).configure( config );
}
catch( Throwable e )
{
@@ -403,15 +394,15 @@
throw new PipelineException( error, e );
}
}
- else if( object instanceof Parameterizable )
+ else if( object instanceof Parameterizable )
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "parameterization" );
}
- ((Parameterizable)object).parameterize(
+ ( (Parameterizable)object ).parameterize(
Parameters.fromConfiguration( config ) );
}
catch( Throwable e )
@@ -428,15 +419,15 @@
// [need to update this to handle an args sequence]
//
- if( object instanceof Contextualizable )
+ if( object instanceof Contextualizable )
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "contextualization" );
}
- ((Contextualizable)object).contextualize( info.getContext() );
+ ( (Contextualizable)object ).contextualize(
info.getContext() );
}
catch( Throwable e )
{
@@ -451,16 +442,16 @@
// get the blocks required to support the dependencies
//
- if( object instanceof Serviceable )
+ if( object instanceof Serviceable )
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "composition" );
}
ServiceManager manager = createServiceManager( info, base );
- ((Serviceable)object).service( manager );
+ ( (Serviceable)object ).service( manager );
}
catch( Throwable e )
{
@@ -474,12 +465,12 @@
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "composition" );
}
ComponentManager manager = createComponentManager( info,
base );
- ((Composable)object).compose( manager );
+ ( (Composable)object ).compose( manager );
}
catch( Throwable e )
{
@@ -494,15 +485,15 @@
// initialize the object
//
- if( object instanceof Initializable )
+ if( object instanceof Initializable )
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "initilization" );
}
try
{
- ((Initializable)object).initialize();
+ ( (Initializable)object ).initialize();
}
catch( Throwable e )
{
@@ -517,15 +508,15 @@
// start the object
//
- if( object instanceof Startable )
+ if( object instanceof Startable )
{
try
{
- if( m_verbose )
+ if( m_verbose )
{
getLogger().debug( "starting" );
}
- ((Startable)object).start();
+ ( (Startable)object ).start();
}
catch( Throwable e )
{
@@ -545,22 +536,22 @@
{
try
{
- ((Disposable)object).dispose();
+ ( (Disposable)object ).dispose();
}
catch( Throwable e )
{
if( getLogger().isDebugEnabled() )
{
- getLogger().debug("ignoring disposal error", e );
+ getLogger().debug( "ignoring disposal error", e );
}
}
}
}
- /**
- * Notification by the controlling application to dispose of the
- * service factory.
- */
+ /**
+ * Notification by the controlling application to dispose of the
+ * service factory.
+ */
public void dispose()
{
//
@@ -570,13 +561,13 @@
//Enumeration pools = m_pools.elements();
//while( pools.hasMoreElements() )
//{
- //
+ //
// ServiceProvider pool = (ServiceProvider) pools.nextElement();
// if( pool instanceof Disposable )
// {
// try
// {
- // if( m_verbose ) if( getLogger().isDebugEnabled() )
getLogger().debug(
+ // if( m_verbose ) if( getLogger().isDebugEnabled() )
getLogger().debug(
// "pool entry disposal (" + pool.getRole() + ")");
// ((Disposable)pool).dispose();
// }
@@ -595,23 +586,23 @@
Enumeration singletons = m_singletons.elements();
while( singletons.hasMoreElements() )
{
- ServiceProvider singleton = (ServiceProvider)
singletons.nextElement();
+ ServiceProvider singleton =
(ServiceProvider)singletons.nextElement();
if( singleton instanceof Disposable )
{
try
{
- if( m_verbose && getLogger().isDebugEnabled() )
+ if( m_verbose && getLogger().isDebugEnabled() )
{
- getLogger().debug(
- "singleton entry disposal (" + singleton.getRole()
+ ")");
+ getLogger().debug(
+ "singleton entry disposal (" +
singleton.getRole() + ")" );
}
- ((Disposable)singleton).dispose();
+ ( (Disposable)singleton ).dispose();
}
catch( Throwable e )
{
- final String warning =
- "Ignoring exception while invoking singleton provider
disposal.";
- if( getLogger().isWarnEnabled() )
+ final String warning =
+ "Ignoring exception while invoking singleton
provider disposal.";
+ if( getLogger().isWarnEnabled() )
{
getLogger().warn( warning, e );
}
@@ -626,23 +617,23 @@
Enumeration transients = m_transients.elements();
while( transients.hasMoreElements() )
{
- ServiceProvider object = (ServiceProvider)
transients.nextElement();
+ ServiceProvider object =
(ServiceProvider)transients.nextElement();
if( object instanceof Disposable )
{
try
{
- if( m_verbose && getLogger().isDebugEnabled() )
+ if( m_verbose && getLogger().isDebugEnabled() )
{
- getLogger().debug(
- "transient entry disposal (" + object.getRole() +
")");
+ getLogger().debug(
+ "transient entry disposal (" + object.getRole()
+ ")" );
}
- ((Disposable)object).dispose();
+ ( (Disposable)object ).dispose();
}
catch( Throwable e )
{
- final String warning =
- "Ignoring exception while invoking transient provider
disposal.";
- if( getLogger().isWarnEnabled() )
+ final String warning =
+ "Ignoring exception while invoking transient
provider disposal.";
+ if( getLogger().isWarnEnabled() )
{
getLogger().warn( warning, e );
}
1.2 +32 -35
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceInfo.java
Index: ServiceInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceInfo.java 10 May 2002 17:53:09 -0000 1.1
+++ ServiceInfo.java 12 May 2002 13:41:28 -0000 1.2
@@ -7,7 +7,6 @@
*
* Original contribution by OSM SARL, http://www.osm.net
*/
-
package org.apache.excalibur.merlin;
import org.apache.avalon.framework.Version;
@@ -19,65 +18,63 @@
*/
class ServiceInfo
{
-
private Class m_interface;
private Version m_version;
-
- /**
- * Creation of a new <code>ServiceInfo</code> instance.
- */
- public ServiceInfo( Configuration config ) throws Exception
+
+ /**
+ * Creation of a new <code>ServiceInfo</code> instance.
+ */
+ public ServiceInfo( final Configuration config ) throws Exception
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader(
);
- m_interface = loader.loadClass( config.getAttribute("name") );
- m_version = Version.getVersion( config.getAttribute("version") );
+ final ClassLoader loader =
+ Thread.currentThread().getContextClassLoader();
+ m_interface = loader.loadClass( config.getAttribute( "name" ) );
+ m_version = Version.getVersion( config.getAttribute( "version" ) );
}
- /**
- * Equality test.
- * @return TRUE if this instance is equal to the supplied instance, where
- * equality is derived from equivalent interface values and versions.
- */
+ /**
+ * Equality test.
+ * @return TRUE if this instance is equal to the supplied instance, where
+ * equality is derived from equivalent interface values and versions.
+ */
public boolean equals( Object object )
{
- if( object instanceof ServiceInfo )
+ if( object instanceof ServiceInfo )
{
- return equals( (ServiceInfo) object );
+ return equals( (ServiceInfo)object );
}
return false;
}
- /**
- * Equality test.
- * @return TRUE if this instance is equal to the supplied instance, where
- * equality is derived from equivalent interface values and versions.
- */
+ /**
+ * Equality test.
+ * @return TRUE if this instance is equal to the supplied instance, where
+ * equality is derived from equivalent interface values and versions.
+ */
public boolean equals( ServiceInfo other )
{
- if( !other.getInterface().isAssignableFrom( m_interface ) )
+ if( !other.getInterface().isAssignableFrom( m_interface ) )
{
return false;
}
- return m_version.equals( other.getVersion() );
+ return m_version.equals( other.getVersion() );
}
- /**
- * Returns the class representing the service interface.
- * @return the service interface
- */
+ /**
+ * Returns the class representing the service interface.
+ * @return the service interface
+ */
public Class getInterface()
{
return m_interface;
}
- /**
- * Returns the service version.
- * @return the service version
- */
+ /**
+ * Returns the service version.
+ * @return the service version
+ */
public Version getVersion()
{
return m_version;
}
-
-}
-
+}
\ No newline at end of file
1.4 +276 -278
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceLoader.java
Index: ServiceLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceLoader.java 12 May 2002 13:31:30 -0000 1.3
+++ ServiceLoader.java 12 May 2002 13:41:28 -0000 1.4
@@ -10,32 +10,31 @@
package org.apache.excalibur.merlin;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.Vector;
-import java.util.Hashtable;
import java.util.Enumeration;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileInputStream;
-
-import org.apache.log.Hierarchy;
-import org.apache.log.Priority;
-import org.apache.log.output.io.StreamTarget;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.CascadingRuntimeException;
+import java.util.Hashtable;
+import java.util.Vector;
import org.apache.avalon.framework.CascadingException;
-import org.apache.avalon.framework.logger.LogKitLogger;
-import org.apache.avalon.framework.logger.AvalonFormatter;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.activity.Startable;
-import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.AvalonFormatter;
+import org.apache.avalon.framework.logger.LogKitLogger;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.log.Hierarchy;
+import org.apache.log.Priority;
+import org.apache.log.output.io.StreamTarget;
/**
* A service loader that loads a target class, manages full component
lifecycle
@@ -135,7 +134,7 @@
implements PipelineService
{
private static final String DEFAULT_FORMAT =
- "[%7.7{priority}] (%{category}): %{message}\\n%{throwable}";
+ "[%7.7{priority}] (%{category}): %{message}\\n%{throwable}";
private static OutputStream c_out = System.out;
private PipelineClassLoader m_classloader;
@@ -151,83 +150,82 @@
private ServiceFactory m_factory;
private Configuration m_config;
-
- /**
- * Command line entry point supporting establishment and initalization of
a service
- * loader instance with a supplied target component and supporting
services.
- *
- * <p><strong>java -jar form</strong></p>
- * <p>Execution using java -jar pattern requires the presence
- * of the following files under the same directory:</p>
- * <ul>
- * <li><code>merlin.jar</code>
- * <li><code>avalon-framework.jar</code>
- * <li><code>logkit.jar</code>
- * </ul>
- * <p>An example command line is shown below:</p>
- * <pre>
- * $ java -jar <strong>merlin.jar</strong>
<space-sep-list-of-supporting-jar-files>
- * -target <class-name>
- * </pre>
- * <p><strong>java -classpath form</strong></p>
- * <p>Execution using java -classpath pattern requires the inclusions
- * of the pipeline, framework and logkit jar files in the classpath
- * statement.</p>
- * <p>An example command line is shown below:</p>
- * <pre>
- * $ java -classpath merlin.jar;avalon-framework.jar;logkit.jar
- * <strong>org.apache.excalibur.merlin.ServiceLoader</strong>
- * <space-sep-list-of-supporting-jar-files> -target
<class-name>
- * </pre>
- * </ul>
- *
- * <p><table border="1" cellpadding="3" cellspacing="0" width="80%">
- * <tr bgcolor="#ccccff">
- * <td colspan="2"><b>Command Line Parameters and Arguments</b></td>
- * <tr><td width="30%"><b>Parameter</b></td><td
width="60%"><b>Description</b></td></tr>
- * <tr>
- * <td valign="top"><code>-target <class-name></code></td>
- * <td>
- * <p>The class to instantiate. If the class exposes any Avalon
lifecycle interface
- * (such as <code>Configurable</code>, <code>Contextualizable</code>,
<code>Serviceable</code>,
- * <code>Initializable</code>, <code>Startable</code>, or
<code>Disposable</code>, the
- * pipeline will automate lifecycle processing and termination.
- * </p>
- * </td></tr>
- * <tr>
- * <td valign="top"><code><supporting-jar-files></code></td>
- * <td>
- * <p>A list of space seperated jar files that will be added to the
pipeline
- * as supporting classes and components. Any jar file included in the
list
- * that contains an Avalon <code>Block</code> manifest will be registered
as
- * an available service when resolving component dependecies.</p>
- * </td></tr>
- * <tr><td valign="top"><code>-verbose <boolean></code></td>
- * <td>
- * <p>A value of <code>true</code> will force debug level logging of the
actual pipeline
- * processor. A value of <code>false</code> will disable pipeline debug
priority logging.
- * Visibility of logging infomration is dependent on the level supplied
under the
- * <code>priority</code parameter.</p>
- * </td></tr>
- * <tr><td valign="top"><code>-priority <priority></code></td>
- * <td>
- * <p>Declaration of the logging priority to use during pipeline
execution. Valid values
- * include FATAL_ERROR, ERROR, WARN, INFO, and DEBUG. </p>
- * </td></tr>
- * <tr><td valign="top"><code>-dispose <boolean></code></td>
- * <td>
- * If the target component is <code>Startable</code>, and the dispose
argument
- * is <code>FALSE</code> the component will be treated as a server and
will continue
- * to run following initialization. Otherwise, the component will be
disposed of.
- * </td></tr>
- * <tr><td valign="top"><code>-configuration <file-path></code></td>
- * <td>
- * Optional parameter naming a file to be used as the configuration
source.
- * </td></tr>
- * </table>
- *
- * @param args a array of <code>String</code> argument values passed
under the command line.
- */
+ /**
+ * Command line entry point supporting establishment and initalization
of a service
+ * loader instance with a supplied target component and supporting
services.
+ *
+ * <p><strong>java -jar form</strong></p>
+ * <p>Execution using java -jar pattern requires the presence
+ * of the following files under the same directory:</p>
+ * <ul>
+ * <li><code>merlin.jar</code>
+ * <li><code>avalon-framework.jar</code>
+ * <li><code>logkit.jar</code>
+ * </ul>
+ * <p>An example command line is shown below:</p>
+ * <pre>
+ * $ java -jar <strong>merlin.jar</strong>
<space-sep-list-of-supporting-jar-files>
+ * -target <class-name>
+ * </pre>
+ * <p><strong>java -classpath form</strong></p>
+ * <p>Execution using java -classpath pattern requires the inclusions
+ * of the pipeline, framework and logkit jar files in the classpath
+ * statement.</p>
+ * <p>An example command line is shown below:</p>
+ * <pre>
+ * $ java -classpath merlin.jar;avalon-framework.jar;logkit.jar
+ * <strong>org.apache.excalibur.merlin.ServiceLoader</strong>
+ * <space-sep-list-of-supporting-jar-files> -target
<class-name>
+ * </pre>
+ * </ul>
+ *
+ * <p><table border="1" cellpadding="3" cellspacing="0" width="80%">
+ * <tr bgcolor="#ccccff">
+ * <td colspan="2"><b>Command Line Parameters and Arguments</b></td>
+ * <tr><td width="30%"><b>Parameter</b></td><td
width="60%"><b>Description</b></td></tr>
+ * <tr>
+ * <td valign="top"><code>-target <class-name></code></td>
+ * <td>
+ * <p>The class to instantiate. If the class exposes any Avalon
lifecycle interface
+ * (such as <code>Configurable</code>, <code>Contextualizable</code>,
<code>Serviceable</code>,
+ * <code>Initializable</code>, <code>Startable</code>, or
<code>Disposable</code>, the
+ * pipeline will automate lifecycle processing and termination.
+ * </p>
+ * </td></tr>
+ * <tr>
+ * <td valign="top"><code><supporting-jar-files></code></td>
+ * <td>
+ * <p>A list of space seperated jar files that will be added to the
pipeline
+ * as supporting classes and components. Any jar file included in the
list
+ * that contains an Avalon <code>Block</code> manifest will be
registered as
+ * an available service when resolving component dependecies.</p>
+ * </td></tr>
+ * <tr><td valign="top"><code>-verbose <boolean></code></td>
+ * <td>
+ * <p>A value of <code>true</code> will force debug level logging of the
actual pipeline
+ * processor. A value of <code>false</code> will disable pipeline debug
priority logging.
+ * Visibility of logging infomration is dependent on the level supplied
under the
+ * <code>priority</code parameter.</p>
+ * </td></tr>
+ * <tr><td valign="top"><code>-priority <priority></code></td>
+ * <td>
+ * <p>Declaration of the logging priority to use during pipeline
execution. Valid values
+ * include FATAL_ERROR, ERROR, WARN, INFO, and DEBUG. </p>
+ * </td></tr>
+ * <tr><td valign="top"><code>-dispose <boolean></code></td>
+ * <td>
+ * If the target component is <code>Startable</code>, and the dispose
argument
+ * is <code>FALSE</code> the component will be treated as a server and
will continue
+ * to run following initialization. Otherwise, the component will be
disposed of.
+ * </td></tr>
+ * <tr><td valign="top"><code>-configuration
<file-path></code></td>
+ * <td>
+ * Optional parameter naming a file to be used as the configuration
source.
+ * </td></tr>
+ * </table>
+ *
+ * @param args a array of <code>String</code> argument values passed
under the command line.
+ */
public static void main( String[] args )
{
ServiceLoader pipeline = null;
@@ -237,21 +235,20 @@
CLI cli = new CLI( args );
Hierarchy hierarchy = createBootstrapLogger(
cli.getLoggingPriority() );
logger = new LogKitLogger( hierarchy.getLoggerFor( "" ) );
- Logger merlin = logger.getChildLogger("merlin");
+ Logger merlin = logger.getChildLogger( "merlin" );
- merlin.info("starting");
+ merlin.info( "starting" );
String target = cli.getTarget();
if( target == null )
{
merlin.warn(
- "missing parameter: " +
- "-target <required-target-classname>" );
- merlin.warn("cannot proceed");
+ "missing parameter: " +
+ "-target <required-target-classname>" );
+ merlin.warn( "cannot proceed" );
return;
}
-
File path = cli.getConfigurationPath();
Configuration config = null;
if( path != null )
@@ -260,7 +257,7 @@
}
if( config == null )
{
- config = new DefaultConfiguration("profile", null );
+ config = new DefaultConfiguration( "profile", null );
}
pipeline = new ServiceLoader();
@@ -302,10 +299,10 @@
}
}
- /**
- * Returns the verbose mode.
- * @return boolean TRUE if verbose mode enabled
- */
+ /**
+ * Returns the verbose mode.
+ * @return boolean TRUE if verbose mode enabled
+ */
private boolean getVerbose()
{
return m_verbose;
@@ -315,11 +312,11 @@
// Configurable
//=======================================================================
- /**
- * Configuration of the pipeline.
- * @param config the configuration
- * @exception ConfigurationException if a configuration exception occurs
- */
+ /**
+ * Configuration of the pipeline.
+ * @param config the configuration
+ * @exception ConfigurationException if a configuration exception occurs
+ */
public void configure( Configuration config ) throws
ConfigurationException
{
m_config = config;
@@ -329,22 +326,22 @@
// Contextualizable
//=======================================================================
- /**
- * Contextualization of the pipeline including the supply of command-line
- * arguments, include files, target class, and related execution policies.
- * @param context the pipeline context
- * @exception ContextException if the supplied context is not an instance
- * of ServiceLoaderContext, or if an internal error occurs while
resolving
- * context information.
- * @see ServiceLoaderContext
- */
+ /**
+ * Contextualization of the pipeline including the supply of command-line
+ * arguments, include files, target class, and related execution
policies.
+ * @param context the pipeline context
+ * @exception ContextException if the supplied context is not an instance
+ * of ServiceLoaderContext, or if an internal error occurs while
resolving
+ * context information.
+ * @see ServiceLoaderContext
+ */
public void contextualize( Context context ) throws ContextException
{
if( context instanceof ServiceLoaderContext )
{
try
{
- ServiceLoaderContext c = (ServiceLoaderContext) context;
+ ServiceLoaderContext c = (ServiceLoaderContext)context;
m_includes = c.getIncludes();
m_verbose = c.getVerbose();
m_policy = c.getDisposalPolicy();
@@ -360,18 +357,18 @@
{
try
{
- m_includes = (File[]) context.get(
- ServiceLoaderContext.INCLUDES_KEY );
+ m_includes = (File[])context.get(
+ ServiceLoaderContext.INCLUDES_KEY );
}
catch( ContextException e )
{
- m_includes = new File[0];
+ m_includes = new File[ 0 ];
}
try
{
- m_verbose = ((Boolean)context.get(
- ServiceLoaderContext.VERBOSE_POLICY_KEY )).booleanValue();
+ m_verbose = ( (Boolean)context.get(
+ ServiceLoaderContext.VERBOSE_POLICY_KEY )
).booleanValue();
}
catch( ContextException e )
{
@@ -380,8 +377,8 @@
try
{
- m_policy = ((Boolean)context.get(
- ServiceLoaderContext.DISPOSAL_POLICY_KEY
)).booleanValue();
+ m_policy = ( (Boolean)context.get(
+ ServiceLoaderContext.DISPOSAL_POLICY_KEY )
).booleanValue();
}
catch( ContextException e )
{
@@ -394,10 +391,10 @@
// Initializable
//=======================================================================
- /**
- * Start the pipeline and handle any errors arrising from loader
execution.
- * @exception PipelineException if a lifecycle error occurs
- */
+ /**
+ * Start the pipeline and handle any errors arrising from loader
execution.
+ * @exception PipelineException if a lifecycle error occurs
+ */
public void initialize() throws PipelineException
{
//if( m_target == null ) throw new PipelineException(
@@ -413,12 +410,12 @@
{
m_classloader = createClassloader();
}
- m_root = new File( System.getProperty("user.dir") );
+ m_root = new File( System.getProperty( "user.dir" ) );
m_factory = new ServiceFactory( m_root, getVerbose() );
m_factory.enableLogging( getLogger() );
m_factory.configure( m_config );
m_factory.initialize();
- enableLogging( getLogger().getChildLogger("loader") );
+ enableLogging( getLogger().getChildLogger( "loader" ) );
}
catch( Throwable e )
{
@@ -433,9 +430,9 @@
Vector list = new Vector();
Vector stack = new Vector();
- for (int i=0; i<m_includes.length; i++)
+ for( int i = 0; i < m_includes.length; i++ )
{
- File target = m_includes[i];
+ File target = m_includes[ i ];
stack.add( target );
list.add( target );
}
@@ -467,13 +464,13 @@
// PipelineService
//=======================================================================
- /**
- * Initates execution of the loading of supporting services derived from a
- * target.
- * @param target the name of the class to process
- * @return Object a fully prepared service instance
- * @exception PipelineException if a lifecycle error occurs
- */
+ /**
+ * Initates execution of the loading of supporting services derived from
a
+ * target.
+ * @param target the name of the class to process
+ * @return Object a fully prepared service instance
+ * @exception PipelineException if a lifecycle error occurs
+ */
public Object pipeline( String target ) throws PipelineException
{
@@ -484,10 +481,10 @@
UnitInfo info;
try
{
- info = new UnitInfo( target.replace('.','/'), m_config, m_root );
+ info = new UnitInfo( target.replace( '.', '/' ), m_config,
m_root );
if( getVerbose() && getLogger().isDebugEnabled() )
{
- getLogger().debug( "validating target");
+ getLogger().debug( "validating target" );
}
try
{
@@ -524,18 +521,18 @@
// ServiceLoader
//=======================================================================
- /**
- * Handles association of a shutdown hook prior to execution of a normal
- * pipeline process.
- * @param target the name of the component class
- * @param policy if TRUE then terminate following initialization
- * @exception PipelineException if a component execution error occurs
- */
+ /**
+ * Handles association of a shutdown hook prior to execution of a normal
+ * pipeline process.
+ * @param target the name of the component class
+ * @param policy if TRUE then terminate following initialization
+ * @exception PipelineException if a component execution error occurs
+ */
private void pipeline( String target, boolean policy ) throws
PipelineException
{
- if( getVerbose() && (getLogger() != null) &&
getLogger().isDebugEnabled() )
+ if( getVerbose() && ( getLogger() != null ) &&
getLogger().isDebugEnabled() )
{
- getLogger().debug("pipelining: " + target );
+ getLogger().debug( "pipelining: " + target );
}
final Object object = pipeline( target );
@@ -545,24 +542,24 @@
//
Runtime.getRuntime().addShutdownHook(
- new Thread()
- {
- public void run()
- {
- if( getVerbose() )
- {
- if( getLogger() != null)
- {
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug("shutdown initiated");
- }
- }
- }
- terminate( object );
- dispose();
- }
- }
+ new Thread()
+ {
+ public void run()
+ {
+ if( getVerbose() )
+ {
+ if( getLogger() != null )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "shutdown initiated" );
+ }
+ }
+ }
+ terminate( object );
+ dispose();
+ }
+ }
);
if( policy )
@@ -576,14 +573,14 @@
}
else
{
- getLogger().info( "target established: " +
object.getClass().getName());
+ getLogger().info( "target established: " +
object.getClass().getName() );
}
}
- /**
- * Run the termination lifecycle actions on the primary object.
- * @param object the object to terminate
- */
+ /**
+ * Run the termination lifecycle actions on the primary object.
+ * @param object the object to terminate
+ */
private void terminate( Object object )
{
if( m_terminated )
@@ -599,14 +596,14 @@
if( getVerbose() && getLogger().isDebugEnabled() )
{
getLogger().debug(
- "terminating " + object.getClass().getName() );
+ "terminating " + object.getClass().getName() );
}
if( object instanceof Startable )
{
try
{
- ((Startable)object).stop();
+ ( (Startable)object ).stop();
}
catch( Throwable e )
{
@@ -622,7 +619,7 @@
{
try
{
- ((Disposable)object).dispose();
+ ( (Disposable)object ).dispose();
}
catch( Throwable e )
{
@@ -635,9 +632,9 @@
}
}
- /**
- * Disposal of the pipeline and release of all resources.
- */
+ /**
+ * Disposal of the pipeline and release of all resources.
+ */
public void dispose()
{
if( m_disposed )
@@ -648,13 +645,13 @@
if( getVerbose() && getLogger().isDebugEnabled() )
{
getLogger().debug(
- "loader disposal" );
+ "loader disposal" );
}
if( m_factory instanceof Disposable )
{
try
{
- ((Disposable)m_factory).dispose();
+ ( (Disposable)m_factory ).dispose();
}
catch( Throwable e )
{
@@ -678,47 +675,48 @@
}
catch( Throwable e )
{
- final String error = "Failed to instantial a classloader.";
- throw new CascadingRuntimeException( error, e );
+ final String error = "Failed to instantial a classloader.";
+ throw new CascadingRuntimeException( error, e );
}
}
static class PipelineClassLoader
extends URLClassLoader
{
- PipelineClassLoader( )
+ PipelineClassLoader()
{
- super( new URL[0],
Thread.currentThread().getContextClassLoader() );
+ super( new URL[ 0 ],
Thread.currentThread().getContextClassLoader() );
}
protected void addURL( URL url )
{
try
{
- URL jarURL = new URL("jar:" + url.toString() + "!/");
+ URL jarURL = new URL( "jar:" + url.toString() + "!/" );
super.addURL( jarURL );
}
catch( Throwable e )
{
throw new CascadingRuntimeException(
- "Unexpected error while attempting to add classloader URL:
" + url, e );
+ "Unexpected error while attempting to add classloader
URL: " + url, e );
}
}
+
protected Class loadClass( String name, boolean resolve ) throws
ClassNotFoundException
{
return super.loadClass( name, resolve );
}
}
- /**
- * Load the supplied jar files under the pipeline classloader.
- * For each entry in the stack, try to load it and
- * if sucessfull, remove it from the stack - on completion
- * the stack should be less than its original size - recursivly
- * invoke load until the stack is empty.
- * @param stack a <code>Vector</code> containing a sequence of jar files
- * to be added to the classloader.
- */
+ /**
+ * Load the supplied jar files under the pipeline classloader.
+ * For each entry in the stack, try to load it and
+ * if sucessfull, remove it from the stack - on completion
+ * the stack should be less than its original size - recursivly
+ * invoke load until the stack is empty.
+ * @param stack a <code>Vector</code> containing a sequence of jar files
+ * to be added to the classloader.
+ */
private void load( Vector stack )
{
int size = stack.size();
@@ -730,7 +728,7 @@
Enumeration enum = stack.elements();
while( enum.hasMoreElements() )
{
- File file = (File) enum.nextElement();
+ File file = (File)enum.nextElement();
if( getVerbose() )
{
getLogger().debug( "Loading resource: " + file );
@@ -745,7 +743,7 @@
if( getVerbose() )
{
getLogger().warn(
- "Encountered error while loading resource: " + file,
error );
+ "Encountered error while loading resource: " + file,
error );
}
errors.put( file, error );
}
@@ -761,15 +759,15 @@
else
{
Enumeration keys = errors.keys();
- getLogger().error("Load error count = " + errors.size() );
+ getLogger().error( "Load error count = " + errors.size() );
while( keys.hasMoreElements() )
{
- File key = (File) keys.nextElement();
+ File key = (File)keys.nextElement();
getLogger().error(
- "Error while loading file."
- + "\n\tfile: " + key.toString(), (Throwable) errors.get(
key ) );
+ "Error while loading file."
+ + "\n\tfile: " + key.toString(), (Throwable)errors.get(
key ) );
}
- throw new RuntimeException("Unable to load file stack - see
trace for details.");
+ throw new RuntimeException( "Unable to load file stack - see
trace for details." );
}
}
@@ -777,19 +775,19 @@
// configuration
//==========================================================
- /**
- * Get client configuration from a file.
- */
+ /**
+ * Get client configuration from a file.
+ */
private static Configuration getRuntimeConfiguration( final File file )
{
try
{
- DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder( );
+ DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
InputStream is = new FileInputStream( file );
if( is == null )
{
throw new Exception(
- "Could not load the configuration resource \"" + file +
"\"" );
+ "Could not load the configuration resource \"" + file +
"\"" );
}
return builder.build( is );
}
@@ -810,7 +808,7 @@
{
Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
hierarchy.setDefaultLogTarget(
- new StreamTarget( c_out, new AvalonFormatter( DEFAULT_FORMAT
) ) );
+ new StreamTarget( c_out, new AvalonFormatter( DEFAULT_FORMAT
) ) );
hierarchy.setDefaultPriority( priority );
return hierarchy;
}
@@ -824,55 +822,55 @@
// command-line
//==========================================================
- /**
- * Exception thorwn by the command line handler.
- */
+ /**
+ * Exception thorwn by the command line handler.
+ */
private static class IllegalParameterException extends Exception
{
- /**
- * Construct a new <code>IllegalParameterException</code> instance
with the
- * supplied message parameter.
- * @param message Message summarising the exception.
- */
+ /**
+ * Construct a new <code>IllegalParameterException</code> instance
with the
+ * supplied message parameter.
+ * @param message Message summarising the exception.
+ */
public IllegalParameterException( final String message )
{
- super( message );
+ super( message );
}
}
- /**
- * Command line handler.
- */
+ /**
+ * Command line handler.
+ */
private static class CLI
{
- private String[] m_args = new String[0];
+ private String[] m_args = new String[ 0 ];
private Priority m_priority = Priority.INFO;
private String m_target = null;
private boolean m_policy = true;
private boolean m_verbose = false;
- private File[] m_files = new File[0];
+ private File[] m_files = new File[ 0 ];
private File m_path = null;
- /**
- * Creation of a new command line handler.
- * @param args the command line arguments to parse
- */
+ /**
+ * Creation of a new command line handler.
+ * @param args the command line arguments to parse
+ */
public CLI( String[] args ) throws IllegalParameterException
{
m_args = args;
Vector vector = new Vector();
String arg = null;
- for( int i=0; i < m_args.length; i++ )
+ for( int i = 0; i < m_args.length; i++ )
{
- arg = m_args[i].toLowerCase();
+ arg = m_args[ i ].toLowerCase();
- if( arg.startsWith("-tar") )
+ if( arg.startsWith( "-tar" ) )
{
- if( i+1 < m_args.length )
+ if( i + 1 < m_args.length )
{
- m_target = m_args[i+1];
- i = i+1;
+ m_target = m_args[ i + 1 ];
+ i = i + 1;
}
else
{
@@ -880,12 +878,12 @@
throw new RuntimeException( error );
}
}
- else if( arg.startsWith("-conf") )
+ else if( arg.startsWith( "-conf" ) )
{
- if( i+1 < m_args.length )
+ if( i + 1 < m_args.length )
{
- m_path = new File( m_args[i+1] );
- i = i+1;
+ m_path = new File( m_args[ i + 1 ] );
+ i = i + 1;
}
else
{
@@ -893,12 +891,12 @@
throw new RuntimeException( error );
}
}
- else if( arg.startsWith("-pri") )
+ else if( arg.startsWith( "-pri" ) )
{
- if( i+1 < m_args.length )
+ if( i + 1 < m_args.length )
{
- m_priority = Priority.getPriorityForName(
m_args[i+1].toUpperCase() );
- i = i+1;
+ m_priority = Priority.getPriorityForName( m_args[ i
+ 1 ].toUpperCase() );
+ i = i + 1;
}
else
{
@@ -906,12 +904,12 @@
throw new RuntimeException( error );
}
}
- else if( arg.startsWith("-dis") )
+ else if( arg.startsWith( "-dis" ) )
{
- if( i+1 < m_args.length )
+ if( i + 1 < m_args.length )
{
- m_policy =
(m_args[i+1].toUpperCase().equals("TRUE"));
- i = i+1;
+ m_policy = ( m_args[ i + 1 ].toUpperCase().equals(
"TRUE" ) );
+ i = i + 1;
}
else
{
@@ -919,12 +917,12 @@
throw new RuntimeException( error );
}
}
- else if( arg.startsWith("-ver") )
+ else if( arg.startsWith( "-ver" ) )
{
- if( i+1 < m_args.length )
+ if( i + 1 < m_args.length )
{
- m_verbose =
(m_args[i+1].toUpperCase().equals("TRUE"));
- i = i+1;
+ m_verbose = ( m_args[ i + 1 ].toUpperCase().equals(
"TRUE" ) );
+ i = i + 1;
}
else
{
@@ -932,63 +930,63 @@
throw new RuntimeException( error );
}
}
- else if( arg.startsWith("-") )
+ else if( arg.startsWith( "-" ) )
{
final String error = "Unrecognized parameter: " + arg;
throw new IllegalParameterException( error );
}
else
{
- final File file = new File( m_args[i] );
+ final File file = new File( m_args[ i ] );
if( file.exists() )
{
vector.add( file );
}
}
}
- m_files = (File[]) vector.toArray( new File[0] );
+ m_files = (File[])vector.toArray( new File[ 0 ] );
}
- /**
- * Returns the target service class name.
- * @return String the name of the target service class
- */
+ /**
+ * Returns the target service class name.
+ * @return String the name of the target service class
+ */
public String getTarget()
{
- return m_target;
+ return m_target;
}
- /**
- * Returns a service loader context.
- * @return ServiceLoaderContext the service loader context
- */
+ /**
+ * Returns a service loader context.
+ * @return ServiceLoaderContext the service loader context
+ */
public ServiceLoaderContext getContext()
{
- return new ServiceLoaderContext( m_args, m_target, m_files,
m_policy, m_verbose );
+ return new ServiceLoaderContext( m_args, m_target, m_files,
m_policy, m_verbose );
}
- /**
- * Returns the configuration file path
- * @return File the configuration file path
- */
+ /**
+ * Returns the configuration file path
+ * @return File the configuration file path
+ */
public File getConfigurationPath()
{
- return m_path;
+ return m_path;
}
- /**
- * Returns the logging priority.
- * @return Priority the logging priority to apply.
- */
+ /**
+ * Returns the logging priority.
+ * @return Priority the logging priority to apply.
+ */
public Priority getLoggingPriority()
{
return m_priority;
}
- /**
- * Returns the disposal policy.
- * @return boolean the disposal policy.
- */
+ /**
+ * Returns the disposal policy.
+ * @return boolean the disposal policy.
+ */
public boolean getDisposalPolicy()
{
return m_policy;
1.2 +77 -77
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceLoaderContext.java
Index: ServiceLoaderContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceLoaderContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceLoaderContext.java 10 May 2002 17:53:09 -0000 1.1
+++ ServiceLoaderContext.java 12 May 2002 13:41:28 -0000 1.2
@@ -11,102 +11,102 @@
package org.apache.excalibur.merlin;
import java.io.File;
-import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.DefaultContext;
/**
- * <code>ServiceLoaderContext</code> context to hold command line arguments,
- * base directory, target class name, and include files for a
+ * <code>ServiceLoaderContext</code> context to hold command line arguments,
+ * base directory, target class name, and include files for a
* <code>ServiceLoader</code> component.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class ServiceLoaderContext extends DefaultContext
{
- /**
- * Context key for command line arguments.
- * @see #getArgs()
- */
+ /**
+ * Context key for command line arguments.
+ * @see #getArgs()
+ */
public static final String ARGS_KEY = "ARGS";
- /**
- * Context key for the base directory.
- * @see #getBaseDirectory()
- */
+ /**
+ * Context key for the base directory.
+ * @see #getBaseDirectory()
+ */
public static final String BASE_DIRECTORY_KEY = "APP_DIR";
- /**
- * Context key for the target class name.
- * @see #getTarget()
- */
+ /**
+ * Context key for the target class name.
+ * @see #getTarget()
+ */
public static final String TARGET_KEY = "TARGET";
- /**
- * Context key for the set of supporting include jar files.
- * @see #getIncludes()
- */
+ /**
+ * Context key for the set of supporting include jar files.
+ * @see #getIncludes()
+ */
public static final String INCLUDES_KEY = "INCLUDES";
- /**
- * Context key for the disposal policy.
- * @see #getDisposalPolicy()
- */
+ /**
+ * Context key for the disposal policy.
+ * @see #getDisposalPolicy()
+ */
public static final String DISPOSAL_POLICY_KEY = "DISPOSAL.POLICY";
- /**
- * Context key for the verbose policy.
- * @see #getVerbose()
- */
+ /**
+ * Context key for the verbose policy.
+ * @see #getVerbose()
+ */
public static final String VERBOSE_POLICY_KEY = "VERBOSE.POLICY";
- /**
- * Creation of a new <oce>ServiceLoaderContext</code> with the supplied
- * arguments.
- * @param args command line arguments
- * @param target class name of the target object to be loaded
- * @param includes set of jar files to be added to the loader classloader
- * @param disposal boolean disposal policy
- * @param verbose policy concerning display of loader debug messages
- */
- public ServiceLoaderContext(
- final String[] args, final String target, final File[] includes,
- final boolean disposal, final boolean verbose )
+ /**
+ * Creation of a new <oce>ServiceLoaderContext</code> with the supplied
+ * arguments.
+ * @param args command line arguments
+ * @param target class name of the target object to be loaded
+ * @param includes set of jar files to be added to the loader classloader
+ * @param disposal boolean disposal policy
+ * @param verbose policy concerning display of loader debug messages
+ */
+ public ServiceLoaderContext(
+ final String[] args, final String target, final File[] includes,
+ final boolean disposal, final boolean verbose )
{
super.put( ARGS_KEY, args );
super.put( TARGET_KEY, target );
- super.put( BASE_DIRECTORY_KEY, new File(
System.getProperty("user.dir")) );
+ super.put( BASE_DIRECTORY_KEY, new File( System.getProperty(
"user.dir" ) ) );
super.put( INCLUDES_KEY, includes );
- super.put( DISPOSAL_POLICY_KEY, new Boolean( disposal ));
- super.put( VERBOSE_POLICY_KEY, new Boolean( verbose ));
+ super.put( DISPOSAL_POLICY_KEY, new Boolean( disposal ) );
+ super.put( VERBOSE_POLICY_KEY, new Boolean( verbose ) );
}
- /**
- * Returns the command-line argument <code>String[]</code>.
- * @return String[] command line arguments
- */
+ /**
+ * Returns the command-line argument <code>String[]</code>.
+ * @return String[] command line arguments
+ */
public String[] getArgs()
{
try
{
- return (String[]) super.get( ARGS_KEY );
+ return (String[])super.get( ARGS_KEY );
}
catch( ContextException e )
{
- final String error =
- "Unexpected exception while retrieving command line
arguments.";
+ final String error =
+ "Unexpected exception while retrieving command line
arguments.";
throw new PipelineRuntimeException( error, e );
}
}
- /**
- * Returns the base directory as a <code>File</code>.
- * @return File the base working directory
- */
+ /**
+ * Returns the base directory as a <code>File</code>.
+ * @return File the base working directory
+ */
public File getBaseDirectory()
{
try
{
- return (File) super.get( BASE_DIRECTORY_KEY );
+ return (File)super.get( BASE_DIRECTORY_KEY );
}
catch( ContextException e )
{
@@ -115,16 +115,16 @@
}
}
- /**
- * Returns the disposal policy to apply if the target component implements
- * the <code>Startable</code> interface.
- * @return boolean the target component disposal policy
- */
+ /**
+ * Returns the disposal policy to apply if the target component
implements
+ * the <code>Startable</code> interface.
+ * @return boolean the target component disposal policy
+ */
public boolean getDisposalPolicy()
{
try
{
- return ((Boolean)super.get( DISPOSAL_POLICY_KEY
)).booleanValue();
+ return ( (Boolean)super.get( DISPOSAL_POLICY_KEY )
).booleanValue();
}
catch( ContextException e )
{
@@ -133,15 +133,15 @@
}
}
- /**
- * Class name of a target object.
- * @return String the class name of the target
- */
+ /**
+ * Class name of a target object.
+ * @return String the class name of the target
+ */
public String getTarget()
{
try
{
- return (String) super.get( TARGET_KEY );
+ return (String)super.get( TARGET_KEY );
}
catch( ContextException e )
{
@@ -150,15 +150,15 @@
}
}
- /**
- * Returns the set of supporting jar files.
- * @return File[] an array of jar files supporting target composition and
execution
- */
+ /**
+ * Returns the set of supporting jar files.
+ * @return File[] an array of jar files supporting target composition
and execution
+ */
public File[] getIncludes()
{
try
{
- return (File[]) super.get( INCLUDES_KEY );
+ return (File[])super.get( INCLUDES_KEY );
}
catch( ContextException e )
{
@@ -167,17 +167,17 @@
}
}
- /**
- * Returns the verbose policy - if true, logging entries from the
pipeline
- * will be inclued, otherwise, logging entries will be restricted to the
- * target component.
- * @return boolean the verbose policy
- */
+ /**
+ * Returns the verbose policy - if true, logging entries from the
pipeline
+ * will be inclued, otherwise, logging entries will be restricted to the
+ * target component.
+ * @return boolean the verbose policy
+ */
public boolean getVerbose()
{
try
{
- return ((Boolean)super.get( VERBOSE_POLICY_KEY )).booleanValue();
+ return ( (Boolean)super.get( VERBOSE_POLICY_KEY )
).booleanValue();
}
catch( ContextException e )
{
1.2 +18 -18
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceProvider.java
Index: ServiceProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ServiceProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceProvider.java 10 May 2002 17:53:09 -0000 1.1
+++ ServiceProvider.java 12 May 2002 13:41:28 -0000 1.2
@@ -13,12 +13,12 @@
import org.apache.avalon.framework.activity.Disposable;
/**
- * <code>ServiceProvider</code> is an abstract base class to services
- * factories. The abstract class provides the single <code>getRole</code>
- * method that can be used by a <code>ServiceManager</code> implementation
+ * <code>ServiceProvider</code> is an abstract base class to services
+ * factories. The abstract class provides the single <code>getRole</code>
+ * method that can be used by a <code>ServiceManager</code> implementation
* to identity a service provider for a particular role.
- * A concrete <code>ServiceProvider</code> instance will typically be
- * created by an implementation when constructing a
<code>ServiceManager</code>
+ * A concrete <code>ServiceProvider</code> instance will typically be
+ * created by an implementation when constructing a
<code>ServiceManager</code>
* for a target component.
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
@@ -26,29 +26,29 @@
{
private String m_role;
- /**
- * Creation of a new <code>ServiceProvider</code> instance based on
- * a supplied role.
- * @param role the role of the service provided by the provider relative
- * to a <code>ServiceManager</code> that is exposing provider services.
- */
+ /**
+ * Creation of a new <code>ServiceProvider</code> instance based on
+ * a supplied role.
+ * @param role the role of the service provided by the provider relative
+ * to a <code>ServiceManager</code> that is exposing provider services.
+ */
public ServiceProvider( String role )
{
m_role = role;
}
- /**
- * Returns the role of this provider within the scope of a
<code>ServiceManager</code>.
- * @return String the role of the service provider by the provider.
- */
+ /**
+ * Returns the role of this provider within the scope of a
<code>ServiceManager</code>.
+ * @return String the role of the service provider by the provider.
+ */
public String getRole()
{
return m_role;
}
- /**
- * Disposal of the provider and release of related resources.
- */
+ /**
+ * Disposal of the provider and release of related resources.
+ */
public void dispose()
{
m_role = null;
1.2 +16 -19
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/SingletonProvider.java
Index: SingletonProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/SingletonProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SingletonProvider.java 10 May 2002 17:53:09 -0000 1.1
+++ SingletonProvider.java 12 May 2002 13:41:28 -0000 1.2
@@ -7,13 +7,12 @@
*
* Original contribution by OSM SARL, http://www.osm.net
*/
-
package org.apache.excalibur.merlin;
import org.apache.avalon.framework.activity.Disposable;
/**
- * A <code>SingletonProvider</code> is a provider of singleton services. A
+ * A <code>SingletonProvider</code> is a provider of singleton services. A
* singleton service is a service that is managed by the container providing
the
* the service. The container providing the service is reposible for all
lifecycle
* actions including service decommissioning.
@@ -21,38 +20,37 @@
*/
class SingletonProvider extends ServiceProvider
{
-
private Object m_object;
- /**
- * Creation of a new <code>SingletonProvider</code>.
- * @param object the singleton object to provide.
- */
+ /**
+ * Creation of a new <code>SingletonProvider</code>.
+ * @param object the singleton object to provide.
+ */
public SingletonProvider( Object object, String role )
{
super( role );
m_object = object;
}
- /**
- * Provides a reference to a singleton service.
- * @return Object the singleton service
- */
+ /**
+ * Provides a reference to a singleton service.
+ * @return Object the singleton service
+ */
public Object provide()
{
return m_object;
}
- /**
- * Disposal of the provider and release of related resources.
- */
+ /**
+ * Disposal of the provider and release of related resources.
+ */
public void dispose()
{
- if(( m_object != null ) && ( m_object instanceof Disposable ))
+ if( ( m_object != null ) && ( m_object instanceof Disposable ) )
{
try
- {
- ((Disposable)m_object).dispose();
+ {
+ ( (Disposable)m_object ).dispose();
}
catch( Throwable anything )
{
@@ -64,5 +62,4 @@
}
}
}
-}
-
+}
\ No newline at end of file
1.3 +14 -15
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/TransientProvider.java
Index: TransientProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/TransientProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TransientProvider.java 12 May 2002 12:38:12 -0000 1.2
+++ TransientProvider.java 12 May 2002 13:41:28 -0000 1.3
@@ -11,7 +11,6 @@
package org.apache.excalibur.merlin;
import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.avalon.framework.configuration.Configuration;
/**
* A <code>TransientProvider</code> is a provider of transient services. A
@@ -25,12 +24,12 @@
private UnitInfo m_info;
private boolean m_disposed;
- /**
- * Creation of a new TransientProvider.
- * @param factory the object factory
- * @param info service meta info
- * @param role service role
- */
+ /**
+ * Creation of a new TransientProvider.
+ * @param factory the object factory
+ * @param info service meta info
+ * @param role service role
+ */
public TransientProvider( ServiceFactory factory, UnitInfo info, String
role )
{
super( role );
@@ -38,15 +37,15 @@
m_factory = factory;
}
- /**
- * Create a new instance of a transient service.
- * @return Object a new instance of a transient service
- */
+ /**
+ * Create a new instance of a transient service.
+ * @return Object a new instance of a transient service
+ */
public Object create()
{
if( m_disposed )
{
- throw new IllegalStateException( "Transient provider has been
disposed.");
+ throw new IllegalStateException( "Transient provider has been
disposed." );
}
try
{
@@ -59,9 +58,9 @@
}
}
- /**
- * Disposal of the provider and release of related resources.
- */
+ /**
+ * Disposal of the provider and release of related resources.
+ */
public void dispose()
{
m_disposed = true;
1.4 +27 -28
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ant/Load.java
Index: Load.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/ant/Load.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Load.java 12 May 2002 13:21:43 -0000 1.3
+++ Load.java 12 May 2002 13:41:29 -0000 1.4
@@ -12,12 +12,12 @@
import java.io.File;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
/**
@@ -36,16 +36,16 @@
private String m_config;
private Commandline m_cmd = new Commandline();
- private Execute m_exe = new Execute(new PumpStreamHandler(System.out,
System.err));
+ private Execute m_exe = new Execute( new PumpStreamHandler( System.out,
System.err ) );
private Path m_classpath;
/**
* Adds a set of files (nested fileset attribute).
* @param set the file set
*/
- public void addFileset(FileSet set)
+ public void addFileset( FileSet set )
{
- m_filesets.addElement(set);
+ m_filesets.addElement( set );
}
/**
@@ -61,15 +61,15 @@
* Sets the classpath to the supplied path.
* @param path the classpath
*/
- public void setClasspath(Path path)
+ public void setClasspath( Path path )
{
- if (m_classpath == null)
+ if( m_classpath == null )
{
m_classpath = path;
}
else
{
- m_classpath.append(path);
+ m_classpath.append( path );
}
}
@@ -79,9 +79,9 @@
*/
public Path createClasspath()
{
- if (m_classpath == null)
+ if( m_classpath == null )
{
- m_classpath = new Path(project);
+ m_classpath = new Path( project );
}
return m_classpath.createPath();
}
@@ -132,7 +132,6 @@
m_config = value;
}
-
/**
* Performs execution as an Ant target.
* @exception BuildException indicates a build faliure
@@ -144,39 +143,39 @@
// add the classpath
//
- if (m_classpath == null)
+ if( m_classpath == null )
{
m_classpath = Path.systemClasspath;
}
else
{
- m_classpath = m_classpath.concatSystemClasspath("ignore");
+ m_classpath = m_classpath.concatSystemClasspath( "ignore" );
}
- m_cmd.createArgument().setValue("-classpath");
- m_cmd.createArgument().setPath(m_classpath);
+ m_cmd.createArgument().setValue( "-classpath" );
+ m_cmd.createArgument().setPath( m_classpath );
Commandline toExecute = (Commandline)m_cmd.clone();
- toExecute.setExecutable("java");
+ toExecute.setExecutable( "java" );
//
// declare the service loader class
//
-
toExecute.createArgument().setValue("org.apache.excalibur.merlin.ServiceLoader");
+ toExecute.createArgument().setValue(
"org.apache.excalibur.merlin.ServiceLoader" );
//
// preprocess the fileset into a vector of file arguments
//
- for (int i=0; i<m_filesets.size(); i++)
+ for( int i = 0; i < m_filesets.size(); i++ )
{
- final FileSet fs = (FileSet) m_filesets.elementAt(i);
+ final FileSet fs = (FileSet)m_filesets.elementAt( i );
final File base = fs.getDir( project );
- final DirectoryScanner ds = fs.getDirectoryScanner(project);
+ final DirectoryScanner ds = fs.getDirectoryScanner( project );
final String[] files = ds.getIncludedFiles();
- for( int j=0; j<files.length; j++ )
+ for( int j = 0; j < files.length; j++ )
{
- File target = new File( base, files[j] );
+ File target = new File( base, files[ j ] );
toExecute.createArgument().setValue( target.toString() );
}
}
@@ -189,33 +188,33 @@
// add the priority parameter
- toExecute.createArgument().setValue( "-priority");
+ toExecute.createArgument().setValue( "-priority" );
toExecute.createArgument().setValue( m_priority );
// add the policy parameter
- toExecute.createArgument().setValue( "-disposal");
+ toExecute.createArgument().setValue( "-disposal" );
toExecute.createArgument().setValue( m_policy );
// add the verbose parameter
- toExecute.createArgument().setValue( "-verbose");
+ toExecute.createArgument().setValue( "-verbose" );
toExecute.createArgument().setValue( m_verbose );
// add the config parameter
if( m_config != null )
{
- toExecute.createArgument().setValue( "-configuration");
+ toExecute.createArgument().setValue( "-configuration" );
toExecute.createArgument().setValue( m_config );
}
try
{
- m_exe.setAntRun(project);
- m_exe.setWorkingDirectory( new
File(System.getProperty("user.dir")));
+ m_exe.setAntRun( project );
+ m_exe.setWorkingDirectory( new File( System.getProperty(
"user.dir" ) ) );
- m_exe.setCommandline(toExecute.getCommandline());
+ m_exe.setCommandline( toExecute.getCommandline() );
m_exe.execute();
}
catch( Throwable e )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>