Author: mwringe
Date: 2009-03-06 16:08:48 -0500 (Fri, 06 Mar 2009)
New Revision: 12966
Removed:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/build.xml
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/impl/CacheInfoImpl.java
Log:
Update to use the metadata module.
Modified: branches/JBoss_Portal_AS5_Deployer/portlet-server/build.xml
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/portlet-server/build.xml 2009-03-06 21:05:27 UTC
(rev 12965)
+++ branches/JBoss_Portal_AS5_Deployer/portlet-server/build.xml 2009-03-06 21:08:48 UTC
(rev 12966)
@@ -90,6 +90,7 @@
<path id="library.classpath">
<path refid="portlet.portlet.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
+ <path refid="jboss.portal/modules/metadata.classpath"/>
<path refid="jboss.portal/modules/web.classpath"/>
<path refid="jboss.portal/modules/portlet.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -25,8 +25,8 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.metadata.portlet.common.LocalizedDescriptionMetaData;
import org.jboss.portal.portlet.impl.metadata.adapter.LocalizedStringAdapter;
-import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -70,6 +70,19 @@
}
}
+ public List<LocalizedDescriptionMetaData> getLocalizedDescriptionMetaData(Object
key)
+ {
+ try
+ {
+ return this.map.get(key) != null ?
this.map.get(key).getLocalizedDescriptionMetaData() : null;
+ }
+ catch (Exception e)
+ {
+ log.error("could not generate localized string.", e);
+ return null;
+ }
+ }
+
private static class LocalizedMetaDataContainer
{
/** The list of localiezd meta data */
@@ -80,10 +93,15 @@
this.list.add(description);
}
+ public List<LocalizedDescriptionMetaData> getLocalizedDescriptionMetaData()
+ {
+ return list;
+ }
+
public LocalizedString getLocalizedString() throws Exception
{
LocalizedStringAdapter adapter = new LocalizedStringAdapter();
- return adapter.unmarshal(list);
+ return adapter.getLocalizedString(list);
}
}
}
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -29,42 +29,43 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.portlet.LifeCyclePhase;
import org.jboss.portal.portlet.TransportGuarantee;
-import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
-import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
-import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
-import static
org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.DEFAULT_LOCALE;
-import static
org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
-import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
-import org.jboss.portal.portlet.impl.metadata.UserAttributeMetaData;
-import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
-import org.jboss.portal.portlet.impl.metadata.common.DescribableMetaData;
-import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
-import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
-import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
-import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
-import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
-import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletInfoMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
-import org.jboss.portal.portlet.impl.metadata.security.PortletCollectionMetaData;
-import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
-import org.jboss.portal.portlet.impl.metadata.security.UserDataConstraintMetaData;
+import org.jboss.portal.metadata.portlet.CustomPortletModeMetaData;
+import org.jboss.portal.metadata.portlet.CustomWindowStateMetaData;
+import org.jboss.portal.metadata.portlet.ListenerMetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication20MetaData;
+import static org.jboss.portal.metadata.portlet.PortletMetaDataConstants.DEFAULT_LOCALE;
+import static
org.jboss.portal.metadata.portlet.PortletMetaDataConstants.PORTLET_JSR_286_NS;
+import org.jboss.portal.metadata.portlet.PublicRenderParameterMetaData;
+import org.jboss.portal.metadata.portlet.UserAttributeMetaData;
+import org.jboss.portal.metadata.portlet.common.ContainerRuntimeMetaData;
+import org.jboss.portal.metadata.portlet.common.DescribableMetaData;
+import org.jboss.portal.metadata.portlet.common.InitParamMetaData;
+import org.jboss.portal.metadata.portlet.common.LocalizedDescriptionMetaData;
+import org.jboss.portal.metadata.portlet.event.EventDefinitionMetaData;
+import org.jboss.portal.metadata.portlet.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.metadata.portlet.filter.FilterMappingMetaData;
+import org.jboss.portal.metadata.portlet.filter.FilterMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletCacheScopeEnum;
+import org.jboss.portal.metadata.portlet.portlet.PortletInfoMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletModeMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.metadata.portlet.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.metadata.portlet.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.metadata.portlet.portlet.SupportsMetaData;
+import org.jboss.portal.metadata.portlet.portlet.WindowStateMetaData;
+import org.jboss.portal.metadata.portlet.security.PortletCollectionMetaData;
+import org.jboss.portal.metadata.portlet.security.SecurityConstraintMetaData;
+import org.jboss.portal.metadata.portlet.security.UserDataConstraintMetaData;
import org.jboss.xb.binding.GenericObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.List;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
@@ -302,7 +303,7 @@
if (child instanceof DescribableMetaData)
{
DescribableMetaData md = (DescribableMetaData)child;
- LocalizedString d = this.descriptions.getLocalizedString(md);
+ List<LocalizedDescriptionMetaData> d =
this.descriptions.getLocalizedDescriptionMetaData(md);
md.setDescription(d);
}
@@ -314,7 +315,8 @@
if (child instanceof PortletMetaData)
{
PortletMetaData portlet = (PortletMetaData)child;
- portlet.setDisplayName(this.displayNames.getLocalizedString(portlet));
+ List<LocalizedDescriptionMetaData> displayName =
this.displayNames.getLocalizedDescriptionMetaData(portlet);
+ portlet.setDisplayName(displayName);
md.addPortlet(portlet);
}
// add custom-portlet-mode
@@ -337,7 +339,8 @@
{
SecurityConstraintMetaData security = (SecurityConstraintMetaData)child;
// display-name
- security.setDisplayName(this.displayNames.getLocalizedString(security));
+ List<LocalizedDescriptionMetaData> displayName =
this.displayNames.getLocalizedDescriptionMetaData(security);
+ security.setDisplayName(displayName);
md.addSecurityConstraint(security);
}
}
@@ -360,7 +363,8 @@
else if (child instanceof FilterMetaData)
{
FilterMetaData filter = (FilterMetaData)child;
- filter.setDisplayName(this.displayNames.getLocalizedString(filter));
+ List<LocalizedDescriptionMetaData> displayName =
this.displayNames.getLocalizedDescriptionMetaData(filter);
+ filter.setDisplayName(displayName);
md.addFilter(filter);
}
// add filter-mapping
@@ -377,7 +381,8 @@
else if (child instanceof ListenerMetaData)
{
ListenerMetaData listener = (ListenerMetaData)child;
- listener.setDisplayName(this.displayNames.getLocalizedString(listener));
+ List<LocalizedDescriptionMetaData> displayName =
this.displayNames.getLocalizedDescriptionMetaData(listener);
+ listener.setDisplayName(displayName);
md.addListener(listener);
}
}
@@ -584,7 +589,7 @@
PortletModeMetaData md = (PortletModeMetaData)object;
if ("portlet-mode".equals(localName))
{
- md.setPortletMode(Mode.create(value));
+ md.setPortletMode(value);
}
}
@@ -594,7 +599,7 @@
WindowStateMetaData md = (WindowStateMetaData)object;
if ("window-state".equals(localName))
{
- md.setWindowState(WindowState.create(value));
+ md.setWindowState(value);
}
}
@@ -716,7 +721,7 @@
UserDataConstraintMetaData md = (UserDataConstraintMetaData)object;
if ("transport-guarantee".equals(localName))
{
- md.setTransportQuarantee(TransportGuarantee.valueOf(value));
+ md.setTransportQuarantee(value);
}
}
@@ -748,7 +753,7 @@
String lifeCycle = value.substring(0, end > 0 ? end : 0);
try
{
- md.addLifecycle(LifeCyclePhase.valueOf(lifeCycle));
+ md.addLifecycle(lifeCycle);
}
catch (IllegalArgumentException e)
{
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
import org.jboss.portal.server.deployment.PortalWebApp;
/**
@@ -32,6 +32,6 @@
*/
public interface InfoBuilderFactory
{
- public InfoBuilder createInfoBuilder(PortalWebApp webApp, JBossApplicationMetaData
jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD);
+ public InfoBuilder createInfoBuilder(PortalWebApp webApp, JBossPortletAppMetaData
jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD);
}
Deleted:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -1,435 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.deployment.jboss;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.xml.NullEntityResolver;
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.PortletContainerContext;
-import org.jboss.portal.portlet.container.PortletFilterContext;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.jboss.portal.portlet.container.object.PortletApplicationObject;
-import org.jboss.portal.portlet.container.object.PortletContainerObject;
-import org.jboss.portal.portlet.container.object.PortletFilterObject;
-import org.jboss.portal.portlet.deployment.PortletApplicationModelFactory;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
-import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
-import org.jboss.portal.portlet.impl.container.PortletFilterLifeCycle;
-import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletFilterImpl;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.server.deployment.PortalWebApp;
-import org.jboss.portal.server.deployment.jboss.Deployment;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.xml.sax.EntityResolver;
-
-import javax.management.MBeanServer;
-import javax.servlet.ServletContext;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletAppDeployment extends Deployment
-{
-
- /** The existing configurations. */
- protected Map configurations;
-
- /** . */
- protected PortletApplication10MetaData portletAppMD;
-
- /** . */
- protected JBossApplicationMetaData jbossAppMD;
-
- /** . */
- protected PortletAppDeploymentFactory factory;
-
- /** . */
- protected PortletApplicationContextImpl portletApplicationContext;
-
- /** . */
- private PortletApplicationLifeCycle portletApplicationLifeCycle;
-
- /** . */
- private ManagedObjectRegistryEventListener listener;
-
- /** . */
- private String appId;
-
- public PortletAppDeployment(URL url, PortalWebApp pwa,
ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer,
PortletAppDeploymentFactory factory)
- {
- super(url, pwa, mbeanServer);
- this.factory = factory;
- this.listener = listener;
- }
-
- public void create() throws DeploymentException
- {
- //disable for now so we can use the new deployer
- if (true) return;
-
- importTLD();
-
- //
- try
- {
- portletAppMD = buildPortletApplicationMetaData();
- jbossAppMD = buildJBossApplicationMetaData();
-
- //
- if (jbossAppMD.getId() == null)
- {
- log.debug("The portlet application does not have an explicit id value,
will use the value provided by the jboss-portal-app.xml instead");
- jbossAppMD.setId(pwa.getId());
- }
-
- //
- appId = jbossAppMD.getId();
-
- // Merge or provide defaults
- JBossApplicationMetaData standardJBossAppMD =
factory.getStandardJBossApplicationMetaData();
- if (standardJBossAppMD != null)
- {
- log.debug("Found standard jboss app meta data");
-
- JBossPortletMetaData defaultJBossPortletMD =
standardJBossAppMD.getPortlets().get("DefaultPortlet");
- if (defaultJBossPortletMD != null)
- {
- log.debug("Found default jboss portlet meta data");
- for (PortletMetaData portletMD : portletAppMD.getPortlets().values())
- {
- String name = portletMD.getPortletName();
- JBossPortletMetaData jbossPortletMD =
jbossAppMD.getPortlets().get(name);
- if (jbossPortletMD != null)
- {
- log.debug("Merging default jboss portlet meta data for " +
name);
-
- // Merge with app settings
-// jbossPortletMD.merge(jbossAppMD); // todo: remove since it
shouldn't be needed anymore with the adding of merge in factory...
-
- // Merge with default portlet
- jbossPortletMD.merge(defaultJBossPortletMD);
- }
- else
- {
- log.debug("Using default jboss portlet meta data for " +
name);
- jbossAppMD.getPortlets().put(name,
(JBossPortletMetaData)defaultJBossPortletMD.clone());
- }
- }
- }
- }
- }
- catch (Throwable e)
- {
- throw new DeploymentException("Cannot deploy portlet application",
e);
- }
- }
-
- public void start() throws DeploymentException
- {
- //disable for now to use new deployer
- if (true) return;
-
- log.debug("Starting installation");
-
- //
- InfoBuilder infoBuilder =
factory.getCoreInfoBuilderFactory().createInfoBuilder(pwa, jbossAppMD, portletAppMD);
-
- infoBuilder.build();
- /*
- ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(portletAppMD, pwa);
- ContainerInfoBuilder builder = new ContainerInfoBuilder(pwa.getContextPath(),
portletAppMD, builderContext);
- builder.build();
- */
- //
- PortletApplicationObject portletApplicationObject = new
PortletApplicationImpl(infoBuilder.getApplication());
- PortletApplicationContext portletApplicationContext = new
PortletApplicationContextImpl(pwa);
-
- //
- portletApplicationLifeCycle = new PortletApplicationLifeCycle(
- listener,
- portletApplicationContext,
- portletApplicationObject);
-
- //
- for (ContainerFilterInfo filterInfo :
infoBuilder.getApplication().getFilters().values())
- {
- PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
- PortletFilterContext portletFilterContext = new PortletFilterContextImpl();
-
- //
- portletApplicationLifeCycle.addPortletFilter(portletFilterContext,
portletFilterObject);
- }
-
- //
- for (PortletInfo portletInfo : infoBuilder.getPortlets())
- {
- ContainerPortletInfo cpi = (ContainerPortletInfo)portletInfo;
- PortletContainerObject portletContainerObject = new PortletContainerImpl(cpi);
- PortletContainerContext portletContainerContext = new
PortletContainerContextImpl();
-
- //
- PortletContainerLifeCycle portletContainerLifeCycle =
portletApplicationLifeCycle.addPortletContainer(portletContainerContext,
portletContainerObject);
-
- // Now create deps
- for (String filterRef : cpi.getFilterRefs())
- {
- PortletFilterLifeCycle portletFilterLifeCycle =
portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
-
- //
- if (portletFilterLifeCycle != null)
- {
- portletApplicationLifeCycle.addDependency(portletFilterLifeCycle,
portletContainerLifeCycle);
- }
- else
- {
- // todo
- }
- }
- }
-
- //
- portletApplicationLifeCycle.create();
-
- //
- portletApplicationLifeCycle.managedStart();
-
- //
-
- /*
- try
- {
- portletApplicationContext = new PortletApplicationContextImpl(
- factory.getWebAppRegistry(),
- factory.getPortletAPIFactory(),
- factory.getPortletInfoFactory(),
- portletAppMD,
- jbossAppMD,
- pwa.getServletContext(),
- pwa.getClassLoader(),
- pwa.getContextPath()
- );
-
- // Install portlet containers
- portletApplicationContext.startPortletApplication();
- }
- catch (Throwable e)
- {
- throw new DeploymentException("Cannot deploy portlet
application", e);
- }
-
- // Configure security
- PortletSecurityService portletSecurityService =
factory.getPortletSecurityService();
- if (portletSecurityService != null)
- {
- AuthorizationDomain authDomain =
portletSecurityService.getAuthorizationDomain();
- DomainConfigurator domainConfigurator = authDomain.getConfigurator();
-
- //
- for (Iterator i = jbossAppMD.getPortlets().values().iterator();
i.hasNext();)
- {
- JBossPortletMetaData portletMD = (JBossPortletMetaData)i.next();
- SecurityConstraintMetaData securityConstraintMD =
portletMD.getSecurityConstraint();
-
- //
- if (securityConstraintMD == null)
- {
- securityConstraintMD = new SecurityConstraintMetaData();
- PolicyPermissionMetaData policyPermission = new
PolicyPermissionMetaData();
-
policyPermission.setRoleName(SecurityConstants.UNCHECKED_ROLE_NAME);
- policyPermission.getActions().add("view");
-
securityConstraintMD.getPolicyPermissions().put(SecurityConstants.UNCHECKED_ROLE_NAME,
policyPermission);
- }
-
- //
- Set bindings = new HashSet();
- for (Iterator j =
securityConstraintMD.getPolicyPermissions().values().iterator(); j.hasNext();)
- {
- PolicyPermissionMetaData policyPermissionMD =
(PolicyPermissionMetaData)j.next();
- RoleSecurityBinding binding = new
RoleSecurityBinding(policyPermissionMD.getActions(), policyPermissionMD.getRoleName());
- bindings.add(binding);
- }
-
- //
- try
- {
- String portletId = pwa.getId() + "." +
portletMD.getName();
- domainConfigurator.setSecurityBindings(portletId, bindings);
- }
- catch (SecurityConfigurationException e)
- {
- log.error("Error in configuration", e);
- }
- }
- }
-
- */
- //
- super.start();
- }
-
- public void stop() throws DeploymentException
- {
-
- /*
- PortletSecurityService portletSecurityService =
factory.getPortletSecurityService();
- if (portletSecurityService != null)
- {
- AuthorizationDomain authDomain =
portletSecurityService.getAuthorizationDomain();
- DomainConfigurator domainConfigurator = authDomain.getConfigurator();
- for (Iterator i = portletAppMD.getPortlets().values().iterator();
i.hasNext();)
- {
- PortletMetaData portletMD = (PortletMetaData)i.next();
-
- //
- try
- {
- String portletId = pwa.getId() + "." + portletMD.getId();
- domainConfigurator.removeSecurityBindings(portletId);
- }
- catch (SecurityConfigurationException e)
- {
- log.error("Error in configuration", e);
- }
- }
- }
- */
- //
- super.stop();
- }
-
- public void destroy() throws DeploymentException
- {
- //disable for now to use new deployer
- if (true) return;
-
- portletApplicationLifeCycle.destroy();
-
-// portletApplicationContext.stopPortletApplication();
- }
-
- /** Import the portlet jsp tag TLD in the deployed application. */
- protected void importTLD()
- {
- InputStream sourceTLD = null;
- try
- {
- if (portletAppMD instanceof PortletApplication20MetaData)
- {
- sourceTLD =
IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/portlet_2_0.tld"));
- }
- else
- {
- sourceTLD =
IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/portlet.tld"));
- }
- pwa.importFile("/WEB-INF", "portlet.tld", sourceTLD,
false);
- }
- catch (IOException e)
- {
- log.warn("Cannot copy TLD file to the portlet application", e);
- }
- finally
- {
- IOTools.safeClose(sourceTLD);
- }
- }
-
- protected PortletApplication10MetaData buildPortletApplicationMetaData() throws
Exception
- {
- InputStream in = null;
- try
- {
- in = IOTools.safeBufferedWrapper(url.openStream());
- PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- PortletApplication10MetaData portletAppMD =
(PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory),
null);
- portletAppMD.setId(pwa.getId());
- return portletAppMD;
- }
- finally
- {
- IOTools.safeClose(in);
- }
- }
-
- protected JBossApplicationMetaData buildJBossApplicationMetaData()
- {
- JBossApplicationMetaData jbossAppMD = new JBossApplicationMetaData();
- ServletContext servletContext = pwa.getServletContext();
- String contextPath = pwa.getContextPath();
- InputStream in = null;
- try
- {
- in =
IOTools.safeBufferedWrapper(servletContext.getResourceAsStream("/WEB-INF/jboss-portlet.xml"));
- if (in != null)
- {
- log.info("Parsing " + contextPath +
"/jboss-portlet.xml");
-
- //
- JBossApplicationMetaDataFactory factory =
this.factory.createJBossApplicationMetaDataFactory();
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- EntityResolver entityResolver =
this.factory.getJBossPortletEntityResolver();
- if (entityResolver == null)
- {
- log.debug("Could not obtain entity resolver for
jboss-portlet.xml");
- entityResolver = new NullEntityResolver();
- }
- else
- {
- log.debug("Obtained entity resolver " + entityResolver + "
for jboss-portlet.xml");
- }
- unmarshaller.setEntityResolver(entityResolver);
- jbossAppMD = (JBossApplicationMetaData)unmarshaller.unmarshal(in, new
ValueTrimmingFilter(factory), null);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- IOTools.safeClose(in);
- }
- return jbossAppMD;
- }
-
- public String getAppId()
- {
- return appId;
- }
-}
Deleted:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -1,245 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.deployment.jboss;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.ContainerPortletInvoker;
-import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
-import org.jboss.portal.portlet.container.managed.ManagedObject;
-import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
-import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEvent;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
-import org.jboss.portal.portlet.security.PortletSecurityService;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.deployment.PortalWebApp;
-import org.jboss.portal.server.deployment.jboss.AbstractDeploymentFactory;
-import org.jboss.portal.server.deployment.jboss.Deployment;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.xml.sax.EntityResolver;
-
-import javax.management.MBeanServer;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * todo : remove unused ConfigService
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletAppDeploymentFactory extends AbstractDeploymentFactory
-{
-
- /** . */
- protected static final Pattern urlPattern =
Pattern.compile(".*/portlet\\.xml");
-
- /** . */
- protected ServerConfig config;
-
- /** . */
- protected PortletSecurityService portletSecurityService;
-
- /** . */
- protected String standardJBossApplicationMetaDataLocation;
-
- /** . */
- protected JBossApplicationMetaData standardJBossApplicationMetaData;
-
- /** . */
- protected EntityResolver jbossPortletEntityResolver;
-
- private PortletInvoker portletContainerInvoker;
-
- private InfoBuilderFactory coreInfoBuilderFactory;
-
- public EntityResolver getJBossPortletEntityResolver()
- {
- return jbossPortletEntityResolver;
- }
-
- public void setJBossPortletEntityResolver(EntityResolver jbossPortletEntityResolver)
- {
- this.jbossPortletEntityResolver = jbossPortletEntityResolver;
- }
-
- public void setCoreInfoBuilderFactory(InfoBuilderFactory coreInfoBuilderFactory)
- {
- this.coreInfoBuilderFactory = coreInfoBuilderFactory;
- }
-
- public InfoBuilderFactory getCoreInfoBuilderFactory()
- {
- return coreInfoBuilderFactory;
- }
-
- public ServerConfig getConfig()
- {
- return config;
- }
-
- public void setConfig(ServerConfig config)
- {
- this.config = config;
- }
-
- public String getStandardJBossApplicationMetaDataLocation()
- {
- return standardJBossApplicationMetaDataLocation;
- }
-
- public void setStandardJBossApplicationMetaDataLocation(String
standardJBossApplicationMetaDataLocation)
- {
- this.standardJBossApplicationMetaDataLocation =
standardJBossApplicationMetaDataLocation;
- }
-
- public JBossApplicationMetaData getStandardJBossApplicationMetaData()
- {
- return standardJBossApplicationMetaData;
- }
-
- public boolean acceptFile(URL url)
- {
- String urlAsFile = url.getFile();
- Matcher matcher = urlPattern.matcher(urlAsFile);
- return matcher.matches();
- }
-
- public Deployment newInstance(URL url, PortalWebApp pwa, MBeanServer mbeanServer)
throws DeploymentException
- {
- return new PortletAppDeployment(url, pwa, bridgeToInvoker, mbeanServer, this);
- }
-
- public void start() throws Exception
- {
- //
- loadStandardJBossApplicationMetaData();
-
- //
- super.start();
- }
-
- public void loadStandardJBossApplicationMetaData()
- {
- if (standardJBossApplicationMetaDataLocation != null)
- {
- InputStream in = null;
- try
- {
- in =
IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream(standardJBossApplicationMetaDataLocation));
- if (in != null)
- {
- JBossApplicationMetaDataFactory factory =
createJBossApplicationMetaDataFactory();
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- standardJBossApplicationMetaData =
(JBossApplicationMetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory),
null);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- IOTools.safeClose(in);
- }
- }
- }
-
- public void stop()
- {
- super.stop();
- }
-
- public PortletSecurityService getPortletSecurityService()
- {
- return portletSecurityService;
- }
-
- public void setPortletSecurityService(PortletSecurityService portletSecurityService)
- {
- this.portletSecurityService = portletSecurityService;
- }
-
- /** Subclasses can provide a subclass of JBossApplicationMetaDataFactory. */
- public JBossApplicationMetaDataFactory createJBossApplicationMetaDataFactory()
- {
- return new JBossApplicationMetaDataFactory();
- }
-
- public PortletInvoker getPortletContainerInvoker()
- {
- return portletContainerInvoker;
- }
-
- public void setPortletContainerInvoker(PortletInvoker portletContainerInvoker)
- {
- this.portletContainerInvoker = portletContainerInvoker;
- }
-
- /** Bridge managed object event to add/remove portlet container in portlet container
invoker. */
- protected final ManagedObjectRegistryEventListener bridgeToInvoker = new
ManagedObjectRegistryEventListener()
- {
- public void onEvent(ManagedObjectRegistryEvent event)
- {
- if (event instanceof ManagedObjectEvent)
- {
- ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
- ManagedObject managedObject = managedObjectEvent.getManagedObject();
-
- //
- if (managedObject instanceof PortletContainerLifeCycle)
- {
- PortletContainerLifeCycle portletContainerLifeCycle =
(PortletContainerLifeCycle)managedObject;
- PortletContainer portletContainer =
portletContainerLifeCycle.getPortletContainer();
-
- //
- if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
- {
- ManagedObjectLifeCycleEvent lifeCycleEvent =
(ManagedObjectLifeCycleEvent)managedObjectEvent;
-
- //
- LifeCycleStatus status = lifeCycleEvent.getStatus();
- //
- if (status == LifeCycleStatus.STARTED)
- {
-
((ContainerPortletInvoker)portletContainerInvoker).addPortletContainer(portletContainer);
- }
- else
- {
-
((ContainerPortletInvoker)portletContainerInvoker).removePortletContainer(portletContainer);
- }
- }
- }
- }
- }
- };
-
-}
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -25,7 +25,7 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletMetaData;
import org.jboss.portal.portlet.info.PortletInfo;
/**
Modified:
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/impl/CacheInfoImpl.java
===================================================================
---
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/impl/CacheInfoImpl.java 2009-03-06
21:05:27 UTC (rev 12965)
+++
branches/JBoss_Portal_AS5_Deployer/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/impl/CacheInfoImpl.java 2009-03-06
21:08:48 UTC (rev 12966)
@@ -24,7 +24,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletMetaData;
import org.jboss.portal.portlet.info.CacheInfo;
/**