Author: mwringe
Date: 2009-02-08 22:49:06 -0500 (Sun, 08 Feb 2009)
New Revision: 12796
Added:
modules/deployer/trunk/deployer/src/main/deployer/conf/
modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd
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/portlet/InstanceDeployer.java
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/ObjectDeployer.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
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java
modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
Modified:
modules/deployer/trunk/build/pom.xml
modules/deployer/trunk/deployer/pom.xml
modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
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/portal/WebDeploymentListener.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/pom.xml
Log:
Update deployer code improvements.
Modified: modules/deployer/trunk/build/pom.xml
===================================================================
--- modules/deployer/trunk/build/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/build/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -1,10 +1,10 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+<!-- <parent>
<groupId>org.jboss.portal</groupId>
<artifactId>jboss-portal-parent</artifactId>
<version>1.0.0</version>
- </parent>
+ </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.deployer</groupId>
<artifactId>module-parent</artifactId>
@@ -15,7 +15,9 @@
<properties>
<version.assembly>2.2-beta-2</version.assembly>
- <version.jboss-deployers>2.0.0.CR1</version.jboss-deployers>
+ <version.jboss.aop>1.0.0.GA</version.jboss.aop>
+ <version.jboss.aspects>1.0.0.GA</version.jboss.aspects>
+ <version.jboss-deployers>2.2.0-SNAPSHOT</version.jboss-deployers>
<version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
<version.jboss.portal>2.8-SNAPSHOT</version.jboss.portal>
<version.jboss.portal.metadata>trunk-SNAPSHOT</version.jboss.portal.metadata>
@@ -50,7 +52,15 @@
</releases>
</repository>
</repositories>
+<!-- <pluginRepositories>
+ <pluginRepository>
+ <id>maven.jboss.org</id>
+ <name>JBoss Maven Repository</name>
+ <
url>http://repository.jboss.com/maven2</url>
+ </pluginRepository>
+ </pluginRepositories> -->
+
<build>
<plugins>
<plugin>
@@ -121,7 +131,28 @@
<artifactId>core</artifactId>
<version>${version.jboss.portal.server}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Modified: modules/deployer/trunk/deployer/pom.xml
===================================================================
--- modules/deployer/trunk/deployer/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -66,21 +66,59 @@
<groupId>org.jboss.portal.core</groupId>
<artifactId>core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>test</artifactId>
+ <version>0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
<build>
+
+<pluginManagement>
+<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+</plugin>
+</plugins>
+</pluginManagement>
+
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>iso-8859-1</encoding>
+ <source>1.5</source>
+ <target>1.5</target>
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>${version.assembly}</version>
+ <!-- <version>${version.assembly}</version> -->
<configuration>
<finalName>jboss-portal.deployer</finalName>
<descriptors>
@@ -98,12 +136,46 @@
</executions>
</plugin>
-
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/base-aop.xml</exclude>
+ <exclude>**/deployment-aop.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <configuration>
+ <includeProjectDependency>true</includeProjectDependency>
+ <aoppaths>
+ <aoppath>src/main/resources/base-aop.xml</aoppath>
+ <aoppath>src/main/resources/deployment-aop.xml</aoppath>
+ </aoppaths>
+ <includes>
+
<include>org/jboss/portal/deployer/portlet/InstanceDeployerImpl.class</include>
+ </includes>
+ </configuration>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
- <properties/>
+<!-- <properties/> -->
</project>
Modified:
modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml
===================================================================
---
modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml 2009-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml 2009-02-09
03:49:06 UTC (rev 12796)
@@ -1,13 +1,18 @@
<component>
<fileSets>
-
<fileSet>
<directory>src/main/deployer</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
-
</fileSets>
+ <files>
+ <file>
+ <source>src/main/resources/deployment-aop.xml</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ </files>
+
</component>
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-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-02-09
03:49:06 UTC (rev 12796)
@@ -95,6 +95,11 @@
<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 -->
<!--
where the actual deployment occurs, these classes will send the data to the various
runtime containers
@@ -102,11 +107,14 @@
<!-- 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>foo</value>
+ <value>portal:service=InfoBuilderFactory,type=Core</value>
+ <value>portal:service=PortletInvoker,type=Container</value>
+ <value>portal:service=PortletSecurityService</value>
+ <value>portal:container=Instance</value>
</list>
- </property> -->
+ </property>
</bean>
<bean name="CommandServletDeployer"
class="org.jboss.portal.deployer.portlet.CommandServletDeployer"/>
@@ -118,7 +126,21 @@
</bean>
<bean name="PortletDeployer"
class="org.jboss.portal.deployer.portlet.PortletDeployer">
- <property name="warDeployerOrder"><inject
bean="WarDeployer" property="relativeOrder"/></property>
+ <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>
+
+ <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="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>
+
</deployment>
Added: modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,39 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <portlet>
+ <portlet-name>DefaultPortlet</portlet-name>
+ <remotable>false</remotable>
+ <ajax>
+ <partial-refresh>true</partial-refresh>
+ </ajax>
+ <transaction>
+ <trans-attribute>NotSupported</trans-attribute>
+ </transaction>
+ </portlet>
+</portlet-app>
Property changes on:
modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+-->
+
+<!--
+The deployements element is a container for deployment elements.
+-->
+<!ELEMENT deployments (deployment*)>
+
+<!--
+The deployment is a container for an instance element.
+-->
+<!ELEMENT deployment (if-exists?,instance)>
+
+<!--
+The if-exists element is used to define action to take if instance with such name is
+already present. Possible values are overwrite or keep . Overwrite will destroy the
+existing object in the database and create a new one, based on the content of the
+deployment. Keep will maintain the existing object deployment or create a new one if
+it does not yet exist.
+-->
+<!ELEMENT if-exists (#PCDATA)>
+
+<!--
+The instance element is used to create an instance of a portlet from the portlet
+application of the same war file containing the portlet-instances.xml file. The portlet
+will be created and configured only if the portlet is present and an instance with
+such a name does not already exist.
+
+Example :
+
+<instance>
+ <instance-id>MyPortletInstance</instance-id>
+ <portlet-ref>MyPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>abc</name>
+ <value>def</value>
+ </preference>
+ </preferences>
+ <security-constraint>
+ <policy-permission>
+ <role-name>User</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+ </security-constraint>
+</instance>
+
+-->
+<!ELEMENT instance (instance-id,portlet-ref,display-name*,preferences?,
+ security-constraint?, (display-name* | (resource-bundle,
supported-locale+)))>
+
+
+<!ELEMENT resource-bundle (#PCDATA)>
+
+<!ELEMENT supported-locale (#PCDATA)>
+
+
+<!--
+The identifier of the instance.
+-->
+<!ELEMENT instance-id (#PCDATA)>
+
+<!--
+The reference to the portlet which is its portlet name.
+-->
+<!ELEMENT portlet-ref (#PCDATA)>
+
+<!--
+Display name is the string used to represent this instance
+-->
+<!ELEMENT display-name (#PCDATA)>
+<!ATTLIST display-name
+ xml:lang NMTOKEN #IMPLIED
+>
+
+<!--
+The preferences element configures the instance with a specific set of preferences.
+-->
+<!ELEMENT preferences (preference+)>
+
+<!--
+The preference configure one preference of a set of preferences.
+-->
+<!ELEMENT preference (name,value)>
+
+<!--
+A name.
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+A string value.
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!--
+The security-constraint element is a container for policy-permission elements
+
+Examples:
+
+<security-constraint>
+ <policy-permission>
+ <role-name>User</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+</security-constraint>
+
+<security-constraint>
+ <policy-permission>
+ <unchecked/>
+ <action-name>view</action-name>
+ </policy-permission>
+</security-constraint>
+-->
+<!ELEMENT security-constraint (policy-permission*)>
+
+<!--
+The policy-permission element is used to secure a specific portlet instance based on a
+user's role.
+-->
+<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
+
+<!--
+The action-name element is used to define the access rights given to the role defined.
+Possible values are:
+
+ * view - Users can view the page.
+ * viewrecursive - Users can view the page and child pages.
+ * personalize - Users are able to view AND personalize the page.
+ * personalizerecursive - Users are able to view AND personalize the page AND its
child
+ pages.
+-->
+<!ELEMENT action-name (#PCDATA)>
+
+<!--
+The unchecked element is used to define (if present) that anyone can view this instance
+-->
+<!ELEMENT unchecked EMPTY>
+
+<!--
+The role-name element is used to define a role that this security constraint will apply
to
+
+ * <role-name>SOMEROLE</role-name> Access to this instance is limited to
the defined role.
+-->
+<!ELEMENT role-name (#PCDATA)>
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-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -23,12 +23,15 @@
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.portal.portlet.deployment.jboss.JBossApplicationMetaDataFactory;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -61,7 +64,13 @@
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();
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * 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.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.portal.deployer.PortalEntityResolver;
+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.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class MergedPortletParsingDeployer extends AbstractDeployer
+{
+ public static final String PORTLET_MERGED_ATTACHMENT_NAME = "merged." +
JBossApplicationMetaData.class.getName();
+
+ protected String standardPortletFileLocation;
+ protected PortalEntityResolver entityResolver;
+
+ public MergedPortletParsingDeployer()
+ {
+ setAllInputs(false);
+ setInput(JBossApplicationMetaData.class);
+ addInput(PortletApplication10MetaData.class);
+ setOutput(JBossApplicationMetaData.class);
+ addOutput(PORTLET_MERGED_ATTACHMENT_NAME);
+ this.setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public String getStandardPortletFileLocation()
+ {
+ return standardPortletFileLocation;
+ }
+
+ public void setStandardPortletFileLocation(String standardPortletFileLocation)
+ {
+ this.standardPortletFileLocation = standardPortletFileLocation;
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ JBossApplicationMetaData jbossAppMetaData =
unit.getAttachment(JBossApplicationMetaData.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)
+ {
+ jbossAppMetaData.setId(appMetaData.getAppName());
+ }
+
+ try{
+
+ InputStream stream =
this.getClass().getClassLoader().getResourceAsStream(standardPortletFileLocation);
+
+ 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());
+
+ System.out.println("DEFAULT PORTLETS : " +
defaultAppMetaData.getPortlets().get("DefaultPortlet"));
+
+ JBossPortletMetaData defaultPortletMetaData =
defaultAppMetaData.getPortlets().get("DefaultPortlet");
+ if (defaultPortletMetaData != null)
+ {
+ PortletApplication10MetaData portletAppMD =
unit.getAttachment(PortletApplication10MetaData.class);
+
+ for (PortletMetaData portletMD : portletAppMD.getPortlets().values())
+ {
+ String name = portletMD.getPortletName();
+ JBossPortletMetaData jbossPortletMetaData =
jbossAppMetaData.getPortlets().get(name);
+ if (jbossPortletMetaData != null)
+ {
+ jbossPortletMetaData.merge(defaultPortletMetaData);
+ }
+ else
+ {
+ jbossAppMetaData.getPortlets().put(name,
(JBossPortletMetaData)defaultPortletMetaData.clone());
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ unit.addAttachment(PORTLET_MERGED_ATTACHMENT_NAME, jbossAppMetaData,
JBossApplicationMetaData.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/portal/WebDeploymentListener.java
===================================================================
---
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java 2009-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -25,7 +25,7 @@
import org.jboss.web.WebApplication;
/*
- * This is only to get portal 2.7 working with JBoss AS 5 intially, should be replaced
with a
+ * This is only to get portal 2.7 working with JBoss AS 5 initially, should be replaced
with a
* full deployment implementation.
*
* TODO: remove this file once full deployment has been done.
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008-2009, 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.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.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer;
+import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+
+/**
+ * Deploys to portlet instances to the portlet instance container
+ * as specified in portlet-instances.xml
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class InstanceDeployer extends AbstractComponentDeployer
+{
+
+ protected Kernel kernel;
+
+ //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);
+ this.setInput(PortletDeploymentInstancesMetaData.class);
+
+ // need to call this after merging the portlet.xml metadata to get the proper id.
+ this.addInput(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME);
+
+ // need to call this after the portlet is deployed since the instance container
needs to already
+ // have reference to the portlet before an instance of it can be deployed.
+ this.addInput(PortletDeployer.PORLET_DEPLOYED);
+
+ this.setStage(DeploymentStages.INSTALLED);
+ }
+
+
+ @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);
+ }
+
+ }
+
+
+}
+
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,183 @@
+/******************************************************************************
+ * 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());
+ securityConstraints.getPolicyPermission().add(policyPermission);
+ }
+
+ 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);
+ }
+
+}
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * 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.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.metadata.portal.object.PortalObjectMetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+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";
+
+ 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);
+ }
+
+ @Override
+ public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ PortalObjectMetaData objectMetaData = (PortalObjectMetaData)
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);
+
+ }
+}
+
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -73,7 +73,10 @@
public void deploy(DeploymentUnit unit) throws DeploymentException
{
ControllerContext context = unit.getAttachment(ControllerContext.class);
-
+
+ if (context != null)
+ {
+
if (dependencies != null)
{
for (int i = 0; i < dependencies.size(); i++)
@@ -88,6 +91,7 @@
unit.addIDependOn(dependItem);
}
}
+ }
}
}
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-02-09
03:32:05 UTC (rev 12795)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -22,115 +22,217 @@
******************************************************************************/
package org.jboss.portal.deployer.portlet;
+import java.lang.reflect.Method;
+import java.net.URL;
import java.util.ArrayList;
-import java.util.Iterator;
+import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.servlet.ServletContext;
-import org.jboss.deployers.client.spi.main.MainDeployer;
+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.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.portal.metadata.jboss.app.PortalAppMetaData;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+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.system.metadata.ServiceConstructorMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.web.WebApplication;
import org.jboss.web.deployers.AbstractWarDeployer;
public class PortletDeployer extends AbstractComponentDeployer
{
+ protected final Logger log = Logger.getLogger(getClass());
- //the relative order of the war deployer in the main deployer.
- private int warDeployerOrder;
+ public static final String PORLET_DEPLOYED = "portlet.deployed";
+
+ protected AbstractWarDeployer warDeployer;
+
+ protected MBeanServer mbeanServer;
- private AbstractWarDeployer warDeployer;
+ protected Kernel kernel;
+
+ protected String coreInfoBuilderReferenceName =
"portal:service=InfoBuilderFactory,type=Core";
+
+ protected String portletContainerInvoker =
"portal:service=PortletInvoker,type=Container";
+
+ protected ArrayList listeners = new ArrayList();
- private ArrayList listeners = new ArrayList();
-
public PortletDeployer()
{
setAllInputs(false);
- setInput(PortalAppMetaData.class);
- addInput(PortalAppMetaData.class);
- addInput(PortletApplication10MetaData.class);
- addInput(JBossApplicationMetaData.class);
- setOutput(ServiceMetaData.class);
+ setInput(PortletApplication10MetaData.class);
+ addInput(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME);
+ addOutput(PORLET_DEPLOYED);
+ setStage(DeploymentStages.INSTALLED);
}
- public void setWarDeployerOrder(int order)
+ public void setWarDeployer(AbstractWarDeployer warDeployer)
{
- this.warDeployerOrder = order;
+ this.warDeployer = warDeployer;
}
+ public void setMBeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel=kernel;
+ }
+
public int getRelativeOrder()
{
- return warDeployerOrder + 1;
+ return warDeployer.getRelativeOrder() + 10;
}
+ 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);
+
+ PortalWebApp portalWebApp = createPortalWebApp(unit.getName());
+
+ 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);
+
+
+ unit.addAttachment(PORLET_DEPLOYED, "deployed");
+ }
+
+ @Override
+ public void internalUndeploy(DeploymentUnit unit)
{
- //super.internalDeploy(unit);
- MainDeployer md = unit.getMainDeployer();
-
- PortalAppMetaData metaData = unit.getAttachment(PortalAppMetaData.class);
- if (metaData != null)
+ System.out.println("INTERNALUNDEPLOY");
+ }
+
+ /**
+ * 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
{
- System.out.println("INTERNALDEPLOYAPPNAME : " +
metaData.getAppName());
+ objectName = (ObjectName) webApp.getAppData();
}
- else
+ catch (ClassCastException cce)
{
- System.out.println("NO PORTAL-APP.XML FILE");
+ throw new DeploymentException(
+ "Can not deploy portlet, the WebApplication.getAppData " +
+ "doesn't contain a proper ObjectName", cce);
}
-
- PortletApplication10MetaData portletMetaData =
unit.getAttachment(PortletApplication10MetaData.class);
- if (portletMetaData != null)
+
+ try
{
- System.out.println("INTERNALDEPLOYPORTLETS : " +
portletMetaData.getPortlets());
+ standardContextObject = mbeanServer.getAttribute(objectName,
"managedResource");
}
- else
+ catch (Exception e)
{
- System.out.println("NO PORTLET.XML FILE");
+ throw new DeploymentException(
+ "Could not deploy the portlet, could not get the attribute
'managedResource'" +
+ "from mbean with object name '" + objectName
+"'", e);
}
-
- JBossApplicationMetaData jbossPortletMetaData =
unit.getAttachment(JBossApplicationMetaData.class);
- if (portletMetaData != null)
+
+ 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
{
- System.out.println("INTERNALDEPLOYJBOSSPORTLETS : " +
jbossPortletMetaData.getPortlets());
+ Class standardContextClass = standardContextObject.getClass();
+ Method getPathMethod = standardContextClass.getMethod("getPath", new
Class[0]);
+
+ return (String)getPathMethod.invoke(standardContextObject, new Object[0]);
}
- else
+ catch (Exception e)
{
- System.out.println("NO JBOSS-PORTLET.XML FILE");
+ throw new DeploymentException("Error trying to get the ContextPath from the
web server.", e);
}
-
- if (portletMetaData != null)
+ }
+
+ //TODO: determine a better way to get the servlet context
+ protected ServletContext getServletContext(Object standardContextObject) throws
DeploymentException
+ {
+ try
{
- try
- {
- ServiceMetaData portletModule = new ServiceMetaData();
-
- JBossWebMetaData jbosswebMD = unit.getAttachment(JBossWebMetaData.class);
-
- //todo: fix situation for empty context root (ie for the ROOT war)
- String name = "jboss.portal.deployment:war=" +
jbosswebMD.getContextRoot();
- ObjectName objectName = new ObjectName(name);
-
- portletModule.setObjectName(objectName);
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ 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
+ {
- @Override
- public void internalUndeploy(DeploymentUnit unit)
- {
- System.out.println("INTERNALUNDEPLOY");
+ public PortalWebApplication(ServletContext servletContext, URL url, ClassLoader
classloader, String contextPath)
+ {
+ init(servletContext, url, classloader, contextPath);
+ }
+
+ @Override
+ public void instrument() throws Exception
+ {
+ //do nothing
+ }
+
}
}
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,176 @@
+/******************************************************************************
+ * 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);
+ }
+ }
+ }
+ }
+ }
+ };
+
+}
+
Added:
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
(rev 0)
+++
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.
+ }
+ }
+
+
+}
+
Added: modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
(rev 0)
+++ modules/deployer/trunk/deployer/src/main/resources/base-aop.xml 2009-02-09 03:49:06
UTC (rev 12796)
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE aop PUBLIC
+ "-//JBoss//DTD JBOSS AOP 1.0//EN"
+ "http://www.jboss.org/aop/dtd/jboss-aop_1_0.dtd">
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <!-- custom configuration for AOP Security -->
+ <metadata-loader tag="security"
class="org.jboss.aspects.security.SecurityClassMetaDataLoader"/>
+
+ <stack name="J2EESecurityStack">
+ <interceptor
factory="org.jboss.aspects.security.AuthenticationInterceptorFactory"
scope="PER_CLASS"/>
+ <interceptor
factory="org.jboss.aspects.security.RoleBasedAuthorizationInterceptorFactory"
scope="PER_CLASS"/>
+ <interceptor
factory="org.jboss.aspects.security.RunAsSecurityInterceptorFactory"
scope="PER_CLASS"/>
+ </stack>
+
+ <bind pointcut="all(@security)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Permissions)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Unchecked)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Exclude)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <introduction expr="class((a)org.jboss.aspects.jmx.MBean)">
+ <mixin>
+ <interfaces>javax.management.DynamicMBean</interfaces>
+ <class>org.jboss.aspects.jmx.JmxIntrospectingMixin</class>
+ <construction>new
org.jboss.aspects.jmx.JmxIntrospectingMixin(this)</construction>
+ </mixin>
+ </introduction>
+
+ <!-- asynchronous aspect -->
+ <aspect class="org.jboss.aspects.asynch.AsynchAspect"
scope="PER_INSTANCE">
+ <advisor-attribute name="Advisor"/>
+ </aspect>
+
+ <bind pointcut="execution(!static *
*->@org.jboss.aspects.asynch.Asynchronous(..))">
+ <advice name="execute"
aspect="org.jboss.aspects.asynch.AsynchAspect"/>
+ </bind>
+
+ <introduction expr="has(!static *
*->@org.jboss.aspects.asynch.Asynchronous(..))">
+ <mixin>
+
<interfaces>org.jboss.aspects.asynch.AsynchProvider,org.jboss.aspects.asynch.FutureHolder</interfaces>
+ <class>org.jboss.aspects.asynch.AsynchMixin</class>
+ </mixin>
+ </introduction>
+
+ <!-- old asynch aspect from Claude -->
+
+ <aspect
class="org.jboss.aspects.asynchronous.aspects.jboss.AsynchronousAspect"
scope="PER_VM"/>
+
+ <bind pointcut="execution(*
*->@org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous(..))">
+ <advice name="execute"
aspect="org.jboss.aspects.asynchronous.aspects.jboss.AsynchronousAspect"/>
+ </bind>
+
+ <introduction
+ expr="has(*
*->@org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous(..)) OR
class((a)org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous)">
+
+ <mixin>
+ <interfaces>
+ org.jboss.aspects.asynchronous.aspects.AsynchronousFacade
+ </interfaces>
+
<class>org.jboss.aspects.asynchronous.aspects.AsynchronousFacadeImpl</class>
+ <construction>new
org.jboss.aspects.asynchronous.aspects.AsynchronousFacadeImpl()</construction>
+ </mixin>
+ </introduction>
+
+ <!-- TRANSACTIONS -->
+ <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor"
scope="PER_VM"/>
+ <interceptor factory="org.jboss.aspects.tx.TxInterceptorFactory"
scope="PER_CLASS_JOINPOINT"/>
+
+ <bind pointcut="all(@transaction)">
+ <interceptor-ref
name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <interceptor name="class-txsynchronized"
factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_CLASS"/>
+ <interceptor name="instance-txsynchronized"
factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_INSTANCE"/>
+
+ <bind pointcut="execution(static * *->@TxSynchronized(..)) OR
execution(*->@TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static * *->@TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.tx.Tx)">
+ <interceptor-ref
name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <bind
+ pointcut="execution(static *
*->@org.jboss.aspects.txlock.TxSynchronized(..)) OR
execution(*->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static *
*->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+
+ <!-- injection -->
+ <aspect class="org.jboss.aspects.tx.TransactionInjector"/>
+ <aspect class="org.jboss.aspects.tx.TransactionManagerInjector"/>
+
+ <bind pointcut="field(javax.transaction.Transaction
*->(a)org.jboss.aspects.Current)">
+ <advice name="access"
aspect="org.jboss.aspects.tx.TransactionInjector"/>
+ </bind>
+
+ <bind pointcut="field(javax.transaction.TransactionManager
*->(a)org.jboss.aspects.Injected)">
+ <advice name="access"
aspect="org.jboss.aspects.tx.TransactionManagerInjector"/>
+ </bind>
+
+ <bind
+ pointcut="execution(*->new(..)) AND
hasfield(javax.transaction.TransactionManager
*->(a)org.jboss.aspects.Injected)">
+ <advice name="allocation"
aspect="org.jboss.aspects.tx.TransactionManagerInjector"/>
+ </bind>
+
+ <!-- special types -->
+ <aspect class="org.jboss.aspects.ThreadbasedAspect"
scope="PER_JOINPOINT"/>
+ <bind pointcut="field(* *->(a)org.jboss.aspects.Threadbased)">
+ <advice name="access"
aspect="org.jboss.aspects.ThreadbasedAspect"/>
+ </bind>
+
+ <aspect class="org.jboss.aspects.tx.TransactionLocalAspect"
scope="PER_JOINPOINT"/>
+ <bind pointcut="field(* *->(a)org.jboss.aspects.tx.TxLocal)">
+ <advice name="access"
aspect="org.jboss.aspects.tx.TransactionLocalAspect"/>
+ </bind>
+
+</aop>
Property changes on: modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
(rev 0)
+++ modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml 2009-02-09
03:49:06 UTC (rev 12796)
@@ -0,0 +1,7 @@
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <metadata tag="transaction"
class="org.jboss.portal.deployer.portlet.InstanceDeployerImpl">
+ <method name="deployInstances">
+ <trans-attribute>RequiresNew</trans-attribute>
+ </method>
+ </metadata>
+</aop>
Modified: modules/deployer/trunk/pom.xml
===================================================================
--- modules/deployer/trunk/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -1,41 +1,159 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<!-- <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-parent</artifactId>
+ <version>1-SNAPSHOT</version>
+ </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.deployer</groupId>
- <artifactId>module-aggregator</artifactId>
+ <artifactId>module-parent</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Deployer</name>
<version>trunk-SNAPSHOT</version>
+ <
url>http://labs.jboss.com/jbossportal</url>
- <distributionManagement>
+ <properties>
+ <version.assembly>2.2-beta-2</version.assembly>
+ <version.jboss.aop>1.0.0.GA</version.jboss.aop>
+ <version.jboss.aspects>1.0.0.GA</version.jboss.aspects>
+ <version.jboss-deployers>2.2.0-SNAPSHOT</version.jboss-deployers>
+ <version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
+ <version.jboss.portal>2.8-SNAPSHOT</version.jboss.portal>
+
<version.jboss.portal.metadata>trunk-SNAPSHOT</version.jboss.portal.metadata>
+ <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
+
<version.jboss.portal.portlet>2.1.0-SNAPSHOT</version.jboss.portal.portlet>
+ <version.jboss.portal.server>2.7.0.GA</version.jboss.portal.server>
+ <version.jboss.portlet.server>2.7.0</version.jboss.portlet.server>
+ <version.jboss-as>5.0.0.CR2</version.jboss-as>
+ <version.saxon>6.5.3</version.saxon>
+ </properties>
+
+ <repositories>
<repository>
- <!--Copy the distribution jar file to a local checkout of the maven
repository
- - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
<id>repository.jboss.org</id>
- <url>file://${jboss.repository.root}</url>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <
url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
</repository>
- <snapshotRepository>
+ <repository>
<id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <
url>dav:https://snapshots.jboss.org/maven2</url>
- <uniqueVersion>true</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <
url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+<!-- <pluginRepositories>
+ <pluginRepository>
+ <id>maven.jboss.org</id>
+ <name>JBoss Maven Repository</name>
+ <
url>http://repository.jboss.com/maven2</url>
+ </pluginRepository>
+ </pluginRepositories> -->
- <modules>
- <module>build</module>
- <module>deployer</module>
- </modules>
- <reporting>
+ <build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
+ <artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
- </reporting>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss-deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss-deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ <version>${version.jboss-metadata}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${version.jboss-as}</version>
+ </dependency>
+ <dependency>
+ <groupId>saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>${version.saxon}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.metadata</groupId>
+ <artifactId>metadata-metadata</artifactId>
+ <version>${version.jboss.portal.metadata}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ <version>${version.jboss.portal.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>server</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.server</groupId>
+ <artifactId>portlet-server</artifactId>
+ <version>${version.jboss.portlet.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>core</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
</project>