mcconnell 2002/12/19 02:34:28
Modified: assembly/src/java/org/apache/avalon/assembly/appliance
ApplianceContext.java
Log:
Made implementation write-once aware.
Revision Changes Path
1.3 +29 -15
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ApplianceContext.java 17 Dec 2002 09:55:23 -0000 1.2
+++ ApplianceContext.java 19 Dec 2002 10:34:28 -0000 1.3
@@ -85,12 +85,6 @@
public class ApplianceContext
{
//=====================================================================
- // static
- //=====================================================================
-
- private static final Map EMPTY_MAP = new Hashtable();
-
- //=====================================================================
// state
//=====================================================================
@@ -113,7 +107,7 @@
/**
* The base path for the appliance.
*/
- private String m_path;
+ private String m_partition;
/**
* The appliance domain.
@@ -156,37 +150,52 @@
/**
* Set the appliance profile.
* @param profile the profile
+ * @exception IllegalStateException if the profile is already set
*/
- public void setProfile( Profile profile )
+ 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;
}
/**
* Set the appliance partition name.
* @param name the partition name
+ * @exception IllegalStateException if the partition name is already set
*/
- public void setPartitionName( String name )
+ public void setPartitionName( String name ) throws IllegalStateException
{
- m_path = name;
+ if( m_partition != null )
+ {
+ throw new IllegalStateException("partition");
+ }
+ m_partition = name;
}
/**
* Get the partition name
- * @return the name
+ * @return the name (possibly null)
*/
public String getPartitionName()
{
- return m_path;
+ return m_partition;
}
/**
@@ -239,10 +248,15 @@
/**
* 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 )
+ public void setDeploymentContext( Map map ) throws IllegalStateException
{
+ if( m_context != null )
+ {
+ throw new IllegalStateException("map");
+ }
m_context = map;
}
@@ -254,7 +268,7 @@
{
if( m_context == null )
{
- return EMPTY_MAP;
+ return new Hashtable();
}
return m_context;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>