mcconnell 2004/01/16 08:39:02
Modified: merlin maven.xml
merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
AbstractBlock.java Deployer.java
DeploymentRequest.java
merlin/composition/api/src/java/org/apache/avalon/composition/model
SystemContext.java
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
DefaultSystemContext.java
merlin/kernel/api/src/java/org/apache/avalon/merlin
KernelCriteria.java
merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli
Main.java Resources.properties
Resources_de.properties Resources_fr.properties
Resources_pt.properties
merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
DefaultCriteria.java DefaultFactory.java
Log:
Updates to the timeout handling (removal of timouts on containers) and the addition
of logging messages containing the actual deployment time taken for a particular
component. Updates to the kernel to inlcude an audit reposrt of the assembly and
corresponding updates to add -audit as a comand line option.
Revision Changes Path
1.37 +1 -1 avalon/merlin/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/maven.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- maven.xml 15 Jan 2004 10:15:01 -0000 1.36
+++ maven.xml 16 Jan 2004 16:39:02 -0000 1.37
@@ -279,7 +279,7 @@
-->
<maven:snapshot project="${pom}"/>
<j:set var="timestamp" value="${snapshotSignature.substring(7,15)}"/>
- <j:set var="package.name" value="${maven.final.name}-${timestamp}"/>
+ <j:set var="package.name" value="${maven.final.name}-dist-${timestamp}"/>
<ant:echo>Building distribution: ${package.name}</ant:echo>
<ant:zip zipfile="${maven.build.dir}/${package.name}.zip">
1.14 +2 -2
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java
Index: AbstractBlock.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AbstractBlock.java 13 Jan 2004 18:43:15 -0000 1.13
+++ AbstractBlock.java 16 Jan 2004 16:39:02 -0000 1.14
@@ -278,7 +278,7 @@
Thread.currentThread().setContextClassLoader( classloader );
Deployer deployer =
- new Deployer( getLogger().getChildLogger( "deployer" ) );
+ new Deployer( getLogger() );
try
{
1.6 +28 -6
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Deployer.java
Index: Deployer.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Deployer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Deployer.java 14 Jan 2004 16:32:39 -0000 1.5
+++ Deployer.java 16 Jan 2004 16:39:02 -0000 1.6
@@ -131,16 +131,38 @@
{
throw new NullPointerException( "deployable" );
}
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "deploying: " + deployable );
- }
if( null != m_deploymentThread )
{
+ if( m_logger.isDebugEnabled() )
+ {
+ if( deployable instanceof ContainmentModel )
+ {
+ m_logger.debug(
+ "initiating container deployment ["
+ + deployable.getName()
+ + "]" );
+ }
+ else
+ {
+ m_logger.debug(
+ "initiating component deployment ["
+ + deployable.getName()
+ + "]" );
+ }
+ }
+
DeploymentRequest req =
new DeploymentRequest( deployable, m_deploymentThread );
m_deploymentFIFO.put( req );
- req.waitForCompletion();
+ long t = req.waitForCompletion();
+ if( m_logger.isDebugEnabled() )
+ {
+ m_logger.debug(
+ "deployment of ["
+ + deployable.getName()
+ + "] completed in "
+ + t + " milliseconds" );
+ }
}
else
{
1.4 +10 -8
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DeploymentRequest.java
Index: DeploymentRequest.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DeploymentRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeploymentRequest.java 13 Jan 2004 11:41:22 -0000 1.3
+++ DeploymentRequest.java 16 Jan 2004 16:39:02 -0000 1.4
@@ -91,7 +91,6 @@
m_interrupted = false;
m_exception = null;
m_deploymentThread = deploymentThread;
- m_timeout = deployable.getDeploymentTimeout();
}
//------------------------------------------------------------
@@ -103,19 +102,22 @@
return m_deployable;
}
- void waitForCompletion()
+ long waitForCompletion()
throws Exception
{
+ long t1 = System.currentTimeMillis();
synchronized( this )
{
- wait( m_timeout ); // wait for startup
+ long timeout = getDeployable().getDeploymentTimeout();
+ wait( timeout ); // wait for startup
processException();
if( m_completed )
{
- return;
+ long t2 = System.currentTimeMillis();
+ return t2-t1;
}
m_deploymentThread.interrupt();
- wait( m_timeout ); // wait for shutdown
+ wait( timeout ); // wait for shutdown
processException();
if( m_interrupted || m_completed )
{
@@ -123,7 +125,7 @@
"deployment target: ["
+ m_deployable
+ "] did not respond within the timeout period: ["
- + m_timeout
+ + timeout
+ "] and was successfully interrupted.";
throw new DeploymentException( error );
}
@@ -133,7 +135,7 @@
"deployment target: ["
+ m_deployable
+ "] did not respond within the timeout period: ["
- + m_timeout
+ + timeout
+ "] and failed to respond to an interrupt.";
throw new FatalDeploymentException( error );
}
1.4 +2 -2
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/SystemContext.java
Index: SystemContext.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/SystemContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SystemContext.java 13 Jan 2004 11:41:24 -0000 1.3
+++ SystemContext.java 16 Jan 2004 16:39:02 -0000 1.4
@@ -101,7 +101,7 @@
File getTempDirectory();
/**
- * Return the system wide repository from which resource
+ * Return the application repository from which resource
* directives can be resolved.
*
* @return the repository
1.20 +12 -11
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- DefaultContainmentModel.java 16 Jan 2004 01:29:54 -0000 1.19
+++ DefaultContainmentModel.java 16 Jan 2004 16:39:02 -0000 1.20
@@ -260,16 +260,17 @@
*/
public long getDeploymentTimeout()
{
- long n = super.getDeploymentTimeout();
- if( isAssembled() )
- {
- DeploymentModel[] startup = getStartupGraph();
- for( int i=0; i<startup.length; i++ )
- {
- n = ( n + startup[i].getDeploymentTimeout() );
- }
- }
- return n;
+ return 0;
+ //long n = super.getDeploymentTimeout();
+ //if( isAssembled() )
+ //{
+ // DeploymentModel[] startup = getStartupGraph();
+ // for( int i=0; i<startup.length; i++ )
+ // {
+ // n = ( n + startup[i].getDeploymentTimeout() );
+ // }
+ //}
+ //return n;
}
/**
1.7 +11 -10
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java
Index: DefaultSystemContext.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultSystemContext.java 13 Jan 2004 11:41:26 -0000 1.6
+++ DefaultSystemContext.java 16 Jan 2004 16:39:02 -0000 1.7
@@ -59,19 +59,20 @@
import org.apache.avalon.composition.logging.impl.DefaultLoggingManager;
import org.apache.avalon.composition.model.ModelFactory;
import org.apache.avalon.composition.model.SystemContext;
+import org.apache.avalon.composition.data.CategoryDirective;
+
import org.apache.avalon.repository.Repository;
import org.apache.avalon.repository.provider.CacheManager;
import org.apache.avalon.repository.impl.DefaultCacheManager;
import org.apache.avalon.repository.impl.DefaultRepository;
+
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.ConsoleLogger;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.composition.data.CategoryDirective;
+import org.apache.avalon.excalibur.i18n.ResourceManager;
+import org.apache.avalon.excalibur.i18n.Resources;
/**
@@ -104,7 +105,8 @@
{
LoggingManager logging = createLoggingManager( base, priority );
Logger logger = logging.getLoggerForCategory( "" );
- Repository repository = createRepository( root );
+ CacheManager cache = createCacheManager( root );
+ Repository repository = cache.createRepository();
final File working = new File( System.getProperty( "user.dir" ), "working"
);
final File home = new File( working, "home" );
final File temp = new File( working, "temp" );
@@ -113,12 +115,11 @@
logging, base, home, temp, repository, "system", false, null );
}
- private static Repository createRepository( File root ) throws Exception
+ private static CacheManager createCacheManager( File root ) throws Exception
{
String dpml = "http://dpml.net";
String ibiblio = "http://www.ibiblio.org/maven";
- CacheManager manager = new DefaultCacheManager( root, null, new String[]{
dpml, ibiblio } );
- return manager.createRepository();
+ return new DefaultCacheManager( root, null, new String[]{ dpml, ibiblio } );
}
private static LoggingManager createLoggingManager( File base, int priority )
throws Exception
@@ -211,7 +212,7 @@
* within a classpath or library directive shall be resolved
* @param home the home directory
* @param temp the temp directory
- * @param repository a resource repository to be used when resolving
+ * @param repository the application repository to be used when resolving
* resource directives
* @param trace flag indicating if internal logging is enabled
*/
1.3 +14 -1
avalon/merlin/kernel/api/src/java/org/apache/avalon/merlin/KernelCriteria.java
Index: KernelCriteria.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/api/src/java/org/apache/avalon/merlin/KernelCriteria.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- KernelCriteria.java 16 Jan 2004 00:09:12 -0000 1.2
+++ KernelCriteria.java 16 Jan 2004 16:39:02 -0000 1.3
@@ -147,6 +147,12 @@
"merlin.debug";
/**
+ * Audit policy parameter.
+ */
+ String MERLIN_AUDIT =
+ "merlin.audit";
+
+ /**
* Server model parameter.
*/
String MERLIN_SERVER =
@@ -260,6 +266,13 @@
* @return the debug policy
*/
boolean isDebugEnabled();
+
+ /**
+ * Return audit policy. If TRUE a model listing will be generated.
+ *
+ * @return the audit policy
+ */
+ boolean isAuditEnabled();
/**
* Return server execution policy. If TRUE the kernel will
1.13 +15 -1
avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Main.java 13 Jan 2004 11:41:27 -0000 1.12
+++ Main.java 16 Jan 2004 16:39:02 -0000 1.13
@@ -132,6 +132,10 @@
"debug",
REZ.getString( "cli-debug-description" ) );
+ Option audit = new Option(
+ "audit",
+ REZ.getString( "cli-audit-description" ) );
+
Option info = new Option(
"info",
REZ.getString( "cli-info-description" ) );
@@ -202,6 +206,7 @@
options.addOption( version );
options.addOption( info );
options.addOption( debug );
+ options.addOption( audit );
options.addOption( install );
options.addOption( home );
options.addOption( context );
@@ -337,6 +342,7 @@
setLanguage( criteria, line );
setInfoPolicy( criteria, line );
setDebugPolicy( criteria, line );
+ setAuditPolicy( criteria, line );
setServerPolicy( criteria, line );
setAnchorDirectory( criteria, line );
setContextDirectory( criteria, line );
@@ -414,6 +420,14 @@
if( line.hasOption( "debug" ) )
{
criteria.put( "merlin.debug", new Boolean( true ) );
+ }
+ }
+
+ private void setAuditPolicy( Map criteria, CommandLine line )
+ {
+ if( line.hasOption( "audit" ) )
+ {
+ criteria.put( "merlin.audit", new Boolean( true ) );
}
}
1.4 +2 -0
avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Resources.properties 22 Dec 2003 01:19:11 -0000 1.3
+++ Resources.properties 16 Jan 2004 16:39:02 -0000 1.4
@@ -21,6 +21,8 @@
cli-debug-description=Enables debug mode.
+cli-audit-description=Generate a model audit report.
+
cli-implementation-description=An artifact specification that overrides the default
implementation.
cli-home-description=A relative or absolute path to a working home directory. If
not supplied, the system will default to the current directory.
1.3 +1 -0
avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_de.properties
Index: Resources_de.properties
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_de.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources_de.properties 9 Dec 2003 11:54:57 -0000 1.2
+++ Resources_de.properties 16 Jan 2004 16:39:02 -0000 1.3
@@ -9,6 +9,7 @@
cli-execute-description=???
cli-version-description=Gibt die Systemversionsnummer von Merlin aus.
cli-info-description=???
+cli-audit-description=???
cli-install-description=???
cli-debug-description=Aktiviere Debug-Meldungen w\u00e4hrend der Bootstrap-Phase.
cli-implementation-description=???
1.3 +2 -0
avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_fr.properties
Index: Resources_fr.properties
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_fr.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources_fr.properties 9 Dec 2003 11:54:57 -0000 1.2
+++ Resources_fr.properties 16 Jan 2004 16:39:02 -0000 1.3
@@ -17,6 +17,8 @@
cli-debug-description=Presentation des messages debug pendant la phase
d'initialisation.
+cli-audit-description=???.
+
cli-implementation-description=???
cli-home-description=Un chemin relatif ou absolu a un repertoire local de
fonctionnement. Si non fourni la valeur par defaut correspondra au repertoire local.
Un nom releative de chemin sera parent resolu par le repertoire local.
1.3 +2 -0
avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_pt.properties
Index: Resources_pt.properties
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources_pt.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources_pt.properties 22 Dec 2003 21:28:09 -0000 1.2
+++ Resources_pt.properties 16 Jan 2004 16:39:02 -0000 1.3
@@ -16,6 +16,8 @@
cli-info-description=Lista de informa��es sobre o contexto do deployment.
+cli-audit-description=Lista de informa��es sobre o modelization?
+
cli-install-description=Instala um bloco (block archive) no reposit�rio local.
cli-debug-description=Habilita o modo debug.
1.15 +15 -1
avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java
Index: DefaultCriteria.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DefaultCriteria.java 16 Jan 2004 01:29:54 -0000 1.14
+++ DefaultCriteria.java 16 Jan 2004 16:39:02 -0000 1.15
@@ -205,6 +205,8 @@
new Parameter(
MERLIN_DEBUG, Boolean.class, new Boolean( false ) ),
new Parameter(
+ MERLIN_AUDIT, Boolean.class, new Boolean( false ) ),
+ new Parameter(
MERLIN_SERVER, Boolean.class, new Boolean( true ) ),
new Parameter(
MERLIN_AUTOSTART, Boolean.class, new Boolean( true ) ),
@@ -569,6 +571,18 @@
public boolean isDebugEnabled()
{
Boolean value = (Boolean) get( MERLIN_DEBUG );
+ if( null != value ) return value.booleanValue();
+ return false;
+ }
+
+ /**
+ * Return audit policy. If TRUE a model listing will be generated.
+ *
+ * @return the audit policy
+ */
+ public boolean isAuditEnabled()
+ {
+ Boolean value = (Boolean) get( MERLIN_AUDIT );
if( null != value ) return value.booleanValue();
return false;
}
1.17 +155 -33
avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
Index: DefaultFactory.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DefaultFactory.java 16 Jan 2004 00:09:12 -0000 1.16
+++ DefaultFactory.java 16 Jan 2004 16:39:02 -0000 1.17
@@ -82,6 +82,7 @@
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.model.ClassLoaderContext;
import org.apache.avalon.composition.model.ClassLoaderModel;
+import org.apache.avalon.composition.model.DeploymentModel;
import org.apache.avalon.composition.model.ModelRepository;
import org.apache.avalon.composition.model.impl.DefaultSystemContext;
import org.apache.avalon.composition.model.impl.DelegatingSystemContext;
@@ -133,6 +134,9 @@
private static Resources REZ =
ResourceManager.getPackageResources( DefaultFactory.class );
+ private static final String LINE =
+ "\n-----------------------------------------------------------";
+
private static final XMLComponentProfileCreator CREATOR =
new XMLComponentProfileCreator();
@@ -142,6 +146,7 @@
private static final XMLTargetsCreator TARGETS =
new XMLTargetsCreator();
+
//--------------------------------------------------------------------------
// state
//--------------------------------------------------------------------------
@@ -244,13 +249,17 @@
getLogger().debug( "logging system established" );
+ String[] hosts =
+ getHosts(
+ kernelConfig.getChild( "repository" ).getChild( "hosts" ) );
+
//
// Create the system context.
//
SystemContext systemContext =
createSystemContext(
- m_context, criteria, logging, kernelConfig, name );
+ m_context, criteria, hosts, logging, kernelConfig, name );
//
// with the logging system established, check if the
@@ -260,8 +269,15 @@
if( criteria.isInfoEnabled() )
{
- String report = createInfoListing( m_context, criteria );
- getLogger().info( report );
+ StringBuffer buffer = new StringBuffer( "info report" );
+ buffer.append( LINE );
+ buffer.append( "\n" );
+ buffer.append( REZ.getString( "info.listing" ) );
+ buffer.append( LINE );
+ createInfoListing( buffer, hosts, m_context, criteria );
+ buffer.append( "\n" );
+ buffer.append( LINE );
+ getLogger().info( buffer.toString() );
}
//
@@ -388,6 +404,11 @@
throw new KernelException( error, e );
}
+ if( criteria.isAuditEnabled() )
+ {
+ printModel( application );
+ }
+
if( !criteria.isServerEnabled() )
{
getLogger().debug( "shutdown phase" );
@@ -443,8 +464,8 @@
* @param name not sure - need to check
*/
private SystemContext createSystemContext(
- InitialContext context, KernelCriteria criteria, LoggingManager logging,
- Configuration config, String name ) throws Exception
+ InitialContext context, KernelCriteria criteria, String[] hosts,
+ LoggingManager logging, Configuration config, String name ) throws Exception
{
//
@@ -453,8 +474,9 @@
Configuration repositoryConfig =
config.getChild( "repository" );
- Repository repository =
- createRepository( context, criteria, repositoryConfig );
+ CacheManager cache =
+ createCacheManager( context, criteria, hosts, config );
+ Repository repository = cache.createRepository();
getLogger().debug(
"repository established: " + repository );
@@ -566,21 +588,22 @@
* @param config the repositotry configuration element
* @return the repository
*/
- private Repository createRepository(
- InitialContext context, KernelCriteria criteria, Configuration config )
+ private CacheManager createCacheManager(
+ InitialContext context, KernelCriteria criteria, String[] hosts,
Configuration config )
throws KernelException
{
- File cache = criteria.getRepositoryDirectory();
+ File root = criteria.getRepositoryDirectory();
+ File cache = getCacheDirectory( root, config.getChild( "cache" ) );
+ Configuration proxy = config.getChild( "proxy", false );
CacheManager manager =
- createCacheManager( context, cache, config );
- return manager.createRepository();
+ createCacheManager( context, cache, hosts, proxy );
+ return manager;
}
private CacheManager createCacheManager(
- InitialContext context, File root, Configuration config )
+ InitialContext context, File cache, String[] hosts, Configuration proxyConfig
)
throws KernelException
{
-
//
// the supplied root argument is the root cache resolved relative
// to system properties and environment variables. This value is
@@ -588,9 +611,6 @@
// configuration
//
- File cache = getCacheDirectory( root, config.getChild( "cache" ) );
- String[] hosts = getHosts( config.getChild( "hosts" ) );
-
try
{
Factory factory = context.getInitialFactory();
@@ -598,7 +618,6 @@
criteria.put( "avalon.repository.cache", cache );
criteria.put( "avalon.repository.hosts", hosts );
- Configuration proxyConfig = config.getChild( "proxy", false );
if( null != proxyConfig )
{
final String host =
@@ -912,12 +931,9 @@
return new FileTargetProvider( file );
}
- private String createInfoListing(
- InitialContext context, KernelCriteria criteria )
+ private void createInfoListing(
+ StringBuffer buffer, String[] hosts, InitialContext context, KernelCriteria
criteria )
{
- StringBuffer buffer =
- new StringBuffer( REZ.getString( "info.listing" ) );
-
buffer.append( "\n" );
buffer.append(
"\n ${user.dir} == "
@@ -930,20 +946,16 @@
buffer.append( "\n ${avalon.repository.cache} == "
+ context.getInitialCacheDirectory() );
buffer.append( "\n ${avalon.repository.hosts} == " );
- String[] hosts = context.getInitialHosts();
- for( int i=0; i<hosts.length; i++ )
+ String[] ihosts = context.getInitialHosts();
+ for( int i=0; i<ihosts.length; i++ )
{
if( i>0 ) buffer.append( "," );
- buffer.append( hosts[i] );
+ buffer.append( ihosts[i] );
}
buffer.append( "\n" );
buffer.append(
- "\n ${merlin.repository} == "
- + criteria.getRepositoryDirectory() );
-
- buffer.append(
"\n ${merlin.lang} == "
+ criteria.getLanguageCode() );
@@ -992,6 +1004,10 @@
+ criteria.isDebugEnabled() );
buffer.append(
+ "\n ${merlin.audit} == "
+ + criteria.isAuditEnabled() );
+
+ buffer.append(
"\n ${merlin.server} == "
+ criteria.isServerEnabled() );
@@ -999,6 +1015,17 @@
"\n ${merlin.autostart} == "
+ criteria.isAutostartEnabled() );
+ buffer.append(
+ "\n ${merlin.repository} == "
+ + criteria.getRepositoryDirectory() );
+
+ buffer.append( "\n ${merlin.repository.hosts} == " );
+ for( int i=0; i<hosts.length; i++ )
+ {
+ if( i>0 ) buffer.append( "," );
+ buffer.append( StringHelper.toString( hosts[i] ) );
+ }
+
buffer.append( "\n ${merlin.deployment} == " );
URL[] urls = criteria.getDeploymentURLs();
for( int i=0; i<urls.length; i++ )
@@ -1006,9 +1033,6 @@
if( i>0 ) buffer.append( "," );
buffer.append( StringHelper.toString( urls[i] ) );
}
- buffer.append( "\n" );
-
- return buffer.toString();
}
/**
@@ -1049,4 +1073,102 @@
);
}
+ public void printModel( DeploymentModel model )
+ {
+ StringBuffer buffer = new StringBuffer( "audit report" );
+ buffer.append( LINE );
+ buffer.append( "\nApplication Model" );
+ buffer.append( LINE );
+ buffer.append( "\n" );
+ printModel( buffer, " ", model );
+ buffer.append( "\n" );
+ buffer.append( LINE );
+ getLogger().info( buffer.toString() );
+ }
+
+ public void printModel( StringBuffer buffer, String lead, DeploymentModel model
)
+ {
+ if( model instanceof ContainmentModel )
+ {
+ printContainmentModel( buffer, lead, (ContainmentModel) model );
+ }
+ else if( model instanceof ComponentModel )
+ {
+ printComponentModel( buffer, lead, (ComponentModel) model );
+ }
+ }
+
+ public void printContainmentModel( StringBuffer buffer, String lead,
ContainmentModel model )
+ {
+ buffer.append(
+ "\n" + lead
+ + "container:"
+ + model
+ + ")" );
+ printDeploymentModel( buffer, lead, model );
+ DeploymentModel[] models = model.getModels();
+ if( models.length > 0 )
+ {
+ buffer.append( "\n" + lead + " children:" );
+ for( int i=0; i<models.length; i++ )
+ {
+ DeploymentModel m = models[i];
+ printModel( buffer, " " + lead, m );
+ }
+ }
+ models = model.getStartupGraph();
+ if( models.length > 0 )
+ {
+ buffer.append( "\n" + lead + " startup:" );
+ for( int i=0; i<models.length; i++ )
+ {
+ DeploymentModel m = models[i];
+ buffer.append( "\n" + " " + lead + (i+1) + ": " + m );
+ }
+ }
+ models = ((ContainmentModel)model).getShutdownGraph();
+ if( models.length > 0 )
+ {
+ buffer.append( "\n" + lead + " shutdown:" );
+ for( int i=0; i<models.length; i++ )
+ {
+ DeploymentModel m = models[i];
+ buffer.append( "\n" + " " + lead + (i+1) + ": " + m );
+ }
+ }
+ }
+
+ public void printComponentModel( StringBuffer buffer, String lead,
ComponentModel model )
+ {
+ buffer.append(
+ "\n" + lead
+ + "component:"
+ + model + "("
+ + model.getDeploymentTimeout()
+ + ")" );
+ printDeploymentModel( buffer, lead, model );
+ }
+
+ public void printDeploymentModel( StringBuffer buffer, String lead,
DeploymentModel model )
+ {
+ DeploymentModel[] providers = model.getProviderGraph();
+ DeploymentModel[] consumers = model.getConsumerGraph();
+
+ if(( providers.length == 0 ) && ( consumers.length == 0 ))
+ {
+ return;
+ }
+
+ if( providers.length > 0 ) for( int i=0; i<providers.length; i++ )
+ {
+ DeploymentModel m = providers[i];
+ buffer.append( "\n" + lead + " <-- " + m );
+ }
+
+ if( consumers.length > 0 ) for( int i=0; i<consumers.length; i++ )
+ {
+ DeploymentModel m = consumers[i];
+ buffer.append( "\n" + lead + " --> " + m );
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]