raphael 2002/11/07 12:17:54
Modified: src/java/org/apache/jetspeed/om/registry CapabilityMap.java
MediaTypeEntry.java
src/java/org/apache/jetspeed/om/registry/base
BaseClientRegistry.java BaseMediaTypeRegistry.java
BaseRegistry.java
Log:
Update capability package to use the configurable Client registry
Revision Changes Path
1.2 +19 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/CapabilityMap.java
Index: CapabilityMap.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/CapabilityMap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CapabilityMap.java 30 Oct 2002 15:52:05 -0000 1.1
+++ CapabilityMap.java 7 Nov 2002 20:17:54 -0000 1.2
@@ -99,4 +99,22 @@
*/
public void removeCapability(String name);
+ /**
+ * Checks if the argument capability is included in this map
+ *
+ * @param capabiltiy a capability descriptor
+ * @return true if the capability is supported
+ */
+ public boolean contains(String capability);
+
+ /**
+ * Checks if the all the elements of argument capability map
+ * are included in the current one
+ *
+ * @param map a CapabilityMap implementation to test
+ * @return true is all the elements the argument map are included in the
+ * current map.
+ */
+ public boolean containsAll(CapabilityMap map);
+
}
1.3 +13 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/MediaTypeEntry.java
Index: MediaTypeEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/MediaTypeEntry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MediaTypeEntry.java 13 Jun 2002 09:23:22 -0000 1.2
+++ MediaTypeEntry.java 7 Nov 2002 20:17:54 -0000 1.3
@@ -57,7 +57,7 @@
/**
* This entry describes all the properties that should be present in
* a RegistryEntry describing a MediaType
- *
+ *
* FIXME: we should add some additionnal attrbutes for separating 2 versions
* of the same mime type
*
@@ -77,8 +77,17 @@
/** @return the character set associated with this MediaType */
public String getCharacterSet();
-
+
/** Sets the character set associated with this MediaType */
public void setCharacterSet( String charSet);
-
+
+ /**
+ * Returns all supported capablities as <CODE>CapabilityMap</CODE>.
+ * The <CODE>CapabilityMap</CODE> contains all capabilities in arbitrary
+ * order.
+ *
+ * @return the CapabilityMap
+ * @see CapabilityMap
+ */
+ public CapabilityMap getCapabilityMap();
}
1.2 +55 -37
jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseClientRegistry.java
Index: BaseClientRegistry.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseClientRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseClientRegistry.java 30 Oct 2002 15:52:05 -0000 1.1
+++ BaseClientRegistry.java 7 Nov 2002 20:17:54 -0000 1.2
@@ -55,9 +55,8 @@
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.ClientEntry;
-import org.apache.jetspeed.om.registry.PortletRegistry;
+import org.apache.jetspeed.om.registry.ClientRegistry;
import org.apache.jetspeed.om.registry.RegistryEntry;
-import org.apache.jetspeed.om.registry.PortletEntry;
import org.apache.jetspeed.om.registry.InvalidEntryException;
import org.apache.jetspeed.om.registry.RegistryException;
import org.apache.jetspeed.services.Registry;
@@ -83,24 +82,26 @@
* @author <a href="mailto:raphael@;apache.org">Rapha�l Luta</a>
* @version $Id$
*/
-public class BaseClientRegistry extends BaseRegistry
+public class BaseClientRegistry extends BaseOrderedRegistry implements
ClientRegistry
{
+ static final boolean DEBUG = false;
+
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
- // Delegate to the RegistryService to ensure correct handling of
- // persistence if using file fragments
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
- try
- {
- Registry.addEntry(Registry.CLIENT, entry);
- }
- catch (RegistryException e)
- {
- Log.error(e);
- }
+ try
+ {
+ Registry.addEntry(Registry.CLIENT, entry);
+ }
+ catch (RegistryException e)
+ {
+ Log.error(e);
+ }
}
/**
@@ -108,17 +109,17 @@
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
- // Delegate to the RegistryService to ensure correct handling of
- // persistence if using file fragments
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
- try
- {
- Registry.addEntry(Registry.CLIENT, entry);
- }
- catch (RegistryException e)
- {
- Log.error(e);
- }
+ try
+ {
+ Registry.addEntry(Registry.CLIENT, entry);
+ }
+ catch (RegistryException e)
+ {
+ Log.error(e);
+ }
}
/**
@@ -126,10 +127,10 @@
*/
public void removeEntry( String name )
{
- // Delegate to the RegistryService to ensure correct handling of
- // persistence if using file fragments
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
- Registry.removeEntry(Registry.CLIENT, name);
+ Registry.removeEntry(Registry.CLIENT, name);
}
/**
@@ -137,13 +138,13 @@
*/
public void removeEntry( RegistryEntry entry )
{
- // Delegate to the RegistryService to ensure correct handling of
- // persistence if using file fragments
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
- if (entry != null)
- {
- Registry.removeEntry(Registry.CLIENT, entry.getName());
- }
+ if (entry != null)
+ {
+ Registry.removeEntry(Registry.CLIENT, entry.getName());
+ }
}
/**
@@ -158,6 +159,11 @@
ClientEntry clientEntry = null;
Enumeration clients = getEntries();
+ if (DEBUG && Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("ClientRegistry: Looking for client with useragent :" +
useragent);
+ }
+
if (clients != null)
{
while (clients.hasMoreElements())
@@ -172,8 +178,20 @@
if (r.match(useragent))
{
- clientEntry = client;
- break;
+
+ if (DEBUG && Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("ClientRegistry: "+useragent+" matches
"+client.getUseragentpattern());
+ }
+
+ return client;
+ }
+ else
+ {
+ if (DEBUG && Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("ClientRegistry: "+useragent+" does not
match "+client.getUseragentpattern());
+ }
}
}
catch (org.apache.regexp.RESyntaxException e)
@@ -196,6 +214,6 @@
*/
public RegistryEntry createEntry()
{
- return new BaseClientEntry();
- }
+ return new BaseClientEntry();
+ }
}
1.4 +2 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeRegistry.java
Index: BaseMediaTypeRegistry.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeRegistry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BaseMediaTypeRegistry.java 3 Nov 2002 15:10:06 -0000 1.3
+++ BaseMediaTypeRegistry.java 7 Nov 2002 20:17:54 -0000 1.4
@@ -76,7 +76,7 @@
* @author <a href="mailto:raphael@;apache.org">Rapha�l Luta</a>
* @version $Id$
*/
-public class BaseMediaTypeRegistry extends BaseRegistry
+public class BaseMediaTypeRegistry extends BaseOrderedRegistry
implements MediaTypeRegistry
{
1.6 +5 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistry.java
Index: BaseRegistry.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseRegistry.java 3 Nov 2002 15:10:06 -0000 1.5
+++ BaseRegistry.java 7 Nov 2002 20:17:54 -0000 1.6
@@ -54,7 +54,8 @@
package org.apache.jetspeed.om.registry.base;
-import org.apache.jetspeed.om.registry.*;
+import org.apache.jetspeed.om.registry.RegistryEntry;
+import org.apache.jetspeed.om.registry.InvalidEntryException;
import java.util.Map;
import java.util.TreeMap;
import java.util.Iterator;
@@ -68,9 +69,9 @@
* @author <a href="mailto:raphael@;apache.org">Rapha�l Luta</a>
* @version $Id$
*/
-public class BaseRegistry implements Registry
+public class BaseRegistry implements LocalRegistry
{
- protected static final boolean DEBUG = false;
+ protected static final boolean DEBUG = false;
protected Map entries = new TreeMap();
--
To unsubscribe, e-mail: <mailto:jetspeed-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@;jakarta.apache.org>