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 [4/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...
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/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/jpa/PublicRenderParameterImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,308 @@
+/*
+ * 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.PortletQName;
+import org.apache.jetspeed.om.portlet.PublicRenderParameter;
+import org.apache.jetspeed.util.JetspeedLocale;
+
+/**
+ * @version $Id: PublicRenderParameterImpl.java 720057 2008-11-23 22:31:00Z ate $
+ *
+ */
+@Entity (name="PublicRenderParameter")
+@Table (name="PUBLIC_PARAMETER")
+public class PublicRenderParameterImpl implements PublicRenderParameter, 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="IDENTIFIER")
+ private String identifier;
+ @OneToMany (targetEntity=ParameterAliasImpl.class, mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+ private List<ParameterAliasImpl> aliases;
+ @OneToMany (targetEntity=PublicRenderParameterDescriptionImpl.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<ParameterAliasImpl> 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 PublicRenderParameterImpl()
+ {
+ }
+
+ /**
+ * Construct public render parameter with specified name and identifier.
+ *
+ * @param name name of parameter.
+ * @param identifier identifier of parameter.
+ */
+ public PublicRenderParameterImpl(String name, String identifier)
+ {
+ this.localPart = name;
+ this.identifier = identifier;
+ }
+
+ /**
+ * Construct public render parameter with specified qname.
+ *
+ * @param qname qname of parameter.
+ */
+ 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()
+ {
+ return identifier;
+ }
+
+ public void setIdentifier(String value)
+ {
+ identifier = value;
+ }
+
+ 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 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 ((this.getNamespace() == null) ? "" : this.getNamespace() + "//:") +
+ ((this.getPrefix() == null) ? "" : this.getPrefix() + ":") +
+ ((this.getLocalPart() == null) ? "" : this.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<ParameterAliasImpl>)JPAUtils.createList();
+ }
+ if (aliasesList == null)
+ {
+ aliasesList = new PortletDefinitionList<ParameterAliasImpl>(this, aliases);
+ }
+ if (!containsAlias(alias))
+ {
+ aliasesList.add(new ParameterAliasImpl(alias));
+ }
+ }
+
+ protected boolean containsAlias(QName qname)
+ {
+ if (aliases != null)
+ {
+ PortletQName alias = new ParameterAliasImpl(qname);
+ for (PortletQName p : aliases)
+ {
+ if (p.equals(alias))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ 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)
+ {
+ PublicRenderParameterDescriptionImpl d = new PublicRenderParameterDescriptionImpl(this, lang);
+ for (Description desc : getDescriptions())
+ {
+ if (desc.getLocale().equals(d.getLocale()))
+ {
+ throw new IllegalArgumentException("Description for language: "+d.getLocale()+" already defined");
+ }
+ }
+ getDescriptions();
+ descriptions.add(d);
+ return d;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.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/PublishingEventReferenceImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,91 @@
+/*
+ * 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="PublishingEventReference")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PUBLISHING_EVENT")
+public class PublishingEventReferenceImpl 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 PublishingEventReferenceImpl()
+ {
+ super();
+ }
+
+ /**
+ * Construct event definition reference with specified qname.
+ *
+ * @param qname qname of event definition reference.
+ */
+ public PublishingEventReferenceImpl(QName qname)
+ {
+ super(qname);
+ }
+
+ /**
+ * Construct event definition reference with specified name.
+ *
+ * @param qname name of event definition reference.
+ */
+ public PublishingEventReferenceImpl(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/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/jpa/SupportedPublicRenderParameterImpl.java?rev=746641&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java Sun Feb 22 06:06:20 2009
@@ -0,0 +1,89 @@
+/*
+ * 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.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.SupportedPublicRenderParameter;
+
+@Entity (name="SupportedPublicRenderParameter")
+@Table (name="NAMED_PARAMETER")
+public class SupportedPublicRenderParameterImpl implements SupportedPublicRenderParameter, PortletDefinitionCollectionMember
+{
+ // 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;
+ @Basic
+ @Column (name="NAME")
+ private String name;
+
+ /* (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 SupportedPublicRenderParameterImpl()
+ {
+ }
+
+ public SupportedPublicRenderParameterImpl(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean equals(Object qname)
+ {
+ return (this.toString().equals(qname.toString()));
+ }
+
+ public String toString()
+ {
+ return name;
+ }
+}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/resources/META-INF/persistence.xml Sun Feb 22 06:06:20 2009
@@ -28,29 +28,44 @@
<class>org.apache.jetspeed.components.portletpreferences.jpa.DatabasePreference</class>
<class>org.apache.jetspeed.components.portletpreferences.jpa.DatabasePreferenceValue</class>
<class>org.apache.jetspeed.om.portlet.jpa.BaseLocalizedImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.ContainerRuntimeOptionImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.ContainerRuntimeOptionValueImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.CustomPortletModeDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.CustomPortletModeImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.CustomWindowStateDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.CustomWindowStateImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.DescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.DisplayNameImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.EventAliasImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.EventDefinitionDescriptionImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.EventDefinitionImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.EventDefinitionReferenceImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.InitParamDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.InitParamImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.JetspeedServiceReferenceImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.LanguageImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.LocalizedFieldImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.ParameterAliasImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PortletApplicationContainerRuntimeOptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletApplicationDefinitionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletApplicationDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletApplicationDisplayNameImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletApplicationLocalizedFieldImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PortletDefinitionContainerRuntimeOptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletDefinitionDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletDefinitionDisplayNameImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletDefinitionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.PortletDefinitionLocalizedFieldImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PortletQNameImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.ProcessingEventReferenceImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PublicRenderParameterDescriptionImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PublicRenderParameterImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.PublishingEventReferenceImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.SecurityRoleDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.SecurityRoleImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.SecurityRoleRefDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.SecurityRoleRefImpl</class>
+ <class>org.apache.jetspeed.om.portlet.jpa.SupportedPublicRenderParameterImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.SupportsImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.UserAttributeDescriptionImpl</class>
<class>org.apache.jetspeed.om.portlet.jpa.UserAttributeImpl</class>
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java Sun Feb 22 06:06:20 2009
@@ -185,6 +185,7 @@
assertNotNull("App did NOT persist its description", app.getDescription(Locale.FRENCH));
+ TestPortletRegistryDAO.verifyPortlet20Data(app, portlet);
}
protected String getBeanDefinitionFilterCategories()
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java Sun Feb 22 06:06:20 2009
@@ -18,22 +18,30 @@
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import java.util.Locale;
+import javax.xml.namespace.QName;
+
import org.apache.jetspeed.Jetspeed;
import org.apache.jetspeed.components.persistence.store.LockFailedException;
import org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase;
import org.apache.jetspeed.engine.MockJetspeedEngine;
-import org.apache.jetspeed.om.portlet.InitParam;
-import org.apache.jetspeed.om.portlet.Language;
-import org.apache.jetspeed.om.portlet.Supports;
-import org.apache.jetspeed.om.portlet.UserAttribute;
-import org.apache.jetspeed.om.portlet.Preference;
-import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
+import org.apache.jetspeed.om.portlet.Description;
import org.apache.jetspeed.om.portlet.DublinCore;
+import org.apache.jetspeed.om.portlet.EventDefinition;
+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;
import org.apache.jetspeed.om.portlet.PortletApplication;
import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Preference;
+import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.portlet.PublicRenderParameter;
+import org.apache.jetspeed.om.portlet.Supports;
+import org.apache.jetspeed.om.portlet.UserAttribute;
import org.apache.jetspeed.om.portlet.UserAttributeRef;
import org.apache.jetspeed.om.portlet.impl.DublinCoreImpl;
import org.apache.jetspeed.util.JetspeedLocale;
@@ -200,9 +208,11 @@
supports.addPortletMode(MODE_HELP);
supports.addPortletMode(MODE_VIEW);
- portletRegistry.updatePortletApplication(app);
+ build20TestData(app, portlet);
+ portletRegistry.updatePortletApplication(app);
}
-
+
+
protected void verifyData(boolean afterUpdates) throws Exception
{
PortletApplication app;
@@ -275,9 +285,11 @@
app = portletRegistry.getPortletApplication("App_1");
assertNotNull("App did NOT persist its description", app.getDescription(Locale.FRENCH));
-
+
+ verifyPortlet20Data(app, portlet);
}
-
+
+
protected void validateDublinCore(GenericMetadata metadata)
{
DublinCore dc = new DublinCoreImpl(metadata);
@@ -307,4 +319,179 @@
return new String[]
{ "transaction.xml", "registry-test.xml", "cache-test.xml", "static-bean-references.xml" };
}
+
+ public static void build20TestData(PortletApplication app, PortletDefinition portlet)
+ throws RegistryException
+ {
+ // Portlet 2.0 Support
+ app.setDefaultNamespace("http:apache.org/events");
+ portlet.setCacheScope("private");
+ portlet.setExpirationCache(-1);
+ EventDefinition event = app.addEventDefinition("plainOldEvent");
+ event.setValueType("java.lang.String");
+ Description en1 = event.addDescription("en");
+ en1.setDescription("The Plain Old Event");
+ Description fr1 = event.addDescription("fr");
+ fr1.setDescription("Le Vieux Ordinaire vnement");
+
+ QName q2 = new QName("http:portals.apache.org/events", "qualifiedEvent");
+ EventDefinition event2 = app.addEventDefinition(q2);
+ event2.setValueType("java.lang.String");
+
+ QName q3 = new QName("http:portals.apache.org/events", "prefixedEvent", "x");
+ EventDefinition event3 = app.addEventDefinition(q3);
+ event3.setValueType("java.lang.String");
+ event3.addAlias(new QName("local-1"));
+ event3.addAlias(new QName("http:2portals.apache.org/events", "local-2"));
+ event3.addAlias(new QName("http:3portals.apache.org/events", "local-3", "p"));
+ // test dupes
+ event3.addAlias(new QName("local-1"));
+ event3.addAlias(new QName("http:2portals.apache.org/events", "local-2"));
+ event3.addAlias(new QName("http:3portals.apache.org/events", "local-3", "p"));
+ assertEquals(event3.getAliases().size(), 3);
+
+ portlet.addSupportedProcessingEvent("plainOldEvent");
+ portlet.addSupportedProcessingEvent(q3);
+ portlet.addSupportedPublishingEvent("local-1");
+ portlet.addSupportedPublishingEvent(q2);
+
+ portlet.addSupportedPublicRenderParameter("city");
+ portlet.addSupportedPublicRenderParameter("zipcode");
+
+ ContainerRuntimeOption opt1 = portlet.addContainerRuntimeOption("PortletOption1");
+ opt1.addValue("p-value-1");
+ opt1.addValue("p-value-2");
+ opt1.addValue("p-value-3");
+ ContainerRuntimeOption opt2 = portlet.addContainerRuntimeOption("PortletOption2");
+ opt2.addValue("p-value-4");
+ opt2.addValue("p-value-5");
+
+ ContainerRuntimeOption opt3 = app.addContainerRuntimeOption("AppOption1");
+ opt3.addValue("a-value-1");
+ opt3.addValue("a-value-2");
+ opt3.addValue("a-value-3");
+ ContainerRuntimeOption opt4 = app.addContainerRuntimeOption("AppOption2");
+ opt4.addValue("a-value-4");
+
+ PublicRenderParameter prp1 = app.addPublicRenderParameter("prp1", "prp1-id");
+ Description d1 = prp1.addDescription("en");
+ d1.setDescription("dog");
+ Description d2 = prp1.addDescription("fr");
+ d2.setDescription("chien");
+ prp1.addAlias(new QName("alias-1"));
+ }
+
+ public static void verifyPortlet20Data(PortletApplication app, PortletDefinition portlet)
+ throws Exception
+ {
+ // Portlet 2.0 Support
+ assertEquals(app.getDefaultNamespace(), "http:apache.org/events");
+ assertEquals(portlet.getCacheScope(), "private");
+ assertEquals(portlet.getExpirationCache(), -1);
+
+ List<EventDefinition> events = app.getEventDefinitions();
+ assertNotNull(events);
+ assertTrue(events.size() == 3);
+ EventDefinition event1 = events.get(0);
+ assertNotNull(event1);
+ assertEquals(event1.getName(), "plainOldEvent");
+ assertEquals(event1.getValueType(), "java.lang.String");
+ QName q = event1.getQName();
+ assertEquals(q.getNamespaceURI(), "");
+ assertEquals(q.getPrefix(), "");
+ Description en = event1.getDescription(new Locale("en"));
+ assertEquals(en.getDescription(), "The Plain Old Event");
+ Description fr = event1.getDescription(new Locale("fr"));
+ assertEquals(fr.getDescription(), "Le Vieux Ordinaire vnement");
+
+ EventDefinition event2 = events.get(1);
+ assertNotNull(event2);
+ QName qname = event2.getQName();
+ assertEquals(qname.getNamespaceURI(), "http:portals.apache.org/events");
+ assertEquals(qname.getLocalPart(), "qualifiedEvent");
+ assertEquals(event2.getValueType(), "java.lang.String");
+ assertEquals(qname.getPrefix(), "");
+
+ EventDefinition event3 = events.get(2);
+ assertNotNull(event3);
+ QName qname3 = event3.getQName();
+ assertEquals(qname3.getNamespaceURI(), "http:portals.apache.org/events");
+ assertEquals(qname3.getLocalPart(), "prefixedEvent");
+ assertEquals(qname3.getPrefix(), "x");
+ assertEquals(event3.getValueType(), "java.lang.String");
+
+ QName alias1 = event3.getAliases().get(0);
+ assertEquals(alias1.getLocalPart(), "local-1");
+ QName alias2 = event3.getAliases().get(1);
+ assertEquals(alias2.getLocalPart(), "local-2");
+ assertEquals(alias2.getNamespaceURI(), "http:2portals.apache.org/events");
+ QName alias3 = event3.getAliases().get(2);
+ assertEquals(alias3.getLocalPart(), "local-3");
+ assertEquals(alias3.getNamespaceURI(), "http:3portals.apache.org/events");
+ assertEquals(alias3.getPrefix(), "p");
+
+ List<EventDefinitionReference> refs = portlet.getSupportedProcessingEvents();
+ assertEquals(refs.size(), 2);
+ EventDefinitionReference ref1 = refs.get(0);
+ assertEquals(ref1.getName(), "plainOldEvent");
+ EventDefinitionReference ref2 = refs.get(1);
+ QName ref2QName = ref2.getQName();
+ assertEquals(ref2QName, new QName("http:portals.apache.org/events", "prefixedEvent", "x"));
+
+ List<EventDefinitionReference> pubRefs = portlet.getSupportedPublishingEvents();
+ assertEquals(pubRefs.size(), 2);
+ EventDefinitionReference pubRef1 = pubRefs.get(0);
+ assertEquals(pubRef1.getName(), "local-1");
+ EventDefinitionReference pubRef2 = pubRefs.get(1);
+ QName pubRef2QName = pubRef2.getQName();
+ assertEquals(pubRef2QName, new QName("http:portals.apache.org/events", "qualifiedEvent"));
+
+ List<String> supportedRenderParams = portlet.getSupportedPublicRenderParameters();
+ assertEquals(supportedRenderParams.size(), 2);
+ String p1 = supportedRenderParams.get(0);
+ assertEquals(p1, "city");
+ String p2 = supportedRenderParams.get(1);
+ assertEquals(p2, "zipcode");
+
+ List<ContainerRuntimeOption> portletOptions = portlet.getContainerRuntimeOptions();
+ assertEquals(portletOptions.size(), 2);
+ ContainerRuntimeOption opt1 = portlet.getContainerRuntimeOption("PortletOption1");
+ assertEquals(opt1.getName(), "PortletOption1");
+ assertEquals(opt1.getValues().size(), 3);
+ assertEquals(opt1.getValues().get(0), "p-value-1");
+ assertEquals(opt1.getValues().get(1), "p-value-2");
+ assertEquals(opt1.getValues().get(2), "p-value-3");
+ ContainerRuntimeOption opt2 = portlet.getContainerRuntimeOption("PortletOption2");
+ assertEquals(opt2.getName(), "PortletOption2");
+ assertEquals(opt2.getValues().size(), 2);
+ assertEquals(opt2.getValues().get(0), "p-value-4");
+ assertEquals(opt2.getValues().get(1), "p-value-5");
+
+ List<ContainerRuntimeOption> appOptions = app.getContainerRuntimeOptions();
+ assertEquals(appOptions.size(), 2);
+ ContainerRuntimeOption opt3 = app.getContainerRuntimeOption("AppOption1");
+ assertEquals(opt3.getName(), "AppOption1");
+ assertEquals(opt3.getValues().size(), 3);
+ assertEquals(opt3.getValues().get(0), "a-value-1");
+ assertEquals(opt3.getValues().get(1), "a-value-2");
+ assertEquals(opt3.getValues().get(2), "a-value-3");
+ ContainerRuntimeOption opt4 = app.getContainerRuntimeOption("AppOption2");
+ assertEquals(opt4.getName(), "AppOption2");
+ assertEquals(opt4.getValues().size(), 1);
+ assertEquals(opt4.getValues().get(0), "a-value-4");
+
+ PublicRenderParameter x = app.getPublicRenderParameter("prp1-id");
+ assertNotNull(x);
+ assertEquals(x.getName(), "prp1");
+ List<PublicRenderParameter> xs = app.getPublicRenderParameters();
+ assertEquals(xs.size(), 1);
+ Description d1 = x.getDescription(new Locale("en"));
+ assertEquals(d1.getDescription(), "dog");
+ Description d2 = x.getDescription(new Locale("fr"));
+ assertEquals(d2.getDescription(), "chien");
+ List<QName> aliases = x.getAliases();
+ assertEquals(aliases.size(), 1);
+ assertEquals(aliases.get(0).getLocalPart(), "alias-1");
+ }
+
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java Sun Feb 22 06:06:20 2009
@@ -22,6 +22,7 @@
import org.apache.jetspeed.components.persistence.store.LockFailedException;
import org.apache.jetspeed.components.portletregistry.AbstractRegistryTest;
import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.components.portletregistry.TestPortletRegistryDAO;
import org.apache.jetspeed.om.portlet.InitParam;
import org.apache.jetspeed.om.portlet.Language;
import org.apache.jetspeed.om.portlet.Preference;
@@ -122,6 +123,7 @@
supports.addPortletMode(MODE_HELP);
supports.addPortletMode(MODE_VIEW);
+ TestPortletRegistryDAO.build20TestData(app, portlet);
registry.registerPortletApplication(app);
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java Sun Feb 22 06:06:20 2009
@@ -18,11 +18,14 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import org.apache.jetspeed.security.mapping.model.Attribute;
import org.apache.jetspeed.security.mapping.model.AttributeDef;
+import java.util.Arrays;
+
/**
* @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
* @version $Id$
@@ -65,7 +68,17 @@
public Collection<String> getValues()
{
- return getDefinition().isMultiValue() ? values : null;
+ if(getDefinition().isMultiValue())
+ {
+ return values;
+ }else{
+ if(value==null)
+ {
+ return Collections.emptyList();
+ }else{
+ return Arrays.asList(new String[]{value});
+ }
+ }
}
public void setValues(Collection<String> values)
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java Sun Feb 22 06:06:20 2009
@@ -18,6 +18,7 @@
import java.io.Serializable;
import java.sql.SQLException;
+import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -95,6 +96,24 @@
super(repositoryPath);
}
+ @SuppressWarnings("unchecked")
+ protected Long getPrincipalId(String name, String type, Long domainId) throws SecurityException
+ {
+ Criteria criteria = new Criteria();
+ criteria.addEqualTo("name", name);
+ criteria.addEqualTo("type", type);
+ criteria.addEqualTo("domainId", domainId);
+ ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
+ query.setAttributes(new String[]{"id"});
+ // need to force OJB to return a Long, otherwise it'll return a Integer causing a CCE
+ query.setJdbcTypes(new int[]{Types.BIGINT});
+ for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); iter.hasNext(); )
+ {
+ return (Long)iter.next()[0];
+ }
+ throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(type, name));
+ }
+
public boolean principalExists(JetspeedPrincipal principal)
{
if (principal.getId() == null)
@@ -914,17 +933,17 @@
public void revokePermission(PersistentJetspeedPermission permission, JetspeedPrincipal principal) throws SecurityException
{
+ Long principalId = null;
Criteria criteria = new Criteria();
if (principal.isTransient() || principal.getId() == null)
{
- criteria.addEqualTo("principal.type", principal.getType());
- criteria.addEqualTo("principal.name", principal.getName());
- criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
+ principalId = getPrincipalId(principal.getName(), principal.getType().getName(), getDefaultSecurityDomainId());
}
else
{
- criteria.addEqualTo("principalId", principal.getId());
+ principalId = principal.getId();
}
+ criteria.addEqualTo("principalId", principalId);
if (permission.getId() == null)
{
criteria.addEqualTo("permission.type", permission.getType());
@@ -951,17 +970,17 @@
public void revokeAllPermissions(JetspeedPrincipal principal) throws SecurityException
{
+ Long principalId = null;
Criteria criteria = new Criteria();
if (principal.isTransient() || principal.getId() == null)
{
- criteria.addEqualTo("principal.type", principal.getType());
- criteria.addEqualTo("principal.name", principal.getName());
- criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
+ principalId = getPrincipalId(principal.getName(), principal.getType().getName(), getDefaultSecurityDomainId());
}
else
{
- criteria.addEqualTo("principalId", principal.getId());
+ principalId = principal.getId();
}
+ criteria.addEqualTo("principalId", principalId);
Query query = QueryFactory.newQuery(JetspeedPrincipalPermission.class,criteria);
try
{
@@ -1037,8 +1056,7 @@
}
else
{
- // return fake id that should not exist
- return new Long(-1);
+ throw new IllegalStateException("The default security domain could not be found.");
}
}
return defaultSecurityDomainId;
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java Sun Feb 22 06:06:20 2009
@@ -39,12 +39,12 @@
@IdClass (value=JetspeedPrincipalPermission.JetspeedPrincipalPermissionId.class)
@Table (name="PRINCIPAL_PERMISSION")
@NamedQueries ({@NamedQuery(name="PRINCIPAL_PERMISSION", query="select pp from PrincipalPermission pp where pp.principalId = :principalId and pp.permissionId = :permissionId"),
- @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION", query="delete from PrincipalPermission pp where pp.principalId = :principalId and pp.permissionId = :permissionId"),
- @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION", query="delete from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = :permissionId"),
- @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION_TYPE_NAME", query="delete from PrincipalPermission pp, Permission pm where pp.principalId = :principalId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
- @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION_TYPE_NAME", query="delete from PrincipalPermission pp, Principal p, Permission pm where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
- @NamedQuery(name="DELETE_PRINCIPAL_PERMISSIONS", query="delete from PrincipalPermission pp where pp.principalId = :principalId"),
- @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSIONS", query="delete from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId")})
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION", query="select pp from PrincipalPermission pp where pp.principalId = :principalId and pp.permissionId = :permissionId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION", query="select pp from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = :permissionId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION_TYPE_NAME", query="select pp from PrincipalPermission pp, Permission pm where pp.principalId = :principalId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION_TYPE_NAME", query="select pp from PrincipalPermission pp, Principal p, Permission pm where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSIONS", query="select pp from PrincipalPermission pp where pp.principalId = :principalId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSIONS", query="select pp from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId")})
public class JetspeedPrincipalPermission implements Serializable
{
private static final long serialVersionUID = 1842368505096279355L;
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedSecurityPersistenceManager.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedSecurityPersistenceManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedSecurityPersistenceManager.java Sun Feb 22 06:06:20 2009
@@ -1165,6 +1165,7 @@
}
@Transactional (readOnly=false, rollbackFor=SecurityException.class)
+ @SuppressWarnings("unchecked")
public void revokePermission(PersistentJetspeedPermission permission, JetspeedPrincipal principal) throws SecurityException
{
// perform principal permission delete
@@ -1185,7 +1186,7 @@
principalPermissionDelete = entityManager.createNamedQuery("DELETE_PRINCIPAL_TYPE_NAME_PERMISSION");
principalPermissionDelete.setParameter("permissionId", permission.getId());
}
- principalPermissionDelete.setParameter("principalType", principal.getType());
+ principalPermissionDelete.setParameter("principalType", principal.getType().getName());
principalPermissionDelete.setParameter("principalName", principal.getName());
principalPermissionDelete.setParameter("principalDomainId", getDefaultSecurityDomainId());
}
@@ -1208,13 +1209,24 @@
}
try
{
- principalPermissionDelete.executeUpdate();
- // evict all principal and persistence object instances and
- // related queries from cache since the relationships between
- // the principals and permissions are not modeled explicitly
- // in JPA metadata
- evictFromCache(PersistentJetspeedPrincipal.class);
- evictFromCache(PersistentJetspeedPermissionImpl.class);
+ List<JetspeedPrincipalPermission> deleteList = principalPermissionDelete.getResultList();
+ if (!deleteList.isEmpty())
+ {
+ // remove queried permissions
+ for (JetspeedPrincipalPermission delete : deleteList)
+ {
+ entityManager.remove(delete);
+ }
+ // explicitly flush entity manager after remove
+ entityManager.flush();
+
+ // evict all principal and persistence object instances and
+ // related queries from cache since the relationships between
+ // the principals and permissions are not modeled explicitly
+ // in JPA metadata
+ evictFromCache(PersistentJetspeedPrincipal.class);
+ evictFromCache(PersistentJetspeedPermissionImpl.class);
+ }
}
catch (Exception e)
{
@@ -1225,6 +1237,7 @@
}
@Transactional (readOnly=false, rollbackFor=SecurityException.class)
+ @SuppressWarnings("unchecked")
public void revokeAllPermissions(JetspeedPrincipal principal) throws SecurityException
{
// perform principal permissions delete
@@ -1234,7 +1247,7 @@
{
// delete by principal type, name, and domain
principalPermissionsDelete = entityManager.createNamedQuery("DELETE_PRINCIPAL_TYPE_NAME_PERMISSIONS");
- principalPermissionsDelete.setParameter("principalType", principal.getType());
+ principalPermissionsDelete.setParameter("principalType", principal.getType().getName());
principalPermissionsDelete.setParameter("principalName", principal.getName());
principalPermissionsDelete.setParameter("principalDomainId", getDefaultSecurityDomainId());
}
@@ -1246,13 +1259,24 @@
}
try
{
- principalPermissionsDelete.executeUpdate();
- // evict all principal and persistence object instances and
- // related queries from cache since the relationships between
- // the principals and permissions are not modeled explicitly
- // in JPA metadata
- evictFromCache(PersistentJetspeedPrincipal.class);
- evictFromCache(PersistentJetspeedPermissionImpl.class);
+ List<JetspeedPrincipalPermission> deleteList = principalPermissionsDelete.getResultList();
+ if (!deleteList.isEmpty())
+ {
+ // remove queried permissions
+ for (JetspeedPrincipalPermission delete : deleteList)
+ {
+ entityManager.remove(delete);
+ }
+ // explicitly flush entity manager after remove
+ entityManager.flush();
+
+ // evict all principal and persistence object instances and
+ // related queries from cache since the relationships between
+ // the principals and permissions are not modeled explicitly
+ // in JPA metadata
+ evictFromCache(PersistentJetspeedPrincipal.class);
+ evictFromCache(PersistentJetspeedPermissionImpl.class);
+ }
}
catch (Exception e)
{
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestPermissionManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestPermissionManager.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestPermissionManager.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestPermissionManager.java Sun Feb 22 06:06:20 2009
@@ -31,6 +31,8 @@
import javax.security.auth.Subject;
+import org.apache.jetspeed.security.impl.TransientUser;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -161,7 +163,10 @@
try
{
- pms.revokeAllPermissions(user);
+ // test revokeAllPrincipal a Transient User representation to ensure
+ // that use-case is covered too because it requires additional
+ // handling (lookup of the principal Id first)
+ pms.revokeAllPermissions(new TransientUser("test"));
Permissions permissions = pms.getPermissions(user);
assertEquals(
"permissions should be empty for user " + user.getName(),
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java Sun Feb 22 06:06:20 2009
@@ -70,6 +70,7 @@
public static final String PAGE_LAYOUT_HELP = "org.apache.jetspeed.layout.help";
public static final String PAGE_LAYOUT_EDIT = "org.apache.jetspeed.layout.edit";
public static final String PAGE_LAYOUT_SOLO = "org.apache.jetspeed.layout.solo";
+ public static final String PORTLET_CONTAINER_INVOKER_USE_FORWARD = "org.apache.jetspeed.portlet.container.invoker.useForward";
/**
* Setting this as a session attribute will override all themes declared in
@@ -139,14 +140,4 @@
* </p>
*/
public static final String PORTLET_EXTENDED_DESCRIPTOR_MERGE_PORTAL_PARAMETERS_BEFORE_PORTLET_PARAMETERS = "merge.portal.parameters.before.portlet.parameters";
-
- /**
- * Preliminary Portlet API 2.0 ResourceURL support.
- * By setting the RenderURL parameter PORTLET_RESOURCE_URL_REQUEST_PARAMETER (with whatever value) the Jetspeed encoded PortletURL
- * will be marked as a ResourceURL (the parameter itself will not be stored).
- * By invoking such a Render/ResourceURL, NavigationalState.getPortletWindowOfResource() will be set, and with an custom Valve
- * (example implementation o.a.j.resource.ResourceValveImpl) this PortletWindow can be invoked directly,
- * similar as an ActionURL but as a direct Portlet Render request.
- */
- public static final String PORTLET_RESOURCE_URL_REQUEST_PARAMETER = "org.apache.jetspeed.portlet.resource.url";
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/PortletRegistry.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/PortletRegistry.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/PortletRegistry.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletregistry/PortletRegistry.java Sun Feb 22 06:06:20 2009
@@ -130,4 +130,13 @@
void addRegistryListener(RegistryEventListener listener);
void removeRegistryEventListener(RegistryEventListener listener);
+
+ /**
+ * Given a portlet definition, create a clone of it, with a new name
+ * @param source the portlet definition to be cloned
+ * @param newPortletName the unique name of the new portlet definition
+ * @throws FailedToStorePortletDefinitionException
+ */
+ void clonePortletDefinition(PortletDefinition source, String newPortletName) throws FailedToStorePortletDefinitionException;
+
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/state/NavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/state/NavigationalState.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/state/NavigationalState.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/state/NavigationalState.java Sun Feb 22 06:06:20 2009
@@ -25,6 +25,7 @@
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.url.PortalURL;
/**
* NavigationalState gives readonly access to the state of the Portal URL and all navigational state context
@@ -134,12 +135,14 @@
*/
PortletWindow getMaximizedWindow();
- Iterator getParameterNames(PortletWindow window);
+ Iterator<String> getParameterNames(PortletWindow window);
String[] getParameterValues(PortletWindow window, String parameterName);
Map<String, String[]> getParameterMap(PortletWindow window);
+ PortalURL.URLType getURLType();
+
PortletWindow getPortletWindowOfAction();
PortletWindow getPortletWindowOfResource();
@@ -151,7 +154,7 @@
* the PortletWindowOfAction.
* @return iterator of portletWindow ids (String)
*/
- Iterator getWindowIdIterator();
+ Iterator<String> getWindowIdIterator();
/**
* Encodes the Navigational State with overrides for a specific PortletWindow into a string to be embedded within a
@@ -163,8 +166,22 @@
* @param state the new WindowState for the PortalWindow
* @param action indicates if to be used in an actionURL or renderURL
* @return encoded new Navigational State
+ * @deprecated
+ */
+ String encode(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action) throws UnsupportedEncodingException;
+
+ /**
+ * Encodes the Navigational State with overrides for a specific PortletWindow into a string to be embedded within a
+ * PortalURL.
+ *
+ * @param window the PortalWindow
+ * @param parameters the new request or action parameters for the PortalWindow
+ * @param mode the new PortletMode for the PortalWindow
+ * @param state the new WindowState for the PortalWindow
+ * @param urlType indicates if to be used in an actionURL, ResourceURL or renderURL
+ * @return encoded new Navigational State
*/
- String encode(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action) throws UnsupportedEncodingException;
+ String encode(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, PortalURL.URLType urlType) throws UnsupportedEncodingException;
/**
* Encodes the Navigational State with overrides for a specific PortletWindow while retaining its (request)
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/container/url/PortalURL.java Sun Feb 22 06:06:20 2009
@@ -39,6 +39,8 @@
*/
public interface PortalURL
{
+ enum URLType { ACTION, RESOURCE, RENDER }
+
/** HTTP protocol. */
public static final String HTTP = "http";
@@ -115,8 +117,24 @@
* @param action indicates if an actionURL or renderURL is created
* @param secure indicates if a secure url is required
* @return a new actionURL or renderURL as String
+ * @deprecated
+ */
+ String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action, boolean secure);
+
+ /**
+ * Create a new PortletURL for a PortletWindow including request or action parameters.
+ * <br>
+ * The Portal Navigational State is encoded within the URL
+ *
+ * @param window the PortalWindow
+ * @param parameters the new request or action parameters for the PortalWindow
+ * @param mode the new PortletMode for the PortalWindow
+ * @param state the new WindowState for the PortalWindow
+ * @param urlType indicates if an actionURL, Resource or renderURL is to created
+ * @param secure indicates if a secure url is required
+ * @return a new actionURL or renderURL as String
*/
- String createPortletURL(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action, boolean secure);
+ String createPortletURL(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, URLType urlType, boolean secure);
/**
* Create a new PortletURL for a PortletWindow retaining its (request) parameters.
@@ -152,8 +170,23 @@
* @param action indicates if an actionURL or renderURL is created
* @param secure indicates if a secure url is required
* @return a new navigational state as String
+ * @deprecated
+ */
+ String createNavigationalEncoding(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, boolean action);
+
+ /**
+ * Creates the navigational encoding for a given window
+ * Similiar to createPortletURL above
+ *
+ * @param window the PortalWindow
+ * @param parameters the new request or action parameters for the PortalWindow
+ * @param mode the new PortletMode for the PortalWindow
+ * @param state the new WindowState for the PortalWindow
+ * @param urlType indicates if an actionURL, Resource or renderURL is to created
+ * @param secure indicates if a secure url is required
+ * @return a new navigational state as String
*/
- String createNavigationalEncoding(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action);
+ String createNavigationalEncoding(PortletWindow window, Map<String, String[]> parameters, PortletMode mode, WindowState state, URLType urlType);
/**
* Creates the navigational encoding for a given window
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/GenericMetadata.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/GenericMetadata.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/GenericMetadata.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/GenericMetadata.java Sun Feb 22 06:06:20 2009
@@ -58,7 +58,7 @@
* @param name
* @return
*/
- public Collection getFields( String name );
+ public Collection<LocalizedField> getFields( String name );
/**
*
@@ -69,7 +69,7 @@
* @param name
* @param values
*/
- public void setFields( String name, Collection values );
+ public void setFields( String name, Collection<LocalizedField> values );
/**
*
@@ -79,7 +79,7 @@
*
* @return
*/
- public Collection getFields();
+ public Collection<LocalizedField> getFields();
/**
*
@@ -89,7 +89,7 @@
*
* @param fields
*/
- public void setFields( Collection fields );
+ public void setFields( Collection<LocalizedField> fields );
/**
*
@@ -109,5 +109,5 @@
*
* @param fields
*/
- public void copyFields( Collection fields );
+ public void copyFields( Collection<LocalizedField> fields );
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/container/JetspeedContainerServlet.java Sun Feb 22 06:06:20 2009
@@ -26,9 +26,15 @@
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
import javax.portlet.PortletRequest;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceServingPortlet;
import javax.portlet.UnavailableException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
@@ -262,7 +268,6 @@
ActionRequest actionRequest = (ActionRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
ActionResponse actionResponse = (ActionResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
((InternalPortletRequest)actionRequest).init(portlet.getConfig().getPortletContext(), jetspeedServletWrapper);
- ((InternalPortletRequest)actionRequest).setIncluded(true);
portlet.processAction(actionRequest, actionResponse);
}
else if (method == ContainerConstants.METHOD_RENDER)
@@ -284,6 +289,44 @@
((InternalPortletRequest)renderRequest).init(portlet.getConfig().getPortletContext(), jetspeedServletWrapper);
portlet.render(renderRequest, renderResponse);
}
+ else if (method == ContainerConstants.METHOD_EVENT)
+ {
+ EventRequest eventRequest = null;
+ EventResponse eventResponse = null;
+
+ if (isParallelMode)
+ {
+ eventRequest = (EventRequest) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ eventResponse = (EventResponse) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+ }
+ else
+ {
+ eventRequest = (EventRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ eventResponse = (EventResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+
+ }
+ ((InternalPortletRequest)eventRequest).init(portlet.getConfig().getPortletContext(), jetspeedServletWrapper);
+ ((EventPortlet)portlet.getRealPortlet()).processEvent(eventRequest, eventResponse);
+ }
+ else if (method == ContainerConstants.METHOD_RESOURCE && portlet.getRealPortlet() instanceof ResourceServingPortlet)
+ {
+ ResourceRequest resourceRequest = null;
+ ResourceResponse resourceResponse = null;
+
+ if (isParallelMode)
+ {
+ resourceRequest = (ResourceRequest) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ resourceResponse = (ResourceResponse) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+ }
+ else
+ {
+ resourceRequest = (ResourceRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ resourceResponse = (ResourceResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+
+ }
+ ((InternalPortletRequest)resourceRequest).init(portlet.getConfig().getPortletContext(), jetspeedServletWrapper);
+ ((ResourceServingPortlet)portlet.getRealPortlet()).serveResource(resourceRequest, resourceResponse);
+ }
// if we get this far we are home free
return;
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletObjectProxy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletObjectProxy.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletObjectProxy.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletObjectProxy.java Sun Feb 22 06:06:20 2009
@@ -20,14 +20,17 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.Modifier;
+import java.util.HashSet;
import java.util.List;
import java.io.IOException;
+import javax.portlet.EventPortlet;
import javax.portlet.Portlet;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
+import javax.portlet.ResourceServingPortlet;
import javax.portlet.WindowState;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -103,21 +106,34 @@
public static Object createProxy(Object proxiedObject, boolean autoSwitchEditDefaultsModeToEditMode, boolean autoSwitchConfigMode, String customConfigModePortletUniqueName)
{
- Class proxiedClass = proxiedObject.getClass();
- ClassLoader classLoader = proxiedClass.getClassLoader();
- Class [] proxyInterfaces = null;
-
- if (proxiedObject instanceof SupportsHeaderPhase)
+ HashSet<Class> interfaces = new HashSet<Class>();
+ interfaces.add(Portlet.class);
+ Class current = proxiedObject.getClass();
+ while (current != null)
{
- proxyInterfaces = new Class [] { Portlet.class, SupportsHeaderPhase.class };
- }
- else
- {
- proxyInterfaces = new Class [] { Portlet.class };
+ try
+ {
+ Class[] currentInterfaces = current.getInterfaces();
+ for (int i = 0; i < currentInterfaces.length; i++)
+ {
+ if (currentInterfaces[i] != Portlet.class)
+ {
+ interfaces.add(currentInterfaces[i]);
+ }
+ }
+ current = current.getSuperclass();
+ }
+ catch (Exception e)
+ {
+ current = null;
+ }
}
+ Class proxiedClass = proxiedObject.getClass();
+ ClassLoader classLoader = proxiedClass.getClassLoader();
+
InvocationHandler handler = new PortletObjectProxy(proxiedObject, autoSwitchEditDefaultsModeToEditMode, autoSwitchConfigMode, customConfigModePortletUniqueName);
- return Proxy.newProxyInstance(classLoader, proxyInterfaces, handler);
+ return Proxy.newProxyInstance(classLoader, interfaces.toArray(new Class[interfaces.size()]), handler);
}
private PortletObjectProxy(Object portletObject, boolean autoSwitchEditDefaultsModeToEditMode, boolean autoSwitchConfigMode, String customConfigModePortletUniqueName)
@@ -150,7 +166,7 @@
boolean handledHere = false;
Class declaringClass = method.getDeclaringClass();
- if (declaringClass == Portlet.class)
+ if (declaringClass == Portlet.class || declaringClass == ResourceServingPortlet.class || declaringClass == EventPortlet.class)
{
if (renderMethod.equals(method))
{
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletResourceURLFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletResourceURLFactoryImpl.java?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletResourceURLFactoryImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-commons/src/main/java/org/apache/jetspeed/portlet/PortletResourceURLFactoryImpl.java Sun Feb 22 06:06:20 2009
@@ -20,11 +20,10 @@
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.ResourceURL;
-import org.apache.jetspeed.PortalReservedParameters;
import org.apache.portals.bridges.common.PortletResourceURLFactory;
/**
@@ -44,13 +43,12 @@
*/
public String createResourceURL(PortletConfig config, RenderRequest request, RenderResponse response, Map parameters)
throws PortletException
- {
- PortletURL url = response.createRenderURL();
+ {
+ ResourceURL url = response.createResourceURL();
if (parameters != null)
{
url.setParameters(parameters);
}
- url.setParameter(PortalReservedParameters.PORTLET_RESOURCE_URL_REQUEST_PARAMETER, "");
return url.toString();
}
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config-min.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config-min.xml?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config-min.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config-min.xml Sun Feb 22 06:06:20 2009
@@ -44,7 +44,7 @@
<page type="input" name="requiredComponents" displayText="Components selection">
<comment displayText="Jetspeed Enterprise Portal version 2.2-SNAPSHOT" bold="true" />
- <target displayText="Tomcat 5.5.27 Webserver" target="install" defaultValue="true" force="true" />
+ <target displayText="Tomcat 6.0.18 Webserver" target="install" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Portal" property="dummy" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Layout Portlets" property="dummy" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Administration Portlets" property="dummy" defaultValue="true" force="true" />
@@ -196,20 +196,20 @@
<page type="input" name="dbCheckFailed" displayText="Connection to the database failed"
ifProperty="(${checkdb}=true) AND (${dbvalid}=false)">
<hidden property="checkdb" value="false" />
- <hidden property="setupDBAntTarget" value="setupNoDB" />
+ <hidden property="setupDBAntTarget" value="runSetupNoDB" />
<comment displayText="Please go back and specify the correct database configuration parameters." bold="true" />
<comment displayText="" />
<comment displayText="Continuing now will otherwise require manual setup of the database."/>
</page>
- <page type="input" name="beforeInstall" displayText="Before your install.." ifProperty="(${dbName}=manual) OR (${setupDBAntTarget}=setupNoDB)">
+ <page type="input" name="beforeInstall" displayText="Before your install.." ifProperty="(${dbName}=manual) OR (${setupDBAntTarget}=runSetupNoDB)">
<hidden property="db.username" value="" />
<hidden property="db.password" value="" />
<hidden property="jdbc.url" value="" />
<hidden property="jdbc.driver.class" value="" />
<hidden property="jdbc.driver.jar" value="" />
- <hidden property="setupDBAntTarget" value="setupNoDB" />
+ <hidden property="setupDBAntTarget" value="runSetupNoDB" />
<comment displayText="Jetspeed will be installed without yet a configured database to:" bold="true"/>
<comment displayText=" ${installDir}"/>
<comment displayText="Warning: all content in this directory will be deleted first!" bold="true"/>
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config.xml?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/antinstall-config.xml Sun Feb 22 06:06:20 2009
@@ -44,7 +44,7 @@
<page type="input" name="requiredComponents" displayText="Components selection">
<comment displayText="Jetspeed Enterprise Portal version 2.2-SNAPSHOT" bold="true" />
- <target displayText="Tomcat 5.5.27 Webserver" target="install" defaultValue="true" force="true" />
+ <target displayText="Tomcat 6.0.18 Webserver" target="install" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Portal" property="dummy" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Layout Portlets" property="dummy" defaultValue="true" force="true" />
<checkbox displayText="Jetspeed Administration Portlets" property="dummy" defaultValue="true" force="true" />
@@ -199,20 +199,20 @@
<page type="input" name="dbCheckFailed" displayText="Connection to the database failed"
ifProperty="(${checkdb}=true) AND (${dbvalid}=false)">
<hidden property="checkdb" value="false" />
- <hidden property="setupDBAntTarget" value="setupNoDB" />
+ <hidden property="setupDBAntTarget" value="runSetupNoDB" />
<comment displayText="Please go back and specify the correct database configuration parameters." bold="true" />
<comment displayText="" />
<comment displayText="Continuing now will otherwise require manual setup of the database."/>
</page>
- <page type="input" name="beforeInstall" displayText="Before your install.." ifProperty="(${dbName}=manual) OR (${setupDBAntTarget}=setupNoDB)">
+ <page type="input" name="beforeInstall" displayText="Before your install.." ifProperty="(${dbName}=manual) OR (${setupDBAntTarget}=runSetupNoDB)">
<hidden property="db.username" value="" />
<hidden property="db.password" value="" />
<hidden property="jdbc.url" value="" />
<hidden property="jdbc.driver.class" value="" />
<hidden property="jdbc.driver.jar" value="" />
- <hidden property="setupDBAntTarget" value="setupNoDB" />
+ <hidden property="setupDBAntTarget" value="runSetupNoDB" />
<comment displayText="Jetspeed will be installed without yet a configured database to:" bold="true"/>
<comment displayText=" ${installDir}"/>
<comment displayText="Warning: all content in this directory will be deleted first!" bold="true"/>
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/build.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/build.xml?rev=746641&r1=746640&r2=746641&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/build.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/jetspeed-installer/etc/ant-installer/build.xml Sun Feb 22 06:06:20 2009
@@ -56,7 +56,7 @@
</condition>
<property name="jdbcjar" value="${jdbc.driver.jar}" />
- <copy failonerror="false" todir="${installDir}/shared/lib" file="${jdbcjar}" />
+ <copy failonerror="false" todir="${installDir}/lib" file="${jdbcjar}" />
<move file="${installDir}/database/database.properties.template" tofile="${installDir}/database/database.properties"
overwrite="true">
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org