portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r743646 [1/2] - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/ components/jetspeed-portal/src/ma...
Date Thu, 12 Feb 2009 08:02:19 GMT
Author: taylor
Date: Thu Feb 12 08:02:18 2009
New Revision: 743646

URL: http://svn.apache.org/viewvc?rev=743646&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-927
* prerequisite to events: persisting all Portlet 2.0 objects including event defs, published/processed event refs, render params, qnames, aliases container runtime options (still to implement: filters, filter mappings, listeners)
* first implementation of events: this is currently under construction: need to complete marshalling of non-string events
* portlet definition cloning support started (in progress)

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/ContainerRuntimeOptionValue.java   (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/PortletQName.java   (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/SupportedPublicRenderParameter.java   (with props)
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/JetspeedPortletContainerWrapper.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/PortletRegistry.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/GenericMetadata.java
    portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pluto-services.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/JetspeedPortletContainerWrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/JetspeedPortletContainerWrapper.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/JetspeedPortletContainerWrapper.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/JetspeedPortletContainerWrapper.java Thu Feb 12 08:02:18 2009
@@ -27,6 +27,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
 import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
+import org.apache.pluto.EventContainer;
 import org.apache.pluto.OptionalContainerServices;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
@@ -163,8 +164,7 @@
             HttpServletResponse response, PortletWindow window, Event event)
             throws PortletException, IOException, PortletContainerException
     {
-        // TODO Auto-generated method stub
-        
+        ((EventContainer)pluto).fireEvent(request, response, window, event);
     }
     
 

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java?rev=743646&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java Thu Feb 12 08:02:18 2009
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.container.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.Event;
+
+/**
+ * The Class EventList.
+ * Stores events in a list.
+ */
+public class EventList 
+{    
+    /** The events. */
+    private Map<Event,Boolean> events = new HashMap<Event, Boolean>();
+    
+    /**
+     * Adds an event.
+     * 
+     * @param event the event
+     * @param eventNumber the event number
+     */
+    public void addEvent(Event event)
+    {
+        events.put(event, new Boolean(true));
+    }
+
+    /**
+     * Gets the events.
+     * 
+     * @return the events
+     */
+    public List<Event> getEvents() 
+    {
+        List<Event> list = new ArrayList<Event>();
+        for (Event event : events.keySet()) 
+        {
+            list.add(event);
+        }
+        return list;
+    }
+
+    /**
+     * Checks if the event is not processed.
+     * 
+     * @param event the event
+     * 
+     * @return true, if is not processed
+     */
+    public boolean isNotProcessed(Event event) 
+    {
+        return events.get(event).booleanValue();
+    }
+
+    /**
+     * Checks for more events.
+     * 
+     * @return true, if has more events
+     */
+    public boolean hasMoreEvents() 
+    {
+        Collection<Boolean> attr = this.events.values();
+        for (Boolean attribute : attr) 
+        {
+            if (attribute.booleanValue())
+                return true;
+        }
+        return false;
+    }
+
+    /**
+     * Sets the processed.
+     * 
+     * @param event the processed
+     */
+    public void setProcessed(Event event) 
+    {
+        events.remove(event);
+        Boolean attr = new Boolean(false);
+        events.put(event, attr);
+    }
+    
+    /**
+     * Gets the event.
+     * 
+     * @param eventName the event name
+     * @param eventNumber the event number
+     * 
+     * @return the event
+     */
+    public Event getEvent(String eventName)
+    {
+        for (Event event : getEvents()) 
+        {
+            if ((event.getName() != null) && (event.getName().toString().equals(eventName)))
+                return event;
+        }
+        return null;
+    }
+    
+    /**
+     * Gets the size.
+     * 
+     * @return the size
+     */
+    public int getSize() 
+    {
+        return events.size();
+    }
+
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventList.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java Thu Feb 12 08:02:18 2009
@@ -17,33 +17,334 @@
 package org.apache.jetspeed.container.providers;
 
 import java.io.Serializable;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
 
+import javax.portlet.Event;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
 import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.aggregator.PortletAccessDeniedException;
+import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
+import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.Constants;
 import org.apache.pluto.EventContainer;
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.internal.impl.EventImpl;
+import org.apache.pluto.om.portlet.EventDefinition;
+import org.apache.pluto.om.portlet.EventDefinitionReference;
+import org.apache.pluto.om.portlet.PortletApplicationDefinition;
 import org.apache.pluto.spi.EventProvider;
 
 /**
- * TODO: 2.2 implement 
- * 
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id: $
  */
 public class EventProviderImpl implements EventProvider, Cloneable
 {
+    private static Log log = LogFactory.getLog(EventProviderImpl.class);
+    private final PortletWindow portletWindow;
+    private EventList savedEvents = new EventList();
+    private final RequestContext rc;
+    private final PortletWindowAccessor windowAccessor;
+    
     public EventProviderImpl()
-    {}
+    {
+        windowAccessor = null;
+        rc = null;
+        portletWindow = null;
+    }
+
+    public EventProviderImpl(final RequestContext rc, final PortletWindow window, final PortletWindowAccessor windowAccessor)
+    {
+        this.portletWindow = window;
+        this.rc = rc;
+        this.windowAccessor = windowAccessor;
+    }
+        
+    public void registerToFireEvent(QName qname, Serializable value)
+            throws IllegalArgumentException
+    {
+        System.out.println("registering to fire events");
+        if (isDeclaredAsPublishingEvent(qname)) 
+        {
+            if (value != null && !isValueInstanceOfDefinedClass(qname, value))
+            {
+                throw new IllegalArgumentException("Payload has not the right class");
+            }
+            try 
+            {
+                if (value == null) 
+                {
+                    savedEvents.addEvent(new EventImpl(qname, value));
+                } 
+                else if (!(value instanceof Serializable)) 
+                {
+                    throw new IllegalArgumentException(
+                            "Object payload must implement Serializable");
+                } 
+                else 
+                {
+                    Writer out = new StringWriter();
+                    Class clazz = value.getClass();
+                    ClassLoader cl = Thread.currentThread().getContextClassLoader();
+                    try
+                    {
+                        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+                        JAXBContext jc = JAXBContext.newInstance(clazz);
+                        Marshaller marshaller = jc.createMarshaller();
+                        JAXBElement<Serializable> element = new JAXBElement<Serializable>(
+                                qname, clazz, value);
+                        marshaller.marshal(element, out);
+                        // marshaller.marshal(value, out);
+                    }
+                    finally
+                    {
+                        Thread.currentThread().setContextClassLoader(cl);
+                    }
+                    if (out != null) 
+                    {
+                        savedEvents.addEvent(new EventImpl(qname,
+                                (Serializable) out.toString()));
+                    } 
+                    else 
+                    {
+                        savedEvents.addEvent(new EventImpl(qname, value));
+                    }
+                }
+            } catch (JAXBException e) 
+            {
+                // maybe there is no valid jaxb binding
+                // TODO wsrp:eventHandlingFailed
+                log.error("Event handling failed", e);
+            } 
+            catch (FactoryConfigurationError e) 
+            {
+                log.warn(e);
+            }
+        }
+    }
+    
+    public static final int MAX_EVENTS_SIZE = 10; // TODO
     
     public void fireEvents(EventContainer eventContainer)
     {
-        //throw new UnsupportedOperationException();
-        // TODO: 2.2 implement 
+        System.out.println("firing events");
+
+        while (savedEvents.hasMoreEvents()
+                && savedEvents.getSize() < MAX_EVENTS_SIZE) 
+        {
+            Event event = getArbitraryEvent();
+            this.savedEvents.setProcessed(event);
+            
+            List<PortletWindow> windows = getAllPortletsRegisteredForEvent(event);
+
+            // iterate all portlets in the portal
+            for (PortletWindow window : windows) 
+            {
+                
+                HttpServletRequest request = rc.getRequestForWindow((org.apache.jetspeed.container.PortletWindow)window);
+                //this.request.setAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
+                request.setAttribute(PortalReservedParameters.PAGE_ATTRIBUTE, rc.getPage());
+                request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, rc);
+                request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_OBJECTS, rc.getObjects());    
+                try
+                {
+                    eventContainer.fireEvent(request, 
+                          rc.getResponseForWindow((org.apache.jetspeed.container.PortletWindow)window), window, event);
+                }
+                catch (Exception e)
+                {
+                    // TODO: handle
+                    e.printStackTrace();
+                }
+                    
+// TODO: threading                
+//                PortletWindow window = new PortletWindowImpl(container, config, portalURL);
+//                if (portletNames != null) {
+//                    for (String portlet : portletNames) {
+//                        if (portlet.equals(config.getId())) {
+//
+//                            // the thread now is a new one, with possible
+//                            // waiting,
+//                            // for the old to exit
+//                            
+//
+//                            PortletWindowThread portletWindowThread = getPortletWindowThread(
+//                                    eventContainer, config, window, containerServletContext);
+//
+//                            // is this event
+//                            portletWindowThread.addEvent(eActual);
+//
+//                            portletWindowThread.start();
+//                        }
+//                    }
+                }
+            }
+//            waitForEventExecution();
+//            try {
+//                Thread.sleep(WAITING_CYCLE);
+//            } catch (InterruptedException e) {
+//                LOG.warn(e);
+//            }
+        
+//        waitForEventExecution();        
+    }
+    
+    private boolean isDeclaredAsPublishingEvent(QName qname) 
+    {
+        PortletDefinition pd = (PortletDefinition)this.portletWindow.getPortletEntity().getPortletDefinition();         
+        List<? extends EventDefinitionReference> events = pd.getSupportedPublishingEvents();
+        if (events != null) 
+        {
+            String defaultNamespace = pd.getApplication().getDefaultNamespace();
+            for (EventDefinitionReference ref : events) 
+            {
+                QName name = ref.getQualifiedName(defaultNamespace);
+                if (name == null)
+                {
+                    continue;
+                }
+                if (qname.equals(name)) 
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
     }
 
-    public void registerToFireEvent(QName name, Serializable value)
-            throws IllegalArgumentException
+    private boolean isValueInstanceOfDefinedClass(QName qname, Serializable value) 
+    {
+        PortletApplicationDefinition app = portletWindow.getPortletEntity().getPortletDefinition().getApplication();
+        List<? extends EventDefinition> events = app.getEventDefinitions();
+        if (events != null) 
+        {
+            for (EventDefinition def : events)
+            {
+                if (def.getQName() != null)
+                {
+                    if (def.getQName().equals(qname))
+                    {
+                        return value.getClass().getName().equals(def.getValueType());
+                    }
+                }
+                else
+                {
+                    QName tmp = new QName(app.getDefaultNamespace(),def.getName());
+                    if (tmp.equals(qname))
+                    {
+                        return value.getClass().getName().equals(def.getValueType());
+                    }
+                }
+            }
+        }
+        return true;
+    }
+    
+    private Event getArbitraryEvent() 
+    {
+        Event eActual = null;
+        for (Event event : this.savedEvents.getEvents()) 
+        {
+            if (this.savedEvents.isNotProcessed(event)) 
+            {
+                eActual = event;
+            }
+        }
+        return eActual;
+    }
+    
+    private boolean optionsNotifyCurrentPage = true;
+    private boolean optionsNotifyAnyPortlet = false;
+    
+    private List<PortletWindow> getAllPortletsRegisteredForEvent(Event event)
+    {
+        if (optionsNotifyCurrentPage)
+        {
+            Fragment root = rc.getPage().getRootFragment();
+            List<PortletWindow> eventTargets = new LinkedList<PortletWindow>();            
+            return getPortletsRegisteredOnPage(root, event, eventTargets);
+        }
+        else if (optionsNotifyAnyPortlet)
+        {
+            
+        }
+        return null;
+    }
+ 
+    private List<PortletWindow> getPortletsRegisteredOnPage(Fragment fragment, Event event, List<PortletWindow> eventTargets)
     {
-        //throw new UnsupportedOperationException();
-        // TODO: 2.2 implement         
+        List<Fragment> fragments = fragment.getFragments();
+        if (fragments != null && fragments.size() > 0)
+        {
+            for (Fragment child : fragments)
+            {
+                getPortletsRegisteredOnPage(child, event, eventTargets);
+            }
+        }
+        PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment.getId()); // TODO: support fragment to window id
+        if (portletWindow == null)
+            return eventTargets;
+        
+        PortletDefinition portlet = (PortletDefinition) portletWindow.getPortletEntity().getPortletDefinition();
+        
+// TODO: check security        
+//        if (checkSecurityConstraints && !checkSecurityConstraint(portletDefinition, fragment))
+//        {
+//            throw new PortletAccessDeniedException("Access Denied.");
+//        }
+        
+// TODO: check portlet tracking        
+//        if (portletTracking.isOutOfService(portletWindow))
+//        {
+//            log.info("Taking portlet out of service: " + portletDefinition.getUniqueName() + " for window " + fragment.getId());
+//            fragment.overrideRenderedContent(OUT_OF_SERVICE_MESSAGE);
+//            return;
+//        }
+        
+        List<? extends EventDefinitionReference> processingEvents = portlet.getSupportedProcessingEvents();
+        if (isEventSupported(processingEvents, event.getQName(), portlet.getApplication().getDefaultNamespace())) 
+        {
+            if (portlet.getPortletName().equals(portlet.getPortletName())) // BOZO: WTF?
+            {
+                eventTargets.add(portletWindow);
+            }
+        }
+        return eventTargets;
     }
+    
+
+    private boolean isEventSupported(List<? extends EventDefinitionReference> supportedEvents, QName eventName, String defaultNamespace)
+    {
+        if (supportedEvents != null)
+        {
+            for (EventDefinitionReference ref : supportedEvents)
+            {
+                QName refQName = ref.getQualifiedName(defaultNamespace);
+                if (refQName != null && refQName.equals(eventName))
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java Thu Feb 12 08:02:18 2009
@@ -21,9 +21,12 @@
 
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.container.PortletEntity;
+import org.apache.jetspeed.container.providers.EventProviderImpl;
 import org.apache.jetspeed.container.providers.PortletURLProviderImpl;
 import org.apache.jetspeed.container.providers.ResourceURLProviderImpl;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.EventContainer;
 import org.apache.pluto.om.portlet.PortletApplicationDefinition;
 import org.apache.pluto.spi.EventProvider;
 import org.apache.pluto.spi.FilterManager;
@@ -42,20 +45,28 @@
  */
 public class JetspeedPortalCallbackServices implements PortalCallbackService
 {
+    public static final String PER_REQUEST_EVENT_PROVIDER = "org.apache.jetspeed.container.EventProvider";
+
     PropertyManager propertyManager;   
-    EventProvider eventProvider; 
     FilterManager filterManager;
     PortletURLListener urlListener;
+    PortletWindowAccessor windowAccessor;
+    EventContainer eventContainer; 
     
-    public JetspeedPortalCallbackServices(PropertyManager propertyManager,
-            EventProvider eventProvider, FilterManager filterManager, PortletURLListener urlListener)
+    public JetspeedPortalCallbackServices(final PropertyManager propertyManager,
+            final FilterManager filterManager, final PortletURLListener urlListener, final PortletWindowAccessor windowAccessor)
     {
         this.propertyManager = propertyManager;
-        this.eventProvider = eventProvider;
         this.filterManager = filterManager;
         this.urlListener = urlListener;
+        this.windowAccessor = windowAccessor;
     }
 
+    public void setEventContainer(final EventContainer eventContainer)
+    {
+        this.eventContainer = eventContainer;
+    }
+    
     public PortletURLProvider getPortletURLProvider(HttpServletRequest request,
             org.apache.pluto.PortletWindow portletWindow)
     {
@@ -77,16 +88,23 @@
         return propertyManager;
     }
         
-
+    
     public EventProvider getEventProvider(HttpServletRequest request,
             org.apache.pluto.PortletWindow portletWindow)
     {   
-        return eventProvider;
+        RequestContext rc = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+        EventProvider provider = (EventProvider)rc.getObjects().get(PER_REQUEST_EVENT_PROVIDER);
+        if (provider == null)
+        {
+            provider  = new EventProviderImpl(rc, portletWindow, this.windowAccessor);
+            rc.getObjects().put(PER_REQUEST_EVENT_PROVIDER, provider);
+        }
+        return provider;
     }
 
     public EventProvider getEventProvider()
     {
-        return eventProvider;
+        throw new RuntimeException("TODO: need to deprecate this");
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml Thu Feb 12 08:02:18 2009
@@ -160,7 +160,12 @@
          column="SECURITY_REF"
          jdbc-type="VARCHAR"
       />
-      
+      <field-descriptor
+         name="defaultNamespace"
+         column="DEFAULT_NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+            
       <collection-descriptor
          name="metadataFields"
          element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletApplicationLocalizedFieldImpl"
@@ -267,13 +272,50 @@
      <collection-descriptor
        name="roles"
        element-class-ref="org.apache.jetspeed.om.portlet.impl.SecurityRoleImpl"
-       auto-delete="false"
+       auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="appId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+       name="eventDefinitions"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.EventDefinitionImpl"
+       auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+     >
+       <inverse-foreignkey field-ref="appId"/>
+    </collection-descriptor>
+
+     <collection-descriptor
+       name="publicRenderParameters"
+       element-class-ref="org.apache.jetspeed.om.portlet.impl.PublicRenderParameterImpl"
+       auto-delete="true"
          auto-update = "true"
          auto-retrieve = "true"
      >
        <inverse-foreignkey field-ref="appId"/>
     </collection-descriptor>
+  
 
+   <collection-descriptor
+         name="containerRuntimeOptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+      
    </class-descriptor>
 
 <!--
@@ -320,6 +362,12 @@
          jdbc-type="INTEGER"
       />
 
+       <field-descriptor
+         name="cacheScope"
+         column="CACHE_SCOPE"
+         jdbc-type="VARCHAR"
+      />
+
       <field-descriptor
          name="resourceBundle"
          column="RESOURCE_BUNDLE"
@@ -448,6 +496,75 @@
          </query-customizer>
       </collection-descriptor>
 
+     <collection-descriptor
+         name="supportedProcessingEvents"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.EventDefinitionReferenceImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+     <collection-descriptor
+         name="supportedPublishingEvents"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.EventDefinitionReferenceImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+     <collection-descriptor
+         name="supportedPublicRenderParameters"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.SupportedPublicRenderParameterImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+   <collection-descriptor
+         name="containerRuntimeOptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
 
    <!--
       <collection-descriptor
@@ -616,7 +733,7 @@
 
 
 <!--
-   - L O C A L I Z E D   D E S C R I P I T I O N
+   - L O C A L I Z E D   D E S C R I P T I O N
  -->
    <class-descriptor
       class="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
@@ -1242,4 +1359,414 @@
       />
    </class-descriptor>
 
+<!--
+   - E V E N T  D E F I N I T I O N
+-->
+
+  <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.EventDefinitionImpl"
+      table="EVENT_DEFINITION"
+   >
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+     <field-descriptor
+         name="appId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+       <field-descriptor
+         name="valueType"
+         column="VALUE_TYPE"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="aliases"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletQNameImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+   
+	</class-descriptor>
+
+
+<!--
+   - Q N A M E
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.PortletQNameImpl"
+      table="PORTLET_QNAME"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - Q N A M E
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.EventDefinitionReferenceImpl"
+      table="PORTLET_QNAME"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - S U P P O R T E D  P U B L I C  R E N D E R  P A R A M E T E R S
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.SupportedPublicRenderParameterImpl"
+      table="NAMED_PARAMETER"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - C O N T A I N E R  R U N T I M E  O P T I O N
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionImpl"
+      table="RUNTIME_OPTION"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="values"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionValueImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+    </class-descriptor>
+
+<!--
+   - C O N T A I N E R  R U N T I M E  O P T I O N  V A L U E
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ContainerRuntimeOptionValueImpl"
+      table="RUNTIME_VALUE"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+
+      <field-descriptor
+         name="owner"
+         column="OWNER_CLASS_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="value"
+         column="RVALUE"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - PUBLIC RENDER PARAMETERS
+-->
+
+  <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.PublicRenderParameterImpl"
+      table="PUBLIC_PARAMETER"
+   >
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+     <field-descriptor
+         name="appId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="localPart"
+         column="LOCAL_PART"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="namespace"
+         column="NAMESPACE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="prefix"
+         column="PREFIX"
+         jdbc-type="VARCHAR"
+      />
+
+       <field-descriptor
+         name="identifier"
+         column="IDENTIFIER"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="aliases"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.PortletQNameImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+
+      </collection-descriptor>
+   
+	</class-descriptor>
+	
 </descriptor-repository>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java Thu Feb 12 08:02:18 2009
@@ -18,18 +18,32 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import org.apache.jetspeed.cache.JetspeedCache;
 import org.apache.jetspeed.cache.JetspeedCacheEventListener;
 import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
 import org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider;
 import org.apache.jetspeed.om.common.Support;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.EventDefinitionReference;
+import org.apache.jetspeed.om.portlet.InitParam;
+import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.om.portlet.Supports;
 import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
 import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
+import org.apache.jetspeed.om.portlet.impl.PreferencesImpl;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.springframework.dao.DataAccessException;
@@ -294,5 +308,48 @@
     {
         this.listeners.remove(listener);
     }
+ 
+    public void clonePortletDefinition(PortletDefinition source, String newPortletName) throws FailedToStorePortletDefinitionException
+    {
+        if (this.portletDefinitionExists(newPortletName, source.getApplication()))
+        {
+            throw new FailedToStorePortletDefinitionException("Cannot clone to portlet named " + newPortletName + ", name already exists"); 
+        }
+        PortletDefinitionImpl copy = new PortletDefinitionImpl();
+        copy.setApplication(source.getApplication());
+        copy.setPortletName(newPortletName);
+        copy.setPortletClass(source.getPortletClass());
+        copy.setResourceBundle(source.getResourceBundle());
+        copy.setPreferenceValidatorClassname(source.getPreferenceValidatorClassname());
+        copy.setExpirationCache(source.getExpirationCache());
+        copy.setCacheScope(source.getCacheScope());
+        // TODO: Metadata
+        
+        copy.setJetspeedSecurityConstraint(source.getJetspeedSecurityConstraint());
+        copy.getDescriptions().addAll(source.getDescriptions());
+        copy.getDisplayNames().addAll(source.getDisplayNames());
+        
+    }
+    
+    /*
+
+    private Collection<LocalizedField> metadataFields = null;
+
+    
+    private List<InitParam> initParams;
+    private List<EventDefinitionReference> supportedProcessingEvents;
+    private List<EventDefinitionReference> supportedPublishingEvents;
+    private List<SecurityRoleRef> securityRoleRefs;
+    private List<Supports> supports;
+    private List<String> supportedLocales;
+    private List<Language> languages;
+    private List<ContainerRuntimeOption> containerRuntimeOptions;    
+    private List<String> supportedPublicRenderParameters;
+    private Preferences descriptorPreferences = new PreferencesImpl();    
+    
+    private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
+    
+    protected List portletEntities;     
+     */
     
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionImpl.java Thu Feb 12 08:02:18 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOptionValue;
 
 /**
  * @version $Id$
@@ -29,8 +30,19 @@
  */
 public class ContainerRuntimeOptionImpl implements ContainerRuntimeOption, Serializable
 {
+    private static final long serialVersionUID = 1L;
     protected String name;
-    protected List<String> values = new ArrayList<String>();
+    protected List<ContainerRuntimeOptionValue> values = new ArrayList<ContainerRuntimeOptionValue>();    
+    protected String owner;    
+
+    public ContainerRuntimeOptionImpl()
+    {}
+    
+    public ContainerRuntimeOptionImpl(Object owner, String name)
+    {
+        this.owner = owner.getClass().getName();        
+        this.name = name;
+    }
     
     public String getName()
     {
@@ -44,11 +56,31 @@
 
     public void addValue(String value)
     {
-        values.add(value);
+        if (values == null)
+        {
+            values = new ArrayList<ContainerRuntimeOptionValue>();
+        }
+        for (ContainerRuntimeOptionValue param : this.values)
+        {
+            if (param.equals(value))
+            {
+                throw new IllegalArgumentException("Support for container runtime parameter with identifier: "+value+" already defined");
+            }
+        }
+        values.add(new ContainerRuntimeOptionValueImpl(this, value));                
     }
 
     public List<String> getValues()
     {
-        return values;
+        if (values == null)
+        {
+            values = new ArrayList<ContainerRuntimeOptionValue>();
+        }
+        List<String> vals = new ArrayList<String>();
+        for (ContainerRuntimeOptionValue v : this.values)
+        {
+            vals.add(v.toString());
+        }
+        return vals;
     }
 }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java?rev=743646&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java Thu Feb 12 08:02:18 2009
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.portlet.impl;
+
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOptionValue;
+
+public class ContainerRuntimeOptionValueImpl implements
+        ContainerRuntimeOptionValue
+{
+    private String value;
+    protected String owner;    
+
+    public ContainerRuntimeOptionValueImpl()
+    {}
+    
+    public ContainerRuntimeOptionValueImpl(Object owner, String value)
+    {
+        this.owner = owner.getClass().getName();        
+        this.value = value;
+    }
+    
+    public String getValue()
+    {
+        return value;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return value;
+    }
+    
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ContainerRuntimeOptionValueImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/DescriptionImpl.java Thu Feb 12 08:02:18 2009
@@ -41,8 +41,7 @@
     protected Locale locale = null;
     
     public DescriptionImpl()
-    {
-        
+    {        
     }
     
     public DescriptionImpl(Object owner, String lang)

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionImpl.java Thu Feb 12 08:02:18 2009
@@ -26,6 +26,7 @@
 
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.EventDefinition;
+import org.apache.jetspeed.om.portlet.PortletQName;
 import org.apache.jetspeed.util.JetspeedLocale;
 
 /**
@@ -34,10 +35,12 @@
  */
 public class EventDefinitionImpl implements EventDefinition, Serializable
 {
-    protected String name;
-    protected QName qname;
+    private static final long serialVersionUID = 1L;
+    protected String localPart;
+    protected String prefix;
+    protected String namespace;
     protected String valueType;
-    protected List<QName> aliases;
+    protected List<PortletQName> aliases;
     protected List<Description> descriptions;
     
     public Description getDescription(Locale locale)
@@ -70,39 +73,77 @@
 
     public QName getQName()
     {
-        return qname;
+        if (namespace == null)
+        {
+            return new QName(localPart);
+        }
+        else if (prefix == null)
+        {
+            return new QName(namespace, localPart);
+        }
+        else
+        {
+            return new QName(namespace, localPart, prefix);
+        }
     }
 
-    public void setQName(QName value)
+    public void setQName(QName qname)
     {
-        qname = value;
-        name = null;
+        this.namespace = qname.getNamespaceURI();
+        if (this.namespace != null && this.namespace.equals(""))
+            this.namespace = null;
+        this.prefix = qname.getPrefix();
+        if (this.prefix != null && this.prefix.equals(""))
+            this.prefix = null;
+        this.localPart = qname.getLocalPart();
     }
 
     public String getName()
     {
-        return name;
+        return this.localPart;
     }
 
-    public void setName(String value)
+    public void setName(String name)
     {
-        name = value;
-        qname = null;
+        this.localPart = name;
+        this.prefix = null;
+        this.namespace = null;
     }
 
     public List<QName> getAliases()
     {
-        if (aliases == null)
+        List<QName> result = new ArrayList<QName>();
+        if (aliases != null)
         {
-            aliases = new ArrayList<QName>();
+            for (PortletQName qname : aliases)
+            {
+                result.add(qname.getQName());
+            }
         }
-        return aliases;
+        return result;
     }
     
     public void addAlias(QName alias)
+    {       
+        if (aliases == null)
+        {
+            aliases = new ArrayList<PortletQName>();
+        }
+        if (!containsAlias(alias))
+        {
+            aliases.add(new PortletQNameImpl(this, alias));
+        }
+    }
+    
+    protected boolean containsAlias(QName qname)
     {
-        // TODO: check for duplicates
-        getAliases().add(alias);
+        PortletQName alias = new PortletQNameImpl(this, qname);
+        for (PortletQName p : aliases)
+        {
+            if (p.equals(alias))
+                return true;
+        }
+        return false;
     }
 
     public String getValueType()
@@ -115,8 +156,9 @@
         valueType = value;
     }
 
-    public QName getQualifiedName(String defaultNamespace)
+    public QName getQualifiedName(String defaultnamespace)
     {
-        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+        return new QName(defaultnamespace, localPart);
+        //return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/EventDefinitionReferenceImpl.java Thu Feb 12 08:02:18 2009
@@ -27,35 +27,30 @@
  * @version $Id$
  *
  */
-public class EventDefinitionReferenceImpl implements EventDefinitionReference, Serializable
+public class EventDefinitionReferenceImpl extends PortletQNameImpl implements EventDefinitionReference, Serializable
 {
-    protected QName qname;
-    protected String name;
-    
-    public QName getQName()
+    public EventDefinitionReferenceImpl()
     {
-        return qname;
+        super();
     }
-
-    public void setQName(QName value)
+    
+    public EventDefinitionReferenceImpl(Object owner, QName qname)
     {
-        qname = value;
-        name = null;
+        super(owner, qname);
     }
 
-    public String getName()
+    public EventDefinitionReferenceImpl(Object owner, String qname)
     {
-        return name;
+        super(owner, new QName(qname));
     }
-
-    public void setName(String value)
+    
+    public String getName()
     {
-        name = value;
-        qname = null;
+        return super.getLocalPart();
     }
 
     public QName getQualifiedName(String defaultNamespace)
     {
-        return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+        return super.getQName();
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/GenericMetadataImpl.java Thu Feb 12 08:02:18 2009
@@ -36,7 +36,7 @@
  */
 public abstract class GenericMetadataImpl implements GenericMetadata
 {   
-    private Collection fields = null;
+    private Collection<LocalizedField> fields = null;
     private transient MultiValueMap fieldMap = null;
     
     private MultiValueMap getFieldMap(boolean create)
@@ -75,7 +75,7 @@
     {
         if(fields == null)
         {
-            fields = new ArrayList();
+            fields = new ArrayList<LocalizedField>();
         }
         
         fields.add(field);
@@ -85,17 +85,18 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#getFields(java.lang.String)
      */
-    public Collection getFields(String name)
+    @SuppressWarnings("unchecked")
+    public Collection<LocalizedField> getFields(String name)
     {
     	//TODO:  return an immutable version?
         MultiValueMap fieldMap = getFieldMap(false);
-        return (Collection)(fieldMap !=null ? fieldMap.get(name) : null);
+        return (Collection<LocalizedField>)(fieldMap !=null ? fieldMap.get(name) : null);
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#setFields(java.lang.String, java.util.Collection)
      */
-    public void setFields(String name, Collection values)
+    public void setFields(String name, Collection<LocalizedField> values)
     {
         MultiValueMap fieldMap = getFieldMap(false);
         if (fieldMap != null)
@@ -103,7 +104,7 @@
             fieldMap.remove(name);
         }
         
-        Iterator fieldIter = fields.iterator();
+        Iterator<LocalizedField> fieldIter = fields.iterator();
         while(fieldIter.hasNext())
         {
             LocalizedField field = (LocalizedField)fieldIter.next();
@@ -115,7 +116,7 @@
         
         if(values != null)
         {    
-            Iterator iter = values.iterator();
+            Iterator<LocalizedField> iter = values.iterator();
             while(iter.hasNext())
             {
                 LocalizedField field = (LocalizedField)iter.next();
@@ -129,14 +130,15 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#getFields()
      */
-    public Collection getFields() {
+    public Collection<LocalizedField> getFields() 
+    {
         return fields;
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#setFields(java.util.Collection)
      */
-    public void setFields(Collection fields)
+    public void setFields(Collection<LocalizedField> fields)
     {
         this.fields = fields;
 
@@ -148,7 +150,7 @@
         
         if(fields != null)
         {    
-            Iterator fieldIter = fields.iterator();
+            Iterator<LocalizedField> fieldIter = fields.iterator();
             while(fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();
@@ -164,7 +166,7 @@
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.common.GenericMetadata#copyFields(java.util.Collection)
      */
-    public void copyFields(Collection fields)
+    public void copyFields(Collection<LocalizedField> fields)
     {
         // preserve matching fields during copy to
         // minimize persistent store thrash and
@@ -188,10 +190,10 @@
             // create new fields collection if necessary
             if (this.fields == null)
             {
-                this.fields = new ArrayList();
+                this.fields = new ArrayList<LocalizedField>();
             }
             // copy unique new metadata members
-            Iterator fieldIter = fields.iterator();
+            Iterator<LocalizedField> fieldIter = fields.iterator();
             while (fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();
@@ -211,7 +213,7 @@
         
         if (this.fields != null)
         {    
-            Iterator fieldIter = this.fields.iterator();
+            Iterator<LocalizedField> fieldIter = this.fields.iterator();
             while (fieldIter.hasNext())
             {
                 LocalizedField field = (LocalizedField)fieldIter.next();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java Thu Feb 12 08:02:18 2009
@@ -46,6 +46,7 @@
 import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.PortletQName;
 import org.apache.jetspeed.om.portlet.PublicRenderParameter;
 import org.apache.jetspeed.om.portlet.SecurityConstraint;
 import org.apache.jetspeed.om.portlet.SecurityRole;
@@ -82,9 +83,6 @@
     /** Metadata property */
     private Collection<LocalizedField> metadataFields = null;
     
-    /** Description */
-    private String description;
-
     private String resourceBundle;
     private String defaultNamespace;
     
@@ -233,16 +231,6 @@
         this.jetspeedSecurityConstraint = constraint;
     }
     
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription(String string)
-    {
-        description = string;
-    }
-
     /**
      * @see org.apache.jetspeed.om.portlet.PortletApplication#getMetadata()
      */
@@ -427,11 +415,11 @@
         {
             throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
         }
-        // TODO: check duplicates on name|qname?
-        PublicRenderParameterImpl p = new PublicRenderParameterImpl();
-        p.setName(name);
-        p.setIdentifier(identifier);
-        getPublicRenderParameters().add(p);
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(name, identifier);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
         return p;        
     }
 
@@ -441,14 +429,25 @@
         {
             throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
         }
-        // TODO: check duplicates on name|qname?
-        PublicRenderParameterImpl p = new PublicRenderParameterImpl();
-        p.setQName(qname);
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(qname);        
         p.setIdentifier(identifier);
-        getPublicRenderParameters().add(p);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
         return p;        
     }
 
+    protected boolean containsPublicRenderParameter(PublicRenderParameter prp)
+    {
+        for (PublicRenderParameter p : this.publicRenderParameters)
+        {
+            if (p.equals(prp))
+                return true;
+        }
+        return false;
+    }
+    
     public CustomPortletMode getCustomPortletMode(String name)
     {
         for (CustomPortletMode cpm : getCustomPortletModes())
@@ -828,8 +827,7 @@
         {
             throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
         }
-        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl();
-        cro.setName(name);
+        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl(this, name);
         getContainerRuntimeOptions().add(cro);
         return cro;        
     }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java Thu Feb 12 08:02:18 2009
@@ -49,6 +49,7 @@
 import org.apache.jetspeed.om.portlet.Preference;
 import org.apache.jetspeed.om.portlet.Preferences;
 import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.om.portlet.SupportedPublicRenderParameter;
 import org.apache.jetspeed.om.portlet.Supports;
 import org.apache.jetspeed.util.HashCodeBuilder;
 import org.apache.jetspeed.util.JetspeedLocale;
@@ -96,7 +97,7 @@
     private List<String> supportedLocales;
     private List<Language> languages;
     private List<ContainerRuntimeOption> containerRuntimeOptions;    
-    private List<String> supportedPublicRenderParameters;
+    private List<SupportedPublicRenderParameter> supportedPublicRenderParameters;
     private Preferences descriptorPreferences = new PreferencesImpl();    
     
     private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
@@ -559,8 +560,7 @@
         {
             throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
         }
-        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl();
-        cro.setName(name);
+        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl(this, name);
         containerRuntimeOptions.add(cro);
         return cro;        
     }
@@ -661,21 +661,30 @@
     {
         if (supportedPublicRenderParameters == null)
         {
-            supportedPublicRenderParameters = new ArrayList<String>();
+            supportedPublicRenderParameters = new ArrayList<SupportedPublicRenderParameter>();
         }
-        return supportedPublicRenderParameters;
+        List<String> params = new ArrayList<String>();
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
+        {
+            params.add(param.toString());
+        }
+        return params;
     }
     
     public void addSupportedPublicRenderParameter(String identifier)
     {
-        for (String ident : getSupportedPublicRenderParameters())
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = new ArrayList<SupportedPublicRenderParameter>();
+        }
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
         {
-            if (ident.equals(identifier))
+            if (param.equals(identifier))
             {
                 throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
             }
         }
-        supportedPublicRenderParameters.add(identifier);
+        supportedPublicRenderParameters.add(new SupportedPublicRenderParameterImpl(this, identifier));        
     }
 
 
@@ -806,8 +815,7 @@
     {
         // TODO: check duplicates
         getSupportedProcessingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setQName(qname);
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl(this, qname);
         supportedProcessingEvents.add(edr);
         return edr;
     }
@@ -816,8 +824,7 @@
     {
         // TODO check duplicates
         getSupportedProcessingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setName(name);
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl(this, name);
         supportedProcessingEvents.add(edr);
         return edr;
     }
@@ -835,8 +842,7 @@
     {
         // TODO: check duplicates
         getSupportedPublishingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setQName(qname);
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl(this, qname);
         supportedPublishingEvents.add(edr);
         return edr;
     }
@@ -845,8 +851,7 @@
     {
         // TODO check duplicates
         getSupportedPublishingEvents();
-        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl();
-        edr.setName(name);
+        EventDefinitionReferenceImpl edr = new EventDefinitionReferenceImpl(this, name);
         supportedPublishingEvents.add(edr);
         return edr;
     }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java?rev=743646&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java Thu Feb 12 08:02:18 2009
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.portlet.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.jetspeed.om.portlet.PortletQName;
+
+
+public class PortletQNameImpl implements PortletQName
+{
+    private String localPart;
+    private String prefix;
+    private String namespace;
+    protected String owner;    
+
+    public PortletQNameImpl()
+    {}
+    
+    public PortletQNameImpl(Object owner, QName qname)
+    {
+        this.owner = owner.getClass().getName();        
+        this.namespace = qname.getNamespaceURI();
+        if (this.namespace != null && this.namespace.equals(""))
+            this.namespace = null;
+        this.prefix = qname.getPrefix();
+        if (this.prefix != null && this.prefix.equals(""))
+            this.prefix = null;
+        this.localPart = qname.getLocalPart();        
+    }
+    
+    public String getLocalPart()
+    {
+        return this.localPart;
+    }
+
+    public String getNamespace()
+    {
+        return this.namespace;
+    }
+
+    public String getPrefix()
+    {
+        return this.prefix;
+    }
+
+    public QName getQName()
+    {
+        if (namespace == null)
+        {
+            return new QName(localPart);
+        }
+        else if (prefix == null)
+        {
+            return new QName(namespace, localPart);
+        }
+        else
+        {
+            return new QName(namespace, localPart, prefix);
+        }
+    }
+    
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return ((this.getNamespace() == null) ? "" : this.getNamespace() + "//:") + 
+               ((this.getPrefix() == null) ? "" : this.getPrefix() + ":") +
+               ((this.getLocalPart() == null) ? "" : this.getLocalPart());
+    }
+
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletQNameImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java Thu Feb 12 08:02:18 2009
@@ -25,6 +25,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.PortletQName;
 import org.apache.jetspeed.om.portlet.PublicRenderParameter;
 import org.apache.jetspeed.util.JetspeedLocale;
 
@@ -34,11 +35,34 @@
  */
 public class PublicRenderParameterImpl implements PublicRenderParameter, Serializable
 {
+    private static final long serialVersionUID = 1L;
+    private String localPart;
+    private String prefix;
+    private String namespace;
     protected String identifier;
-    protected QName qname;
-    protected String name;
-    protected List<QName> alias;
+
+    protected List<PortletQName> aliases;
     protected List<Description> descriptions;
+
+    public PublicRenderParameterImpl()
+    {}
+    
+    public PublicRenderParameterImpl(String name, String identifier)    
+    {
+        this.localPart = name;
+        this.identifier = identifier;
+    }
+    
+    public PublicRenderParameterImpl(QName qname)
+    {
+        this.namespace = qname.getNamespaceURI();
+        if (this.namespace != null && this.namespace.equals(""))
+            this.namespace = null;
+        this.prefix = qname.getPrefix();
+        if (this.prefix != null && this.prefix.equals(""))
+            this.prefix = null;
+        this.localPart = qname.getLocalPart();                
+    }
     
     public String getIdentifier()
     {
@@ -50,41 +74,113 @@
         identifier = value;
     }
 
-    public QName getQName()
+    public String getLocalPart()
     {
-        return qname;
+        return this.localPart;
     }
 
-    public void setQName(QName value)
+    public String getNamespace()
     {
-        qname = value;
-        name = null;
+        return this.namespace;
     }
 
-    public String getName()
+    public String getPrefix()
+    {
+        return this.prefix;
+    }
+
+    public QName getQName()
+    {
+        if (namespace == null)
+        {
+            return new QName(localPart);
+        }
+        else if (prefix == null)
+        {
+            return new QName(namespace, localPart);
+        }
+        else
+        {
+            return new QName(namespace, localPart, prefix);
+        }
+    }
+    
+    public void setQName(QName qname)
+    {
+        this.namespace = qname.getNamespaceURI();
+        if (this.namespace != null && this.namespace.equals(""))
+            this.namespace = null;
+        this.prefix = qname.getPrefix();
+        if (this.prefix != null && this.prefix.equals(""))
+            this.prefix = null;
+        this.localPart = qname.getLocalPart();
+    }    
+    
+    public boolean equals(Object o)
+    {
+        if (!(o instanceof PublicRenderParameter))
+            return false;
+        PublicRenderParameter param = (PublicRenderParameter)o;
+        String i1 = (param.getIdentifier() == null ? "" : param.getIdentifier());
+        String i2 = (this.identifier == null ? "" : this.identifier);
+        if (i1.equals(i2))
+            return true;
+        return (this.toString().equals(param.toString()));
+    }
+    
+    public String toString()
     {
-        return name;
+        return ((this.getNamespace() == null) ? "" : this.getNamespace() + "//:") + 
+               ((this.getPrefix() == null) ? "" : this.getPrefix() + ":") +
+               ((this.getLocalPart() == null) ? "" : this.getLocalPart());
     }
 
-    public void setName(String value)
+    public String getName()
     {
-        name = value;
-        qname = null;
+        return this.localPart;
     }
 
+    public void setName(String name)
+    {
+        this.localPart = name;
+        this.prefix = null;
+        this.namespace = null;
+    }
+    
     public List<QName> getAliases()
     {
-        if (alias == null)
+        List<QName> result = new ArrayList<QName>();
+        if (aliases != null)
         {
-            alias = new ArrayList<QName>();
+            for (PortletQName qname : aliases)
+            {
+                result.add(qname.getQName());
+            }
         }
-        return alias;
+        return result;
     }
-
+    
     public void addAlias(QName alias)
+    {       
+        if (aliases == null)
+        {
+            aliases = new ArrayList<PortletQName>();
+        }
+        if (!containsAlias(alias))
+        {
+            aliases.add(new PortletQNameImpl(this, alias));
+        }
+    }
+    
+    protected boolean containsAlias(QName qname)
     {
-        // TODO: check duplicates
-        getAliases().add(alias);
+        PortletQName alias = new PortletQNameImpl(this, qname);
+        for (PortletQName p : aliases)
+        {
+            if (p.equals(alias))
+                return true;
+        }
+        return false;
     }
     
     public Description getDescription(Locale locale)

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java?rev=743646&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java Thu Feb 12 08:02:18 2009
@@ -0,0 +1,35 @@
+package org.apache.jetspeed.om.portlet.impl;
+
+import org.apache.jetspeed.om.portlet.SupportedPublicRenderParameter;
+
+
+public class SupportedPublicRenderParameterImpl implements SupportedPublicRenderParameter
+{
+    private String name;
+    protected String owner;    
+
+    public SupportedPublicRenderParameterImpl()
+    {}
+    
+    public SupportedPublicRenderParameterImpl(Object owner, String name)
+    {
+        this.owner = owner.getClass().getName();        
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return name;
+    }
+    
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java?rev=743646&r1=743645&r2=743646&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java Thu Feb 12 08:02:18 2009
@@ -186,6 +186,7 @@
 
         assertNotNull("App did NOT persist its description", app.getDescription(Locale.FRENCH));
 
+        TestPortletRegistryDAO.verifyPortlet20Data(app, portlet);
     }
 
     protected String getBeanDefinitionFilterCategories()



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message