You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/02/22 07:06:23 UTC

svn commit: r746641 [3/5] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: applications/jetspeed/src/main/webapp/WEB-INF/min-pages/Administrative/portal-admin/ applications/jetspeed/src/main/webapp/WEB-INF/pages/ applications/jetspeed/src/main/weba...

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.jetspeed.om.portlet.impl;
 
-import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -26,9 +25,13 @@
 import java.util.Locale;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 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.GenericMetadata;
 import org.apache.jetspeed.om.portlet.InitParam;
 import org.apache.jetspeed.om.portlet.Language;
@@ -37,6 +40,7 @@
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.om.portlet.SecurityRoleRef;
 import org.apache.jetspeed.om.portlet.Supports;
+import org.apache.jetspeed.om.portlet.SupportedPublicRenderParameter;
 import org.apache.jetspeed.util.HashCodeBuilder;
 import org.apache.jetspeed.util.JetspeedLocale;
 import org.apache.ojb.broker.PersistenceBroker;
@@ -58,19 +62,24 @@
     
     private Long id;
     private PortletApplication app;    
-    protected String portletName;
-    protected String portletClass;
-    protected String resourceBundle;
-    protected String preferenceValidatorClassname;
+    private String portletName;
+    private String portletClass;
+    private String resourceBundle;
+    private String preferenceValidatorClassname;
     private Integer expirationCache;
+    private String cacheScope;
     private Collection<LocalizedField> metadataFields = null;
     private String jetspeedSecurityConstraint;
     private List<Description> descriptions;
     private List<DisplayName> displayNames;
     private List<InitParam> initParams;
+    private List<EventDefinitionReference> supportedProcessingEvents;
+    private List<EventDefinitionReference> supportedPublishingEvents;
     private List<SecurityRoleRef> securityRoleRefs;
     private List<Supports> supports;
     private List<Language> languages;
+    private List<ContainerRuntimeOption> containerRuntimeOptions;    
+    private List<SupportedPublicRenderParameter> supportedPublicRenderParameters;
     
     private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
     
@@ -339,6 +348,20 @@
         expirationCache = new Integer(value);
     }
 
+    /**
+     * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
+     * "public" indicating that the content may be shared across users. The default value if not present is "private".
+     */
+    public String getCacheScope()
+    {
+        return cacheScope != null ? cacheScope : "private";
+    }
+
+    public void setCacheScope(String cacheScope)
+    {
+        this.cacheScope = cacheScope;
+    }
+
     public Description getDescription(Locale locale)
     {
         return (Description)JetspeedLocale.getBestLocalizedObject(getDescriptions(), locale);
@@ -411,4 +434,102 @@
         initParams.add(param);
         return param;
     }
+
+    public List<EventDefinitionReference> getSupportedProcessingEvents()
+    {
+        if (supportedProcessingEvents == null)
+        {
+            supportedProcessingEvents = new ArrayList<EventDefinitionReference>();            
+        }
+        return supportedProcessingEvents;
+    }
+
+    public EventDefinitionReference addSupportedProcessingEvent(QName qname)
+    {
+        List<EventDefinitionReference> refs = getSupportedProcessingEvents();
+        for (EventDefinitionReference ref : refs)
+        {
+            if (ref.getQName().equals(qname))
+            {
+                return ref;
+            }
+        }
+        ProcessingEventReferenceImpl edr = new ProcessingEventReferenceImpl(qname);
+        supportedProcessingEvents.add(edr);
+        return edr;
+    }
+        
+    public List<EventDefinitionReference> getSupportedPublishingEvents()
+    {
+        if (supportedPublishingEvents == null)
+        {
+            supportedPublishingEvents = new ArrayList<EventDefinitionReference>();            
+        }
+        return supportedPublishingEvents;
+    }
+    
+    public EventDefinitionReference addSupportedPublishingEvent(QName qname)
+    {
+        List<EventDefinitionReference> refs = getSupportedPublishingEvents();
+        for (EventDefinitionReference ref : refs)
+        {
+            if (ref.getQName().equals(qname))
+            {
+                return ref;
+            }
+        }
+        EventDefinitionReferenceImpl edr = new ProcessingEventReferenceImpl(qname);
+        supportedPublishingEvents.add(edr);
+        return edr;
+    }    
+    
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    {
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = new ArrayList<ContainerRuntimeOption>();
+        }
+        return containerRuntimeOptions;
+    }
+
+    public ContainerRuntimeOption addContainerRuntimeOption(String name)
+    {
+        if (getContainerRuntimeOption(name) != null)
+        {
+            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+        }
+        ContainerRuntimeOptionImpl cro = new ContainerRuntimeOptionImpl(this, name);
+        containerRuntimeOptions.add(cro);
+        return cro;        
+    }
+
+    public List<String> getSupportedPublicRenderParameters()
+    {
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = new ArrayList<SupportedPublicRenderParameter>();
+        }
+        List<String> params = new ArrayList<String>();
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
+        {
+            params.add(param.toString());
+        }
+        return params;
+    }
+    
+    public void addSupportedPublicRenderParameter(String identifier)
+    {
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = new ArrayList<SupportedPublicRenderParameter>();
+        }
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
+        {
+            if (param.equals(identifier))
+            {
+                throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
+            }
+        }
+        supportedPublicRenderParameters.add(new SupportedPublicRenderParameterImpl(identifier));        
+    }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PublicRenderParameterImpl.java Sun Feb 22 06:06:20 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<ParameterAliasImpl> 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<ParameterAliasImpl>();
+        }
+        if (!containsAlias(alias))
+        {
+            aliases.add(new ParameterAliasImpl(alias));
+        }
+    }
+    
+    protected boolean containsAlias(QName qname)
     {
-        // TODO: check duplicates
-        getAliases().add(alias);
+        PortletQName alias = new ParameterAliasImpl(qname);
+        for (PortletQName p : aliases)
+        {
+            if (p.equals(alias))
+                return true;
+        }
+        return false;
     }
     
     public Description getDescription(Locale locale)

