You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/03/10 11:52:18 UTC
cvs commit: avalon/merlin/platform/tutorials/hello/conf config.xml
mcconnell 2004/03/10 02:52:18
Modified: merlin INSTALL.TXT
merlin/activation/impl/src/java/org/apache/avalon/activation/impl
TransientLifestyleManager.java
merlin/composition/api/src/java/org/apache/avalon/composition/data
BlockCompositionDirective.java
BlockIncludeDirective.java ComponentProfile.java
ContainmentProfile.java DeploymentProfile.java
NamedComponentProfile.java
merlin/composition/api/src/java/org/apache/avalon/composition/model
ComponentModel.java
merlin/composition/api/src/test/org/apache/avalon/composition/data/test
ComponentProfileTestCase.java
merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder
XMLComponentProfileCreator.java
XMLContainmentProfileCreator.java
XMLProfileCreator.java
merlin/composition/impl/src/java/org/apache/avalon/composition/data/writer
XMLComponentProfileWriter.java
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultComponentModel.java
merlin/platform/tutorials/configuration/defaults/conf
block.xml
merlin/platform/tutorials/configuration/defaults/src/java/tutorial
HelloComponent.java
merlin/platform/tutorials/hello/conf config.xml
Log:
Improve the meta-data model to describe an ENABLED, DISABLED and DEFAULT activation status so we can differentiate the default model activation status based on the lifestyle of the component type.
Revision Changes Path
1.17 +99 -99 avalon/merlin/INSTALL.TXT
Index: INSTALL.TXT
===================================================================
RCS file: /home/cvs/avalon/merlin/INSTALL.TXT,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- INSTALL.TXT 8 Mar 2004 11:28:35 -0000 1.16
+++ INSTALL.TXT 10 Mar 2004 10:52:17 -0000 1.17
@@ -1,99 +1,99 @@
-
-PROJECT: Merlin @VERSION@
-====================================================================
-
-DESCRIPTION:
-------------
-
-This directory contains the merlin system installation and related
-resources.
-
- /merlin
- /bin
- /config
- /system
- README.TXT
- LICENSE.TXT
- INSTALL.TXT
- /plugins
- @META_PLUGIN_JAR@
- @MERLIN_PLUGIN_JAR@
-
-
-Installing Merlin.
-------------------
-
-To use Merlin command line support or the Merlin NT Service
-you will need to define the MERLIN_HOME environment
-variable for your system and include MERLIN_HOME/bin in
-your system path. The MERLIN_HOME environment variable
-should point to the merlin directory.
-
-Under Windows you can set environment variables by selecting the
-Environment Tab from the System Control Panel.
-
-Under Lunix you can do this as follows:
-
- $ echo '
- > # set location of merlin
- > export MERLIN_HOME=/opt/merlin
- > # include it in the path
- > export PATH=$PATH:$MERLIN_HOME/bin
- > ' >> ~/.bash_profile
- $ source ~/.bash_profile
-
-Versions of Merlin prior to the 3.2-dev 20031210 build maintained
-a local repository of jar files under the %MERLIN_HOME%/repository
-directory. As of the 20031210 build the repository is maintained
-under AVALON_HOME which defaults to ${user.home}/.avalon. To
-override this behaviour you can either define a AVALON_HOME
-environment variable or you can add a merlin.properties file to
-${user.home} containing the "merlin.repository" property key and
-a value point to you preferred repository location.
-
-To confirm that your environment variables are correct, you
-should open a new command window and invoke the Merlin
-CLI application.
-
-Under DOS:
-
- $ merlin -version
-
-Under Lunix:
-
- $ merlin.sh -version
-
-The installation of Merlin is now complete, however, two plugins are
-provided with the installation supporting merlin development under the
-Maven platform. These plugins should be placed in the Maven plugin
-directory (${maven.home.local}\plugins).
-
- [YOUR-MAVEN-HOME]\plugins\@META_PLUGIN_JAR@
- [YOUR-MAVEN-HOME]\plugins\@MERLIN_PLUGIN_JAR@
-
-Please note that if you are upgrading an existing installation you must
-delete the following two directories:
-
- [YOUR-MAVEN-HOME]\plugins\avalon-meta-plugin-*
- [YOUR-MAVEN-HOME]\plugins\merlin-plugin-*
-
-Replace the existing avalon-meta and merlin plugin jar files with the supplied
-versions. Finally, delete all *.cache files in the Maven plugin directory.
-
-You now have everything in place to start using the Merlin Tutorial or
-building you own components. If you have any problems, please subscribe
-and post a message to users@avalon.apache.org.
-
-Special Note for JRE 1.3 and earlier.
--------------------------------------
-
-Some applications assume that XML parsing classes are available withing
-the JRE. This is not the case with JDK 1.3 and earlier. To resolve this
-you can copy the following files to the JAVAHOME/lib/ext directory or
-declare an alternative directory as a JVM argument under the
-MERLIN_JVM_OPTS environment variable, i.e. -Djava.ext.dir=someDirectory
-
- system/xml-apis/jars/xml-apis-2.0.2.jar
- system/xml-apis/jars/xmlParserAPIs-2.0.2.jar
- system/xerces/jars/xerces-2.4.0.jar
-
+
+PROJECT: Merlin @VERSION@
+====================================================================
+
+DESCRIPTION:
+------------
+
+This directory contains the merlin system installation and related
+resources.
+
+ /merlin
+ /bin
+ /config
+ /system
+ README.TXT
+ LICENSE.TXT
+ INSTALL.TXT
+ /plugins
+ @META_PLUGIN_JAR@
+ @MERLIN_PLUGIN_JAR@
+
+
+Installing Merlin.
+------------------
+
+To use Merlin command line support or the Merlin NT Service
+you will need to define the MERLIN_HOME environment
+variable for your system and include MERLIN_HOME/bin in
+your system path. The MERLIN_HOME environment variable
+should point to the merlin directory.
+
+Under Windows you can set environment variables by selecting the
+Environment Tab from the System Control Panel.
+
+Under Lunix you can do this as follows:
+
+ $ echo '
+ > # set location of merlin
+ > export MERLIN_HOME=/opt/merlin
+ > # include it in the path
+ > export PATH=$PATH:$MERLIN_HOME/bin
+ > ' >> ~/.bash_profile
+ $ source ~/.bash_profile
+
+Versions of Merlin prior to the 3.2-dev 20031210 build maintained
+a local repository of jar files under the %MERLIN_HOME%/repository
+directory. As of the 20031210 build the repository is maintained
+under AVALON_HOME which defaults to ${user.home}/.avalon. To
+override this behaviour you can either define a AVALON_HOME
+environment variable or you can add a merlin.properties file to
+${user.home} containing the "merlin.repository" property key and
+a value point to you preferred repository location.
+
+To confirm that your environment variables are correct, you
+should open a new command window and invoke the Merlin
+CLI application.
+
+Under DOS:
+
+ $ merlin -version
+
+Under Lunix:
+
+ $ merlin.sh -version
+
+The installation of Merlin is now complete, however, two plugins are
+provided with the installation supporting merlin development under the
+Maven platform. These plugins should be placed in the Maven plugin
+directory (${maven.home.local}\plugins).
+
+ [YOUR-MAVEN-HOME]\plugins\@META_PLUGIN_JAR@
+ [YOUR-MAVEN-HOME]\plugins\@MERLIN_PLUGIN_JAR@
+
+Please note that if you are upgrading an existing installation you must
+delete the following two directories:
+
+ [YOUR-MAVEN-HOME]\plugins\avalon-meta-plugin-*
+ [YOUR-MAVEN-HOME]\plugins\merlin-plugin-*
+
+Replace the existing avalon-meta and merlin plugin jar files with the supplied
+versions. Finally, delete all *.cache files in the Maven plugin directory.
+
+You now have everything in place to start using the Merlin Tutorial or
+building you own components. If you have any problems, please subscribe
+and post a message to users@avalon.apache.org.
+
+Special Note for JRE 1.3 and earlier.
+-------------------------------------
+
+Some applications assume that XML parsing classes are available withing
+the JRE. This is not the case with JDK 1.3 and earlier. To resolve this
+you can copy the following files to the JAVAHOME/lib/ext directory or
+declare an alternative directory as a JVM argument under the
+MERLIN_JVM_OPTS environment variable, i.e. -Djava.ext.dir=someDirectory
+
+ system/xml-apis/jars/xml-apis-2.0.2.jar
+ system/xml-apis/jars/xmlParserAPIs-2.0.2.jar
+ system/xerces/jars/xerces-2.4.0.jar
+
1.4 +6 -1 avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/impl/TransientLifestyleManager.java
Index: TransientLifestyleManager.java
===================================================================
RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/impl/TransientLifestyleManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TransientLifestyleManager.java 4 Mar 2004 03:42:30 -0000 1.3
+++ TransientLifestyleManager.java 10 Mar 2004 10:52:17 -0000 1.4
@@ -64,6 +64,11 @@
// TODO: setup a background thread to check queues for
// released references and remove them from our list, otherwise we
// have a memory leak due to accumulation of weak references
+
+ if( getComponentModel().getActivationPolicy() )
+ {
+ handleResolve();
+ }
}
/**
1.5 +2 -2 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockCompositionDirective.java
Index: BlockCompositionDirective.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockCompositionDirective.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BlockCompositionDirective.java 24 Feb 2004 22:18:21 -0000 1.4
+++ BlockCompositionDirective.java 10 Mar 2004 10:52:17 -0000 1.5
@@ -60,7 +60,7 @@
public BlockCompositionDirective(
final String name, ResourceDirective resource, TargetDirective[] targets )
{
- super( name, true, Mode.EXPLICIT );
+ super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
if( resource == null )
{
throw new NullPointerException( "resource" );
1.5 +2 -2 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockIncludeDirective.java
Index: BlockIncludeDirective.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockIncludeDirective.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BlockIncludeDirective.java 24 Feb 2004 22:18:21 -0000 1.4
+++ BlockIncludeDirective.java 10 Mar 2004 10:52:17 -0000 1.5
@@ -37,7 +37,7 @@
*/
public BlockIncludeDirective( final String name, final String path )
{
- super( name, true, Mode.EXPLICIT );
+ super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
if( path == null )
{
throw new NullPointerException( "path" );
1.4 +4 -4 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ComponentProfile.java
Index: ComponentProfile.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ComponentProfile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ComponentProfile.java 24 Jan 2004 23:25:23 -0000 1.3
+++ ComponentProfile.java 10 Mar 2004 10:52:17 -0000 1.4
@@ -163,7 +163,7 @@
final String classname )
{
this(
- name, false, InfoDescriptor.UNDEFINED, classname, null, null, null, null,
+ name, DeploymentProfile.DEFAULT, InfoDescriptor.UNDEFINED, classname, null, null, null, null,
null, null, Mode.IMPLICIT );
}
@@ -176,7 +176,7 @@
{
this(
name,
- template.getActivationPolicy(),
+ template.getActivationDirective(),
template.getCollectionPolicy(),
template.m_classname,
template.m_categories,
@@ -190,7 +190,7 @@
public ComponentProfile(
final String name,
- final boolean activation,
+ final int activation,
final int collection,
final String classname,
final CategoriesDirective categories,
1.8 +2 -2 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ContainmentProfile.java
Index: ContainmentProfile.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ContainmentProfile.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ContainmentProfile.java 21 Feb 2004 13:27:03 -0000 1.7
+++ ContainmentProfile.java 10 Mar 2004 10:52:17 -0000 1.8
@@ -111,7 +111,7 @@
final CategoriesDirective categories,
DeploymentProfile[] profiles )
{
- super( name, true, Mode.EXPLICIT );
+ super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
m_categories = categories;
m_classloader = classloader;
1.10 +14 -5 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
Index: DeploymentProfile.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DeploymentProfile.java 24 Jan 2004 23:25:24 -0000 1.9
+++ DeploymentProfile.java 10 Mar 2004 10:52:17 -0000 1.10
@@ -27,6 +27,10 @@
*/
public abstract class DeploymentProfile implements Serializable
{
+ public static final int DEFAULT = -1;
+ public static final int ENABLED = 1;
+ public static final int DISABLED = 0;
+
//--------------------------------------------------------------------------
// state
//--------------------------------------------------------------------------
@@ -40,7 +44,7 @@
/**
* The activation policy.
*/
- private final boolean m_activation;
+ private final int m_activation;
/**
* The mode under which this profile was established.
@@ -52,7 +56,7 @@
//--------------------------------------------------------------------------
public DeploymentProfile(
- final String name, boolean activation, Mode mode )
+ final String name, int activation, Mode mode )
{
m_activation = activation;
if( mode != null )
@@ -89,9 +93,14 @@
}
/**
- * Get the activation policy for the profile.
+ * Get the activation directive for the profile.
+ *
+ * @return the declared activation policy
+ * @see #DEFAULT
+ * @see #ENABLED
+ * @see #DISABLED
*/
- public boolean getActivationPolicy()
+ public int getActivationDirective()
{
return m_activation;
}
1.4 +2 -2 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/NamedComponentProfile.java
Index: NamedComponentProfile.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/NamedComponentProfile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NamedComponentProfile.java 24 Jan 2004 23:25:24 -0000 1.3
+++ NamedComponentProfile.java 10 Mar 2004 10:52:17 -0000 1.4
@@ -44,7 +44,7 @@
final String name,
final String classname,
final String key,
- final boolean activation )
+ final int activation )
{
super( name, activation, Mode.EXPLICIT );
m_classname = classname;
1.7 +1 -6 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java
Index: ComponentModel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ComponentModel.java 2 Mar 2004 00:12:16 -0000 1.6
+++ ComponentModel.java 10 Mar 2004 10:52:17 -0000 1.7
@@ -76,11 +76,6 @@
void setActivationPolicy( boolean policy );
/**
- * Set the activation policy for the model to the default value.
- */
- void revertActivationPolicy();
-
- /**
* Return the class for the deployable target.
* @return the class
*/
1.5 +3 -3 avalon/merlin/composition/api/src/test/org/apache/avalon/composition/data/test/ComponentProfileTestCase.java
Index: ComponentProfileTestCase.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/test/org/apache/avalon/composition/data/test/ComponentProfileTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ComponentProfileTestCase.java 21 Feb 2004 13:27:03 -0000 1.4
+++ ComponentProfileTestCase.java 10 Mar 2004 10:52:18 -0000 1.5
@@ -42,7 +42,7 @@
private Type m_type;
private CategoriesDirective m_categories;
private Mode m_mode;
- private boolean m_activation;
+ private int m_activation;
private Parameters m_parameters;
private Configuration m_configuration;
private ContextDirective m_context;
@@ -67,7 +67,7 @@
m_dependencies = new DependencyDirective[0];
m_stages = new StageDirective[0];
m_parameters = Parameters.fromProperties(System.getProperties());
- m_activation = true;
+ m_activation = DeploymentProfile.ENABLED;
m_mode = Mode.IMPLICIT;
m_categories = new CategoriesDirective( new CategoryDirective[0] );
m_collection = InfoDescriptor.DEMOCRAT;
@@ -85,7 +85,7 @@
assertEquals( "classname", m_classname, profile.getClassname() );
assertEquals( "categories", m_categories, profile.getCategories() );
assertEquals( "mode", m_mode, profile.getMode() );
- assertEquals( "activation", m_activation, profile.getActivationPolicy() );
+ assertEquals( "activation", m_activation, profile.getActivationDirective() );
assertEquals( "parameters", m_parameters, profile.getParameters() );
assertEquals( "configuration", m_configuration, profile.getConfiguration() );
assertEquals( "context", m_context, profile.getContext() );
1.6 +4 -2 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLComponentProfileCreator.java
Index: XMLComponentProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLComponentProfileCreator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLComponentProfileCreator.java 8 Mar 2004 11:28:36 -0000 1.5
+++ XMLComponentProfileCreator.java 10 Mar 2004 10:52:18 -0000 1.6
@@ -26,6 +26,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.composition.data.DeploymentProfile;
import org.apache.avalon.composition.data.ComponentProfile;
import org.apache.avalon.composition.data.ConstructorDirective;
import org.apache.avalon.composition.data.ContextDirective;
@@ -94,7 +95,8 @@
String classname, Configuration config, String name )
throws Exception
{
- final boolean activation = getActivationPolicy( config, true );
+ final int activation =
+ getActivationDirective( config, DeploymentProfile.DEFAULT );
final int collection = getCollectionPolicy( config );
final CategoriesDirective categories =
1.10 +2 -2 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
Index: XMLContainmentProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLContainmentProfileCreator.java 23 Feb 2004 13:00:31 -0000 1.9
+++ XMLContainmentProfileCreator.java 10 Mar 2004 10:52:18 -0000 1.10
@@ -476,7 +476,7 @@
final String name = config.getAttribute( "name" );
final String classname = config.getAttribute( "class" );
final String key = config.getAttribute( "profile" );
- final boolean activation = getActivationPolicy( config );
+ final int activation = getActivationDirective( config );
return new NamedComponentProfile( name, classname, key, activation );
}
1.5 +9 -7 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java
Index: XMLProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLProfileCreator.java 8 Mar 2004 11:28:36 -0000 1.4
+++ XMLProfileCreator.java 10 Mar 2004 10:52:18 -0000 1.5
@@ -25,6 +25,8 @@
import org.apache.avalon.logging.data.CategoriesDirective;
import org.apache.avalon.logging.data.CategoryDirective;
+import org.apache.avalon.composition.data.DeploymentProfile;
+
import org.apache.avalon.util.i18n.ResourceManager;
import org.apache.avalon.util.i18n.Resources;
@@ -67,9 +69,9 @@
* @return TRUE is the value of the activation attribute is 'true' or 'startup'
* otherwise the return value is FALSE
*/
- protected boolean getActivationPolicy( Configuration config )
+ protected int getActivationDirective( Configuration config )
{
- return getActivationPolicy( config, false );
+ return getActivationDirective( config, DeploymentProfile.DEFAULT );
}
/**
@@ -79,7 +81,7 @@
* @param fallback the default policy
* @return activation policy
*/
- protected boolean getActivationPolicy( Configuration config, boolean fallback )
+ protected int getActivationDirective( Configuration config, int fallback )
{
final String value = config.getAttribute( "activation", null );
if( value == null )
@@ -90,15 +92,15 @@
final String string = value.toLowerCase().trim();
if( string.equals( "startup" ) || string.equals( "true" ) )
{
- return true;
+ return DeploymentProfile.ENABLED;
}
else if( string.equals( "lazy" ) || string.equals( "false" ) )
{
- return false;
+ return DeploymentProfile.DISABLED;
}
else
{
- return fallback ;
+ return DeploymentProfile.DEFAULT;
}
}
1.6 +17 -5 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/writer/XMLComponentProfileWriter.java
Index: XMLComponentProfileWriter.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/writer/XMLComponentProfileWriter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLComponentProfileWriter.java 22 Feb 2004 16:12:58 -0000 1.5
+++ XMLComponentProfileWriter.java 10 Mar 2004 10:52:18 -0000 1.6
@@ -23,7 +23,9 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.parameters.ParameterException;
+
import org.apache.avalon.composition.data.ComponentProfile;
+import org.apache.avalon.composition.data.DeploymentProfile;
import org.apache.avalon.composition.data.ContextDirective;
import org.apache.avalon.composition.data.DependencyDirective;
import org.apache.avalon.composition.data.SelectionDirective;
@@ -64,11 +66,21 @@
writer.write( pad + "<component name=\"" + profile.getName() + "\"");
writer.write( "\n" + pad + " class=\"" + profile.getClassname() + "\"");
- if( !profile.getActivationPolicy() )
+ int activation = profile.getActivationDirective();
+ if( activation != DeploymentProfile.DEFAULT )
{
- writer.write(
- "\n" + pad
- + " activation=\"false\"" );
+ if( activation == DeploymentProfile.ENABLED )
+ {
+ writer.write(
+ "\n" + pad
+ + " activation=\"false\"" );
+ }
+ else
+ {
+ writer.write(
+ "\n" + pad
+ + " activation=\"true\"" );
+ }
}
final int collection = profile.getCollectionPolicy();
1.12 +38 -17 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java
Index: DefaultComponentModel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DefaultComponentModel.java 8 Mar 2004 11:28:36 -0000 1.11
+++ DefaultComponentModel.java 10 Mar 2004 10:52:18 -0000 1.12
@@ -23,6 +23,7 @@
import java.util.Properties;
import java.security.AccessControlContext;
+import org.apache.avalon.composition.data.DeploymentProfile;
import org.apache.avalon.composition.data.DependencyDirective;
import org.apache.avalon.composition.data.StageDirective;
import org.apache.avalon.composition.data.ContextDirective;
@@ -130,7 +131,9 @@
super( context, security );
m_context = context;
- m_activation = m_context.getProfile().getActivationPolicy();
+
+ m_activation = getDefaultActivationPolicy();
+
m_categories = m_context.getProfile().getCategories();
setCollectionPolicy( m_context.getProfile().getCollectionPolicy() );
@@ -230,6 +233,39 @@
}
}
+ /**
+ * Get the default activation policy for the model.
+ */
+ public boolean getDefaultActivationPolicy()
+ {
+ final int activation =
+ m_context.getProfile().getActivationDirective();
+
+ if( activation != DeploymentProfile.DEFAULT )
+ {
+ return (activation == DeploymentProfile.ENABLED );
+ }
+ else
+ {
+ if( m_context.getProfile().getMode() == Mode.EXPLICIT )
+ {
+ Type type = m_context.getType();
+ if( type.getInfo().getLifestyle().equals( InfoDescriptor.TRANSIENT ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
//--------------------------------------------------------------
// Composite
//--------------------------------------------------------------
@@ -488,21 +524,6 @@
public void setActivationPolicy( boolean policy )
{
m_activation = policy;
- }
-
- /**
- * Set the activation policy for the model to the default value.
- */
- public void revertActivationPolicy()
- {
- if( m_context.getProfile().getMode() == Mode.EXPLICIT )
- {
- m_activation = true;
- }
- else
- {
- m_activation = false;
- }
}
/**
1.2 +1 -1 avalon/merlin/platform/tutorials/configuration/defaults/conf/block.xml
Index: block.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/platform/tutorials/configuration/defaults/conf/block.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- block.xml 24 Sep 2003 09:33:48 -0000 1.1
+++ block.xml 10 Mar 2004 10:52:18 -0000 1.2
@@ -9,6 +9,6 @@
</classpath>
</classloader>
- <component name="hello" class="tutorial.HelloComponent"/>
+ <component name="hello" class="tutorial.HelloComponent" activation="startup"/>
</container>
1.4 +1 -1 avalon/merlin/platform/tutorials/configuration/defaults/src/java/tutorial/HelloComponent.java
Index: HelloComponent.java
===================================================================
RCS file: /home/cvs/avalon/merlin/platform/tutorials/configuration/defaults/src/java/tutorial/HelloComponent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HelloComponent.java 10 Mar 2004 08:08:19 -0000 1.3
+++ HelloComponent.java 10 Mar 2004 10:52:18 -0000 1.4
@@ -26,7 +26,7 @@
/**
* A configurable component.
*
- * @avalon.component version="1.0" name="simple" lifestyle="singleton"
+ * @avalon.component version="1.0" name="simple"
*/
public class HelloComponent extends AbstractLogEnabled
implements Configurable, Initializable
1.3 +1 -1 avalon/merlin/platform/tutorials/hello/conf/config.xml
Index: config.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/platform/tutorials/hello/conf/config.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config.xml 13 Oct 2003 14:13:17 -0000 1.2
+++ config.xml 10 Mar 2004 10:52:18 -0000 1.3
@@ -3,7 +3,7 @@
<targets>
<target path="/tutorial/hello">
- <categories priority="INFO"/>
+ <categories priority="DEBUG"/>
</target>
</targets>
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org