You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ra...@apache.org on 2002/10/30 16:52:06 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base BaseCapabilityMap.java BaseClientEntry.java BaseClientRegistry.java BaseMediaTypeRegistry.java BaseMimetypeMap.java BasePortletControlRegistry.java BasePortletControllerRegistry.java BaseSecurityRegistry.java BaseSkinRegistry.java BaseMediaTypeEntry.java BasePortletRegistry.java BaseRegistry.java BaseRegistryEntry.java DatabaseRegistry.java
raphael 2002/10/30 07:52:06
Modified: src/java/org/apache/jetspeed/om/registry Registry.java
src/java/org/apache/jetspeed/om/registry/base
BaseMediaTypeEntry.java BasePortletRegistry.java
BaseRegistry.java BaseRegistryEntry.java
DatabaseRegistry.java
Added: src/java/org/apache/jetspeed/om/registry CapabilityMap.java
ClientEntry.java ClientRegistry.java
MimetypeMap.java
src/java/org/apache/jetspeed/om/registry/base
BaseCapabilityMap.java BaseClientEntry.java
BaseClientRegistry.java BaseMediaTypeRegistry.java
BaseMimetypeMap.java
BasePortletControlRegistry.java
BasePortletControllerRegistry.java
BaseSecurityRegistry.java BaseSkinRegistry.java
Log:
- Add a configurable Client registry to store user-agent capabilities
- Fix an issue with the BaseRegistry implementation that prevented the elements
being added directly in this instance from being persisted
- Add a factory like method in Registry to ease creation of suitable entries
- Fix some code style issues
Revision Changes Path
1.6 +55 -31 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/Registry.java
Index: Registry.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/Registry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Registry.java 29 Jul 2001 13:41:53 -0000 1.5
+++ Registry.java 30 Oct 2002 15:52:05 -0000 1.6
@@ -58,73 +58,97 @@
import java.util.Iterator;
/**
-Represents all items within Jetspeed that hold configuration information.
-
-@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
-@version $Id$
-*/
+ * Represents all items within Jetspeed that hold configuration information.
+ *
+ * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
+ * @author <a href="raphael@apache.org">Rapha�l Luta</a>
+ * @version $Id$
+ */
public interface Registry
{
/**
- Get the number of entries within the Registry.
- */
+ * Get the number of entries within the Registry.
+ *
+ * @return the number of elements in this Registry instance
+ */
public int getEntryCount();
-
+
+ /**
+ * Creates a new RegistryEntry instance compatible with the current
+ * Registry instance implementation
+ *
+ * @return the newly created RegistryEntry
+ */
+ public RegistryEntry createEntry();
+
/**
- Get the entry in the registry with the specified name
-
- @throws RegistryException if the given 'name' does not exist within the
- Registry
- */
+ * Get the entry in the registry with the specified name
+ *
+ * @throws RegistryException if the given 'name' does not exist within the
+ * Registry
+ */
public RegistryEntry getEntry( String name ) throws RegistryException;
/**
- Set the entry in the registry with the specified name and Entry
-
- @throws RegistryException if the given 'name' does not exist within the
- Registry
- */
+ * Set the entry in the registry with the specified name and Entry
+ *
+ * @throws RegistryException if the given 'name' does not exist within the
+ * Registry
+ */
public void setEntry( RegistryEntry entry ) throws RegistryException;
/**
- Add the given entry to the registry with the given name.
-
- @throws RegistryException if the given 'name' already exists within the
- Registry
- */
+ * Add the given entry to the registry with the given name.
+ *
+ * @throws RegistryException if the given 'name' already exists within the
+ * Registry
+ */
public void addEntry( RegistryEntry entry ) throws RegistryException;
/**
- Returns true if the given name exists within the Registry.
- */
+ * Tests if an entry with the specified name exists within the Registry
+ *
+ * @param name the name of the entry that we are looking for
+ * @return true if an entry with this name exists in the Registry
+ */
public boolean hasEntry( String name );
/**
- Removes the given entry from the Registry
+ * Removes the given entry from the Registry
+ *
+ * @param entry the RegistryEntry to remove
*/
public void removeEntry( RegistryEntry entry );
/**
- Removes the given entry from the Registry
+ * Removes the given entry from the Registry
+ *
+ * @param name the name of the entry to remove from the Registry
*/
public void removeEntry( String name );
/**
- Get all entries within this Registry
+ * Get all entries within this Registry
+ *
+ * @return an Enumeration of all unordered current entries
*/
public Enumeration getEntries();
/**
- List all the entry names within this Registry
+ * List all the entry names within this Registry
+ *
+ * @return an Iterator over an unordered list of current entry names
*/
public Iterator listEntryNames();
/**
- Get all entries within this Registry as an array
+ * Get all entries within this Registry as an array
+ *
+ * @return an unordered array of current registry entries
*/
public RegistryEntry[] toArray();
-
+
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/CapabilityMap.java
Index: CapabilityMap.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry;
import java.util.Iterator;
/**
* <P>
* The <CODE>CapabilityMap</CODE> interface represents a list that
* stores capabilities a client is capable of. It is accessed
* by the portlet container to get information about the client's
* capabilities.
* </P>
* <P>
* The names of the capabilities are matched by the class variable names
* of the class <CODE>Capability</CODE>. To add a capability use the
* class variable name and <B>not</B> the internally used string value.
* </P>
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="raphael@apache.org">Rapha�l Luta</a>
* @see Capability
* @version $Id: CapabilityMap.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public interface CapabilityMap
{
/**
* Returns an enumeration of all capabilities a client
* is capabale of.
*
* @return an enumeration of all capabilities
*/
public Iterator getCapabilities();
/**
* Adds the given capability
*
* @param name the name of the new capability
*/
public void addCapability(String name);
/**
* Removes the given capability
*
* @param name the name of the capability to be removed
*/
public void removeCapability(String name);
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/ClientEntry.java
Index: ClientEntry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry;
/**
* <P>
* The <CODE>ClientEntry</CODE> interface represents one client inside
* of the client registry. It is accessed by the portlet container
* to get information about the clients.
* </P>
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="raphael@apache.org">Rapha�l Luta</a>
*/
public interface ClientEntry extends RegistryEntry
{
/**
* Returns the pattern parameter of this client. The pattern is used
* to match a client to the user agent used to access the portal. If
* the pattern matches the user agent string, this client is recognized
* as the one the user is currently working with.
*
* @return the pattern of this client
*/
public String getUseragentpattern();
/**
* Sets the pattern used to match the user agent.
*
* @param useragentpattern
* the new pattern
*/
public void setUseragentpattern(String useragentpattern);
/**
* Returns the manufacturer of this client
*
* @return the manufacturer of this client
*/
public String getManufacturer();
/**
* Sets the new manufacturer of this client
*
* @param name the new manufacturer
*/
public void setManufacturer(String name);
/**
* Returns the model of this client
*
* @return the model of this client
*/
public String getModel();
/**
* Sets the new model of this client
*
* @param name the new model
*/
public void setModel(String name);
/**
* Returns the version of this client
*
* @return the version of this client
*/
public String getVersion();
/**
* Sets the new version of this client
*
* @param name the new version
*/
public void setVersion(String name);
/**
* Returns all supported mimetypes as <CODE>MimeTypeMap</CODE>.
* The <CODE>MimeTypeMap</CODE> contains all mimetypes in decreasing
* order of importance.
*
* @return the MimeTypeMap
* @see MimeTypeMap
*/
public MimetypeMap getMimetypeMap();
/**
* 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.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/ClientRegistry.java
Index: ClientRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry;
/**
* <P>
* The <CODE>ClientRegistry</CODE> interface allow to query the system
* Registry to find client implementations whose "User-agent" identification
* matches a specific regular expression as defined in a <code>ClientEntry</code>
* </P>
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="raphael@apache.org">Rapha�l Luta</a>
* @version $Id: ClientRegistry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public interface ClientRegistry extends Registry
{
/**
* Returns the client which matches the given useragent string.
*
* @param useragent the useragent to match
* @return the found client or null if the user-agent does not match any
* defined client
*/
public ClientEntry findEntry(String useragent);
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/MimetypeMap.java
Index: MimetypeMap.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry;
import java.util.Iterator;
/**
* <P>
* The <CODE>MimeTypeMap</CODE> interface represents a list that
* stores all mimetypes a client supports. The mimetypes are stored
* in decreasing order of importance. The very first mimetype is the
* preferred mimetype of the client.
* </P>
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="raphael@apache.org">Rapha�l Luta</a>
* @version $Id: MimetypeMap.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public interface MimetypeMap
{
/**
* Returns an enumeration of all mimetypes the client supports.
*
* @return an enumeration of all mimetypes
*/
public Iterator getMimetypes();
/**
* Returns the preferred mimetype of the client.
*
* @return the preferred mimetype
*/
public String getPreferredMimetype();
/**
* Adds the given mimetype
*
* @param name the name of the mimetype
*/
public void addMimetype(String name);
/**
* Removes the given mimetype
*
* @param name the mimetype to be removed
*/
public void removeMimetype(String name);
}
1.4 +27 -10 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeEntry.java
Index: BaseMediaTypeEntry.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeEntry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BaseMediaTypeEntry.java 13 Jun 2002 09:23:21 -0000 1.3
+++ BaseMediaTypeEntry.java 30 Oct 2002 15:52:05 -0000 1.4
@@ -57,9 +57,9 @@
import org.apache.jetspeed.om.registry.*;
/**
- * Default bean like implementation of MediaTypeEntry interface
+ * Default bean like implementation of MediaTypeEntry interface
* suitable for serializing with Castor
- *
+ *
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id$
*/
@@ -69,13 +69,14 @@
protected String mimeType;
protected String characterSet;
-
+ private CapabilityMap capabilities = new BaseCapabilityMap();
+
public BaseMediaTypeEntry()
{}
- public BaseMediaTypeEntry(long id,
- String name,
- int _hidden,
+ public BaseMediaTypeEntry(long id,
+ String name,
+ int _hidden,
String mimeType,
String title,
String description,
@@ -94,7 +95,7 @@
{
return this.mimeType;
}
-
+
/** Sets the MimeType associated with this MediaType
* @param mimeType the MIME type to associate
*/
@@ -108,11 +109,27 @@
{
return this.characterSet;
}
-
+
/** Sets the character set associated with this MediaType */
public void setCharacterSet( String charSet)
{
this.characterSet = charSet;
}
-
+
+ public CapabilityMap getCapabilityMap()
+ {
+ return capabilities;
+ }
+
+ // castor related method definitions
+
+ public BaseCapabilityMap getCapabilities()
+ {
+ return (BaseCapabilityMap)capabilities;
+ }
+
+ public void setCapabilities(BaseCapabilityMap capabilities)
+ {
+ this.capabilities = capabilities;
+ }
}
1.4 +126 -23 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BasePortletRegistry.java
Index: BasePortletRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BasePortletRegistry.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasePortletRegistry.java 28 Mar 2002 23:13:15 -0000 1.3
+++ BasePortletRegistry.java 30 Oct 2002 15:52:05 -0000 1.4
@@ -54,7 +54,15 @@
package org.apache.jetspeed.om.registry.base;
-import org.apache.jetspeed.om.registry.*;
+import org.apache.jetspeed.om.registry.PortletRegistry;
+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.Category;
+import org.apache.jetspeed.om.registry.RegistryException;
+import org.apache.jetspeed.services.Registry;
+
+import org.apache.turbine.util.Log;
import java.util.Map;
import java.util.SortedMap;
@@ -67,12 +75,16 @@
/**
* Provides base functionality within a Portlet Registry.
*
+ * <p>To avoid loops, a RegistryService implementation using this class
+ * nees to call the addLocalEntry/removeLocalEntry methods to modify
+ * the in memory state of this Registry</p>
+ *
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id$
*/
public class BasePortletRegistry extends BaseRegistry implements PortletRegistry
{
-
+
private Map catMap = new TreeMap();
/**
@@ -80,8 +92,17 @@
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
- super.setEntry(entry);
- setPortletEntry((PortletEntry)entry);
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
+
+ try
+ {
+ Registry.addEntry(Registry.PORTLET, entry);
+ }
+ catch (RegistryException e)
+ {
+ Log.error(e);
+ }
}
/**
@@ -89,8 +110,42 @@
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
- super.addEntry(entry);
- setPortletEntry((PortletEntry)entry);
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
+
+ try
+ {
+ Registry.addEntry(Registry.PORTLET, entry);
+ }
+ catch (RegistryException e)
+ {
+ Log.error(e);
+ }
+ }
+
+ /**
+ @see Registry#removeEntry
+ */
+ public void removeEntry( String name )
+ {
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
+
+ Registry.removeEntry(Registry.PORTLET, name);
+ }
+
+ /**
+ @see Registry#removeEntry
+ */
+ public void removeEntry( RegistryEntry entry )
+ {
+ // Delegate to the RegistryService to ensure correct handling of
+ // persistence if using file fragments
+
+ if (entry != null)
+ {
+ Registry.removeEntry(Registry.PORTLET, entry.getName());
+ }
}
protected void setPortletEntry(PortletEntry entry) throws InvalidEntryException
@@ -124,10 +179,10 @@
StringBuffer key = new StringBuffer(128);
key.append(PortletEntry.DEFAULT_GROUP);
key.append(".");
- if (entry.getType().equals(PortletEntry.TYPE_ABSTRACT))
+ if (entry.getType().equals(PortletEntry.TYPE_ABSTRACT))
key.append(PortletEntry.DEFAULT_CATEGORY_ABSTRACT);
else
- key.append(PortletEntry.DEFAULT_CATEGORY_REF);
+ key.append(PortletEntry.DEFAULT_CATEGORY_REF);
HashMap bucket = (HashMap)this.catMap.get(key.toString());
if (null == bucket)
@@ -140,20 +195,26 @@
{
bucket.put(entry.getName(), entry);
}
- }
-
+ }
+
}
}
- public String getCategoryKey(Category category)
+ public String getCategoryKey(Category category)
{
if (category == null)
+ {
return PortletEntry.DEFAULT_GROUP;
+ }
String categoryName = category.getName();
- if (categoryName == null || categoryName.equals(""))
+
+ if ((categoryName == null) || categoryName.equals(""))
+ {
return category.getGroup();
+ }
+
return category.getGroup() + "." + categoryName;
}
@@ -166,12 +227,19 @@
*/
public Iterator findPortletsByCategory(String category)
{
- String key;
- if (category == null || category.equals(""))
- key = PortletEntry.DEFAULT_GROUP;
+ String key;
+
+ if ((category == null) || category.equals(""))
+ {
+ key = PortletEntry.DEFAULT_GROUP;
+ }
else
+ {
key = PortletEntry.DEFAULT_GROUP + "." + category;
+ }
+
CategoryIterator iterator = new CategoryIterator((SortedMap)catMap, key);
+
return iterator;
}
@@ -184,12 +252,15 @@
*/
public Iterator findPortletsByGroupCategory(String group, String category)
{
- if (group == null || group.equals(""))
+ if ((group == null) || group.equals(""))
+ {
group = PortletEntry.DEFAULT_GROUP;
+ }
String key = group + "." + category;
CategoryIterator iterator = new CategoryIterator((SortedMap)catMap, key);
+
return iterator;
}
@@ -205,25 +276,58 @@
}
/**
+ * Creates a new RegistryEntry instance compatible with the current
+ * Registry instance implementation
+ *
+ * @return the newly created RegistryEntry
+ */
+ public RegistryEntry createEntry()
+ {
+ return new BasePortletEntry();
+ }
+
+ /**
+ @see Registry#setEntry
+ */
+ public void setLocalEntry( RegistryEntry entry ) throws InvalidEntryException
+ {
+ super.setLocalEntry(entry);
+ setPortletEntry((PortletEntry)entry);
+ }
+
+ /**
+ @see Registry#addEntry
+ */
+ public void addLocalEntry( RegistryEntry entry ) throws InvalidEntryException
+ {
+ super.addLocalEntry(entry);
+ setPortletEntry((PortletEntry)entry);
+ }
+
+ /**
@see Registry#removeEntry
*/
- public void removeEntry( String name )
+ public void removeLocalEntry( String name )
{
if (name == null)
+ {
return;
+ }
RegistryEntry entry = (RegistryEntry)this.entries.get( name ) ;
+
if (entry == null)
+ {
return;
+ }
- removeEntry(entry);
+ removeLocalEntry(entry);
}
/**
@see Registry#removeEntry
*/
-
- public void removeEntry( RegistryEntry entry )
+ public void removeLocalEntry( RegistryEntry entry )
{
synchronized(catMap)
{
@@ -243,8 +347,7 @@
}
}
}
- super.removeEntry(entry);
+ super.removeLocalEntry(entry);
}
-
}
1.4 +104 -14 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BaseRegistry.java 28 Mar 2002 23:13:15 -0000 1.3
+++ BaseRegistry.java 30 Oct 2002 15:52:05 -0000 1.4
@@ -70,7 +70,7 @@
*/
public class BaseRegistry implements Registry
{
-
+
protected Map entries = new TreeMap();
/** @see Registry#getEntryCount */
@@ -78,23 +78,23 @@
{
return this.entries.size();
}
-
+
/** @see Registry#getEntry */
public RegistryEntry getEntry( String name ) throws InvalidEntryException
{
RegistryEntry entry = null;
-
+
if (name != null)
{
entry = (RegistryEntry)this.entries.get( name ) ;
}
- if ( entry == null )
+ if (entry == null)
{
throw new InvalidEntryException( InvalidEntryException.ENTRY_DOES_NOT_EXIST+" "+name );
}
-
+
return entry;
}
@@ -106,7 +106,8 @@
synchronized (this)
{
- if ( this.hasEntry( entry.getName() ) == false ) {
+ if ( this.hasEntry( entry.getName() ) == false )
+ {
throw new InvalidEntryException( InvalidEntryException.ENTRY_DOES_NOT_EXIST+" "+entry.getName());
}
@@ -119,13 +120,14 @@
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
-
+
synchronized (this)
{
- if ( this.hasEntry( entry.getName() ) ) {
+ if ( this.hasEntry( entry.getName() ) )
+ {
throw new InvalidEntryException( InvalidEntryException.ENTRY_ALREADY_PRESENT );
}
-
+
this.entries.put( entry.getName(), entry );
}
}
@@ -137,7 +139,7 @@
{
return this.entries.containsKey( name );
}
-
+
/**
@see Registry#removeEntry
*/
@@ -167,13 +169,13 @@
public Enumeration getEntries()
{
Vector v = null;
-
+
synchronized (this)
{
// this is ne
v = new Vector(this.entries.values());
}
-
+
return v.elements();
}
@@ -194,7 +196,8 @@
Enumeration enum = getEntries();
Vector v = new Vector();
- while( enum.hasMoreElements() ) {
+ while( enum.hasMoreElements() )
+ {
v.addElement( enum.nextElement() );
}
@@ -203,4 +206,91 @@
return entries;
}
+
+ /**
+ * Creates a new RegistryEntry instance compatible with the current
+ * Registry instance implementation
+ *
+ * @return the newly created RegistryEntry
+ */
+ public RegistryEntry createEntry()
+ {
+ return new BaseRegistryEntry();
+ }
+
+
+ // RegistryService specific methods
+
+ /**
+ * This method is used to only set the entry in the local
+ * memory cache of the registry without any coherency check with
+ * persistent storage
+ *
+ * @param entry the RegistryEntry to store
+ */
+ public void setLocalEntry( RegistryEntry entry ) throws InvalidEntryException
+ {
+ synchronized (this)
+ {
+
+ if ( this.hasEntry( entry.getName() ) == false )
+ {
+ throw new InvalidEntryException( InvalidEntryException.ENTRY_DOES_NOT_EXIST+" "+entry.getName());
+ }
+
+ this.entries.put( entry.getName(), entry );
+ }
+ }
+
+ /**
+ * This method is used to only add the entry in the local
+ * memory cache of the registry without any coherency check with
+ * persistent storage
+ *
+ * @param entry the RegistryEntry to store
+ */
+ public void addLocalEntry( RegistryEntry entry ) throws InvalidEntryException
+ {
+
+ synchronized (this)
+ {
+ if ( this.hasEntry( entry.getName() ) )
+ {
+ throw new InvalidEntryException( InvalidEntryException.ENTRY_ALREADY_PRESENT );
+ }
+
+ this.entries.put( entry.getName(), entry );
+ }
+ }
+
+ /**
+ * This method is used to only remove the entry from the local
+ * memory cache of the registry without any coherency check with
+ * persistent storage
+ *
+ * @param name the name of the RegistryEntry to remove
+ */
+ public void removeLocalEntry( String name )
+ {
+ synchronized(this)
+ {
+ this.entries.remove( name );
+ }
+ }
+
+ /**
+ * This method is used to only remove the entry from the local
+ * memory cache of the registry without any coherency check with
+ * persistent storage
+ *
+ * @param entry the RegistryEntry to remove
+ */
+ public void removeLocalEntry( RegistryEntry entry )
+ {
+ synchronized(this)
+ {
+ this.entries.remove( entry.getName() );
+ }
+ }
+
}
1.6 +33 -33 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistryEntry.java
Index: BaseRegistryEntry.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistryEntry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseRegistryEntry.java 28 Jun 2002 05:37:31 -0000 1.5
+++ BaseRegistryEntry.java 30 Oct 2002 15:52:05 -0000 1.6
@@ -68,21 +68,21 @@
/**
* Base simple bean-like implementation of the RegistryEntry interface
* suitable for Castor XML serialization.
- *
+ *
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id$
*/
-public abstract class BaseRegistryEntry implements RegistryEntry, java.io.Serializable
+public class BaseRegistryEntry implements RegistryEntry, java.io.Serializable
{
protected long id = 0;
protected String name;
-
+
protected MetaInfo metaInfo = null;
-
+
protected Security security = null;
-
- protected boolean hidden;
+
+ protected boolean hidden;
protected int _hidden;
@@ -92,9 +92,9 @@
public BaseRegistryEntry()
{}
- public BaseRegistryEntry(long id,
- String name,
- int _hidden,
+ public BaseRegistryEntry(long id,
+ String name,
+ int _hidden,
String title,
String description,
String image,
@@ -107,7 +107,7 @@
BaseMetaInfo meta = new BaseMetaInfo(title, description, image);
this.setMetaInfo(meta);
BaseSecurity security = new BaseSecurity(role);
- this.setSecurity(security);
+ this.setSecurity(security);
}
/** @see RegistryEntry#getName */
@@ -115,13 +115,13 @@
{
return this.id;
}
-
+
/** @see RegistryEntry#getName */
public String getName()
{
return this.name;
}
-
+
/** @see RegistryEntry#setName */
public void setName( String name )
{
@@ -139,10 +139,10 @@
return title;
}
}
-
+
return null;
}
-
+
/** @see RegistryEntry#setTitle */
public void setTitle(String title)
{
@@ -150,7 +150,7 @@
{
this.metaInfo = new BaseMetaInfo();
}
-
+
this.metaInfo.setTitle(title);
this.description = description;
}
@@ -164,10 +164,10 @@
if (null != desc)
return desc;
}
-
+
return null;
}
-
+
/** @see RegistryEntry#setDescription */
public void setDescription(String description)
{
@@ -175,7 +175,7 @@
{
this.metaInfo = new BaseMetaInfo();
}
-
+
this.metaInfo.setDescription(description);
this.description = description;
}
@@ -185,7 +185,7 @@
{
return this.security;
}
-
+
/** @see RegistryEntry#setSecurity */
public void setSecurity( Security security )
{
@@ -197,25 +197,25 @@
public boolean isHidden()
{
return this.hidden;
- }
-
+ }
+
/** @see RegistryEntry#setHidden */
public void setHidden( boolean hidden )
{
this.hidden = hidden;
this._hidden = (hidden) ? 1 : 0;
}
-
+
// Castor serialization methods
-
- /** Required by Castor 0.8.11 XML serialization for retrieving the visibility
+
+ /** Required by Castor 0.8.11 XML serialization for retrieving the visibility
* status
*/
public boolean getHidden()
{
return this.hidden;
- }
-
+ }
+
/** Required by Castor 0.8.11 XML serialization for retrieving the security
* object
*/
@@ -223,7 +223,7 @@
{
return (BaseSecurity)this.security;
}
-
+
/** Required by Castor 0.8.11 XML serialization for setting the security
* status
*/
@@ -237,7 +237,7 @@
{
return this.metaInfo;
}
-
+
/** Required by Castor 0.8.11 XML serialization for setting the entry
* metainfo
*/
@@ -255,7 +255,7 @@
{
return (BaseMetaInfo)this.metaInfo;
}
-
+
/** Required by Castor 0.8.11 XML serialization for setting the entry
* metainfo
*/
@@ -273,7 +273,7 @@
public SecurityReference getSecurityRef()
{
return securityRef;
- }
+ }
/** Setter for property securityId.
* @param securityId New value of property securityId.
@@ -282,11 +282,11 @@
{
this.securityRef = securityRef;
}
-
+
// OJB - can't seem to get embedded objects to work without this hack
String title;
String description;
String image;
String role;
-
+
}
1.2 +6 -6 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/DatabaseRegistry.java
Index: DatabaseRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/DatabaseRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DatabaseRegistry.java 1 Apr 2002 23:16:53 -0000 1.1
+++ DatabaseRegistry.java 30 Oct 2002 15:52:06 -0000 1.2
@@ -66,7 +66,7 @@
*/
public class DatabaseRegistry extends BaseRegistry implements Registry
{
-
+
/**
@see Registry#setEntry
*/
@@ -84,19 +84,19 @@
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
- // TODO: add it to the database here
+ // TODO: add it to the database here
super.addEntry(entry);
// TODO: notify other servers via jcs
}
-
+
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
- // TODO: add it to the database here
+ // TODO: add it to the database here
super.removeEntry(name);
@@ -109,7 +109,7 @@
public void removeEntry( RegistryEntry entry )
{
- // TODO: add it to the database here
+ // TODO: add it to the database here
super.removeEntry(entry);
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseCapabilityMap.java
Index: BaseCapabilityMap.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.CapabilityMap;
import java.util.Vector;
import java.util.Iterator;
/**
* Simple bean-like implementation of the CapabilityMap
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseCapabilityMap.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BaseCapabilityMap implements CapabilityMap, java.io.Serializable
{
private Vector caps = new Vector();
public BaseCapabilityMap()
{
}
public Iterator getCapabilities()
{
return caps.iterator();
}
public void addCapability(String name)
{
if (!caps.contains(name))
{
caps.add(name);
}
}
public void removeCapability(String name)
{
caps.remove(name);
}
// castor related method definitions
public Vector getCaps()
{
return caps;
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseClientEntry.java
Index: BaseClientEntry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.ClientEntry;
import org.apache.jetspeed.om.registry.MimetypeMap;
import org.apache.jetspeed.om.registry.CapabilityMap;
/**
* Simple implementation of the ClientRegistry interface.
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseClientEntry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BaseClientEntry extends BaseRegistryEntry
implements ClientEntry, java.io.Serializable
{
private String useragentpattern = "";
private String manufacturer = "";
private String model = "";
private String version = "";
private MimetypeMap mimetypes = new BaseMimetypeMap();
private CapabilityMap capabilities = new BaseCapabilityMap();
public BaseClientEntry()
{
}
public String getUseragentpattern()
{
return useragentpattern;
}
public void setUseragentpattern(String useragentpattern)
{
this.useragentpattern = useragentpattern;
}
public String getManufacturer()
{
return manufacturer;
}
public void setManufacturer(String name)
{
manufacturer = name;
}
public String getModel()
{
return model;
}
public void setModel(String name)
{
model = name;
}
public String getVersion()
{
return version;
}
public void setVersion(String name)
{
version = name;
}
public MimetypeMap getMimetypeMap()
{
return mimetypes;
}
public CapabilityMap getCapabilityMap()
{
return capabilities;
}
// castor related method definitions
public BaseMimetypeMap getMimetypes()
{
return (BaseMimetypeMap)mimetypes;
}
public void setMimetypes(BaseMimetypeMap mimetypes)
{
this.mimetypes = mimetypes;
}
public BaseCapabilityMap getCapabilities()
{
return (BaseCapabilityMap)capabilities;
}
public void setCapabilities(BaseCapabilityMap capabilities)
{
this.capabilities = capabilities;
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseClientRegistry.java
Index: BaseClientRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
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.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;
import java.util.Enumeration;
//turbine stuff
import org.apache.turbine.util.Log;
// regexp stuff
import org.apache.regexp.RE;
/**
* Simple implementation of the ClientRegistry interface.
* <p>Extends BaseRegistry implementation to override object creation
* method and ensure Registry object is synchronized with its
* persistence backend by delegating actual addition/deletion of objects
* to the registry service.</p>
* <p>To avoid loops, a RegistryService implementation using this class
* nees to call the addLocalEntry/removeLocalEntry methods to modify
* the in memory state of this Registry</p>
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseClientRegistry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BaseClientRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// 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);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// 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);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.CLIENT, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.CLIENT, entry.getName());
}
}
/**
* Returns the client which matches the given useragent string.
*
* @param useragent the useragent to match
* @return the found client or null if the user-agent does not match any
* defined client
*/
public ClientEntry findEntry(String useragent)
{
ClientEntry clientEntry = null;
Enumeration clients = getEntries();
if (clients != null)
{
while (clients.hasMoreElements())
{
ClientEntry client = (ClientEntry)clients.nextElement();
if (client.getUseragentpattern() != null)
{
try
{
RE r = new RE(client.getUseragentpattern());
r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
if (r.match(useragent))
{
clientEntry = client;
break;
}
}
catch (org.apache.regexp.RESyntaxException e)
{
String message = "ClientRegistryService: UserAgentPattern not valid : " + client.getUseragentpattern() + " : " + e.getMessage();
Log.error( message, e );
}
}
}
}
return clientEntry;
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BaseClientEntry();
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeRegistry.java
Index: BaseMediaTypeRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
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.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;
import org.apache.turbine.util.Log;
/**
* Extends BaseRegistry implementation to override object creation
* method
*
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseMediaTypeRegistry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BaseMediaTypeRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.MEDIA_TYPE, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.MEDIA_TYPE, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.MEDIA_TYPE, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.MEDIA_TYPE, entry.getName());
}
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BaseMediaTypeEntry();
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMimetypeMap.java
Index: BaseMimetypeMap.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.MimetypeMap;
import java.util.Vector;
import java.util.Iterator;
/**
* Simple bean-like implementation of the CapabilityMap
*
* @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseMimetypeMap.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BaseMimetypeMap implements MimetypeMap, java.io.Serializable
{
private Vector mimetypesVector = new Vector();
public BaseMimetypeMap()
{
}
public Iterator getMimetypes()
{
return mimetypesVector.iterator();
}
public String getPreferredMimetype()
{
return (String)mimetypesVector.get(0);
}
public void addMimetype(String name)
{
if (!mimetypesVector.contains(name))
{
mimetypesVector.add(name);
}
}
public void removeMimetype(String name)
{
mimetypesVector.remove(name);
}
// castor related method definitions
public Vector getMimetypesVector()
{
return mimetypesVector;
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BasePortletControlRegistry.java
Index: BasePortletControlRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.PortletRegistry;
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;
import org.apache.turbine.util.Log;
/**
* Extends BaseRegistry implementation to override object creation
* method and ensure Registry object is synchronized with its
* persistence backend by delegating actual addition/deletion of objects
* to the registry service.
* <p>To avoid loops, a RegistryService implementation using this class
* nees to call the addLocalEntry/removeLocalEntry methods to modify
* the in memory state of this Registry</p>
*
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BasePortletControlRegistry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BasePortletControlRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.PORTLET_CONTROL, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.PORTLET_CONTROL, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.PORTLET_CONTROL, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.PORTLET_CONTROL, entry.getName());
}
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BasePortletControlEntry();
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BasePortletControllerRegistry.java
Index: BasePortletControllerRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.PortletRegistry;
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;
import org.apache.turbine.util.Log;
/**
* Extends BaseRegistry implementation to override object creation
* method and ensure Registry object is synchronized with its
* persistence backend by delegating actual addition/deletion of objects
* to the registry service.
* <p>To avoid loops, a RegistryService implementation using this class
* nees to call the addLocalEntry/removeLocalEntry methods to modify
* the in memory state of this Registry</p>
*
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BasePortletControllerRegistry.java,v 1.1 2002/10/30 15:52:05 raphael Exp $
*/
public class BasePortletControllerRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.PORTLET_CONTROLLER, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.PORTLET_CONTROLLER, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.PORTLET_CONTROLLER, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.PORTLET_CONTROLLER, entry.getName());
}
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BasePortletControllerEntry();
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseSecurityRegistry.java
Index: BaseSecurityRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.PortletRegistry;
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;
import org.apache.turbine.util.Log;
/**
* Extends BaseRegistry implementation to override object creation
* method and ensure Registry object is synchronized with its
* persistence backend by delegating actual addition/deletion of objects
* to the registry service.
* <p>To avoid loops, a RegistryService implementation using this class
* nees to call the addLocalEntry/removeLocalEntry methods to modify
* the in memory state of this Registry</p>
*
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseSecurityRegistry.java,v 1.1 2002/10/30 15:52:06 raphael Exp $
*/
public class BaseSecurityRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.SECURITY, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.SECURITY, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.SECURITY, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.SECURITY, entry.getName());
}
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BaseSecurityEntry();
}
}
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseSkinRegistry.java
Index: BaseSkinRegistry.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.om.registry.base;
import org.apache.jetspeed.om.registry.PortletRegistry;
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;
import org.apache.turbine.util.Log;
/**
* Extends BaseRegistry implementation to override object creation
* method and ensure Registry object is synchronized with its
* persistence backend by delegating actual addition/deletion of objects
* to the registry service.
* <p>To avoid loops, a RegistryService implementation using this class
* nees to call the addLocalEntry/removeLocalEntry methods to modify
* the in memory state of this Registry</p>
*
* @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
* @version $Id: BaseSkinRegistry.java,v 1.1 2002/10/30 15:52:06 raphael Exp $
*/
public class BaseSkinRegistry extends BaseRegistry
{
/**
@see Registry#setEntry
*/
public void setEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.SKIN, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#addEntry
*/
public void addEntry( RegistryEntry entry ) throws InvalidEntryException
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
try
{
Registry.addEntry(Registry.SKIN, entry);
}
catch (RegistryException e)
{
Log.error(e);
}
}
/**
@see Registry#removeEntry
*/
public void removeEntry( String name )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
Registry.removeEntry(Registry.SKIN, name);
}
/**
@see Registry#removeEntry
*/
public void removeEntry( RegistryEntry entry )
{
// Delegate to the RegistryService to ensure correct handling of
// persistence if using file fragments
if (entry != null)
{
Registry.removeEntry(Registry.SKIN, entry.getName());
}
}
/**
* Creates a new RegistryEntry instance compatible with the current
* Registry instance implementation
*
* @return the newly created RegistryEntry
*/
public RegistryEntry createEntry()
{
return new BaseSkinEntry();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>