taylor 2002/06/30 21:30:24
Modified: src/java/org/apache/jetspeed/om/dbpsml/map
JetspeedGroupProfileMapBuilder.java
JetspeedRoleProfileMapBuilder.java
JetspeedUserProfileMapBuilder.java
Added: src/java/org/apache/jetspeed/portal
JetspeedPortletInstance.java PortletInstance.java
src/java/org/apache/jetspeed/services/persistence
JetspeedPortalPersistenceService.java
PersistenceManager.java
PortalPersistenceException.java
PortalPersistenceService.java
Log:
Initial implementation of Portlet instances and Persistence Manager for storing and
retrieving portlet instance state
Revision Changes Path
1.4 +1 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedGroupProfileMapBuilder.java
Index: JetspeedGroupProfileMapBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedGroupProfileMapBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedGroupProfileMapBuilder.java 28 Jun 2002 05:37:30 -0000 1.3
+++ JetspeedGroupProfileMapBuilder.java 1 Jul 2002 04:30:24 -0000 1.4
@@ -11,7 +11,7 @@
/**
* This class was autogenerated by Torque on:
*
- * [Thu Jun 27 20:58:50 PDT 2002]
+ * [Thu Jun 27 22:52:04 PDT 2002]
*
*/
public class JetspeedGroupProfileMapBuilder implements MapBuilder
1.4 +1 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedRoleProfileMapBuilder.java
Index: JetspeedRoleProfileMapBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedRoleProfileMapBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedRoleProfileMapBuilder.java 28 Jun 2002 05:37:30 -0000 1.3
+++ JetspeedRoleProfileMapBuilder.java 1 Jul 2002 04:30:24 -0000 1.4
@@ -11,7 +11,7 @@
/**
* This class was autogenerated by Torque on:
*
- * [Thu Jun 27 20:58:50 PDT 2002]
+ * [Thu Jun 27 22:52:04 PDT 2002]
*
*/
public class JetspeedRoleProfileMapBuilder implements MapBuilder
1.4 +1 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedUserProfileMapBuilder.java
Index: JetspeedUserProfileMapBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedUserProfileMapBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedUserProfileMapBuilder.java 28 Jun 2002 05:37:30 -0000 1.3
+++ JetspeedUserProfileMapBuilder.java 1 Jul 2002 04:30:24 -0000 1.4
@@ -11,7 +11,7 @@
/**
* This class was autogenerated by Torque on:
*
- * [Thu Jun 27 20:58:50 PDT 2002]
+ * [Thu Jun 27 22:52:04 PDT 2002]
*
*/
public class JetspeedUserProfileMapBuilder implements MapBuilder
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java
Index: JetspeedPortletInstance.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 [EMAIL PROTECTED]
*
* 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.portal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.jetspeed.om.profile.Entry;
import org.apache.jetspeed.om.profile.PSMLDocument;
import org.apache.jetspeed.om.profile.Parameter;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.profile.psml.PsmlParameter;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.turbine.util.RunData;
/**
* Default Implementation of Jetspeed Portlet Instance.
* It implements the methods for getting, setting and removing attributes from
* portlet instance persistence storage.
*
* In a Jetspeed 1.4x PSML profile, the default XML format for an instance and
attribute is:
*
* <entry>
* <parameter name="someName" value="someValue"/>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @version $Id: JetspeedPortletInstance.java,v 1.1 2002/07/01 04:30:24 taylor Exp $
*/
public class JetspeedPortletInstance implements PortletInstance
{
private Profile profile;
private PSMLDocument doc;
private Entry entry;
/**
* keeping an instance of the actual Portlet around helps us with
* getting information that is not directly available from the PSML profile
*/
private Portlet portlet;
/**
* Constructs a PortletInstance from a Portlet and a RunData.
*
* @param Portlet The parent portlet of this instance.
* @param RunData Jetspeed Run Data
*/
public JetspeedPortletInstance(Portlet portlet, RunData data)
{
this(portlet, ((JetspeedRunData) data).getProfile());
}
/**
* Constructs a PortletInstance from a Portlet and a Profile
*
* @param Portlet The parent portlet of this instance.
* @param Profile The profile containing the instance.
*/
public JetspeedPortletInstance(Portlet portlet, Profile profile)
{
this.portlet = portlet;
this.profile = profile;
doc = profile.getDocument();
entry = doc.getEntryById(portlet.getID());
}
/**
* Protect the constructor so it can only be instantitated by
* by the PortalPersistenceService
*/
protected JetspeedPortletInstance()
{
// does nothin'
}
/**
* @see PortletInstance#getAttribute()
*/
public String getAttribute(String name, String dftValue)
{
Parameter attr = entry.getParameter(name);
if (attr != null)
{
return attr.getValue();
}
else
{
return dftValue;
}
}
/**
* @see PortletInstance#getAttribute()
*/
public String getAttribute(String name)
{
Parameter attr = entry.getParameter(name);
if (attr != null)
{
return attr.getValue();
}
else
{
return "";
}
}
/**
* @see PortletInstance#setAttribute(String, String)
*/
public void setAttribute(String name, String value)
{
Parameter attr = entry.getParameter(name);
// Setting a attribute to null should just remove it.
if(value == null)
{
removeAttribute(name);
}
else if (attr != null)
{
attr.setValue(value);
}
// If an attribute does not exist, then add it.
else
{
PsmlParameter newAttr = new PsmlParameter();
newAttr.setName(name);
newAttr.setValue(value);
entry.addParameter(newAttr);
}
}
/**
* @see PortletInstance#removeAttribute(String)
*/
public void removeAttribute(String name)
{
// I am assuming that we only allow one parameter per name
Iterator params = entry.getParameterIterator();
int index = -1;
int count = 0;
while (params.hasNext())
{
Parameter param = (Parameter) params.next();
if (param.getName().equalsIgnoreCase(name))
{
index = count;
break;
}
count++;
}
// We have to wait until we are outside the loop to remove
// or else we throw a ConcurrentModificationException
if (index != -1)
{
entry.removeParameter(index);
}
}
/**
* @see PortletInstance#removeAllAttributes()
*/
public void removeAllAttributes()
{
entry.removeAllParameter();
}
/**
* @see PortletInstance#getAttributes()
*/
public Iterator getAttributes()
{
return entry.getParameterIterator();
}
/**
* @see PortletInstance#getAttributeNames()
*/
public Iterator getAttributeNames()
{
Iterator itr =getAttributes();
ArrayList list = new ArrayList();
while(itr.hasNext());
{
Parameter param = (Parameter) itr.next();
list.add(param.getName());
}
return list.iterator();
}
/**
* @see PortletInstance#getDocument()
*/
public PSMLDocument getDocument()
{
return doc;
}
/**
* @see PortletInstance#getProfile()
*/
public Profile getProfile()
{
return profile;
}
/**
* @see PortletInstance#getPortlet()
*/
public Entry getEntry()
{
return entry;
}
/**
* @see PortletInstance#getDescription()
*/
public String getDescription()
{
return portlet.getDescription();
}
/**
* @see PortletInstance#getName()
*/
public String getName()
{
return entry.getParent();
}
/**
* @see PortletInstance#getTitle()
*/
public String getTitle()
{
return portlet.getTitle();
}
/**
* @see PortletInstance#getPortlet()
*/
public Portlet getPortlet()
{
return this.portlet;
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletInstance.java
Index: PortletInstance.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 [EMAIL PROTECTED]
*
* 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.portal;
import java.util.Iterator;
import java.util.List;
import org.apache.jetspeed.om.profile.Entry;
import org.apache.jetspeed.om.profile.PSMLDocument;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.portal.Portlet;
/**
* This interface provides an easy, object-oriented approach to modifing
* a portlet instance's persistent attributes.
* It provides methods for getting, setting and removing attributes from
* portlet instance persistence storage.
*
* In a Jetspeed 1.4x PSML profile, the default XML format for an instance and
attribute is:
*
* <entry>
* <parameter name="someName" value="someValue"/>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: PortletInstance.java,v 1.1 2002/07/01 04:30:24 taylor Exp $
*/
public interface PortletInstance
{
/**
* Retrieves an attributes value associated with a named object from a
* portlet instance's persistence storage.
*
* @param name The name of the attribute
* @param defaultValue The default value if the attribute is not found.
* @return String The attribute value, or the defaultValue if not found.
*/
String getAttribute(String name, String defaultValue);
/**
* Retrieves an attributes value associated with a named object from a
* portlet instance's persistence storage.
*
* @param name The name of the attribute
* @return String The attribute value, or the empty string if not found.
*/
String getAttribute(String name);
/**
* Sets a portlet instance attribute into persistence storage.
*
* @param name The name of the attribute.
* @param value The value of the attribute.
*/
void setAttribute(String name, String value);
/**
* Removes a portlet instance attribute from persistence storage.
*
* @param name The name of the attribute.
*/
void removeAttribute(String name);
/**
* Removes all portlet instance attributes from persistence storage.
*
*/
void removeAllAttributes();
/**
* Retrieves a list of all of the attributes of this portlet instance
* as <code>org.apache.jetspeed.om.profile.Parameter</code> objects.
*
* @return java.util.Iterator
*/
Iterator getAttributes();
/**
* Retrieves a list of all attributes names for all the attributes
* contained within this portlet instance.
*
* @return java.util.Iterator
*/
Iterator getAttributeNames();
/**
* Returns the PSMLDocument that contains this portlet instance.
*
* @return org.apache.jetspeed.om.profile.PSMLDocument
*
*/
PSMLDocument getDocument();
/**
* Returns the Profile instance containing this portlet instance.
*
* @return org.apache.jetspeed.om.profile.Profile
*/
Profile getProfile();
/**
* Returns the PSML OM instance associated with this instance.
*
* @return org.apache.jetspeed.om.profile.Entry
*/
Entry getEntry();
/**
* Returns the parent portlet of this PortletInstance.
*
* @return org.apache.jetspeed.portal.Portlet
*/
Portlet getPortlet();
/**
* Retrieves the name of the parent portlet as it is defined within the portlet
registry.
*
* @return String The name of the portlet.
*/
String getName();
/**
* Retrieves the title (if it is defined) of the parent portlet as it is defined
* within the portlet registry.
*
* @return String The title of the portlet.
*/
String getTitle();
/**
* Retrieves the description (if it is defined) of the parent portlet as it
* is defined within the portlet registry.
*
* @return String The description of the portlet.
*/
String getDescription();
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/persistence/JetspeedPortalPersistenceService.java
Index: JetspeedPortalPersistenceService.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 [EMAIL PROTECTED]
*
* 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.services.persistence;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.jetspeed.om.profile.Entry;
import org.apache.jetspeed.om.profile.PSMLDocument;
import org.apache.jetspeed.om.profile.Parameter;
import org.apache.jetspeed.om.profile.Portlets;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.profile.psml.PsmlParameter;
import org.apache.jetspeed.portal.*;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.services.PortletFactory;
import org.apache.jetspeed.services.PsmlManager;
import org.apache.jetspeed.services.portletfactory.PortletFactoryService;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
/**
* Implementation of the Portal Persistence Service for storing and
* retrieving portlet instances.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @version $Id: JetspeedPortalPersistenceService.java,v 1.1 2002/07/01 04:30:24
taylor Exp $
*/
public class JetspeedPortalPersistenceService
extends TurbineBaseService
implements PortalPersistenceService
{
/**
* Use this to verify the RunData object in use is going to be the Jetspeed
* RunData object. This way we know right off, whether or not things are going
* to work.
*
*/
public void init(RunData data) throws InitializationException
{
if (!(data instanceof JetspeedRunData))
{
Log.error(
"[PortalPersistenceService] The current RunData implenetation does
not implement the JetspeedRunData interface.");
setInit(false);
throw new InitializationException("The current RunData implenetation
does not implement the JetspeedRunData interface.");
}
super.init(data);
}
/**
* @see PortalPersistenceService#getInstance(Portlet, Profile)
*/
public PortletInstance getInstance(Portlet portlet, Profile profile)
{
return new JetspeedPortletInstance(portlet, profile);
}
/**
* @see PortalPersistenceService#getInstance(Portlet, RunData)
*/
public PortletInstance getInstance(Portlet portlet, RunData data)
{
return new JetspeedPortletInstance(portlet, data);
}
/**
* @see PortalPersistenceService#store(PortletInstance)
*/
public void store(PortletInstance pPortlet) throws PortalPersistenceException
{
Profile profile = pPortlet.getProfile();
profile.setDocument(pPortlet.getDocument());
if(!PsmlManager.store(profile))
{
throw new PortalPersistenceException("Unable to write portlet
information.");
}
}
/**
* @see PortalPersistenceService#getInstances(Portlet, Profile)
*/
public List getInstances( Profile profile) throws PortletException
{
PSMLDocument doc = profile.getDocument();
Portlets portlets = doc.getPortlets();
ArrayList pList = new ArrayList();
buildAllEntries(portlets, pList, profile);
return pList;
}
/**
* @see PortalPersistenceService#getInstances(Portlet, RunData)
*/
public List getInstances( RunData data) throws PortletException
{
JetspeedRunData jData = (JetspeedRunData) data;
return getInstances(jData.getProfile());
}
protected void buildAllEntries(Portlets portlets, ArrayList entries, Profile
profile) throws PortletException
{
// First let's add all the Entries in the current level
Iterator eItr = portlets.getEntriesIterator();
while(eItr.hasNext())
{
Object obj = eItr.next();
Entry entry = (Entry)obj;
Portlet portlet = PortletFactory.getPortlet(entry);
entries.add(new JetspeedPortletInstance(portlet, profile));
}
//Now if there are child levels, drill down recursively
if(portlets.getPortletsCount() > 0)
{
Iterator pItr = portlets.getPortletsIterator();
while(pItr.hasNext())
{
Portlets childPortlets = (Portlets)pItr.next();
buildAllEntries(childPortlets, entries, profile);
}
return;
}
else
// bootstrap
{
return;
}
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/persistence/PersistenceManager.java
Index: PersistenceManager.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 [EMAIL PROTECTED]
*
* 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.services.persistence;
import java.util.List;
import org.apache.jetspeed.om.profile.PSMLDocument;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.portal.*;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.util.RunData;
/**
* Static accessor to the Portal Persistence Service for storing and
* retrieving portlet instances.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @version $Id: PersistenceManager.java,v 1.1 2002/07/01 04:30:24 taylor Exp $
*/
public abstract class PersistenceManager
{
/**
* Retrieves a List of portlet instances for the given profile.
*
* @param profile Retrieve instances from this profile.
* @return List The list of all instances in current profile.
*/
public static List getInstances(Profile profile) throws PortletException
{
return getService().getInstances(profile);
}
/**
* Retrieves a List of portlet instances for the current profile.
*
* @param data Request rundata.
* @return List The list of all instances in current profile.
*/
public static List getInstances(RunData data) throws PortletException
{
return getService().getInstances(data);
}
/**
* Retrieves a portlet instance from persistent storage for the given portlet.
*
* @param portlet The portlet to retrieve an instance for
* @param data Request rundata.
* @return PortletInstance The instance for the given portlet.
*/
public static PortletInstance getInstance(Portlet portlet, Profile profile)
{
return getService().getInstance(portlet, profile);
}
/**
* Retrieves a portlet instance from persistent storage for the given portlet.
*
* @param portlet The portlet to retrieve an instance for
* @param data Request rundata.
* @return PortletInstance The instance for the given portlet.
*/
public static PortletInstance getInstance(Portlet portlet, RunData data)
{
return getService().getInstance(portlet, data);
}
/**
* Store a portlet instance to permenant storage.
*
* @param instance The portlet instance to be stored.
* @exception PortalPersistenceException if there were problems
* storing the PSMLDocument to persistent storage.
*
*/
public static void store(PortletInstance pPortlet) throws
PortalPersistenceException
{
getService().store(pPortlet);
}
protected static PortalPersistenceService getService()
{
return (PortalPersistenceService) TurbineServices.getInstance().getService(
"PortalPersistenceService");
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/persistence/PortalPersistenceException.java
Index: PortalPersistenceException.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 [EMAIL PROTECTED]
*
* 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.services.persistence;
import org.apache.jetspeed.util.JetspeedException;
/**
* Thrown when an exception occurs in persisting or retrieving portlet instance
* attributes.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @version $Id: PortalPersistenceException.java,v 1.1 2002/07/01 04:30:24 taylor
Exp $
*/
public class PortalPersistenceException extends JetspeedException
{
/**
* Constructor for PortalPersistenceException.
*/
public PortalPersistenceException()
{
super();
}
/**
* Constructor for PortalPersistenceException.
* @param arg0
*/
public PortalPersistenceException(String arg0)
{
super(arg0);
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/persistence/PortalPersistenceService.java
Index: PortalPersistenceService.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 [EMAIL PROTECTED]
*
* 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.services.persistence;
import java.util.Iterator;
import java.util.List;
import org.apache.jetspeed.om.profile.PSMLDocument;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.portal.*;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.turbine.services.Service;
import org.apache.turbine.util.RunData;
/**
* Defines the interface to the Portal Persistence Service for storing and
* retrieving portlet instances.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Weaver</a>
* @version $Id: PortalPersistenceService.java,v 1.1 2002/07/01 04:30:24 taylor Exp $
*/
public interface PortalPersistenceService extends Service
{
String SERVICE_NAME = "PortalPersistenceService";
/**
* Store a portlet instance to permenant storage.
*
* @param instance The portlet instance to be stored.
* @exception PortalPersistenceException if there were problems
* storing the PSMLDocument to persistent storage.
*
*/
void store(PortletInstance instance) throws PortalPersistenceException;
/**
* Retrieves a portlet instance from persistent storage for the given portlet.
*
* @param portlet The portlet to retrieve an instance for
* @param data Request rundata.
* @return PortletInstance The instance for the given portlet.
*/
PortletInstance getInstance(Portlet portlet, RunData data);
/**
* Retrieves a PersistentPortlet instance for this portlet.
*
* @param portlet The portlet to retrieve an instance for
* @param profile Retrieve instance from this profile.
* @return PortletInstance The instance for the given portlet.
*/
PortletInstance getInstance(Portlet portlet, Profile profile);
/**
* Retrieves a List of portlet instances for the current profile.
*
* @param data Request rundata.
* @return List The list of all instances in current profile.
*/
List getInstances(RunData data) throws PortletException;
/**
* Retrieves a List of portlet instances for the given profile.
*
* @param profile Retrieve instances from this profile.
* @return List The list of all instances in current profile.
*/
List getInstances(Profile profile) throws PortletException;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>