adammurdoch 2002/06/25 07:38:28
Modified: container/src/java/org/apache/myrmidon/interfaces/property
PropertyStore.java
container/src/java/org/apache/myrmidon/components/property
MapPropertyStore.java DefaultPropertyStore.java
api/src/java/org/apache/myrmidon/api TaskContext.java
Log:
Change the semantics of getProperties() slightly.
Revision Changes Path
1.4 +3 -3
jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/PropertyStore.java
Index: PropertyStore.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/property/PropertyStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PropertyStore.java 28 Apr 2002 06:06:13 -0000 1.3
+++ PropertyStore.java 25 Jun 2002 14:38:28 -0000 1.4
@@ -61,10 +61,10 @@
throws TaskException;
/**
- * Retrieve a copy of all the properties that are "in-scope"
+ * Retrieve a read-only Map of all the properties that are "in-scope"
* for store.
*
- * @return a copy of all the properties that are "in-scope"
+ * @return a map of all the properties that are "in-scope"
* for store.
* @throws TaskException if theres an error retrieving propertys
*/
1.3 +7 -5
jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/MapPropertyStore.java
Index: MapPropertyStore.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/MapPropertyStore.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MapPropertyStore.java 28 Apr 2002 06:06:12 -0000 1.2
+++ MapPropertyStore.java 25 Jun 2002 14:38:28 -0000 1.3
@@ -9,6 +9,7 @@
import java.util.Map;
import java.util.HashMap;
+import java.util.Collections;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.interfaces.property.PropertyStore;
import org.apache.avalon.excalibur.i18n.ResourceManager;
@@ -27,6 +28,7 @@
ResourceManager.getPackageResources( MapPropertyStore.class );
private final Map m_properties = new HashMap();
+ private final Map m_roProps = Collections.unmodifiableMap( m_properties
);
/**
* Creates an empty store.
@@ -74,17 +76,17 @@
}
/**
- * Retrieve a copy of all the properties that are "in-scope"
+ * Retrieve a read-only map of all the properties that are "in-scope"
* for store.
*
- * @return a copy of all the properties that are "in-scope"
+ * @return a read-only map of all the properties that are "in-scope"
* for store.
- * @throws org.apache.myrmidon.api.TaskException if theres an error
retrieving propertys
+ * @throws org.apache.myrmidon.api.TaskException if theres an error
retrieving properties
*/
public Map getProperties()
throws TaskException
{
- return new HashMap( m_properties );
+ return m_roProps;
}
/**
1.9 +5 -4
jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultPropertyStore.java
Index: DefaultPropertyStore.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/property/DefaultPropertyStore.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultPropertyStore.java 21 Jun 2002 07:56:42 -0000 1.8
+++ DefaultPropertyStore.java 25 Jun 2002 14:38:28 -0000 1.9
@@ -163,16 +163,17 @@
}
/**
- * Retrieve a copy of all the properties that are "in-scope"
+ * Retrieve a read-only map of all the properties that are "in-scope"
* for store.
*
- * @return a copy of all the properties that are "in-scope"
+ * @return a map of all the properties that are "in-scope"
* for store.
- * @throws TaskException if theres an error retrieving propertys
+ * @throws TaskException if theres an error retrieving properties
*/
public Map getProperties()
throws TaskException
{
+ // TODO - reimplement this so that is doesn't create a new map on
each call
final Map properties = new HashMap();
if( m_parent != null )
{
1.39 +2 -2
jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java
Index: TaskContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/TaskContext.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- TaskContext.java 21 Jun 2002 00:59:38 -0000 1.38
+++ TaskContext.java 25 Jun 2002 14:38:28 -0000 1.39
@@ -69,7 +69,7 @@
Object getProperty( String name );
/**
- * Retrieve a copy of all the properties accessible via context.
+ * Retrieve a read-only Map of all the properties accessible via this
context.
*
* @return the map of all property names to values
*/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>