[Jboss-cvs] JBossAS SVN: r55145 - branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/spi
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 3 19:38:05 EDT 2006
Author: scott.stark at jboss.org
Date: 2006-08-03 19:38:03 -0400 (Thu, 03 Aug 2006)
New Revision: 55145
Modified:
branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/spi/DeploymentContext.java
Log:
Add putContextData/removeContextData helper methods to simpify the context data key space.
Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/spi/DeploymentContext.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/spi/DeploymentContext.java 2006-08-03 23:12:56 UTC (rev 55144)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/deployers/spi/DeploymentContext.java 2006-08-03 23:38:03 UTC (rev 55145)
@@ -78,12 +78,45 @@
this.file = file;
}
+ /**
+ * A map of arbitrary data associated with the deployment context
+ * @see #putContextData(Class, Serializable, Serializable)
+ * @return a reference to the context data map.
+ */
public Map<Serializable, Serializable> getContextData()
{
return contextData;
}
/**
+ * A helper method to add data to the context data map using a simple key
+ * space that is scoped by the scope class name.
+ *
+ * @param scope - the class whose FQCN will be used to scope the key
+ * @param key - the simple key
+ * @param data - the context data
+ * @return any previous value for the scope/key.
+ */
+ public Serializable putContextData(Class scope, Serializable key, Serializable data)
+ {
+ String fullKey = scope.getName() + "." + key;
+ Serializable currentData = contextData.put(fullKey, data);
+ return currentData;
+ }
+ /**
+ * The remove analog of {@link putContextData(Class, Serializable, Serializable)}
+ * @param scope - the class whose FQCN will be used to scope the key
+ * @param key - the simple key
+ * @return the value for the removed scope/key.
+ */
+ public Serializable removeContextData(Class scope, Serializable key)
+ {
+ String fullKey = scope.getName() + "." + key;
+ Serializable data = contextData.remove(fullKey);
+ return data;
+ }
+
+ /**
* @return the parent context or null
*/
public DeploymentContext getParentContext()
More information about the jboss-cvs-commits
mailing list