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 we...@apache.org on 2004/02/04 22:17:50 UTC
cvs commit: jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl PortletApplicationDefinitionImpl.java ContentTypeSetImpl.java PortletDefinitionListImpl.java PortletDefinitionImpl.java
weaver 2004/02/04 13:17:50
Modified: services/registry/src/java/org/apache/jetspeed/om/portlet/impl
PortletApplicationDefinitionImpl.java
ContentTypeSetImpl.java
PortletDefinitionListImpl.java
PortletDefinitionImpl.java
Log:
- refactored to support the new non-OJB collections
Revision Changes Path
1.3 +11 -7 jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
Index: PortletApplicationDefinitionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PortletApplicationDefinitionImpl.java 19 Jan 2004 21:48:17 -0000 1.2
+++ PortletApplicationDefinitionImpl.java 4 Feb 2004 21:17:50 -0000 1.3
@@ -55,6 +55,7 @@
package org.apache.jetspeed.om.portlet.impl;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collection;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
@@ -98,14 +99,16 @@
/** Description */
private String description;
- private PortletDefinitionListImpl portlets;
+ private Collection portlets;
+
+ private PortletDefinitionListImpl listWrapper = new PortletDefinitionListImpl();
private int applicationType = MutablePortletApplication.WEBAPP;
/** Creates a new instance of BaseApplication */
public PortletApplicationDefinitionImpl()
{
- portlets = new PortletDefinitionListImpl();
+ portlets = new ArrayList();
}
/**
@@ -165,7 +168,7 @@
*/
public PortletDefinitionList getPortletDefinitionList()
{
- return portlets;
+ return new PortletDefinitionListImpl(portlets);
}
/**
@@ -207,7 +210,7 @@
*/
public void addPortletDefinition(PortletDefinition pd)
{
- ((PortletDefinitionComposite) pd).setPortletApplicationDefinition(this);
+ ((PortletDefinitionComposite) pd).setPortletApplicationDefinition(this);
portlets.add(pd);
}
@@ -224,7 +227,8 @@
*/
public PortletDefinition getPortletDefinitionByName(String name)
{
- return portlets.get(name);
+ listWrapper.setInnerCollection(portlets);
+ return listWrapper.get(name);
}
/**
@@ -232,7 +236,7 @@
*/
public void setPortletDefinitionList(PortletDefinitionList portlets)
{
- this.portlets = (PortletDefinitionListImpl) portlets;
+ this.portlets = ((PortletDefinitionListImpl) portlets).getInnerCollection();
}
/**
1.2 +50 -11 jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/ContentTypeSetImpl.java
Index: ContentTypeSetImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/ContentTypeSetImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContentTypeSetImpl.java 12 Jan 2004 06:19:51 -0000 1.1
+++ ContentTypeSetImpl.java 4 Feb 2004 21:17:50 -0000 1.2
@@ -54,23 +54,28 @@
package org.apache.jetspeed.om.portlet.impl;
import java.io.Serializable;
-import java.util.HashMap;
-
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import org.apache.jetspeed.om.common.portlet.ContentTypeSetComposite;
-import org.apache.jetspeed.om.impl.AbstractSupportSet;
import org.apache.pluto.om.portlet.ContentType;
/**
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
*/
-public class ContentTypeSetImpl extends AbstractSupportSet implements ContentTypeSetComposite, Serializable
+public class ContentTypeSetImpl implements ContentTypeSetComposite, Serializable
{
- private HashMap cTypeMap = new HashMap();
+ protected Collection innerCollection;
public ContentTypeSetImpl()
{
- cTypeMap = new HashMap();
+ innerCollection = new ArrayList();
+ }
+
+ public ContentTypeSetImpl(Collection collection)
+ {
+ innerCollection = collection;
}
/**
@@ -78,7 +83,17 @@
*/
public ContentType get(String contentType)
{
- return (ContentType) cTypeMap.get(contentType);
+ Iterator itr = innerCollection.iterator();
+ while (itr.hasNext())
+ {
+ ContentType p = (ContentType) itr.next();
+ if (p.getContentType().equals(contentType))
+ {
+ return p;
+ }
+ }
+
+ return null;
}
/**
@@ -87,8 +102,8 @@
public boolean add(Object o)
{
ContentType cType = (ContentType) o;
- cTypeMap.put(cType.getContentType(), cType);
- return super.add(cType);
+
+ return innerCollection.add(cType);
}
/**
@@ -97,8 +112,8 @@
public boolean remove(Object o)
{
ContentType cType = (ContentType) o;
- cTypeMap.remove(cType.getContentType());
- return super.remove(cType);
+
+ return innerCollection.remove(cType);
}
/**
@@ -107,6 +122,30 @@
public void addContentType(ContentType contentType)
{
add(contentType);
+ }
+
+ /**
+ * @see org.apache.pluto.om.portlet.ContentTypeSet#iterator()
+ */
+ public Iterator iterator()
+ {
+ return innerCollection.iterator();
+ }
+
+ /**
+ * @return
+ */
+ public Collection getInnerCollection()
+ {
+ return innerCollection;
+ }
+
+ /**
+ * @param collection
+ */
+ public void setInnerCollection(Collection collection)
+ {
+ innerCollection = collection;
}
}
1.2 +66 -18 jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionListImpl.java
Index: PortletDefinitionListImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionListImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletDefinitionListImpl.java 12 Jan 2004 06:19:51 -0000 1.1
+++ PortletDefinitionListImpl.java 4 Feb 2004 21:17:50 -0000 1.2
@@ -54,10 +54,12 @@
package org.apache.jetspeed.om.portlet.impl;
import java.io.Serializable;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import org.apache.jetspeed.om.impl.AbstractSupportSet;
+
+
import org.apache.pluto.om.common.ObjectID;
import org.apache.pluto.om.portlet.PortletDefinition;
import org.apache.pluto.om.portlet.PortletDefinitionList;
@@ -70,18 +72,32 @@
* @version $Id$
*
*/
-public class PortletDefinitionListImpl extends AbstractSupportSet implements PortletDefinitionList, Serializable
+public class PortletDefinitionListImpl implements PortletDefinitionList, Serializable
{
- /** Used to build a quick lookup reference */
- private HashMap portletDefinitionlocator = new HashMap();
- private HashMap portletByName = new HashMap();
+
+ protected Collection innerCollection;
+
+ /**
+ *
+ */
+ public PortletDefinitionListImpl()
+ {
+ super();
+ innerCollection = new ArrayList();
+ }
+
+ public PortletDefinitionListImpl(Collection collection)
+ {
+ super();
+ innerCollection = collection;
+ }
/**
* @see org.apache.pluto.om.portlet.PortletDefinitionList#iterator()
*/
public Iterator iterator()
{
- return super.iterator();
+ return innerCollection.iterator();
}
/**
@@ -89,7 +105,17 @@
*/
public PortletDefinition get(ObjectID id)
{
- return (PortletDefinition) portletDefinitionlocator.get(id);
+ Iterator itr = innerCollection.iterator();
+ while (itr.hasNext())
+ {
+ PortletDefinition pd = (PortletDefinition) itr.next();
+ if (pd.getId().equals(id))
+ {
+ return pd;
+ }
+ }
+
+ return null;
}
/**
@@ -101,7 +127,17 @@
*/
public PortletDefinition get(String name)
{
- return (PortletDefinition) portletByName.get(name);
+ Iterator itr = innerCollection.iterator();
+ while (itr.hasNext())
+ {
+ PortletDefinition pd = (PortletDefinition) itr.next();
+ if (pd.getName().equals(name))
+ {
+ return pd;
+ }
+ }
+
+ return null;
}
/**
@@ -109,10 +145,8 @@
*/
public boolean add(Object o)
{
- PortletDefinition pd = (PortletDefinition) o;
- portletDefinitionlocator.put(pd.getId(), pd);
- portletByName.put(pd.getName(), pd);
- return super.add(pd);
+ PortletDefinition pd = (PortletDefinition) o;
+ return innerCollection.add(pd);
}
/**
@@ -120,10 +154,24 @@
*/
public boolean remove(Object o)
{
- PortletDefinition pd = (PortletDefinition) o;
- portletDefinitionlocator.remove(pd.getName());
- portletByName.remove(pd.getName());
- return super.remove(pd);
+ PortletDefinition pd = (PortletDefinition) o;
+ return innerCollection.remove(pd);
+ }
+
+ /**
+ * @return
+ */
+ public Collection getInnerCollection()
+ {
+ return innerCollection;
+ }
+
+ /**
+ * @param collection
+ */
+ public void setInnerCollection(Collection collection)
+ {
+ innerCollection = collection;
}
}
1.3 +159 -84 jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
Index: PortletDefinitionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PortletDefinitionImpl.java 19 Jan 2004 21:49:03 -0000 1.2
+++ PortletDefinitionImpl.java 4 Feb 2004 21:17:50 -0000 1.3
@@ -55,33 +55,34 @@
import java.io.IOException;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.registry.JetspeedPortletRegistry;
import org.apache.jetspeed.util.HashCodeBuilder;
import org.apache.jetspeed.util.JetspeedObjectID;
import org.apache.jetspeed.om.common.MutableDescription;
-import org.apache.jetspeed.om.common.MutableDescriptionSet;
import org.apache.jetspeed.om.common.MutableDisplayName;
-import org.apache.jetspeed.om.common.MutableDisplayNameSet;
import org.apache.jetspeed.om.common.ParameterComposite;
-import org.apache.jetspeed.om.common.portlet.ContentTypeSetComposite;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.DescriptionImpl;
import org.apache.jetspeed.om.impl.DescriptionSetImpl;
-import org.apache.jetspeed.om.impl.DisplayNameImpl;
+
import org.apache.jetspeed.om.impl.DisplayNameSetImpl;
import org.apache.jetspeed.om.impl.LanguageSetImpl;
import org.apache.jetspeed.om.impl.ParameterSetImpl;
import org.apache.jetspeed.om.impl.PortletParameterSetImpl;
import org.apache.jetspeed.om.impl.SecurityRoleRefSetImpl;
-import org.apache.jetspeed.om.preference.impl.DefaultPreferenceImpl;
import org.apache.jetspeed.om.preference.impl.PreferenceSetImpl;
+import org.apache.jetspeed.persistence.TransactionStateException;
+
import org.apache.pluto.om.common.Description;
import org.apache.pluto.om.common.DescriptionSet;
import org.apache.pluto.om.common.DisplayName;
@@ -95,11 +96,11 @@
import org.apache.pluto.om.common.PreferenceSet;
import org.apache.pluto.om.common.SecurityRoleRef;
import org.apache.pluto.om.common.SecurityRoleRefSet;
-import org.apache.pluto.om.entity.PortletEntity;
import org.apache.pluto.om.portlet.ContentType;
import org.apache.pluto.om.portlet.ContentTypeSet;
import org.apache.pluto.om.portlet.PortletApplicationDefinition;
import org.apache.pluto.om.servlet.ServletDefinition;
+import org.odmg.DList;
/**
*
@@ -111,21 +112,36 @@
*/
public class PortletDefinitionImpl implements PortletDefinitionComposite, Serializable
{
-
- private static final Log log = LogFactory.getLog(PortletDefinitionImpl.class);
+
+ private static final Log log = LogFactory.getLog(PortletDefinitionImpl.class);
private int id;
private String className;
private String name;
private String portletIdentifier;
- private LanguageSetImpl languageSet = null;
- private ParameterSetImpl parameterSet;
- private SecurityRoleRefSet securityRoleRefSet;
+
+ private Collection languageSet = null;
+ private LanguageSetImpl langListWrapper = new LanguageSetImpl();
+
+ private Collection parameterSet;
+ private ParameterSetImpl paramListWrapper = new PortletParameterSetImpl();
+
+ private Collection securityRoleRefSet;
+ private SecurityRoleRefSetImpl secListWrapper = new SecurityRoleRefSetImpl();
private String preferenceValidatorClassname;
- private MutableDisplayNameSet displayNames;
- private MutableDescriptionSet descriptions;
-
+ private Collection displayNames;
+ private DisplayNameSetImpl DNListWrapper = new DisplayNameSetImpl();
+
+ private Collection descriptions;
+ private DescriptionSetImpl descListWrapper = new DescriptionSetImpl(DescriptionImpl.TYPE_PORTLET);
+
+ private Collection prefSet = null;
+ private PreferenceSetImpl prefListWrapper = new PreferenceSetImpl();
+
+ private Collection contentTypes;
+ private ContentTypeSetImpl ctListWrapper = new ContentTypeSetImpl();
+
protected List portletEntities;
/** PortletApplicationDefinition this PortletDefinition belongs to */
@@ -134,9 +150,6 @@
// protected ObjectID appId;
protected long appId;
- private PreferenceSetImpl prefSet = null;
- private ContentTypeSetComposite contentTypes;
-
private ClassLoader portletClassLoader;
private String expirationCache;
@@ -147,9 +160,9 @@
try
{
- parameterSet = new PortletParameterSetImpl();
- securityRoleRefSet = new SecurityRoleRefSetImpl();
- contentTypes = new ContentTypeSetImpl();
+ parameterSet = new ArrayList();
+ securityRoleRefSet = new ArrayList();
+ contentTypes = new ArrayList();
}
catch (RuntimeException e)
@@ -188,7 +201,8 @@
*/
public LanguageSet getLanguageSet()
{
- return languageSet;
+ langListWrapper.setInnerCollection(languageSet);
+ return langListWrapper;
}
/**
@@ -196,7 +210,8 @@
*/
public ParameterSet getInitParameterSet()
{
- return parameterSet;
+ paramListWrapper.setInnerCollection(parameterSet);
+ return paramListWrapper;
}
/**
@@ -204,7 +219,8 @@
*/
public SecurityRoleRefSet getInitSecurityRoleRefSet()
{
- return securityRoleRefSet;
+ secListWrapper.setInnerCollection(securityRoleRefSet);
+ return secListWrapper;
}
/**
@@ -212,8 +228,12 @@
*/
public PreferenceSet getPreferenceSet()
{
- log.debug("Portlet "+name+" has "+prefSet.size()+" preferences.");
- return prefSet;
+ if(prefSet == null)
+ {
+ prefSet = new ArrayList();
+ }
+ prefListWrapper.setInnerCollection(prefSet);
+ return prefListWrapper;
}
/**
@@ -221,7 +241,7 @@
*/
public void setPreferenceSet(PreferenceSet preferences)
{
- this.prefSet = (PreferenceSetImpl) preferences;
+ this.prefSet = ((PreferenceSetImpl) preferences).getInnerCollection();
}
/**
@@ -229,7 +249,8 @@
*/
public ContentTypeSet getContentTypeSet()
{
- return contentTypes;
+ ctListWrapper.setInnerCollection(contentTypes);
+ return ctListWrapper;
}
/**
@@ -305,9 +326,10 @@
{
if (languageSet == null)
{
- languageSet = new LanguageSetImpl();
+ languageSet = new ArrayList();
}
- languageSet.add(lang);
+ langListWrapper.setInnerCollection(languageSet);
+ langListWrapper.add(lang);
}
/**
@@ -315,8 +337,7 @@
*/
public void setContentTypeSet(ContentTypeSet contentTypes)
{
- this.contentTypes = (ContentTypeSetImpl) contentTypes;
-
+ this.contentTypes = ((ContentTypeSetImpl) contentTypes).getInnerCollection();
}
/**
@@ -324,7 +345,7 @@
*/
public void setInitParameterSet(ParameterSet parameters)
{
- this.parameterSet = (ParameterSetImpl) parameters;
+ this.parameterSet = ((ParameterSetImpl) parameters).getInnerCollection();
}
@@ -333,8 +354,7 @@
*/
public void setInitSecurityRoleRefSet(SecurityRoleRefSet securityRefs)
{
- this.securityRoleRefSet = (SecurityRoleRefSetImpl) securityRefs;
-
+ this.securityRoleRefSet = ((SecurityRoleRefSetImpl) securityRefs).getInnerCollection();
}
/**
@@ -342,7 +362,7 @@
*/
public void setLanguageSet(LanguageSet languages)
{
- this.languageSet = (LanguageSetImpl) languages;
+ this.languageSet = ((LanguageSetImpl) languages).getInnerCollection();
}
/**
@@ -377,7 +397,8 @@
*/
public ParameterComposite addInitParameter(String name, String value)
{
- return (ParameterComposite) parameterSet.add(name, value);
+ paramListWrapper.setInnerCollection(parameterSet);
+ return (ParameterComposite) paramListWrapper.add(name, value);
}
/**
@@ -393,7 +414,8 @@
*/
public void addContentType(ContentType cType)
{
- contentTypes.addContentType(cType);
+ ctListWrapper.setInnerCollection(contentTypes);
+ ctListWrapper.addContentType(cType);
}
/**
@@ -402,16 +424,28 @@
public PreferenceComposite addPreference(String name, String[] values)
{
// PreferenceComposite pref = JetspeedPortletRegistry.newPreference();
- PreferenceComposite pref = new DefaultPreferenceImpl();
- pref.setName(name);
- pref.setValues(values);
- if (prefSet == null)
+ PreferenceComposite pref = null;
+ try
{
- prefSet = new PreferenceSetImpl();
+ pref = (PreferenceComposite) JetspeedPortletRegistry.getNewObjectInstance(PreferenceComposite.DEFAULT_PREFERENCE, true);
+ pref.setName(name);
+ pref.setValues(values);
+ if (prefSet == null)
+ {
+ prefSet = new ArrayList();
+ }
+ addPreference(pref);
+
+ return pref;
+
}
- addPreference(pref);
+ catch (Exception e)
+ {
+ String msg = "Unable to instantiate Preference implementor, " + e.toString();
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
- return pref;
+ }
}
public void setPortletIdentifier(String portletIdentifier)
@@ -437,24 +471,19 @@
*/
public boolean equals(Object obj)
{
- if (obj instanceof PortletDefinitionComposite)
+ if (obj != null && obj.getClass().equals(getClass()))
{
- PortletDefinitionComposite portlet = (PortletDefinitionComposite) obj;
- System.out.println("portlet name: " + name);
- if (app == null && portlet.getPortletApplicationDefinition() == null)
- {
- System.out.println("portlet name: " + name);
- return name.equals(portlet.getName());
- }
- else if (app != null && portlet.getPortletApplicationDefinition() != null)
- {
- return name.equals(portlet.getName())
- && app.getName().equals(((MutablePortletApplication) portlet.getPortletApplicationDefinition()).getName());
- }
- else
- {
- return false;
- }
+ PortletDefinitionImpl pd = (PortletDefinitionImpl) obj;
+ boolean sameId = (id != 0 && id == pd.id);
+ if(sameId)
+ {
+ return true;
+ }
+
+ boolean sameAppId = (appId == pd.appId);
+
+ boolean sameName = (pd.getName() != null && name != null && pd.getName().equals(name));
+ return sameName && sameAppId;
}
return false;
@@ -482,7 +511,7 @@
{
if (app != null && name != null)
{
- return app.getName() + ":" + name;
+ return app.getName() + "::" + name;
}
else
{
@@ -498,7 +527,8 @@
{
if (descriptions != null)
{
- return descriptions.get(arg0);
+ descListWrapper.setInnerCollection(descriptions);
+ return descListWrapper.get(arg0);
}
return null;
}
@@ -510,7 +540,8 @@
{
if (displayNames != null)
{
- return displayNames.get(arg0);
+ DNListWrapper.setInnerCollection(displayNames);
+ return DNListWrapper.get(arg0);
}
return null;
@@ -521,7 +552,8 @@
*/
public void setDescriptions(DescriptionSet arg0)
{
- this.descriptions = (MutableDescriptionSet) arg0;
+
+ this.descriptions = ((DescriptionSetImpl) arg0).getInnerCollection();
}
@@ -530,7 +562,7 @@
*/
public void setDisplayNames(DisplayNameSet arg0)
{
- this.displayNames = (MutableDisplayNameSet) arg0;
+ this.displayNames = (DList) ((DisplayNameSetImpl) arg0).getInnerCollection();
}
/**
@@ -575,21 +607,34 @@
{
if (descriptions == null)
{
- descriptions = new DescriptionSetImpl(MutableDescription.TYPE_PORTLET);
+ descriptions = new ArrayList();
+ }
+ descListWrapper.setInnerCollection(descriptions);
+ try
+ {
+ MutableDescription descObj =
+ (MutableDescription) JetspeedPortletRegistry.getNewObjectInstance(MutableDescription.TYPE_PORTLET, true);
+ descObj.setLocale(locale);
+ descObj.setDescription(description);
+ descListWrapper.addDescription(descObj);
+ }
+ catch (Exception e)
+ {
+ String msg = "Unable to instantiate Description implementor, " + e.toString();
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
}
-
- descriptions.addDescription(new DescriptionImpl(locale, description, MutableDescription.TYPE_PORTLET));
-
}
public void addDescription(Description description)
{
if (descriptions == null)
{
- descriptions = new DescriptionSetImpl(MutableDescription.TYPE_PORTLET);
+ descriptions = new ArrayList();
}
- descriptions.addDescription(description);
+ descListWrapper.setInnerCollection(descriptions);
+ descListWrapper.addDescription(description);
}
@@ -600,10 +645,23 @@
{
if (displayNames == null)
{
- displayNames = new DisplayNameSetImpl(MutableDisplayName.TYPE_PORTLET);
+ displayNames = new ArrayList();
+ }
+ DNListWrapper.setInnerCollection(displayNames);
+ try
+ {
+ MutableDisplayName dn =
+ (MutableDisplayName) JetspeedPortletRegistry.getNewObjectInstance(MutableDisplayName.TYPE_PORTLET, true);
+ dn.setLocale(locale);
+ dn.setDisplayName(displayName);
+ DNListWrapper.addDisplayName(dn);
+ }
+ catch (Exception e)
+ {
+ String msg = "Unable to instantiate DisplayName implementor, " + e.toString();
+ log.error(msg, e);
+ throw new IllegalStateException(msg);
}
-
- displayNames.addDisplayName(new DisplayNameImpl(locale, displayName, MutableDisplayName.TYPE_PORTLET));
}
@@ -611,15 +669,17 @@
{
if (displayNames == null)
{
- displayNames = new DisplayNameSetImpl(MutableDisplayName.TYPE_PORTLET);
+ displayNames = new ArrayList();
}
- displayNames.addDisplayName(displayName);
+ DNListWrapper.setInnerCollection(displayNames);
+ DNListWrapper.addDisplayName(displayName);
}
/**
* <p>
- * store
+ * store will attempt to perform an atomic persistence call against
+ * this portletDefinition.
* </p>
*
* @see org.apache.pluto.om.portlet.PortletDefinitionCtrl#store()
@@ -627,8 +687,20 @@
*/
public void store() throws IOException
{
- // TODO We ned to implement the store command
- throw new UnsupportedOperationException("PortletDefinitionImpl.store() is not currently implemented.");
+ try
+ {
+ JetspeedPortletRegistry.beginTransaction();
+ // Make the transaction show us some love ;)
+ JetspeedPortletRegistry.makeDirty(this);
+ JetspeedPortletRegistry.commitTransaction();
+ }
+ catch (TransactionStateException e)
+ {
+
+ String msg = "Transaction failed for PortletDefinitionImpl.store(): " + e.toString();
+ log.error(msg, e);
+ throw new IOException(msg);
+ }
}
@@ -670,9 +742,11 @@
{
if (prefSet == null)
{
- prefSet = new PreferenceSetImpl();
+ prefSet = new ArrayList();
}
- prefSet.add(preference);
+
+ prefListWrapper.setInnerCollection(prefSet);
+ prefListWrapper.add(preference);
}
@@ -686,7 +760,8 @@
*/
public void addSecurityRoleRef(SecurityRoleRef securityRef)
{
- securityRoleRefSet.add(securityRef);
+ secListWrapper.setInnerCollection(securityRoleRefSet);
+ secListWrapper.add(securityRef);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org