Author: mwringe
Date: 2009-03-02 14:30:58 -0500 (Mon, 02 Mar 2009)
New Revision: 12922
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/InstanceDeployment.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortalObjectDeployment.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortletDeployment.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppContextDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppDeployer.java
Removed:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java
Modified:
modules/deployer/trunk/build/pom.xml
modules/deployer/trunk/deployer/pom.xml
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
modules/deployer/trunk/deployer/src/main/deployer/dtd/portal-object_2_6.dtd
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalEntityResolver.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalResolverFactory.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalObjectParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalResolverDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletInstancesParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/LibDirectoryStructure.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/PortalPostWebDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/CommandServletDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletTLDDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java
modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
Log:
Update deployers to not use any jars from the main portal sar.
Modified: modules/deployer/trunk/build/pom.xml
===================================================================
--- modules/deployer/trunk/build/pom.xml 2009-03-02 15:01:37 UTC (rev 12921)
+++ modules/deployer/trunk/build/pom.xml 2009-03-02 19:30:58 UTC (rev 12922)
@@ -101,7 +101,7 @@
<artifactId>metadata-metadata</artifactId>
<version>${version.jboss.portal.metadata}</version>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>org.jboss.portal.web</groupId>
<artifactId>web-web</artifactId>
<version>${version.jboss.portal.web}</version>
@@ -135,7 +135,7 @@
<groupId>org.jboss.portal.core</groupId>
<artifactId>security</artifactId>
<version>${version.jboss.portal.server}</version>
- </dependency>
+ </dependency> -->
<dependency>
<groupId>org.jboss.maven.plugins</groupId>
Modified: modules/deployer/trunk/deployer/pom.xml
===================================================================
--- modules/deployer/trunk/deployer/pom.xml 2009-03-02 15:01:37 UTC (rev 12921)
+++ modules/deployer/trunk/deployer/pom.xml 2009-03-02 19:30:58 UTC (rev 12922)
@@ -42,7 +42,7 @@
<groupId>org.jboss.portal.metadata</groupId>
<artifactId>metadata-metadata</artifactId>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>org.jboss.portal.web</groupId>
<artifactId>web-web</artifactId>
</dependency>
@@ -77,7 +77,7 @@
<artifactId>test</artifactId>
<version>0.0</version>
<scope>provided</scope>
- </dependency>
+ </dependency> -->
<dependency>
<groupId>org.jboss.aspects</groupId>
@@ -147,7 +147,7 @@
</excludes>
</configuration>
</plugin>
-
+<!--
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jbossaop-plugin</artifactId>
@@ -171,11 +171,9 @@
</execution>
</executions>
</plugin>
-
+-->
</plugins>
</build>
-
-<!-- <properties/> -->
</project>
Modified:
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
===================================================================
---
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-03-02
19:30:58 UTC (rev 12922)
@@ -48,14 +48,30 @@
</entry>
<entry>
<key>portlet-instances_2_6.dtd</key>
-
<value>org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData</value>
+
<value>org.jboss.portal.metadata.portlet.instances.PortletDeploymentInstancesMetaData</value>
</entry>
<entry>
<key>portal-object_2_6.dtd</key>
<value>org.jboss.portal.metadata.portal.object.PortalObjectMetaData</value>
</entry>
+ <entry>
+ <key>jboss-portlet_2_6.dtd</key>
+
<value>org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData</value>
+ </entry>
</map>
</property>
+ <property name="XSDMapping">
+ <map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+
<
key>http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd</key>
+
<value>org.jboss.portal.metadata.portlet.mc.AnnotationPortletApplication10MetaData</value>
+ </entry>
+ <entry>
+
<
key>http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd</key>
+
<value>org.jboss.portal.metadata.portlet.mc.AnnotationPortletApplication20MetaData</value>
+ </entry>
+ </map>
+ </property>
</bean>
<bean name="PortalUnmarshallerFactory"
class="org.jboss.portal.deployer.PortalUnmarshallerFactory">
@@ -70,12 +86,9 @@
<depends>WarDeployer</depends>
</bean>
<!-- end fake deployer -->
+
+ <bean name="LibDirectoryDeployer"
class="org.jboss.portal.deployer.portal.LibDirectoryStructure"/>
-<!-- May not be needed in the recent JBoss AS5
- <bean name="LibDirectoryStructure"
class="org.jboss.portal.deployer.portal.LibDirectoryStructure">
- </bean>
--->
-
<!-- jboss-portal-app.xml parsing-->
<bean name="PortalAppParsingDeployer"
class="org.jboss.portal.deployer.parsing.PortalAppParsingDeployer"/>
@@ -85,19 +98,14 @@
<!-- *-object.xml parsing -->
<bean name="PortalObjectParsingDeployer"
class="org.jboss.portal.deployer.parsing.PortalObjectParsingDeployer"/>
+ <!-- jboss-portlet.xml parsing -->
+ <bean name="JBossPortletParsingDeployer"
class="org.jboss.portal.deployer.parsing.JBossPortletParsingDeployer"/>
+
<!-- portlet.xml parsing -->
- <bean name="PortletParsingDeployer"
class="org.jboss.portal.deployer.parsing.PortletParsingDeployer">
- <property name="entityResolver"><inject
bean="PortalEntityResolver"/></property>
- </bean>
+ <bean name="PortletParsingDeployer"
class="org.jboss.portal.deployer.parsing.PortletParsingDeployer"/>
- <!-- jboss-portlet.xml parsing -->
- <bean name="JBossPortletParsingDeployer"
class="org.jboss.portal.deployer.parsing.JBossPortletParsingDeployer">
- <property name="entityResolver"><inject
bean="PortalEntityResolver"/></property>
- </bean>
-
<bean name="MergedPortletParsingDeployer"
class="org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer">
<property
name="standardPortletFileLocation">conf/standardjboss-portlet.xml</property>
- <property name="entityResolver"><inject
bean="PortalEntityResolver"/></property>
</bean>
<!-- component deployables -->
@@ -107,40 +115,36 @@
<!-- deployer that makes sure that dependencies are running before continuing
-->
<bean name="PortletDependencyDeployer"
class="org.jboss.portal.deployer.portlet.PortletDependencyDeployer">
- <property name="dependencies">
+ <property name="dependencies">
<list elementClass="java.lang.String">
- <value>portal:service=InfoBuilderFactory,type=Core</value>
- <value>portal:service=PortletInvoker,type=Container</value>
- <value>portal:service=PortletSecurityService</value>
- <value>portal:container=Instance</value>
+ <value>portal:deployer=ObjectDeployment</value>
+ <value>portal:deployer=InstanceDeployment</value>
+ <value>portal:deployer=PortletDeployment</value>
</list>
</property>
</bean>
-
- <bean name="CommandServletDeployer"
class="org.jboss.portal.deployer.portlet.CommandServletDeployer"/>
- <bean name="PortletTLDDeployer"
class="org.jboss.portal.deployer.portlet.PortletTLDDeployer">
+ <!-- Used to get information from the WarDeployer-->
+ <bean name="PortalWebAppDeployer"
class="org.jboss.portal.deployer.webapp.WebAppDeployer">
<property name="warDeployer"><inject
bean="WarDeployer"/></property>
+ </bean>
+ <bean name="PortalWebAppContextDeployer"
class="org.jboss.portal.deployer.webapp.WebAppContextDeployer">
<property name="MBeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
+ </bean>
+ <bean name="PortletTLDDeployer"
class="org.jboss.portal.deployer.portlet.PortletTLDDeployer">
+ <property name="MBeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
<property name="TLDDirectory">tld</property>
</bean>
+ <!-- end war deployer beans -->
- <bean name="PortletDeployer"
class="org.jboss.portal.deployer.portlet.PortletDeployer">
- <property name="warDeployer"><inject
bean="WarDeployer"/></property>
- <property name="MBeanServer"><inject bean="JMXKernel"
property="mbeanServer"/></property>
- <property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
+ <bean name="CommandServletDeployer"
class="org.jboss.portal.deployer.portlet.CommandServletDeployer">
+ <property
name="commandServletClass">org.jboss.portal.web.command.CommandServlet</property>
</bean>
+
+ <bean name="PortletDeployer"
class="org.jboss.portal.deployer.portlet.PortletDeployer"/>
- <bean name="InstanceDeployer"
class="org.jboss.portal.deployer.portlet.InstanceDeployer">
- <property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
- <property
name="instanceContainerReferenceName">portal:container=Instance</property>
- </bean>
+ <bean name="InstanceDeployer"
class="org.jboss.portal.deployer.portlet.InstanceDeployer"/>
- <bean name="PortalObjectDeployer"
class="org.jboss.portal.deployer.portlet.ObjectDeployer">
- <property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
- <property
name="portalObjectContainerReferenceName">portal:container=PortalObject</property>
- <property
name="contentProviderRegistryReferenceName">portal:service=ContentProviderRegistry</property>
- <property
name="coordinationConfiguratorReferenceName">portal:service=CoordinationService</property>
- </bean>
+ <bean name="PortalObjectDeployer"
class="org.jboss.portal.deployer.portlet.ObjectDeployer"/>
</deployment>
Modified: modules/deployer/trunk/deployer/src/main/deployer/dtd/portal-object_2_6.dtd
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/dtd/portal-object_2_6.dtd 2009-03-02
15:01:37 UTC (rev 12921)
+++ modules/deployer/trunk/deployer/src/main/deployer/dtd/portal-object_2_6.dtd 2009-03-02
19:30:58 UTC (rev 12922)
@@ -382,6 +382,8 @@
-->
<!ELEMENT window-coordination (window-name, qname)>
+<!ELEMENT window-coordination (window-name, qname+)>
+
<!--
QName identifying event or shared render parameter
-->
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalEntityResolver.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalEntityResolver.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalEntityResolver.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.deployer;
+import org.jboss.logging.Logger;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -32,7 +33,8 @@
public class PortalEntityResolver implements org.xml.sax.EntityResolver
{
-
+ Logger log = Logger.getLogger(PortalEntityResolver.class);
+
/** . */
private Properties dtdMapping;
@@ -48,11 +50,10 @@
public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException
{
-
// Let the parser open a regular URI connection to systemId
if (publicId == null)
{
- return null;
+ //return null;
}
//
@@ -60,7 +61,7 @@
if (dtdResourceName != null)
{
- //log.debug("Looking up resource " + dtdResourceName + " for dtd
publicId=" + publicId + ", systemId=" + systemId);
+ log.debug("Looking up resource " + dtdResourceName + " for dtd
publicId=" + publicId + ", systemId=" + systemId);
InputStream dtdStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(dtdResourceName);
if (dtdStream != null)
{
@@ -68,12 +69,12 @@
}
else
{
- //log.debug("No resource found for dtd publicId=" + publicId +
", systemId=" + systemId);
+ log.debug("No resource found for dtd publicId=" + publicId +
", systemId=" + systemId);
}
}
else
{
- //log.debug("No resource name found for dtd publicId=" + publicId +
", systemId=" + systemId);
+ log.debug("No resource name found for dtd publicId=" + publicId +
", systemId=" + systemId);
}
//
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalResolverFactory.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalResolverFactory.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/PortalResolverFactory.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -76,7 +76,6 @@
try
{
Class clazz = classloader.loadClass(classname);
- System.out.println("LOCATION : " + location + " : CLASS
" + classname);
resolver.addClassBindingForLocation(location, clazz);
}
catch (ClassNotFoundException e)
@@ -86,5 +85,28 @@
}
}
}
+
+ public void setXSDMapping(Properties mapping)
+ {
+ ClassLoader classloader = Thread.currentThread().getContextClassLoader();
+ if (mapping != null && mapping.size() > 0)
+ {
+ Enumeration enumer = mapping.keys();
+ while (enumer.hasMoreElements())
+ {
+ String location = (String) enumer.nextElement();
+ String classname = (String) mapping.get(location);
+ try
+ {
+ Class clazz = classloader.loadClass(classname);
+ resolver.addClassBinding(location, clazz);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Could not find class " + classname);
+ }
+ }
+ }
+ }
}
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/InstanceDeployment.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/InstanceDeployment.java
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/InstanceDeployment.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.deployer.container;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.portal.metadata.portlet.instances.PortletDeploymentInstancesMetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public interface InstanceDeployment
+{
+ /**
+ * Deploy the instance objects into the portlet server.
+ *
+ * @param instancesMetaData
+ * @throws DeploymentException If an exception occurs during deployment
+ */
+ public void deployInstances(PortletDeploymentInstancesMetaData instancesMetaData,
String appId) throws DeploymentException;
+}
+
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortalObjectDeployment.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortalObjectDeployment.java
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortalObjectDeployment.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.deployer.container;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public interface PortalObjectDeployment
+{
+ /**
+ * Deploy the portlet objects into the portal server.
+ *
+ * @param objectMetaData The metadata describing the portlet objects
+ * @param classloader The classloader for the portlet webapp
+ * @throws DeploymentException If an exception occurs duing deployment
+ */
+ public void deployObjects (PortalObjectMetaData objectMetaData, ClassLoader
classloader) throws DeploymentException;
+}
+
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortletDeployment.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortletDeployment.java
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/container/PortletDeployment.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.deployer.container;
+
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public interface PortletDeployment
+{
+ /**
+ * Deploy the portlet into the portlet server.
+ *
+ * @param servletContext The ServletContext of the portlet webapp
+ * @param url The url of the portlet webapp
+ * @param classLoader The classloader of the portlet webapp
+ * @param contextPath The ContextPath of the portlet webapp
+ * @param jbossAppMD The metadata descibed in jboss-portlet.xml
+ * @param portletAppMD The metadata descrubed in portlet.xml
+ * @throws DeploymentException If an exception occurs when trying to deploy the
portlet
+ */
+ public void deployPortlets(ServletContext servletContext, URL url, ClassLoader
classLoader, String contextPath,
+ JBossPortletAppMetaData jbossAppMD, PortletApplication10MetaData portletAppMD)
throws DeploymentException;
+}
+
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,33 +22,16 @@
******************************************************************************/
package org.jboss.portal.deployer.parsing;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.List;
-
-import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.portal.core.deployment.JBossApplicationMetaDataFactory;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
-import org.jboss.portal.deployer.PortalEntityResolver;
-import org.jboss.virtual.VFS;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
import org.jboss.virtual.VirtualFile;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-public class JBossPortletParsingDeployer extends
SchemaResolverDeployer<JBossApplicationMetaData>
+public class JBossPortletParsingDeployer extends
PortalResolverDeployer<JBossPortletAppMetaData>
{
- private PortalEntityResolver entityResolver;
-
- public void setEntityResolver(PortalEntityResolver entityResolver)
- {
- this.entityResolver = entityResolver;
- }
-
public JBossPortletParsingDeployer()
{
- super(JBossApplicationMetaData.class);
+ super(JBossPortletAppMetaData.class);
setName("jboss-portlet.xml");
}
@@ -62,26 +45,10 @@
return getName();
}
- protected JBossApplicationMetaData parse(VFSDeploymentUnit unit, VirtualFile file,
JBossApplicationMetaData root)
- throws Exception
- {
-
- //VirtualFile vFile = VFS.getVirtualFile(new
URI("file:///tmp/testVFS"),"/helloworldportlet.war/WEB-INF/test123");
-// VirtualFile vFile = VFS.getRoot(new
URI("file:///home/mwringe/Projects/tld-test/testtld.tld"));
-// System.out.println("VFILE : " + vFile);
-// unit.appendMetaDataFile(vFile);
-
- InputStream stream = file.openStream();
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setEntityResolver(this.entityResolver);
-
- JBossApplicationMetaData jbossPortletMetaData = (JBossApplicationMetaData)
unmarshaller.unmarshal(stream,
- new JBossApplicationMetaDataFactory(), root);
-
- System.out.println("JBOSSPORTLETS : " +
jbossPortletMetaData.getPortlets());
-
- return jbossPortletMetaData;
+ protected JBossPortletAppMetaData parse(VFSDeploymentUnit unit, VirtualFile file,
JBossPortletAppMetaData root) throws Exception
+ {
+ JBossPortletAppMetaData portalApp = super.parse(unit, file, root);
+ return (JBossPortletAppMetaData) super.parse(unit, file, root);
}
}
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,31 +22,24 @@
******************************************************************************/
package org.jboss.portal.deployer.parsing;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
-import java.net.URL;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.plugins.vfs.VirtualFileSerializator;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.portal.core.deployment.JBossApplicationMetaDataFactory;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.logging.Logger;
import org.jboss.portal.deployer.PortalEntityResolver;
+import org.jboss.portal.deployer.PortalResolverFactory;
+import org.jboss.portal.deployer.PortalUnmarshallerFactory;
import org.jboss.portal.metadata.jboss.app.PortalAppMetaData;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
-import org.jboss.virtual.plugins.vfs.VirtualFileUrlStreamHandler;
-import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletMetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.portlet.PortletMetaData;
import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.xml.sax.InputSource;
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
@@ -54,17 +47,19 @@
*/
public class MergedPortletParsingDeployer extends AbstractDeployer
{
- public static final String PORTLET_MERGED_ATTACHMENT_NAME = "merged." +
JBossApplicationMetaData.class.getName();
+ public static final String PORTLET_MERGED_ATTACHMENT_NAME = "merged." +
JBossPortletAppMetaData.class.getName();
+ protected final Logger log = Logger.getLogger(getClass());
+
protected String standardPortletFileLocation;
protected PortalEntityResolver entityResolver;
public MergedPortletParsingDeployer()
{
setAllInputs(false);
- setInput(JBossApplicationMetaData.class);
+ setInput(JBossPortletAppMetaData.class);
addInput(PortletApplication10MetaData.class);
- setOutput(JBossApplicationMetaData.class);
+ setOutput(JBossPortletAppMetaData.class);
addOutput(PORTLET_MERGED_ATTACHMENT_NAME);
this.setStage(DeploymentStages.POST_PARSE);
}
@@ -81,67 +76,58 @@
public void deploy(DeploymentUnit unit) throws DeploymentException
{
- JBossApplicationMetaData jbossAppMetaData =
unit.getAttachment(JBossApplicationMetaData.class);
+ JBossPortletAppMetaData jbossAppMetaData =
unit.getAttachment(JBossPortletAppMetaData.class);
+ PortletApplication10MetaData portletAppMetaData =
unit.getAttachment(PortletApplication10MetaData.class);
// use the app-name from the jboss-portal-app.xml file if it exists
PortalAppMetaData appMetaData = unit.getAttachment(PortalAppMetaData.class);
- if (jbossAppMetaData.getId() == null && appMetaData != null &&
appMetaData.getAppName() != null)
+ if (jbossAppMetaData.getAppId() == null && appMetaData != null &&
appMetaData.getAppName() != null)
{
- jbossAppMetaData.setId(appMetaData.getAppName());
+ jbossAppMetaData.setAppId(appMetaData.getAppName());
}
-
+
try{
InputStream stream =
this.getClass().getClassLoader().getResourceAsStream(standardPortletFileLocation);
+ InputSource source = new InputSource(stream);
- System.out.println("RESOURCE : " +
this.getClass().getClassLoader().getResource(standardPortletFileLocation));
-
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setEntityResolver(this.entityResolver);
-
- JBossApplicationMetaData defaultAppMetaData = (JBossApplicationMetaData)
unmarshaller.unmarshal(stream,
- new JBossApplicationMetaDataFactory(), new JBossApplicationMetaData());
+ SchemaBindingResolver resolver =
PortalResolverFactory.getInstance().getSchemaBindingResolver();
+ Unmarshaller unmarshaller =
PortalUnmarshallerFactory.getInstance().getUnmarshaller();
+ JBossPortletAppMetaData defaultAppMetaData =
(JBossPortletAppMetaData)unmarshaller.unmarshal(source, resolver);
- System.out.println("DEFAULT PORTLETS : " +
defaultAppMetaData.getPortlets().get("DefaultPortlet"));
-
- JBossPortletMetaData defaultPortletMetaData =
defaultAppMetaData.getPortlets().get("DefaultPortlet");
- if (defaultPortletMetaData != null)
+ if (defaultAppMetaData != null)
{
- PortletApplication10MetaData portletAppMD =
unit.getAttachment(PortletApplication10MetaData.class);
-
- for (PortletMetaData portletMD : portletAppMD.getPortlets().values())
+ log.debug("Found standard jboss app meta data");
+ JBossPortletMetaData defaultPortletMetaData =
defaultAppMetaData.getPortlets().get("DefaultPortlet");
+ if (defaultPortletMetaData != null)
{
- String name = portletMD.getPortletName();
- JBossPortletMetaData jbossPortletMetaData =
jbossAppMetaData.getPortlets().get(name);
- if (jbossPortletMetaData != null)
+ log.debug("Found default jboss portlet meta data");
+ for (PortletMetaData portlets :
portletAppMetaData.getPortlets().values())
{
- jbossPortletMetaData.merge(defaultPortletMetaData);
- }
- else
- {
- jbossAppMetaData.getPortlets().put(name,
(JBossPortletMetaData)defaultPortletMetaData.clone());
- }
+ String name = portlets.getPortletName();
+ JBossPortletMetaData jbossPortletMD =
jbossAppMetaData.getPortlets().get(name);
+ if (jbossPortletMD != null)
+ {
+ log.debug("Merging default jboss portlet meta data for " +
name);
+ jbossPortletMD.merge(defaultPortletMetaData);
+ }
+ else
+ {
+ log.debug("Using default jboss portlet meta data for " +
name);
+ jbossAppMetaData.getPortlets().put(name,
(JBossPortletMetaData)defaultPortletMetaData.clone());
+ }
+ }
}
}
}
- catch (Exception e)
+ catch (Throwable e)
{
- e.printStackTrace();
+ throw new DeploymentException("Cannot deploy portlet application",
e);
}
- unit.addAttachment(PORTLET_MERGED_ATTACHMENT_NAME, jbossAppMetaData,
JBossApplicationMetaData.class);
+ unit.addAttachment(PORTLET_MERGED_ATTACHMENT_NAME, jbossAppMetaData,
JBossPortletAppMetaData.class);
}
-
- public PortalEntityResolver getEntityResolver()
- {
- return entityResolver;
- }
-
- public void setEntityResolver(PortalEntityResolver entityResolver)
- {
- this.entityResolver = entityResolver;
- }
-
+
}
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalObjectParsingDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalObjectParsingDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalObjectParsingDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -24,7 +24,7 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
-import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+import org.jboss.portal.metadata.portlet.instances.PortletDeploymentInstancesMetaData;
import org.jboss.virtual.VirtualFile;
/**
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalResolverDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalResolverDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortalResolverDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -60,7 +60,7 @@
{
InputStream stream = file.openStream();
InputSource source = new InputSource(stream);
-
+
return (metadata) unmarshaller.unmarshal(source, resolver);
}
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletInstancesParsingDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletInstancesParsingDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletInstancesParsingDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -23,7 +23,7 @@
package org.jboss.portal.deployer.parsing;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+import org.jboss.portal.metadata.portlet.instances.PortletDeploymentInstancesMetaData;
import org.jboss.virtual.VirtualFile;
/**
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletParsingDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletParsingDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/PortletParsingDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,32 +22,13 @@
******************************************************************************/
package org.jboss.portal.deployer.parsing;
-import java.io.InputStream;
-
-import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.portal.deployer.PortalEntityResolver;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.mc.metadata.factory.PortletApplicationModelFactory; //
note: these are the metadata from the metadata model
-//import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
-//import org.jboss.portal.metadata.portlet.portlet.PortletMetaData;
-//import org.jboss.portal.metamodel.portlet.PortletApplicationModelFactory;
-//import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-//import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
import org.jboss.virtual.VirtualFile;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-public class PortletParsingDeployer extends
SchemaResolverDeployer<PortletApplication10MetaData>
+public class PortletParsingDeployer extends
PortalResolverDeployer<PortletApplication10MetaData>
{
- private PortalEntityResolver entityResolver;
-
- public void setEntityResolver(PortalEntityResolver entityResolver)
- {
- this.entityResolver = entityResolver;
- }
-
public PortletParsingDeployer()
{
super(PortletApplication10MetaData.class);
@@ -64,22 +45,9 @@
return getName();
}
- protected PortletApplication10MetaData parse(VFSDeploymentUnit unit, VirtualFile
file,
- PortletApplication10MetaData root) throws Exception
- {
-
- //super.parse(unit, file, root);
- InputStream stream = file.openStream();
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setEntityResolver(this.entityResolver);
-
- PortletApplication10MetaData portletMetaData = (PortletApplication10MetaData)
unmarshaller.unmarshal(stream,
- new PortletApplicationModelFactory(), root);
-
- System.out.println("PORTLETS : " + portletMetaData.getPortlets());
-
- return portletMetaData;
+ protected PortletApplication10MetaData parse(VFSDeploymentUnit unit, VirtualFile file,
PortletApplication10MetaData root) throws Exception
+ {
+ return (PortletApplication10MetaData) super.parse(unit, file, root);
}
}
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/LibDirectoryStructure.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/LibDirectoryStructure.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/LibDirectoryStructure.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -28,7 +28,6 @@
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
-import org.jboss.portal.core.model.instance.metadata.InstanceMetaData;
import org.jboss.virtual.VirtualFile;
/**
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/PortalPostWebDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/PortalPostWebDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/PortalPostWebDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.web.WebApplication;
@@ -50,6 +51,7 @@
public PortalPostWebDeployer()
{
//addInput(PortalMetaData.class);
+ this.setStage(DeploymentStages.INSTALLED);
}
public void setWarDeployer(AbstractWarDeployer warDeployer)
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/CommandServletDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/CommandServletDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/CommandServletDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -36,31 +36,38 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.FiltersMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.web.command.CommandServlet;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.mc.AnnotationPortletApplication10MetaData;
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
* @version $Revision$
*/
-public class CommandServletDeployer extends
AbstractSimpleVFSRealDeployer<PortletApplication10MetaData>
+public class CommandServletDeployer extends
AbstractSimpleVFSRealDeployer<AnnotationPortletApplication10MetaData>
{
+ //the name of the CommandServlet class to use. Set initially to default value
+ String commandServletClass = "org.jboss.portal.web.command.CommandServlet";
+
public CommandServletDeployer()
{
- super(PortletApplication10MetaData.class);
+ super(AnnotationPortletApplication10MetaData.class);
setStage(DeploymentStages.POST_PARSE);
}
+ public void setCommandServletClass(String commandServletClass)
+ {
+ this.commandServletClass = commandServletClass;
+ }
+
@Override
- public void deploy(VFSDeploymentUnit unit, PortletApplication10MetaData deployment)
throws DeploymentException
+ public void deploy(VFSDeploymentUnit unit, AnnotationPortletApplication10MetaData
deployment) throws DeploymentException
{
-
JBossWebMetaData jbossWebMetaData = (JBossWebMetaData)
unit.getAttachment(JBossWebMetaData.class);
JBossServletMetaData commandServlet = new JBossServletMetaData();
commandServlet.setServletName("CommandServlet");
- commandServlet.setServletClass(CommandServlet.class.getName());
+ commandServlet.setServletClass(commandServletClass);
commandServlet.setLoadOnStartup(0);
JBossServletsMetaData servlets = jbossWebMetaData.getServlets();
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,16 +22,15 @@
******************************************************************************/
package org.jboss.portal.deployer.portlet;
-import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.Kernel;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
-import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.deployer.container.InstanceDeployment;
import org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer;
-import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
+import org.jboss.portal.metadata.portlet.instances.PortletDeploymentInstancesMetaData;
/**
* Deploys to portlet instances to the portlet instance container
@@ -43,21 +42,8 @@
public class InstanceDeployer extends AbstractComponentDeployer
{
- protected Kernel kernel;
+ InstanceDeployment deployment;
- //default container reference name
- protected String instanceContainerReferenceName =
"portal:container=Instance";
-
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public void setInstanceContainerReferenceName (String instanceContainerReferenceName)
- {
- this.instanceContainerReferenceName = instanceContainerReferenceName;
- }
-
public InstanceDeployer()
{
this.setAllInputs(false);
@@ -73,33 +59,19 @@
this.setStage(DeploymentStages.INSTALLED);
}
+ @Install
+ public void addDeployment(InstanceDeployment deployment)
+ {
+ this.deployment = deployment;
+ }
@Override
public void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
- PortletDeploymentInstancesMetaData portletInstancesMetaData = unit
- .getAttachment(PortletDeploymentInstancesMetaData.class);
- JBossApplicationMetaData appMetaData =
unit.getAttachment(JBossApplicationMetaData.class);
-
- InstanceContainer instanceContainer;
- ControllerContext controllerContext =
kernel.getController().getInstalledContext(instanceContainerReferenceName);
- if (controllerContext == null)
- {
- throw new DeploymentException(
- "Cannot Deploy to Instance Container, cannot get ControllerContext
for \"" + instanceContainerReferenceName + "\"");
- }
-
- try
- {
- instanceContainer = (InstanceContainer) controllerContext.getTarget();
- InstanceDeployerImpl deployerImpl = new
InstanceDeployerImpl(appMetaData.getId(), instanceContainer);
- deployerImpl.deployInstances(portletInstancesMetaData);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error deploying instance with portlet id
:" + appMetaData.getId(), e);
- }
+ PortletDeploymentInstancesMetaData deploymentInstancesMetaData =
unit.getAttachment(PortletDeploymentInstancesMetaData.class);
+ JBossPortletAppMetaData appMetaData =
unit.getAttachment(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME,JBossPortletAppMetaData.class);
+ deployment.deployInstances(deploymentInstancesMetaData, appMetaData.getAppId());
}
Deleted:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -1,187 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.deployer.portlet;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.model.instance.DuplicateInstanceException;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.metadata.portlet.InstanceMetaData;
-import org.jboss.portal.metadata.portlet.PolicyPermissionMetaData;
-import org.jboss.portal.metadata.portlet.PortletDeploymentInstanceMetaData;
-import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
-import org.jboss.portal.metadata.portlet.PortletPreferenceMetaData;
-import org.jboss.portal.metadata.portlet.PortletPreferencesMetaData;
-import org.jboss.portal.metadata.portlet.SecurityConstrainMetaData;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.spi.provider.AuthorizationDomain;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-/**
- * Performs the actual deployment to the Instance Container running in
- * the portal sar.
- *
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class InstanceDeployerImpl
-{
- /*
- * Note: this class must be separate from the actual deployer class as it
- * has an AOP dependency for the Transaction Manager. The Transaction Manager
- * is created after the deployer class is created, but before this class is called.
- */
-
- protected final Logger log = Logger.getLogger(getClass());
-
- protected InstanceContainer instanceContainer;
-
- protected String appId;
-
- public InstanceDeployerImpl(String appId, InstanceContainer instanceContainer)
- {
- this.appId = appId;
- this.instanceContainer = instanceContainer;
- }
-
- /**
- * Deploys the instance to the instance container running in the portlet sar.
- *
- * @param instancesMetaData The metadata for the instance.
- * @throws Exception If an exception occurs while deploying the instance
- */
- //Requires a transaction to execute properly, setup through aop configuration for the
deployer.
- public void deployInstances(PortletDeploymentInstancesMetaData instancesMetaData)
throws Exception
- {
- List<PortletDeploymentInstanceMetaData> instancesMD =
instancesMetaData.getDeploymentInstances();
-
- for (int i = 0; i < instancesMD.size(); i++)
- {
- PortletDeploymentInstanceMetaData instanceMD = instancesMD.get(i);
-
- Instance instance =
instanceContainer.getDefinition(instanceMD.getInstance().getInstanceId());
-
- if (instance == null)
- {
- createInstance(instanceMD.getInstance());
- }
- else if (instanceMD.getOverwrite() == true)
- {
- log.debug("Instance " + instanceMD.getInstance().getInstanceId() +
" is about to be overwritten");
- configureInstance(instanceMD.getInstance(), instance);
- }
- else
- {
- log.debug("Instance " + instanceMD.getInstance().getInstanceId() +
" already exists");
- }
- }
- }
-
- protected void createInstance(InstanceMetaData instanceMD) throws
IllegalArgumentException,
- DuplicateInstanceException, PortletInvokerException
- {
- log.debug("Creating portlet instance " + instanceMD.getInstanceId());
-
- instanceMD.setPortletRef("local." + appId + "." +
instanceMD.getPortletRef());
-
- Instance instance = instanceContainer.createDefinition(instanceMD.getInstanceId(),
instanceMD.getPortletRef());
-
- configureInstance(instanceMD, instance);
- }
-
- protected void configureInstance(InstanceMetaData instanceMD, Instance instance)
- throws PortletInvokerException
- {
- log.debug("Configuring portlet instance " + instanceMD.getInstanceId());
- List<PropertyChange> changes = new ArrayList<PropertyChange>();
-
- // Reset all preferences that are not overridden
- PortletPreferencesMetaData preferencesMetaData =
instanceMD.getPortletPreferences();
- PropertyMap propertyMap = instance.getProperties();
-
- if (propertyMap != null && propertyMap.size() > 0)
- {
- for (String key : propertyMap.keySet())
- {
- if (preferencesMetaData == null || preferencesMetaData.getPreferences() ==
null
- || preferencesMetaData.getPreferences().contains(key) == false)
- {
- changes.add(PropertyChange.newReset(key));
- }
- }
- }
-
- // Configure preferences only if needed
- if (preferencesMetaData != null && preferencesMetaData.getPreferences() !=
null && preferencesMetaData.getPreferences().size() > 0)
- {
- for (int i = 0; i < preferencesMetaData.getPreferences().size(); i++)
- {
- PortletPreferenceMetaData portletPreferenceMetaData =
preferencesMetaData.getPreferences().get(i);
- PropertyChange change =
PropertyChange.newUpdate(portletPreferenceMetaData.getName(),
portletPreferenceMetaData.getValue());
- changes.add(change);
- }
- }
-
-
- if (changes.size() > 0)
- {
- instance.setProperties(changes.toArray(new PropertyChange[changes.size()]));
- }
-
- // Configure security
- SecurityConstrainMetaData securityConstraints = instanceMD.getSecurityContraint();
-
- if (securityConstraints == null)
- {
- securityConstraints = new SecurityConstrainMetaData();
- PolicyPermissionMetaData policyPermission = new PolicyPermissionMetaData();
- policyPermission.setActionName("view");
- policyPermission.setRoleName("__unchecked__".intern());
-
- List<PolicyPermissionMetaData> policyPermissions = new
ArrayList<PolicyPermissionMetaData>();
- policyPermissions.add(policyPermission);
-
- securityConstraints.setPolicyPermission(policyPermissions);
- }
-
- HashSet<RoleSecurityBinding> bindings = new
HashSet<RoleSecurityBinding>();
- for (int i = 0; i < securityConstraints.getPolicyPermission().size(); i++)
- {
- PolicyPermissionMetaData policyMD =
securityConstraints.getPolicyPermission().get(i);
- RoleSecurityBinding binding = new RoleSecurityBinding(policyMD.getActionName(),
policyMD.getRoleName());
- bindings.add(binding);
- }
-
- AuthorizationDomain authDomain = instance.getContainer().getAuthorizationDomain();
- DomainConfigurator domainConfigurator = authDomain.getConfigurator();
- domainConfigurator.setSecurityBindings(instance.getId(), bindings);
- }
-
-}
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,16 +22,17 @@
******************************************************************************/
package org.jboss.portal.deployer.portlet;
+import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.kernel.Kernel;
-import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
-import org.jboss.portal.core.model.content.spi.ContentProviderRegistry;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.deployer.container.PortalObjectDeployment;
+import org.jboss.portal.metadata.portal.object.PortalObjectDeploymentMetaData;
import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
+import org.jboss.web.WebApplication;
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
@@ -39,70 +40,28 @@
*/
public class ObjectDeployer extends AbstractComponentDeployer
{
-
- protected Kernel kernel;
- protected String portalObjectContainerReferenceName =
"portal:container=PortalObject";
- protected String contentProviderRegistryReferenceName =
"portal:service=ContentProviderRegistry";
- protected String coordinationConfiguratorReferenceName =
"portal:service=CoordinationService";
+ PortalObjectDeployment deployment;
- public void setKernel (Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public void setPortalObjectContainerReferenceName (String
portalObjectContainerReferenceName)
- {
- this.portalObjectContainerReferenceName = portalObjectContainerReferenceName;
- }
-
- public void setContentProviderRegistryReferenceName (String
contentProviderRegistryReferenceName)
- {
- this.contentProviderRegistryReferenceName = contentProviderRegistryReferenceName;
- }
-
- public void setCoordinationConfiguratorReferenceName (String
coordinationConfigurationReferenceName)
- {
- this.coordinationConfiguratorReferenceName =
coordinationConfigurationReferenceName;
- }
-
public ObjectDeployer()
{
this.setAllInputs(false);
this.setInput(PortalObjectMetaData.class);
this.addInput(PortletDeployer.PORLET_DEPLOYED);
-
this.setStage(DeploymentStages.INSTALLED);
}
+ @Install
+ public void addDeployment(PortalObjectDeployment deployment)
+ {
+ this.deployment = deployment;
+ }
+
@Override
public void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
- PortalObjectMetaData objectMetaData = (PortalObjectMetaData)
unit.getAttachment(PortalObjectMetaData.class);
+ PortalObjectMetaData objectMetaData =
unit.getAttachment(PortalObjectMetaData.class);
- ControllerContext objectContainerControllerContext =
kernel.getController().getInstalledContext(portalObjectContainerReferenceName);
- if (objectContainerControllerContext == null)
- {
- throw new DeploymentException("Cannot deploy to Portal Object Container,
cannot get ControllerContext for \"" + portalObjectContainerReferenceName +
"\"");
- }
- PortalObjectContainer objectContainer =
(PortalObjectContainer)objectContainerControllerContext.getTarget();
-
- ControllerContext contentProviderRegistryControllerContext =
kernel.getController().getInstalledContext(contentProviderRegistryReferenceName);
- if (contentProviderRegistryControllerContext == null)
- {
- throw new DeploymentException("Cannot deploy to Portal Object Container,
cannot get ControllerContext for \"" + contentProviderRegistryReferenceName +
"\"");
- }
- ContentProviderRegistry contentProviderRegistry =
(ContentProviderRegistry)contentProviderRegistryControllerContext.getTarget();
-
- ControllerContext coordinationConfiguratorControllerContext =
kernel.getController().getInstalledContext(coordinationConfiguratorReferenceName);
- if (coordinationConfiguratorControllerContext == null)
- {
- throw new DeploymentException("Cannot deploy to Portal Object Container,
cannot get ControllerContext for \"" + coordinationConfiguratorReferenceName +
"\"");
- }
- CoordinationConfigurator coordinationConfiguration =
(CoordinationConfigurator)coordinationConfiguratorControllerContext.getTarget();
-
- ObjectDeployerImpl objectDeployer = new ObjectDeployerImpl(objectContainer,
contentProviderRegistry, coordinationConfiguration);
- objectDeployer.deployObjects(objectMetaData);
-
+ deployment.deployObjects(objectMetaData, unit.getClassLoader());
}
}
Deleted:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.deployer.portlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
-import org.jboss.portal.core.model.content.spi.ContentProviderRegistry;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
-
-/**
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class ObjectDeployerImpl
-{
-
- protected final Logger log = Logger.getLogger(getClass());
-
- protected PortalObjectContainer portalObjectContainer;
- protected ContentProviderRegistry contentProviderRegistry;
- protected CoordinationConfigurator coordinationConfigurator;
-
- public ObjectDeployerImpl(PortalObjectContainer portalObjectContainer,
ContentProviderRegistry contentProviderRegistry, CoordinationConfigurator
coordinationConfigurator)
- {
- this.portalObjectContainer = portalObjectContainer;
- this.contentProviderRegistry = contentProviderRegistry;
- this.coordinationConfigurator = coordinationConfigurator;
- }
-
- public void deployObjects (PortalObjectMetaData objectMetaData)
- {
- //TODO: need to write a class to convert the PortalObjectMetaData class to
PortalObject class
- }
-
-}
-
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -35,7 +35,7 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
/**
* This deployer adds a dependency item to the DeploymentUnit which
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -22,27 +22,21 @@
******************************************************************************/
package org.jboss.portal.deployer.portlet;
-import java.lang.reflect.Method;
-import java.net.URL;
import java.util.ArrayList;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
import javax.servlet.ServletContext;
-import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.deployer.container.PortletDeployment;
import org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.deployment.jboss.InfoBuilderFactory;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.server.deployment.PortalWebApp;
+import org.jboss.portal.deployer.webapp.WebAppContextDeployer;
+import org.jboss.portal.metadata.jboss.portlet.JBossPortletAppMetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
import org.jboss.web.WebApplication;
import org.jboss.web.deployers.AbstractWarDeployer;
@@ -52,187 +46,47 @@
public static final String PORLET_DEPLOYED = "portlet.deployed";
- protected AbstractWarDeployer warDeployer;
-
- protected MBeanServer mbeanServer;
+ PortletDeployment deployment;
- protected Kernel kernel;
-
- protected String coreInfoBuilderReferenceName =
"portal:service=InfoBuilderFactory,type=Core";
-
- protected String portletContainerInvoker =
"portal:service=PortletInvoker,type=Container";
-
- protected ArrayList listeners = new ArrayList();
-
public PortletDeployer()
{
setAllInputs(false);
setInput(PortletApplication10MetaData.class);
addInput(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME);
+ addInput(WebAppContextDeployer.PORTLET_APP_CONTEXT_PATH_ATTACHMENT);
+ addInput(WebAppContextDeployer.PORTLET_APP_SERVLET_CONTEXT_ATTACHMENT);
+ addInput(WebApplication.class);
addOutput(PORLET_DEPLOYED);
setStage(DeploymentStages.INSTALLED);
}
-
- public void setWarDeployer(AbstractWarDeployer warDeployer)
- {
- this.warDeployer = warDeployer;
- }
-
- public void setMBeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
- public void setKernel(Kernel kernel)
- {
- this.kernel=kernel;
- }
- public int getRelativeOrder()
+ @Install
+ public void addDeployment(PortletDeployment deployment)
{
- return warDeployer.getRelativeOrder() + 10;
+ this.deployment = deployment;
}
-
- public void setCoreInfoBuilderReferenceName (String coreInfoBuilderReferenceName)
- {
- this.coreInfoBuilderReferenceName = coreInfoBuilderReferenceName;
- }
- public void setPortletContainerInvoker (String portletContainerInvoker)
- {
- this.portletContainerInvoker = portletContainerInvoker;
- }
-
@Override
public void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
PortletApplication10MetaData portletMetaData =
unit.getAttachment(PortletApplication10MetaData.class);
- JBossApplicationMetaData jbossPortletMetaData =
unit.getAttachment(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME,
JBossApplicationMetaData.class);
+ JBossPortletAppMetaData jbossPortletMetaData =
unit.getAttachment(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME,
JBossPortletAppMetaData.class);
- PortalWebApp portalWebApp = createPortalWebApp(unit.getName());
+ String contextPath =
unit.getAttachment(WebAppContextDeployer.PORTLET_APP_CONTEXT_PATH_ATTACHMENT,
String.class);
+ ServletContext servletContext =
unit.getAttachment(WebAppContextDeployer.PORTLET_APP_SERVLET_CONTEXT_ATTACHMENT,
ServletContext.class);
+ WebApplication webapp = unit.getAttachment(WebApplication.class);
- ControllerContext coreInfoContext =
kernel.getController().getInstalledContext(coreInfoBuilderReferenceName);
- if (coreInfoContext == null)
- {
- throw new DeploymentException(
- "Cannot Deploy to Instance Container, cannot get ControllerContext
for \"" + coreInfoBuilderReferenceName + "\"");
- }
- InfoBuilderFactory infoBuilderFactory =
(InfoBuilderFactory)coreInfoContext.getTarget();
-
-
- ControllerContext portletContainerContext =
kernel.getController().getInstalledContext(portletContainerInvoker);
- if (portletContainerContext == null)
- {
- throw new DeploymentException(
- "Cannot Deploy to Instance Container, cannot get ControllerContext
for \"" + portletContainerInvoker + "\"");
- }
- PortletInvoker portletInvoker =
(PortletInvoker)portletContainerContext.getTarget();
-
- PortletDeployerImpl portletDeployerImpl = new
PortletDeployerImpl(infoBuilderFactory, portletInvoker);
- portletDeployerImpl.deployPortlets(portalWebApp, jbossPortletMetaData,
portletMetaData);
-
-
+ this.deployment.deployPortlets(servletContext, webapp.getURL(),
webapp.getClassLoader(), contextPath, jbossPortletMetaData, portletMetaData);
+
unit.addAttachment(PORLET_DEPLOYED, "deployed");
}
@Override
public void internalUndeploy(DeploymentUnit unit)
{
- System.out.println("INTERNALUNDEPLOY");
+ System.out.println("INTERNALUNDEPLOY : " + unit.getName());
}
- /**
- * This is a hack, but we currently need this information for the portlet
- * container and there doesn't appear to be any other way to really get this
info.
- *
- * TODO: fix this code to make it more sane and less prone to issues which may
- * occur if internals in the JBoss Web/Tomcat change.
- *
- */
- protected PortalWebApp createPortalWebApp(String warURL) throws DeploymentException
- {
- WebApplication webApp = warDeployer.getDeployedApp(warURL);
- ObjectName objectName;
- Object standardContextObject;
-
- try
- {
- objectName = (ObjectName) webApp.getAppData();
- }
- catch (ClassCastException cce)
- {
- throw new DeploymentException(
- "Can not deploy portlet, the WebApplication.getAppData " +
- "doesn't contain a proper ObjectName", cce);
- }
-
- try
- {
- standardContextObject = mbeanServer.getAttribute(objectName,
"managedResource");
- }
- catch (Exception e)
- {
- throw new DeploymentException(
- "Could not deploy the portlet, could not get the attribute
'managedResource'" +
- "from mbean with object name '" + objectName
+"'", e);
- }
-
- String contextPath = getContextPath(standardContextObject);
- ServletContext servletContext = getServletContext(standardContextObject);
- URL url = webApp.getURL();
- ClassLoader classloader = webApp.getClassLoader();
-
- PortalWebApplication portalWebApp = new PortalWebApplication(servletContext, url,
classloader, contextPath);
- return portalWebApp;
- }
-
- //TODO: determine a better way to get the contextpath string
- protected String getContextPath (Object standardContextObject) throws
DeploymentException
- {
- try
- {
- Class standardContextClass = standardContextObject.getClass();
- Method getPathMethod = standardContextClass.getMethod("getPath", new
Class[0]);
-
- return (String)getPathMethod.invoke(standardContextObject, new Object[0]);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error trying to get the ContextPath from the
web server.", e);
- }
- }
-
- //TODO: determine a better way to get the servlet context
- protected ServletContext getServletContext(Object standardContextObject) throws
DeploymentException
- {
- try
- {
- Class standardContextClass = standardContextObject.getClass();
- Method getServletContextMethod =
standardContextClass.getMethod("getServletContext", new Class[0]);
-
- return (ServletContext)getServletContextMethod.invoke(standardContextObject, new
Object[0]);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error trying to get Reference to the
ServletContext from the web server.", e);
- }
- }
-
- //TODO: remove this class and change PortalWebAPP so that only a simple interface is
needed
- class PortalWebApplication extends PortalWebApp
- {
-
- public PortalWebApplication(ServletContext servletContext, URL url, ClassLoader
classloader, String contextPath)
- {
- init(servletContext, url, classloader, contextPath);
- }
-
- @Override
- public void instrument() throws Exception
- {
- //do nothing
- }
-
- }
}
Deleted:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -1,176 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.deployer.portlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.container.ContainerPortletInvoker;
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerContext;
-import org.jboss.portal.portlet.container.PortletFilterContext;
-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.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.jboss.InfoBuilder;
-import org.jboss.portal.portlet.deployment.jboss.InfoBuilderFactory;
-import org.jboss.portal.portlet.deployment.jboss.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.deployment.jboss.PortletContainerContextImpl;
-import org.jboss.portal.portlet.deployment.jboss.PortletFilterContextImpl;
-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.info.PortletInfo;
-import org.jboss.portal.server.deployment.PortalWebApp;
-
-/**
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class PortletDeployerImpl
-{
- protected final Logger log = Logger.getLogger(this.getClass());
-
- protected InfoBuilderFactory coreInfoBuilderFactory;
- protected PortletInvoker portletContainerInvoker;
-
-
- public PortletDeployerImpl (InfoBuilderFactory coreInfoBuilderFactory, PortletInvoker
portletContainerInvoker)
- {
- this.coreInfoBuilderFactory = coreInfoBuilderFactory;
- this.portletContainerInvoker = portletContainerInvoker;
- }
-
- public void deployPortlets(PortalWebApp pwa, JBossApplicationMetaData jbossAppMD,
PortletApplication10MetaData portletAppMD)
- {
- InfoBuilder infoBuilder = coreInfoBuilderFactory.createInfoBuilder(pwa, jbossAppMD,
portletAppMD);
- infoBuilder.build();
-
- PortletApplicationObject portletApplicationObject = new
PortletApplicationImpl(infoBuilder.getApplication());
- PortletApplicationContext portletApplicationContext = new
PortletApplicationContextImpl(pwa);
-
- //
- PortletApplicationLifeCycle portletApplicationLifeCycle = new
PortletApplicationLifeCycle(bridgeToInvoker, portletApplicationContext,
- portletApplicationObject);
-
- //
- for (ContainerFilterInfo filterInfo :
infoBuilder.getApplication().getFilters().values())
- {
- PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
- PortletFilterContext portletFilterContext = new PortletFilterContextImpl();
-
- //
- portletApplicationLifeCycle.addPortletFilter(portletFilterContext,
portletFilterObject);
- System.out.println("ADDING FILTERINFO : " + portletFilterContext +
" : " + portletFilterObject);
- }
-
- //
- for (PortletInfo portletInfo : infoBuilder.getPortlets())
- {
- System.out.println("PORTLETINFO : " + portletInfo);
- 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();
- }
-
- /** 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:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletTLDDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletTLDDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletTLDDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -23,30 +23,21 @@
package org.jboss.portal.deployer.portlet;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+import org.jboss.portal.metadata.portlet.PortletApplication20MetaData;
import org.jboss.web.WebApplication;
-import org.jboss.web.deployers.AbstractWarDeployer;
/**
* Deployer to add the tld file to the portlet.
@@ -67,14 +58,12 @@
protected String tldDirectory;
- protected AbstractWarDeployer warDeployer;
-
protected MBeanServer server;
public PortletTLDDeployer()
{
setAllInputs(false);
- setInput(PortletApplication10MetaData.class);
+ setInput(WebApplication.class);
setStage(DeploymentStages.INSTALLED);
}
@@ -83,17 +72,6 @@
this.tldDirectory = path;
}
- @Override
- public int getRelativeOrder()
- {
- return warDeployer.getRelativeOrder() + 1;
- }
-
- public void setWarDeployer(AbstractWarDeployer warDeployer)
- {
- this.warDeployer = warDeployer;
- }
-
public void setMBeanServer(MBeanServer server)
{
this.server = server;
@@ -101,9 +79,7 @@
public void deploy(DeploymentUnit unit) throws DeploymentException
{
- //the name of the unit is the same as the war url used
- String name = unit.getName();
- WebApplication webApp = warDeployer.getDeployedApp(name);
+ WebApplication webApp = (WebApplication)unit.getAttachment(WebApplication.class);
//the AppData object is the name of the deployment MBean
ObjectName objectName = (ObjectName) webApp.getAppData();
@@ -113,7 +89,7 @@
// docBase will return where the webapp is deployed. This will either be in the
// deploy for an exploded war or the tmp/deploy for a non exploded war
String docBase = (String) server.getAttribute(objectName, "docBase");
-
+
PortletApplication10MetaData metaData =
unit.getAttachment(PortletApplication10MetaData.class);
if (metaData instanceof PortletApplication20MetaData)
{
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java 2009-03-02
15:01:37 UTC (rev 12921)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -1,65 +1,64 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.deployer.portlet;
-
-import java.util.Iterator;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.portal.core.metadata.ServiceMetaData;
-import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-
-/**
- * This class injects portlet specific services into the war
- *
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class ServiceInjectorDeployer extends
AbstractSimpleVFSRealDeployer<JBossApplicationMetaData>
-{
-
- public ServiceInjectorDeployer()
- {
- super(JBossApplicationMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- @Override
- public void deploy(VFSDeploymentUnit unit, JBossApplicationMetaData deployment) throws
DeploymentException
- {
- Iterator<ServiceMetaData> iterator =
deployment.getServices().values().iterator();
- while (iterator.hasNext())
- {
- ServiceMetaData serviceMD = iterator.next();
- //TODO: finish this deployer. This deployer needs to inject the services into
the portlet servlets
- // need to figure out if this can be done with an xml file or if this is going
to need to have
- // access to the server like the tld deployer.
- }
- }
-
-
-}
-
+///******************************************************************************
+// * JBoss, a division of Red Hat *
+// * Copyright 2008, 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.deployer.portlet;
+//
+//import java.util.Iterator;
+//
+//import org.jboss.deployers.spi.DeploymentException;
+//import org.jboss.deployers.spi.deployer.DeploymentStages;
+//import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+//import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+//import org.jboss.portal.core.metadata.ServiceMetaData;
+//import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+//
+///**
+// * This class injects portlet specific services into the war
+// *
+// * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+// * @version $Revision$
+// */
+//public class ServiceInjectorDeployer extends
AbstractSimpleVFSRealDeployer<JBossApplicationMetaData>
+//{
+//
+// public ServiceInjectorDeployer()
+// {
+// super(JBossApplicationMetaData.class);
+// setStage(DeploymentStages.POST_PARSE);
+// }
+//
+// @Override
+// public void deploy(VFSDeploymentUnit unit, JBossApplicationMetaData deployment)
throws DeploymentException
+// {
+// Iterator<ServiceMetaData> iterator =
deployment.getServices().values().iterator();
+// while (iterator.hasNext())
+// {
+// ServiceMetaData serviceMD = iterator.next();
+// //TODO: finish this deployer. This deployer needs to inject the services into
the portlet servlets
+// // need to figure out if this can be done with an xml file or if this is going
to need to have
+// // access to the server like the tld deployer.
+// }
+// }
+//
+//
+//}
+//
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppContextDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppContextDeployer.java
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppContextDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.deployer.webapp;
+
+import java.lang.reflect.Method;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.web.WebApplication;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class WebAppContextDeployer extends AbstractDeployer
+{
+ protected MBeanServer server;
+ public static String PORTLET_APP_CONTEXT_PATH_ATTACHMENT =
"portletAppContextPath." + String.class.getName();
+ public static String PORTLET_APP_SERVLET_CONTEXT_ATTACHMENT =
"portletAppServletContext." + ServletContext.class.getName();
+
+ public WebAppContextDeployer()
+ {
+ setAllInputs(false);
+ setInput(WebApplication.class);
+ setStage(DeploymentStages.INSTALLED);
+ addOutput(PORTLET_APP_SERVLET_CONTEXT_ATTACHMENT);
+ addOutput(PORTLET_APP_CONTEXT_PATH_ATTACHMENT);
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ this.server = server;
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ WebApplication webApp = unit.getAttachment(WebApplication.class);
+
+ ObjectName objectName = (ObjectName)webApp.getAppData();
+
+ try
+ {
+ Object standardContextObject = server.getAttribute(objectName,
"managedResource");
+ String contextPath = getContextPath(standardContextObject);
+ ServletContext servletContext = getServletContext(standardContextObject);
+
+ unit.addAttachment(PORTLET_APP_CONTEXT_PATH_ATTACHMENT, contextPath,
String.class);
+ unit.addAttachment(PORTLET_APP_SERVLET_CONTEXT_ATTACHMENT, servletContext,
ServletContext.class);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException ("Could not get the Standard Context for
" + unit.getName());
+ }
+ }
+
+ //TODO: determine a better way to get the contextpath string
+ protected String getContextPath(Object standardContextObject) throws
DeploymentException
+ {
+ try
+ {
+ Class standardContextClass = standardContextObject.getClass();
+ Method getPathMethod = standardContextClass.getMethod("getPath", new
Class[0]);
+
+ return (String) getPathMethod.invoke(standardContextObject, new Object[0]);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error trying to get the ContextPath from the
web server.", e);
+ }
+ }
+
+ // TODO: determine a better way to get the servlet context
+ protected ServletContext getServletContext(Object standardContextObject) throws
DeploymentException
+ {
+ try
+ {
+ Class standardContextClass = standardContextObject.getClass();
+ Method getServletContextMethod =
standardContextClass.getMethod("getServletContext", new Class[0]);
+
+ return (ServletContext) getServletContextMethod.invoke(standardContextObject,
new Object[0]);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error trying to get Reference to the
ServletContext from the web server.", e);
+ }
+ }
+
+}
+
Added:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppDeployer.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppDeployer.java
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/webapp/WebAppDeployer.java 2009-03-02
19:30:58 UTC (rev 12922)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.deployer.webapp;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.portal.metadata.portlet.PortletApplication10MetaData;
+import org.jboss.web.WebApplication;
+import org.jboss.web.deployers.AbstractWarDeployer;
+
+/**
+ * This class is used to get a WebApplication object for the deployed
+ * webapp.
+ * NOTE: that this class does not perform like a normal deployer, it is not
+ * metadata driven as the information required is not determined by the webapp's
+ * metadata but how it is deployed into the server.
+ * TODO: More research should be done to determine if this information can be more
+ * sanely extracted from the server.
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class WebAppDeployer extends AbstractDeployer
+{
+
+ protected AbstractWarDeployer warDeployer;
+
+ public WebAppDeployer()
+ {
+ setAllInputs(false);
+ setInput(PortletApplication10MetaData.class);
+ setOutput(WebApplication.class);
+ setStage(DeploymentStages.INSTALLED);
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ // must be set relative to the warDeployer as the data we
+ // need is only set after the webapp has been deployed.
+ return warDeployer.getRelativeOrder() + 1;
+ }
+
+ public void setWarDeployer(AbstractWarDeployer warDeployer)
+ {
+ this.warDeployer = warDeployer;
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ // the unit name of the deployed application is the string
+ // used to store the apps in the warDeployer
+ String name = unit.getName();
+ WebApplication webApp = warDeployer.getDeployedApp(name);
+ if (webApp == null)
+ {
+ throw new DeploymentException ("Could not find a deployed webapp with name
" + name);
+ }
+ unit.addAttachment(WebApplication.class, webApp);
+ }
+
+}
+
Modified: modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml 2009-03-02
15:01:37 UTC (rev 12921)
+++ modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml 2009-03-02
19:30:58 UTC (rev 12922)
@@ -4,4 +4,9 @@
<trans-attribute>RequiresNew</trans-attribute>
</method>
</metadata>
+ <metadata tag="transaction"
class="org.jboss.portal.deployer.container.ObjectDeployer">
+ <method name="deployObjects">
+ <trans-attribute>RequiresNew</trans-attribute>
+ </method>
+ </metadata>
</aop>