Copied: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java (from r746380, 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/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java?p2=portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java&p1=portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java&r1=746380&r2=746641&rev=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/SupportedPublicRenderParameterImpl.java Sun Feb 22 06:06:20 2009
@@ -6,14 +6,12 @@
 public class SupportedPublicRenderParameterImpl implements SupportedPublicRenderParameter
 {
     private String name;
-    protected String owner;    
 
     public SupportedPublicRenderParameterImpl()
     {}
     
-    public SupportedPublicRenderParameterImpl(Object owner, String name)
+    public SupportedPublicRenderParameterImpl(String name)
     {
-        this.owner = owner.getClass().getName();        
         this.name = name;
     }
     

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToMany;
+import javax.persistence.PostLoad;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import org.apache.jetspeed.components.rdbms.jpa.JPAUtils;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOptionValue;
+
+/**
+ * @version $Id: ContainerRuntimeOptionImpl.java 708079 2008-10-27 03:15:51Z ate $
+ *
+ */
+@Entity
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="RUNTIME_OPTION")
+@DiscriminatorColumn (name="OWNER_CLASS_NAME")
+public abstract class ContainerRuntimeOptionImpl implements ContainerRuntimeOption, Serializable
+{
+    private static final long serialVersionUID = 1L;
+    
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @Basic
+    @Column (name="NAME")
+    private String name;   
+    @OneToMany (targetEntity=ContainerRuntimeOptionValueImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<ContainerRuntimeOptionValue> values;
+
+    @PostLoad
+    private void eagerFetchCollections()
+    {
+        if (values != null)
+        {
+            values.size();
+        }
+    }
+
+    @Transient
+    private transient PortletDefinitionList<ContainerRuntimeOptionValue> valuesList;     
+
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public ContainerRuntimeOptionImpl()
+    {
+    }
+    
+    /**
+     * Construct runtime option with specified name.
+     * 
+     * @param owner runtime option owner.
+     * @param name runtime option name.
+     */
+    public ContainerRuntimeOptionImpl(Object owner, String name)
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    public void addValue(String value)
+    {
+        if (values == null)
+        {
+            values = (List<ContainerRuntimeOptionValue>)JPAUtils.createList();
+        }
+        for (ContainerRuntimeOptionValue param : values)
+        {
+            if (param.equals(value))
+            {
+                throw new IllegalArgumentException("Support for container runtime parameter with identifier: "+value+" already defined");
+            }
+        }
+        if (valuesList == null)
+        {
+            valuesList = new PortletDefinitionList<ContainerRuntimeOptionValue>(this, values);
+        }        
+        valuesList.add(new ContainerRuntimeOptionValueImpl(value));                
+    }
+
+    public List<String> getValues()
+    {
+        if (values == null)
+        {
+            values = (List<ContainerRuntimeOptionValue>)JPAUtils.createList();
+        }
+        List<String> vals = new ArrayList<String>();
+        for (ContainerRuntimeOptionValue v : values)
+        {
+            vals.add(v.toString());
+        }
+        return vals;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,93 @@
+/*
+ * 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.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOptionValue;
+
+@Entity (name="ContainerRuntimeOptionValue")
+@Table (name="RUNTIME_VALUE")
+public class ContainerRuntimeOptionValueImpl implements ContainerRuntimeOptionValue, PortletDefinitionCollectionMember
+{
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @ManyToOne (targetEntity=ContainerRuntimeOptionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private ContainerRuntimeOptionImpl owner;
+    @Basic
+    @Column (name="RVALUE")
+    private String value;
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (ContainerRuntimeOptionImpl)inverse;
+    }
+    
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public ContainerRuntimeOptionValueImpl()
+    {
+    }
+    
+    /**
+     * Construct runtime option value.
+     * 
+     * @param value runtime option value.
+     */
+    public ContainerRuntimeOptionValueImpl(String value)
+    {
+        this.value = value;
+    }
+    
+    public String getValue()
+    {
+        return value;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return value;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+@Entity (name="EventAlias")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="EVENT_ALIAS")
+public class EventAliasImpl extends PortletQNameImpl implements PortletDefinitionCollectionMember
+{
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @ManyToOne (targetEntity=EventDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private EventDefinitionImpl owner;
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (EventDefinitionImpl)inverse;
+    }
+    
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public EventAliasImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct event alias with specified qname.
+     * 
+     * @param qname qname of event alias.
+     */
+    public EventAliasImpl(QName qname)
+    {
+        super(qname);
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * EventDefinitionDescriptionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="EventDefinitionDescription")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="LOCALIZED_DESCRIPTION")
+@DiscriminatorColumn (name="OWNER_CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.portlet.impl.EventDefinitionImpl")
+public class EventDefinitionDescriptionImpl extends DescriptionImpl implements PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 2937304565848638402L;
+
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=EventDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private EventDefinitionImpl owner;
+
+    /**
+     * Default constructor
+     */
+    public EventDefinitionDescriptionImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct with owner and language.
+     * 
+     * @param owner description owner.
+     * @param lang description language.
+     */
+    public EventDefinitionDescriptionImpl(Object owner, String lang)
+    {
+        super(owner, lang);
+        this.owner = (EventDefinitionImpl)owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (EventDefinitionImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.PostLoad;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.jetspeed.components.rdbms.jpa.JPAUtils;
+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;
+
+/**
+ * @version $Id: EventDefinitionImpl.java 720057 2008-11-23 22:31:00Z ate $
+ *
+ */
+@Entity (name="EventDefinition")
+@Table (name="EVENT_DEFINITION")
+public class EventDefinitionImpl implements EventDefinition, Serializable, PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 1L;
+    
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    private PortletApplicationDefinitionImpl app;
+    @Basic
+    @Column (name="LOCAL_PART")
+    private String localPart;
+    @Basic
+    @Column (name="PREFIX")
+    private String prefix;
+    @Basic
+    @Column (name="NAMESPACE")
+    private String namespace;
+    @Basic
+    @Column (name="VALUE_TYPE")
+    private String valueType;
+    @OneToMany (targetEntity=EventAliasImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<EventAliasImpl> aliases;
+    @OneToMany (targetEntity=EventDefinitionDescriptionImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<Description> descriptions;
+    
+    @PostLoad
+    private void eagerFetchCollections()
+    {
+        if (aliases != null)
+        {
+            aliases.size();
+        }
+        if (descriptions != null)
+        {
+            descriptions.size();
+        }
+    }
+
+    @Transient
+    private transient PortletDefinitionList<EventAliasImpl> aliasesList;     
+    @Transient
+    private transient PortletDefinitionList<Description> descriptionsList;     
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        app = (PortletApplicationDefinitionImpl)inverse;
+    }
+    
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public EventDefinitionImpl()
+    {
+    }
+
+    /**
+     * Construct event definition with specified qname.
+     * 
+     * @param qname qname of event definition.
+     */
+    public EventDefinitionImpl(QName qname)
+    {
+        setQName(qname);
+    }
+
+    public Description getDescription(Locale locale)
+    {
+        return (Description)JetspeedLocale.getBestLocalizedObject(getDescriptions(), locale);
+    }
+    
+    public List<Description> getDescriptions()
+    {
+        if (descriptions == null)
+        {
+            descriptions = (List<Description>)JPAUtils.createList();
+        }
+        if (descriptionsList == null)
+        {
+            descriptionsList = new PortletDefinitionList<Description>(this, descriptions);
+        }
+        return descriptionsList;
+    }
+    
+    public Description addDescription(String lang)
+    {
+        EventDefinitionDescriptionImpl d = new EventDefinitionDescriptionImpl(this, lang);
+        for (Description desc : getDescriptions())
+        {
+            if (desc.getLocale().equals(d.getLocale()))
+            {
+                throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+            }
+        }
+        getDescriptions();
+        descriptionsList.add(d);
+        return d;
+    }
+
+    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 String getName()
+    {
+        return this.localPart;
+    }
+
+    public void setName(String name)
+    {
+        this.localPart = name;
+        this.prefix = null;
+        this.namespace = null;
+    }
+
+    public List<QName> getAliases()
+    {
+        List<QName> result = new ArrayList<QName>();
+        if (aliases != null)
+        {
+            for (PortletQName qname : aliases)
+            {
+                result.add(qname.getQName());
+            }
+        }
+        return result;
+    }
+    
+    public void addAlias(QName alias)
+    {       
+        if (aliases == null)
+        {
+            aliases = (List<EventAliasImpl>)JPAUtils.createList();
+        }
+        if (aliasesList == null)
+        {
+            aliasesList = new PortletDefinitionList<EventAliasImpl>(this, aliases);
+        }
+        if (!containsAlias(alias))
+        {
+            aliasesList.add(new EventAliasImpl(alias));
+        }
+    }
+    
+    protected boolean containsAlias(QName qname)
+    {
+        if (aliases != null)
+        {
+            PortletQName alias = new EventAliasImpl(qname);
+            for (PortletQName p : aliases)
+            {
+                if (p.equals(alias))
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    public String getValueType()
+    {
+        return valueType;
+    }
+
+    public void setValueType(String value)
+    {
+        valueType = value;
+    }
+
+    public QName getQualifiedName(String defaultnamespace)
+    {
+        return new QName(defaultnamespace, localPart);
+        //return qname != null ? qname : name != null ? new QName(defaultNamespace, name) : null;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return ((this.namespace == null) ? "" : this.namespace + "//:") + 
+               ((this.prefix == null) ? "" : this.prefix + ":") +
+               ((this.localPart == null) ? "" : this.localPart);
+    }
+    
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionReferenceImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionReferenceImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionReferenceImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.MappedSuperclass;
+import javax.xml.namespace.QName;
+
+import org.apache.jetspeed.om.portlet.EventDefinitionReference;
+
+/**
+ * @version $Id: EventDefinitionReferenceImpl.java 708175 2008-10-27 13:41:36Z ate $
+ *
+ */
+@MappedSuperclass
+public class EventDefinitionReferenceImpl extends PortletQNameImpl implements EventDefinitionReference, Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Default constructor
+     */
+    public EventDefinitionReferenceImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct event definition reference with specified qname.
+     * 
+     * @param qname qname of event definition reference.
+     */
+    public EventDefinitionReferenceImpl(QName qname)
+    {
+        super(qname);
+    }
+
+    /**
+     * Construct event definition reference with specified name.
+     * 
+     * @param qname name of event definition reference.
+     */
+    public EventDefinitionReferenceImpl(String qname)
+    {
+        super(new QName(qname));
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.pluto.om.portlet.EventDefinitionReference#getName()
+     */
+    public String getName()
+    {
+        return super.getLocalPart();
+    }
+
+    public QName getQualifiedName(String defaultNamespace)
+    {
+        return super.getQName();
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+@Entity (name="ParameterAlias")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PARAMETER_ALIAS")
+public class ParameterAliasImpl extends PortletQNameImpl implements PortletDefinitionCollectionMember
+{
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @ManyToOne (targetEntity=PublicRenderParameterImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private PublicRenderParameterImpl owner;
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (PublicRenderParameterImpl)inverse;
+    }
+    
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public ParameterAliasImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct parameter alias with specified qname.
+     * 
+     * @param qname qname of parameter alias.
+     */
+    public ParameterAliasImpl(QName qname)
+    {
+        super(qname);
+    }    
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * PortletApplicationContainerRuntimeOptionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PortletApplicationContainerRuntimeOption")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="RUNTIME_OPTION")
+@DiscriminatorColumn (name="OWNER_CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl")
+public class PortletApplicationContainerRuntimeOptionImpl extends ContainerRuntimeOptionImpl implements PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 1127833149923678744L;
+
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID")
+    private PortletApplicationDefinitionImpl owner;
+
+    /**
+     * Default constructor
+     */
+    public PortletApplicationContainerRuntimeOptionImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct runtime option with specified name.
+     * 
+     * @param owner runtime option owner.
+     * @param name runtime option name.
+     */
+    public PortletApplicationContainerRuntimeOptionImpl(Object owner, String name)
+    {
+        super(owner, name);
+        this.owner = (PortletApplicationDefinitionImpl)owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (PortletApplicationDefinitionImpl)inverse;
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -37,17 +37,21 @@
 import javax.persistence.Table;
 import javax.persistence.Transient;
 import javax.persistence.Version;
+import javax.xml.namespace.QName;
 
 import org.apache.jetspeed.components.rdbms.jpa.JPAUtils;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
 import org.apache.jetspeed.om.portlet.CustomPortletMode;
 import org.apache.jetspeed.om.portlet.CustomWindowState;
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.EventDefinition;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.JetspeedServiceReference;
 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.PublicRenderParameter;
 import org.apache.jetspeed.om.portlet.SecurityRole;
 import org.apache.jetspeed.om.portlet.UserAttribute;
 import org.apache.jetspeed.om.portlet.UserAttributeRef;
@@ -97,6 +101,9 @@
     @Column (name="CONTEXT_ROOT")
     private String contextRoot;
     @Basic
+    @Column (name="DEFAULT_NAMESPACE")
+    private String defaultNamespace;
+    @Basic
     @Column (name="SECURITY_REF")
     private String jetspeedSecurityConstraint;
     @OneToMany (targetEntity=PortletApplicationLocalizedFieldImpl.class, mappedBy="parent", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@@ -109,12 +116,18 @@
     private List<SecurityRole> roles;
     @OneToMany (targetEntity=PortletDefinitionImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<PortletDefinition> portlets;
+    @OneToMany (targetEntity=EventDefinitionImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<EventDefinition> eventDefinitions;    
+    @OneToMany (targetEntity=PublicRenderParameterImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<PublicRenderParameter> publicRenderParameters;
     @OneToMany (targetEntity=CustomPortletModeImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<CustomPortletMode> customPortletModes;
     @OneToMany (targetEntity=CustomWindowStateImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<CustomWindowState> customWindowStates;
     @OneToMany (targetEntity=UserAttributeImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<UserAttribute> userAttributes;
+    @OneToMany (targetEntity=PortletApplicationContainerRuntimeOptionImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<ContainerRuntimeOption> containerRuntimeOptions;
     @OneToMany (targetEntity=UserAttributeRefImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<UserAttributeRef> userAttributeRefs;
     @OneToMany (targetEntity=JetspeedServiceReferenceImpl.class, mappedBy="app", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@@ -143,6 +156,14 @@
         {
             portlets.size();
         }
+        if (eventDefinitions != null)
+        {
+            eventDefinitions.size();
+        }
+        if (publicRenderParameters != null)
+        {
+            publicRenderParameters.size();
+        }
         if (customPortletModes != null)
         {
             customPortletModes.size();
@@ -155,6 +176,10 @@
         {
             userAttributes.size();
         }
+        if (containerRuntimeOptions != null)
+        {
+            containerRuntimeOptions.size();
+        }
         if (userAttributeRefs != null)
         {
             userAttributeRefs.size();
@@ -183,12 +208,18 @@
     @Transient
     private transient PortletDefinitionList<PortletDefinition> portletsList;
     @Transient
+    private transient PortletDefinitionList<EventDefinition> eventDefinitionsList;
+    @Transient
+    private transient PortletDefinitionList<PublicRenderParameter> publicRenderParametersList;
+    @Transient
     private transient PortletDefinitionList<CustomPortletMode> customPortletModesList;
     @Transient
     private transient PortletDefinitionList<CustomWindowState> customWindowStatesList;
     @Transient
     private transient PortletDefinitionList<UserAttribute> userAttributesList;
     @Transient
+    private transient PortletDefinitionList<ContainerRuntimeOption> containerRuntimeOptionsList;     
+    @Transient
     private transient PortletDefinitionList<UserAttributeRef> userAttributeRefsList;
     @Transient
     private transient PortletDefinitionList<JetspeedServiceReference> servicesList;
@@ -288,6 +319,16 @@
         return contextRoot;
     }
     
+    public String getDefaultNamespace()
+    {
+        return defaultNamespace;
+    }
+
+    public void setDefaultNamespace(String defaultNamespace)
+    {
+        this.defaultNamespace = defaultNamespace;
+    }
+    
     public String getJetspeedSecurityConstraint()
     {
         return this.jetspeedSecurityConstraint;
@@ -424,6 +465,76 @@
         return portlet;
     }
 
+    public List<EventDefinition> getEventDefinitions()
+    {
+        if (eventDefinitions == null)
+        {
+            eventDefinitions = (List<EventDefinition>)JPAUtils.createList();
+        }
+        if (eventDefinitionsList == null)
+        {
+            eventDefinitionsList = new PortletDefinitionList<EventDefinition>(this, eventDefinitions);
+        }
+        return eventDefinitionsList;
+    }
+
+    public EventDefinition addEventDefinition(QName qname)
+    {
+        List<EventDefinition> defs = getEventDefinitions();
+        for (EventDefinition def : defs)
+        {
+            if (def.getQName().equals(qname))
+            {
+                return def;
+            }
+        }
+        EventDefinitionImpl ed = new EventDefinitionImpl(qname);
+        getEventDefinitions().add(ed);
+        return ed;
+    }
+
+    public List<PublicRenderParameter> getPublicRenderParameters()
+    {
+        if (publicRenderParameters == null)
+        {
+            publicRenderParameters = (List<PublicRenderParameter>)JPAUtils.createList();
+        }
+        if (publicRenderParametersList == null)
+        {
+            publicRenderParametersList = new PortletDefinitionList<PublicRenderParameter>(this, publicRenderParameters);
+        }
+        return publicRenderParametersList;
+    }
+
+    public PublicRenderParameter addPublicRenderParameter(String name, String identifier)
+    {
+        if (getPublicRenderParameter(identifier) != null)
+        {
+            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+        }
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(name, identifier);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
+        return p;        
+    }
+
+    public PublicRenderParameter addPublicRenderParameter(QName qname, String identifier)
+    {
+        if (getPublicRenderParameter(identifier) != null)
+        {
+            throw new IllegalArgumentException("PublicRenderParameter with identifier: "+identifier+" already defined");
+        }
+        PublicRenderParameterImpl p = new PublicRenderParameterImpl(qname);        
+        p.setIdentifier(identifier);
+        if (!containsPublicRenderParameter(p))
+        {
+            getPublicRenderParameters().add(p);
+        }
+        return p;        
+    }
+    
     public List<CustomPortletMode> getCustomPortletModes()
     {
         if (customPortletModes == null)
@@ -511,6 +622,30 @@
         return ua;        
     }
 
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    {
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = (List<ContainerRuntimeOption>)JPAUtils.createList();
+        }
+        if (containerRuntimeOptionsList == null)
+        {
+            containerRuntimeOptionsList = new PortletDefinitionList<ContainerRuntimeOption>(this, containerRuntimeOptions);
+        }
+        return containerRuntimeOptionsList;
+    }
+
+    public ContainerRuntimeOption addContainerRuntimeOption(String name)
+    {
+        if (getContainerRuntimeOption(name) != null)
+        {
+            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+        }
+        ContainerRuntimeOptionImpl cro = new PortletApplicationContainerRuntimeOptionImpl(this, name);
+        getContainerRuntimeOptions().add(cro);
+        return cro;        
+    }
+
     public List<UserAttributeRef> getUserAttributeRefs()
     {
         if (userAttributeRefs == null)

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * PortletDefinitionContainerRuntimeOptionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PortletDefinitionContainerRuntimeOption")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="RUNTIME_OPTION")
+@DiscriminatorColumn (name="OWNER_CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl")
+public class PortletDefinitionContainerRuntimeOptionImpl extends ContainerRuntimeOptionImpl implements PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 2937304565848638402L;
+
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private PortletDefinitionImpl owner;
+
+    /**
+     * Default constructor
+     */
+    public PortletDefinitionContainerRuntimeOptionImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct runtime option with specified name.
+     * 
+     * @param owner runtime option owner.
+     * @param name runtime option name.
+     */
+    public PortletDefinitionContainerRuntimeOptionImpl(Object owner, String name)
+    {
+        super(owner, name);
+        this.owner = (PortletDefinitionImpl)owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (PortletDefinitionImpl)inverse;
+    }
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java Sun Feb 22 06:06:20 2009
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.om.portlet.jpa;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -37,14 +38,16 @@
 import javax.persistence.NamedQueries;
 import javax.persistence.OneToMany;
 import javax.persistence.PostLoad;
-import javax.persistence.PrePersist;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 import javax.persistence.Version;
+import javax.xml.namespace.QName;
 
 import org.apache.jetspeed.components.rdbms.jpa.JPAUtils;
+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.GenericMetadata;
 import org.apache.jetspeed.om.portlet.InitParam;
 import org.apache.jetspeed.om.portlet.Language;
@@ -52,6 +55,7 @@
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 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.om.portlet.impl.AbstractPortletDefinitionImpl;
 import org.apache.jetspeed.om.portlet.impl.InlinePortletResourceBundle;
@@ -99,7 +103,10 @@
     protected String preferenceValidatorClassname;
     @Basic
     @Column (name="EXPIRATION_CACHE")
-    private String expirationCacheField;
+    private Integer expirationCache;    
+    @Basic
+    @Column (name="CACHE_SCOPE")
+    private String cacheScope;
     @Basic
     @Column (name="SECURITY_REF")
     private String jetspeedSecurityConstraint;
@@ -111,17 +118,24 @@
     private List<DisplayName> displayNames;
     @OneToMany (targetEntity=InitParamImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<InitParam> initParams;
+    @OneToMany (targetEntity=ProcessingEventReferenceImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<EventDefinitionReference> supportedProcessingEvents;
+    @OneToMany (targetEntity=PublishingEventReferenceImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<EventDefinitionReference> supportedPublishingEvents;
     @OneToMany (targetEntity=SecurityRoleRefImpl.class, mappedBy="def", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<SecurityRoleRef> securityRoleRefs;
     @OneToMany (targetEntity=SupportsImpl.class, mappedBy="def", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<Supports> supports;
     @OneToMany (targetEntity=LanguageImpl.class, mappedBy="def", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     private List<Language> languages;
+    @OneToMany (targetEntity=PortletDefinitionContainerRuntimeOptionImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<ContainerRuntimeOption> containerRuntimeOptions;
+    @OneToMany (targetEntity=SupportedPublicRenderParameterImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    private List<SupportedPublicRenderParameter> supportedPublicRenderParameters;
 
     @PostLoad
     private void postLoad()
     {
-        expirationCache = ((expirationCacheField != null) ? Integer.parseInt(expirationCacheField) : null);
         eagerFetchReferences();
         eagerFetchCollections();
     }    
@@ -150,6 +164,14 @@
         {
             initParams.size();
         }
+        if (supportedProcessingEvents != null)
+        {
+            supportedProcessingEvents.size();
+        }
+        if (supportedPublishingEvents != null)
+        {
+            supportedPublishingEvents.size();
+        }
         if (securityRoleRefs != null)
         {
             securityRoleRefs.size();
@@ -162,16 +184,17 @@
         {
             languages.size();
         }
-    }
-    @PrePersist
-    private void prePersist()
-    {
-        expirationCacheField = ((expirationCache != null) ? expirationCache.toString() : null);
+        if (containerRuntimeOptions != null)
+        {
+            containerRuntimeOptions.size();
+        }
+        if (supportedPublicRenderParameters != null)
+        {
+            supportedPublicRenderParameters.size();
+        }
     }
 
     @Transient
-    private Integer expirationCache;
-    @Transient
     private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
     @Transient
     private transient PortletDefinitionCollection<LocalizedField> metadataFieldsCollection;     
@@ -182,11 +205,19 @@
     @Transient
     private transient PortletDefinitionList<InitParam> initParamsList;
     @Transient
+    private transient PortletDefinitionList<EventDefinitionReference> supportedProcessingEventsList;
+    @Transient
+    private transient PortletDefinitionList<EventDefinitionReference> supportedPublishingEventsList;
+    @Transient
     private transient PortletDefinitionList<SecurityRoleRef> securityRoleRefsList;
     @Transient
     private transient PortletDefinitionList<Supports> supportsList;
     @Transient
     private transient PortletDefinitionList<Language> languagesList;
+    @Transient
+    private transient PortletDefinitionList<ContainerRuntimeOption> containerRuntimeOptionsList;     
+    @Transient
+    private transient PortletDefinitionList<SupportedPublicRenderParameter> supportedPublicRenderParametersList;
     
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
@@ -420,6 +451,20 @@
         expirationCache = new Integer(value);
     }
 
+    /**
+     * Caching scope, allowed values are "private" indicating that the content should not be shared across users and
+     * "public" indicating that the content may be shared across users. The default value if not present is "private".
+     */
+    public String getCacheScope()
+    {
+        return cacheScope != null ? cacheScope : "private";
+    }
+
+    public void setCacheScope(String cacheScope)
+    {
+        this.cacheScope = cacheScope;
+    }
+
     public Description getDescription(Locale locale)
     {
         return (Description)JetspeedLocale.getBestLocalizedObject(getDescriptions(), locale);
@@ -505,6 +550,120 @@
         return param;
     }
 
+    public List<EventDefinitionReference> getSupportedProcessingEvents()
+    {
+        if (supportedProcessingEvents == null)
+        {
+            supportedProcessingEvents = (List<EventDefinitionReference>)JPAUtils.createList();            
+        }
+        if (supportedProcessingEventsList == null)
+        {
+            supportedProcessingEventsList = new PortletDefinitionList<EventDefinitionReference>(this, supportedProcessingEvents);
+        }
+        return supportedProcessingEventsList;
+    }
+
+    public EventDefinitionReference addSupportedProcessingEvent(QName qname)
+    {
+        List<EventDefinitionReference> refs = getSupportedProcessingEvents();
+        for (EventDefinitionReference ref : refs)
+        {
+            if (ref.getQName().equals(qname))
+            {
+                return ref;
+            }
+        }
+        ProcessingEventReferenceImpl edr = new ProcessingEventReferenceImpl(qname);
+        supportedProcessingEventsList.add(edr);
+        return edr;
+    }
+        
+    public List<EventDefinitionReference> getSupportedPublishingEvents()
+    {
+        if (supportedPublishingEvents == null)
+        {
+            supportedPublishingEvents = (List<EventDefinitionReference>)JPAUtils.createList();            
+        }
+        if (supportedPublishingEventsList == null)
+        {
+            supportedPublishingEventsList = new PortletDefinitionList<EventDefinitionReference>(this, supportedPublishingEvents);
+        }
+        return supportedPublishingEventsList;
+    }
+    
+    public EventDefinitionReference addSupportedPublishingEvent(QName qname)
+    {
+        List<EventDefinitionReference> refs = getSupportedPublishingEvents();
+        for (EventDefinitionReference ref : refs)
+        {
+            if (ref.getQName().equals(qname))
+            {
+                return ref;
+            }
+        }
+        EventDefinitionReferenceImpl edr = new ProcessingEventReferenceImpl(qname);
+        supportedPublishingEventsList.add(edr);
+        return edr;
+    }    
+    
+    public List<ContainerRuntimeOption> getContainerRuntimeOptions()
+    {
+        if (containerRuntimeOptions == null)
+        {
+            containerRuntimeOptions = (List<ContainerRuntimeOption>)JPAUtils.createList();
+        }
+        if (containerRuntimeOptionsList == null)
+        {
+            containerRuntimeOptionsList = new PortletDefinitionList<ContainerRuntimeOption>(this, containerRuntimeOptions);
+        }
+        return containerRuntimeOptionsList;
+    }
+
+    public ContainerRuntimeOption addContainerRuntimeOption(String name)
+    {
+        if (getContainerRuntimeOption(name) != null)
+        {
+            throw new IllegalArgumentException("Container runtime option with name: "+name+" already defined");
+        }
+        ContainerRuntimeOptionImpl cro = new PortletDefinitionContainerRuntimeOptionImpl(this, name);
+        getContainerRuntimeOptions().add(cro);
+        return cro;        
+    }
+
+    public List<String> getSupportedPublicRenderParameters()
+    {
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = (List<SupportedPublicRenderParameter>)JPAUtils.createList();
+        }
+        List<String> params = new ArrayList<String>();
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
+        {
+            params.add(param.toString());
+        }
+        return params;
+    }
+    
+    public void addSupportedPublicRenderParameter(String identifier)
+    {
+        if (supportedPublicRenderParameters == null)
+        {
+            supportedPublicRenderParameters = (List<SupportedPublicRenderParameter>)JPAUtils.createList();
+        }
+        for (SupportedPublicRenderParameter param : this.supportedPublicRenderParameters)
+        {
+            if (param.equals(identifier))
+            {
+                throw new IllegalArgumentException("Support for public render parameter with identifier: "+identifier+" already defined");
+            }
+        }
+        if (supportedPublicRenderParametersList == null)
+        {
+            supportedPublicRenderParametersList = new PortletDefinitionList<SupportedPublicRenderParameter>(this, supportedPublicRenderParameters);
+        }
+        supportedPublicRenderParametersList.add(new SupportedPublicRenderParameterImpl(identifier));        
+    }
+
     /**
      * Get new persistent status.
      * 

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletQNameImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletQNameImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletQNameImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletQNameImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,108 @@
+/*
+ * 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.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
+import javax.xml.namespace.QName;
+
+import org.apache.jetspeed.om.portlet.PortletQName;
+
+@MappedSuperclass
+public class PortletQNameImpl implements PortletQName
+{
+    // Members
+    
+    @Basic
+    @Column (name="LOCAL_PART")
+    private String localPart;
+    @Basic
+    @Column (name="PREFIX")
+    private String prefix;
+    @Basic
+    @Column (name="NAMESPACE")
+    private String namespace;
+
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public PortletQNameImpl()
+    {
+    }
+    
+    /**
+     * Construct with specified qname.
+     * 
+     * @param qname qname of portlet implementation.
+     */
+    public PortletQNameImpl(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 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());
+    }
+
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+@Entity (name="ProcessingEventReference")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PROCESSING_EVENT")
+public class ProcessingEventReferenceImpl extends EventDefinitionReferenceImpl implements PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 1L;
+
+    // Members
+    
+    @Id
+    @GeneratedValue (strategy=GenerationType.AUTO)
+    @Column (name="ID")
+    private long id;
+    @Version
+    @Column (name="JPA_VERSION")
+    private int jpaVersion;
+    @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private PortletDefinitionImpl owner;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (PortletDefinitionImpl)inverse;
+    }
+    
+    // Implementation
+    
+    /**
+     * Default constructor
+     */
+    public ProcessingEventReferenceImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct event definition reference with specified qname.
+     * 
+     * @param qname qname of event definition reference.
+     */
+    public ProcessingEventReferenceImpl(QName qname)
+    {
+        super(qname);
+    }
+
+    /**
+     * Construct event definition reference with specified name.
+     * 
+     * @param qname name of event definition reference.
+     */
+    public ProcessingEventReferenceImpl(String qname)
+    {
+        super(new QName(qname));
+    }   
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jpa;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * PublicRenderParameterDescriptionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PublicRenderParameterDescription")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="LOCALIZED_DESCRIPTION")
+@DiscriminatorColumn (name="OWNER_CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.portlet.impl.PublicRenderParameterImpl")
+public class PublicRenderParameterDescriptionImpl extends DescriptionImpl implements PortletDefinitionCollectionMember
+{
+    private static final long serialVersionUID = 2937304565848638402L;
+
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PublicRenderParameterImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    private PublicRenderParameterImpl owner;
+
+    /**
+     * Default constructor
+     */
+    public PublicRenderParameterDescriptionImpl()
+    {
+        super();
+    }
+    
+    /**
+     * Construct with owner and language.
+     * 
+     * @param owner description owner.
+     * @param lang description language.
+     */
+    public PublicRenderParameterDescriptionImpl(Object owner, String lang)
+    {
+        super(owner, lang);
+        this.owner = (PublicRenderParameterImpl)owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.portlet.jpa.PortletDefinitionCollectionMember#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        owner = (PublicRenderParameterImpl)inverse;
+    }
+}



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