mcconnell 2002/12/20 08:54:08
Modified: assembly/src/java/org/apache/avalon/assembly/appliance
ApplianceContext.java DefaultAppliance.java
Log:
Optimising context handling for appliance and getting documentation into place.
Revision Changes Path
1.5 +51 -55
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceContext.java
Index: ApplianceContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplianceContext.java 20 Dec 2002 11:54:28 -0000 1.4
+++ ApplianceContext.java 20 Dec 2002 16:54:07 -0000 1.5
@@ -85,6 +85,53 @@
public class ApplianceContext extends DefaultContext
{
//=====================================================================
+ // static
+ //=====================================================================
+
+ /**
+ * Activation policy. The type of value supplied as a context argument
+ * is a {@link Boolean}. A value of TRUE establishes the appliance with
+ * a policy of startup on startup of the enclosing container. A value of
+ * FALSE defers activation until demand. The default value is FALSE.
+ *
+ * @see #setActivationPolicy( boolean )
+ * @see #getActivationPolicy()
+ */
+ public static final String ACTIVATION_KEY = "urn:assembly:appliance.activation";
+
+ /**
+ * Applance partition name. This is an option value that muyst be a non-null
+ * {@link String}. The default value is the root partition - "/". This value
+ * will normally be supplied by a containerment system and typically refers to
+ * the containment path.
+ *
+ * @see #setPartitionName( String )
+ * @see #getPartitionName()
+ */
+ public static final String PARTITION_KEY = "urn:assembly:appliance.partition";
+
+ /**
+ * Deployment context. This value is a {@link Map} that holds application
specific
+ * context information that will be supplied to te context handling framework
along
+ * with the system context information.
+ *
+ * @see #setDeploymentContext( Map )
+ * @see #getDeploymentContext()
+ */
+ public static final String DEPLOYMENT_KEY = "urn:assembly:appliance.deployment";
+
+ /**
+ * A name to assign to an appliance. The default name is derived from the type
+ * and profile names. If the type and profile name are the same, the default
name
+ * will be the type name. If the type and profile names are different, the
default
+ * name will be "<type-name>#<profile-name>.
+ *
+ * @see #setName( String )
+ * @see #getName()
+ */
+ public static final String NAME_KEY = "urn:assembly:appliance.name";
+
+ //=====================================================================
// state
//=====================================================================
@@ -135,15 +182,6 @@
/**
* Creation of a new appliance context.
- */
- public ApplianceContext()
- {
- super();
- m_map = getContextData();
- }
-
- /**
- * Creation of a new appliance context.
* @param profile the profile
*/
public ApplianceContext( Profile profile )
@@ -191,30 +229,11 @@
}
/**
- * Set the appliance profile.
- * @param profile the profile
- * @exception IllegalStateException if the profile is already set
- */
- public void setProfile( Profile profile ) throws IllegalStateException
- {
- if( m_profile != null )
- {
- throw new IllegalStateException("profile");
- }
- m_profile = profile;
- }
-
- /**
* Get the appliance profile.
* @return the profile
- * @exception IllegalStateException if the profile has not been set
*/
public Profile getProfile()
{
- if( m_profile == null )
- {
- throw new IllegalStateException("profile");
- }
return m_profile;
}
@@ -223,7 +242,7 @@
* @param name the partition name
* @exception IllegalStateException if the partition name is already set
*/
- public void setPartitionName( String name ) throws IllegalStateException
+ public void setPartitionName( final String name ) throws IllegalStateException
{
if( m_partition != null )
{
@@ -248,7 +267,7 @@
*
* @param policy the activation policy
*/
- public void setActivationPolicy( boolean policy )
+ public void setActivationPolicy( final boolean policy )
{
m_activation = policy;
}
@@ -265,36 +284,13 @@
return m_activation;
}
- /**
- * Return the enabled state of the appliance. A appliance is enabled
- * unless explicitly disabled by an assembly directive, or implicity
- * disabled as a result of an assembly failure.
- *
- * @return TRUE if the profile is enabled.
- * @see #setEnabled( boolean )
- */
- public boolean getEnabled()
- {
- return m_enabled;
- }
-
- /**
- * Set the enabled status of the profile to the supplied value.
- * @param value the enabled status - TRUE or FALSE
- * @see #getEnabled()
- */
- public void setEnabled( boolean value )
- {
- m_enabled = value;
- }
-
/**
* Set the deployment context.
* @param map the deployment context
* @exception IllegalStateException if the deployment context is already set
* @see #getDeploymentContext()
*/
- public void setDeploymentContext( Map map ) throws IllegalStateException
+ public void setDeploymentContext( final Map map ) throws IllegalStateException
{
if( m_context != null )
{
1.14 +1 -2
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultAppliance.java 20 Dec 2002 11:54:28 -0000 1.13
+++ DefaultAppliance.java 20 Dec 2002 16:54:07 -0000 1.14
@@ -202,7 +202,6 @@
m_logger = logger;
m_engine = engine;
- m_enabled = context.getEnabled();
m_system = system;
m_activation = context.getActivationPolicy();
m_partition = context.getPartitionName();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>