You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/10/02 23:11:07 UTC
svn commit: r452211 - in
/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core:
ResourceManager.java SimpleResourceManager.java
Author: danj
Date: Mon Oct 2 14:11:07 2006
New Revision: 452211
URL: http://svn.apache.org/viewvc?view=rev&rev=452211
Log:
fix for MUSE-120
Modified:
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java?view=diff&rev=452211&r1=452210&r2=452211
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java Mon Oct 2 14:11:07 2006
@@ -179,6 +179,20 @@
/**
*
+ * This method allows you to search for the EPRs for all instances
+ * of a given resource type (where each resource type has a unique
+ * context path).
+ *
+ * @param contextPath
+ *
+ * @return An iterator over the collection of resource EPRs
+ * whose wsa:Address includes the given context path.
+ *
+ */
+ Iterator getResourceEPRs(String contextPath);
+
+ /**
+ *
* @param contextPath
*
* @return True if the resource type was specified with the
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java?view=diff&rev=452211&r1=452210&r2=452211
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java Mon Oct 2 14:11:07 2006
@@ -332,6 +332,43 @@
Set copy = new HashSet(_resources.keySet());
return copy.iterator();
}
+
+ /**
+ *
+ * {@inheritDoc}
+ * <br/><br/>
+ * This implementation may be fairly slow depending on how many resource
+ * types are in the application. It does a linear search through the
+ * entire collection of active EPRs and returns those that have the given
+ * context path. This is different from the getResource() method, which
+ * does a simple O(1) hash table lookup.
+ *
+ */
+ public synchronized Iterator getResourceEPRs(String contextPath)
+ {
+ Set copy = new HashSet();
+ Iterator i = _resources.keySet().iterator();
+
+ //
+ // do a linear search through the collection of EPRs and keep those
+ // that have the given context path.
+ //
+ // NOTE: This could be improved if SimpleResourceManager were changed
+ // to keep one HashMap for each resource type (context path).
+ // This method would then become a O(1) operation just like the
+ // more generic getResource(EPR) method.
+ //
+ while (i.hasNext())
+ {
+ EndpointReference next = (EndpointReference)i.next();
+ String addressPath = next.getAddress().getRawPath();
+
+ if (addressPath.endsWith(contextPath))
+ copy.add(next);
+ }
+
+ return copy.iterator();
+ }
public boolean hasBeenInitialized()
{
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org