weaver 2004/10/12 12:56:20
Modified: components/registry/src/java/org/apache/jetspeed/om/portlet/impl
PortletDefinitionImpl.java
components/registry/src/java/org/apache/jetspeed/components/portletentity
PortletEntityAccessComponentImpl.java
Removed: components/registry/src/java/org/apache/jetspeed/om/portlet/impl
StoreablePortletDefinitionDelegate.java
Log:
see: http://nagoya.apache.org/jira/browse/JS2-141
Revision Changes Path
1.25 +34 -3
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
Index: PortletDefinitionImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- PortletDefinitionImpl.java 6 Oct 2004 16:37:40 -0000 1.24
+++ PortletDefinitionImpl.java 12 Oct 2004 19:56:20 -0000 1.25
@@ -29,6 +29,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryException;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.MutableDescription;
import org.apache.jetspeed.om.common.MutableDisplayName;
@@ -83,6 +85,15 @@
public class PortletDefinitionImpl implements PortletDefinitionComposite,
Serializable, Support
{
private static final Log log = LogFactory.getLog(PortletDefinitionImpl.class);
+
+ /**
+ * This is a static instance of the PortletREgistry that can be used by
+ * all instances of the PortletDefinitionImpl to support the
+ * PortletDefintionCtrl.store() method.
+ *
+ */
+ protected static PortletRegistry registry;
+
private long id;
private String className;
private String name;
@@ -710,8 +721,23 @@
*/
public void store() throws IOException
{
- throw new UnsupportedOperationException("PortletDefinitionImpl.store() is
not supported."
- + "Use the StoreablePortletDefinitionDelegate class to wrap the
PortletDefinition to store");
+ if(registry != null)
+ {
+ try
+ {
+ registry.savePortletDefinition(this);
+ }
+ catch (RegistryException e)
+ {
+ IOException ioe = new IOException("Failed to store portlet
definition: "+e.getMessage());
+ ioe.initCause(e);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("The portlet registry for
PortletDefinitionImpl has not been set. "+
+ "Please invoke
PortletDefinitionImpl.setPortletRegistry before invoking the store() method.");
+ }
}
/**
@@ -873,6 +899,11 @@
}
langListWrapper.setClassLoader(getPortletClassLoader());
langListWrapper.postLoad(this.supportedLocales);
+ }
+
+ public static void setPortletRegistry(PortletRegistry registry)
+ {
+ PortletDefinitionImpl.registry = registry;
}
}
1.23 +4 -10
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java
Index: PortletEntityAccessComponentImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- PortletEntityAccessComponentImpl.java 9 Jul 2004 18:17:56 -0000 1.22
+++ PortletEntityAccessComponentImpl.java 12 Oct 2004 19:56:20 -0000 1.23
@@ -31,7 +31,6 @@
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.portlet.impl.StoreablePortletDefinitionDelegate;
import org.apache.jetspeed.util.JetspeedObjectID;
import org.apache.pluto.om.common.ObjectID;
import org.apache.pluto.om.entity.PortletEntity;
@@ -223,14 +222,9 @@
public MutablePortletEntity newPortletEntityInstance( PortletDefinition
portletDefinition )
{
PortletEntityImpl portletEntity = new PortletEntityImpl();
- if (portletDefinition instanceof StoreablePortletDefinitionDelegate)
- {
-
portletEntity.setPortletDefinition(((StoreablePortletDefinitionDelegate)
portletDefinition).getPortlet());
- }
- else
- {
- portletEntity.setPortletDefinition(portletDefinition);
- }
+
+ portletEntity.setPortletDefinition(portletDefinition);
+
portletEntity.setStore(persistenceStore);
return (PortletEntityImpl) portletEntity;
@@ -279,7 +273,7 @@
}
catch (LockFailedException e)
{
- log.error("Unable to remove entity from PersistenceStoreCache
"+e.toString(), e);
+ log.error("Unable to remove entity from PersistenceStoreCache " +
e.toString(), e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]