gatein SVN: r6338 - in portal/trunk/packaging/jboss-as6/pkg: src/main/resources and 10 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 17:19:45 -0400 (Sat, 23 Apr 2011)
New Revision: 6338
Added:
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/common/
portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/common/portlet-container-configuration.xml
Modified:
portal/trunk/packaging/jboss-as6/pkg/pom.xml
portal/trunk/packaging/jboss-as6/pkg/transform.xsl
Log:
GTNPORTAL-1874 Support for CDI (JSR-299) in portlets
- CDI packaging support for jboss-as6 - via additional build profile
Modified: portal/trunk/packaging/jboss-as6/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-23 20:19:24 UTC (rev 6337)
+++ portal/trunk/packaging/jboss-as6/pkg/pom.xml 2011-04-23 21:19:45 UTC (rev 6338)
@@ -1179,5 +1179,63 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>cdi</id>
+ <properties>
+ <profile>cdi</profile>
+ <org.gatein.cdi.version>1.0.0-Alpha01-SNAPSHOT</org.gatein.cdi.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <?profile cdi?>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-cdi</artifactId>
+ <version>${org.gatein.pc.version}</version>
+ </dependency>
+ <dependency>
+ <?profile cdi?>
+ <?move gatein-api.jar?>
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-api</artifactId>
+ <version>${org.gatein.cdi.version}</version>
+ </dependency>
+ <dependency>
+ <?profile cdi?>
+ <?move gatein-cdi-example-portlet.war?>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-example-portlet</artifactId>
+ <version>pong${org.gatein.cdi.version}</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <!-- Copy CDI specific configuration -->
+ <copy todir="${jbossas.target.dir}" preservelastmodified="true" overwrite="true">
+ <fileset dir="${project.basedir}/src/main/resources/cdi/jboss">
+ <include name="**/*.xml" />
+ </fileset>
+ </copy>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
Added: portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/common/portlet-container-configuration.xml
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/common/portlet-container-configuration.xml (rev 0)
+++ portal/trunk/packaging/jboss-as6/pkg/src/main/resources/cdi/jboss/server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/common/portlet-container-configuration.xml 2011-04-23 21:19:45 UTC (rev 6338)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.gatein.pc.cdi.IntegrationService</key>
+ <type>org.gatein.pc.cdi.IntegrationService</type>
+ </component>
+ <component>
+ <key>org.exoplatform.portal.pc.ExoKernelIntegration</key>
+ <type>org.exoplatform.portal.pc.ExoKernelIntegration</type>
+ </component>
+
+</configuration>
Modified: portal/trunk/packaging/jboss-as6/pkg/transform.xsl
===================================================================
--- portal/trunk/packaging/jboss-as6/pkg/transform.xsl 2011-04-23 20:19:24 UTC (rev 6337)
+++ portal/trunk/packaging/jboss-as6/pkg/transform.xsl 2011-04-23 21:19:45 UTC (rev 6338)
@@ -8,6 +8,7 @@
<xsl:param name="default.ear.context"/>
<xsl:param name="lib.context"/>
<xsl:param name="deploy.context"/>
+ <xsl:param name="profile"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:comment>Generated file</xsl:comment>
@@ -20,6 +21,23 @@
</xsl:for-each>
</xsl:variable>
+ <xsl:variable name="active.for.profile">
+ <xsl:for-each select="processing-instruction()[name()='profile']">
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="isActive">
+ <xsl:choose>
+ <xsl:when test="$active.for.profile=''">true</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$active.for.profile=$profile">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<xsl:variable name="a_ext">
<xsl:for-each select="mvn:type">
<xsl:value-of select="text()"/>
@@ -73,60 +91,65 @@
</xsl:variable>
<xsl:choose>
- <xsl:when test="$expand=''">
+ <xsl:when test="$isActive='true'">
<xsl:choose>
- <xsl:when test="$dest.name=''">
- <xsl:element name="copy">
- <xsl:attribute name="todir">
- <xsl:value-of select="$context"/>
- </xsl:attribute>
- <xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
- select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
+
+ <xsl:when test="$expand=''">
+ <xsl:choose>
+ <xsl:when test="$dest.name=''">
+ <xsl:element name="copy">
+ <xsl:attribute name="todir">
+ <xsl:value-of select="$context"/>
+ </xsl:attribute>
+ <xsl:element name="fileset">
+ <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
+ select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="copy">
+ <xsl:attribute name="tofile"><xsl:value-of select="$context"/>/<xsl:value-of select="$dest.name"/>
+ </xsl:attribute>
+ <xsl:element name="fileset">
+ <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
+ select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:otherwise>
- <xsl:element name="copy">
- <xsl:attribute name="tofile"><xsl:value-of select="$context"/>/<xsl:value-of select="$dest.name"/>
- </xsl:attribute>
- <xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
- select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
+ <xsl:choose>
+ <xsl:when test="$dest.name=''">
+ <xsl:element name="unjar">
+ <xsl:attribute name="dest"><xsl:value-of select="$context"/>/<xsl:value-of
+ select="./mvn:artifactId"/>.<xsl:value-of select="$ext"/>
+ </xsl:attribute>
+ <xsl:element name="fileset">
+ <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
+ select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="unjar">
+ <xsl:attribute name="dest"><xsl:value-of select="$context"/>/<xsl:value-of select="$dest.name"/>
+ </xsl:attribute>
+ <xsl:element name="fileset">
+ <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
+ select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$dest.name=''">
- <xsl:element name="unjar">
- <xsl:attribute name="dest"><xsl:value-of select="$context"/>/<xsl:value-of
- select="./mvn:artifactId"/>.<xsl:value-of select="$ext"/>
- </xsl:attribute>
- <xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
- select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="unjar">
- <xsl:attribute name="dest"><xsl:value-of select="$context"/>/<xsl:value-of select="$dest.name"/>
- </xsl:attribute>
- <xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of select="./mvn:groupId"/>:<xsl:value-of
- select="./mvn:artifactId"/>:<xsl:value-of select="$ext"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</target>
13 years, 8 months
gatein SVN: r6337 - sandbox/cdi_support/pc/branches/cdi.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 16:19:24 -0400 (Sat, 23 Apr 2011)
New Revision: 6337
Modified:
sandbox/cdi_support/pc/branches/cdi/pom.xml
Log:
Added cdi module to parent pom
Modified: sandbox/cdi_support/pc/branches/cdi/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/pom.xml 2011-04-23 20:17:03 UTC (rev 6336)
+++ sandbox/cdi_support/pc/branches/cdi/pom.xml 2011-04-23 20:19:24 UTC (rev 6337)
@@ -257,6 +257,7 @@
<module>federation</module>
<module>management</module>
<module>mc</module>
+ <module>cdi</module>
<module>test</module>
<module>portal</module>
<module>samples</module>
13 years, 8 months
gatein SVN: r6336 - in sandbox/cdi_support/pc/branches/cdi: cdi and 10 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 16:17:03 -0400 (Sat, 23 Apr 2011)
New Revision: 6336
Added:
sandbox/cdi_support/pc/branches/cdi/cdi/
sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml
sandbox/cdi_support/pc/branches/cdi/cdi/src/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/IntegrationService.java
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/portlet/
sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/portlet/CDIPortletDecorator.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/PortletDecorator.java
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/PortletContainerImpl.java
Log:
CDI support for portlets - PC container module, and portlet decorator infrastructure through which CDI support is integrated
Added: sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml (rev 0)
+++ sandbox/cdi_support/pc/branches/cdi/cdi/pom.xml 2011-04-23 20:17:03 UTC (rev 6336)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-parent</artifactId>
+ <version>2.3.0-Beta02-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>pc-cdi</artifactId>
+ <name>GateIn - Portlet Container (CDI support)</name>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>picocontainer</groupId>
+ <artifactId>picocontainer</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-wci</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/IntegrationService.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/IntegrationService.java (rev 0)
+++ sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/IntegrationService.java 2011-04-23 20:17:03 UTC (rev 6336)
@@ -0,0 +1,60 @@
+package org.gatein.pc.cdi;
+
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppLifeCycleEvent;
+import org.gatein.wci.WebAppListener;
+import org.gatein.wci.impl.DefaultServletContainerFactory;
+import org.picocontainer.Startable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class IntegrationService implements Startable, WebAppListener
+{
+ private static final String BEAN_MGR_ATTR = "javax.enterprise.inject.spi.BeanManager";
+
+ public void start()
+ {
+ DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(this);
+ }
+
+ public void stop()
+ {
+ DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(this);
+ }
+
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
+
+ switch (lifeCycleEvent.getType())
+ {
+ case WebAppLifeCycleEvent.ADDED:
+ try
+ {
+ ServletContext ctx = event.getWebApp().getServletContext();
+ if (ctx.getAttribute(BEAN_MGR_ATTR) == null)
+ {
+ Object beanMgr = new InitialContext().lookup("java:comp/BeanManager");
+ if (beanMgr != null)
+ {
+ ctx.setAttribute(BEAN_MGR_ATTR, beanMgr);
+ // save TCCL
+ ctx.setAttribute("org.gatein.pc.tccl", Thread.currentThread().getContextClassLoader());
+ }
+ }
+ }
+ catch (NamingException ignored)
+ {}
+
+ break;
+ }
+ }
+ }
+}
Added: sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/portlet/CDIPortletDecorator.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/portlet/CDIPortletDecorator.java (rev 0)
+++ sandbox/cdi_support/pc/branches/cdi/cdi/src/main/java/org/gatein/pc/cdi/portlet/CDIPortletDecorator.java 2011-04-23 20:17:03 UTC (rev 6336)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.cdi.portlet;
+
+import org.gatein.pc.portlet.container.PortletApplication;
+import org.gatein.pc.portlet.impl.spi.PortletDecorator;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class CDIPortletDecorator implements Portlet, PortletDecorator
+{
+ private Portlet delegate;
+
+ public Portlet decorate(Portlet instance, PortletApplication ctx)
+ {
+ this.delegate = instance;
+ if (performInject(delegate, ctx)) return this;
+ return instance;
+ }
+
+ public boolean performInject(Object instance, PortletApplication ctx)
+ {
+ ServletContext sctx = ctx.getContext().getServletContext();
+ BeanManager beanManager = (BeanManager) sctx.getAttribute("javax.enterprise.inject.spi.BeanManager");
+
+ if (beanManager == null)
+ return false;
+
+ ClassLoader oldCl = null;
+ ClassLoader cl = (ClassLoader) sctx.getAttribute("org.gatein.pc.tccl");
+ if (cl != null)
+ {
+ oldCl = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ try
+ {
+ CreationalContext<Object> creationalContext = beanManager.createCreationalContext(null);
+ InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>)
+ beanManager.createInjectionTarget(beanManager.createAnnotatedType(instance.getClass()));
+ injectionTarget.inject(instance, creationalContext);
+ }
+ finally
+ {
+ if (oldCl != null)
+ Thread.currentThread().setContextClassLoader(oldCl);
+ }
+
+ return true;
+ }
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ delegate.init(config);
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
+ {
+ delegate.processAction(request, response);
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ delegate.render(request, response);
+ }
+
+ public void destroy()
+ {
+ delegate.destroy();
+ }
+}
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/PortletContainerImpl.java 2011-04-23 20:10:49 UTC (rev 6335)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/PortletContainerImpl.java 2011-04-23 20:17:03 UTC (rev 6336)
@@ -56,6 +56,7 @@
import org.gatein.pc.portlet.impl.jsr168.api.RenderResponseImpl;
import org.gatein.pc.portlet.impl.jsr168.api.ResourceRequestImpl;
import org.gatein.pc.portlet.impl.jsr168.api.ResourceResponseImpl;
+import org.gatein.pc.portlet.impl.spi.PortletDecorator;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -252,7 +253,7 @@
log.debug("Loading portlet class " + className);
Class portletClass = application.getContext().getClassLoader().loadClass(className);
log.debug("Creating portlet object " + className);
- Portlet portlet = (Portlet)portletClass.newInstance();
+ Portlet portlet = getPortletInstance(portletClass);
log.debug("Created portlet object " + className);
initPortlet(portlet, config);
log.debug("Initialized portlet object " + className);
@@ -294,6 +295,37 @@
}
}
+ private Portlet getPortletInstance(Class portletClass) throws IllegalAccessException, InstantiationException
+ {
+ Portlet portlet = (Portlet) portletClass.newInstance();
+ return applyPortletDecorators(portlet, application);
+ }
+
+ private Portlet applyPortletDecorators(Portlet portlet, PortletApplicationImpl portletApp)
+ {
+ List<String> decoratorsList = getPortletDecoratorsList();
+ for (String className: decoratorsList)
+ {
+ try
+ {
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ PortletDecorator decorator = (PortletDecorator) clazz.newInstance();
+ portlet = decorator.decorate(portlet, portletApp);
+ log.debug("Decorated portlet instance with: " + className);
+ }
+ catch (Exception e)
+ {
+ log.warn("IGNORED: Failed to process decorator " + className + " for portlet: " + portlet, e);
+ }
+ }
+ return portlet;
+ }
+
+ private List<String> getPortletDecoratorsList()
+ {
+ return java.util.Arrays.asList("org.gatein.pc.cdi.portlet.CDIPortletDecorator");
+ }
+
private void buildFilterChains()
{
List<ActionFilter> actionFilterList = builderFilterList(ActionFilter.class);
Added: sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/PortletDecorator.java
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/PortletDecorator.java (rev 0)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/PortletDecorator.java 2011-04-23 20:17:03 UTC (rev 6336)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.pc.portlet.impl.spi;
+
+import org.gatein.pc.portlet.container.PortletApplication;
+
+import javax.portlet.Portlet;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public interface PortletDecorator
+{
+ public Portlet decorate(Portlet instance, PortletApplication ctx);
+}
13 years, 8 months
gatein SVN: r6335 - in sandbox/cdi_support/cdi/trunk: api and 52 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 16:10:49 -0400 (Sat, 23 Apr 2011)
New Revision: 6335
Added:
sandbox/cdi_support/cdi/trunk/api/
sandbox/cdi_support/cdi/trunk/api/pom.xml
sandbox/cdi_support/cdi/trunk/api/src/
sandbox/cdi_support/cdi/trunk/api/src/main/
sandbox/cdi_support/cdi/trunk/api/src/main/java/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/PortalContainerScope.java
sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/RootContainerScope.java
sandbox/cdi_support/cdi/trunk/docs/
sandbox/cdi_support/cdi/trunk/docs/reference/
sandbox/cdi_support/cdi/trunk/docs/reference/pom.xml
sandbox/cdi_support/cdi/trunk/docs/reference/src/
sandbox/cdi_support/cdi/trunk/docs/reference/src/main/
sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/
sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/
sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/general.xml
sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/master.xml
sandbox/cdi_support/cdi/trunk/examples/
sandbox/cdi_support/cdi/trunk/examples/portlet/
sandbox/cdi_support/cdi/trunk/examples/portlet/pom.xml
sandbox/cdi_support/cdi/trunk/examples/portlet/src/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/RequestProcessor.java
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/SimplePortlet.java
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/TestServlet.java
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/resources/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/beans.xml
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/portlet.xml
sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/web.xml
sandbox/cdi_support/cdi/trunk/examples/traceextension/
sandbox/cdi_support/cdi/trunk/examples/traceextension/pom.xml
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/traceextension/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/traceextension/TraceExtension.java
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/beans.xml
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/services/
sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
sandbox/cdi_support/cdi/trunk/impl/
sandbox/cdi_support/cdi/trunk/impl/pom.xml
sandbox/cdi_support/cdi/trunk/impl/src/
sandbox/cdi_support/cdi/trunk/impl/src/main/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/GateInExtension.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/OrganizationServiceExtension.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/GateInServiceLiteral.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/OrganizationServiceSession.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProducerBean.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProxy.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericProxy.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericTLProxy.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceInterceptor.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceProducers.java
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/producers/
sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/producers/ProducersBean.java
sandbox/cdi_support/cdi/trunk/impl/src/main/resources/
sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/
sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/beans.xml
sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/services/
sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
sandbox/cdi_support/cdi/trunk/pom.xml
sandbox/cdi_support/cdi/trunk/readme.txt
Log:
CDI support for portlets - Implementation of CDI standard extensions with producers, custom injection proxies, and example servlet, and portlet
Added: sandbox/cdi_support/cdi/trunk/api/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/api/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/api/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gatein-cdi</artifactId>
+ <name>GateIn CDI :: API</name>
+
+ <packaging>jar</packaging>
+
+</project>
Added: sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/PortalContainerScope.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/PortalContainerScope.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/PortalContainerScope.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@Documented
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface PortalContainerScope
+{
+}
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/RootContainerScope.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/RootContainerScope.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/api/src/main/java/org/gatein/cdi/api/annotations/RootContainerScope.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@Documented
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface RootContainerScope
+{
+}
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/docs/reference/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/docs/reference/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/docs/reference/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <version>Alpha01-</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gatein-cdi-reference-guide</artifactId>
+ <name>GateIn CDI :: Reference Guide</name>
+ <packaging>jdocbook</packaging>
+ <description>Reference Guide for GateIn CDI Module</description>
+
+ <properties>
+ <mpjdocbook.version>2.2.0</mpjdocbook.version>
+ <pdf.name>${project.artifactId}.pdf</pdf.name>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>${mpjdocbook.version}</version>
+ <extensions>true</extensions>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+
+ <configuration>
+ <sourceDirectory>src/main/docbook</sourceDirectory>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <masterTranslation>en-US</masterTranslation>
+ <imageResource>
+ <directory>${pom.basedir}/src/main/docbook/en-US</directory>
+ <includes>
+ <include>images/*.png</include>
+ <include>images/*.jpg</include>
+ </includes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${pdf.name}</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath://xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <transformerParameters>
+ <property>
+ <name>javax.xml.parsers.DocumentBuilderFactory</name>
+ <value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.parsers.SAXParserFactory</name>
+ <value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
+ </property>
+ </transformerParameters>
+ <localeSeparator>-</localeSeparator>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/general.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/general.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/general.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<chapter id="general">
+
+ <title>GateIn CDI General</title>
+
+ <para>TODO
+ </para>
+
+</chapter>
Added: sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/master.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/docs/reference/src/main/docbook/en-US/master.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
+<book lang="en">
+
+ <toc />
+
+ <title>GateIn CDI Reference Guide</title>
+ <xi:include href="general.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</book>
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gatein-cdi-example-portlet</artifactId>
+ <name>GateIn CDI :: Examples :: Portlet</name>
+
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-impl</artifactId>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!--dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-example-traceextension</artifactId>
+ <scope>runtime</scope>
+ <version>${project.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.cache</artifactId>
+ <version>2.2.1-GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/RequestProcessor.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/RequestProcessor.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/RequestProcessor.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.examples.portlet;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@RequestScoped
+public class RequestProcessor
+{
+ private String query;
+
+ public String getQuery()
+ {
+ return query;
+ }
+
+ public void setQuery(String query)
+ {
+ this.query = query;
+ }
+
+ public String toString()
+ {
+ return super.toString() + " [query:" + query + "]";
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/SimplePortlet.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/SimplePortlet.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/SimplePortlet.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.examples.portlet;
+
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.organization.OrganizationService;
+import org.exoplatform.services.organization.UserHandler;
+import org.gatein.api.app.PortalRequestContext;
+import org.gatein.api.app.WebuiRequestContext;
+import org.gatein.api.kernel.PortalContainer;
+import org.gatein.cdi.api.annotations.PortalContainerScope;
+import org.gatein.cdi.api.annotations.RootContainerScope;
+
+import javax.inject.Inject;
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class SimplePortlet extends GenericPortlet
+{
+ private static final Logger log = Logger.getLogger(SimplePortlet.class.getName());
+
+ @Inject
+ @RootContainerScope
+ ConfigurationManager rootMgr;
+
+ @Inject
+ @PortalContainerScope
+ ConfigurationManager confMgr;
+
+ @Inject
+ CacheService cacheService;
+
+ @Inject
+ WebuiRequestContext reqContext;
+
+ @Inject
+ PortalRequestContext preqContext;
+
+ @Inject
+ PortalContainer currentContainer;
+
+ @Inject
+ OrganizationService organizationSvc;
+
+ @Inject
+ UserHandler userHandler;
+
+ public SimplePortlet() {
+ super();
+ }
+
+ public void doView(RenderRequest request, RenderResponse response) throws IOException
+ {
+ PrintWriter writer = response.getWriter();
+ writer.write("<h2>SimplePortlet Injected fields: </h2>");
+ writer.write("<ul>");
+ try
+ {
+ writer.write("<li><em>Root ConfigurationManager: </em>" + rootMgr + "</li>");
+ writer.write("<li><em>Portal ConfigurationManager: </em>" + confMgr + "</li>");
+ writer.write("<li><em>CacheService : </em>" + cacheService + "</li>");
+
+ writer.write("<li><em>WebuiRequestContext: </em>" + reqContext + "</li>");
+ writer.write("<li><em>request: </em>" + reqContext.getRequest() + "</li>");
+
+ writer.write("<li><em>PortalRequestContext: </em>" + preqContext + "</li>");
+ writer.write("<li><em>request: </em>" + preqContext.getRequest() + "</li>");
+
+ writer.write("<li><em>PortalContainer: </em>" + currentContainer + "</li>");
+ writer.write("<li><em>portalContainer component instances: </em>" + currentContainer.getComponentInstances() + "</li>");
+
+ writer.write("<li><em>OrganizationService: </em>" + organizationSvc + "</li>");
+ writer.write("<li><em>root user: </em>" + organizationSvc.getUserHandler().findUserByName("root") + "</li>");
+
+ writer.write("<li><em>UserHandler: </em>" + userHandler + "</li>");
+ writer.write("<li><em>root user: </em>" + userHandler.findUserByName("root") + "</li>");
+ }
+ catch(Exception ex)
+ {
+ log.log(Level.SEVERE, "Exception while generating response: ", ex);
+ }
+ finally
+ {
+ writer.write("<ul>");
+ writer.close();
+ }
+ }
+}
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/TestServlet.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/TestServlet.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/java/org/gatein/cdi/examples/portlet/TestServlet.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.cdi.examples.portlet;
+
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.gatein.api.app.PortalRequestContext;
+import org.gatein.api.app.WebuiRequestContext;
+import org.gatein.api.kernel.PortalContainer;
+import org.gatein.api.util.Availability;
+import org.gatein.cdi.api.annotations.RootContainerScope;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class TestServlet extends HttpServlet
+{
+ private static final Logger log = Logger.getLogger(TestServlet.class.getName());
+
+ @Inject
+ @RootContainerScope
+ ConfigurationManager rootMgr;
+
+ @Inject
+ RequestProcessor reqProc;
+
+ @Inject
+ WebuiRequestContext reqContext;
+
+ @Inject
+ PortalRequestContext portalReqCtx;
+
+ @Inject
+ PortalContainer currentContainer;
+
+ public TestServlet()
+ {
+ log.fine("TestServlet instantiated");
+ }
+
+ @Override
+ public void init() throws ServletException
+ {
+ log.info("Injected fields at servlet init():");
+ log.info(" - Root ConfigurationManager: " + rootMgr);
+ //log.info(" - Managed object packaged with the servlet: " + reqProc);
+ log.info(" - WebuiRequestContext: " + reqContext);
+ log.info(" - PortalRequestContext: " + portalReqCtx);
+ log.info(" - PortalContainer: " + currentContainer);
+ log.info("CDI TestServlet initialized: http://localhost:8080/"
+ + getServletContextName() + "/" + getServletName());
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ PrintWriter out = resp.getWriter();
+ out.println("<html><body>");
+ out.println("<h2>CDI TestServlet</h2>");
+ out.println("<ul>");
+ out.println("<li><em>Root ConfigurationManager: </em>" + rootMgr + "</li>");
+ out.println("<li><em>Managed object packaged with the servlet: </em>" + reqProc + "</li>");
+ out.println("<li><em>WebuiRequestContext: </em>" + reqContext + "</li>");
+
+ try {
+ boolean available = Availability.isObjectAvailable(reqContext);
+ out.println("<li><em>reqContext available? </em>" + available + "</li>");
+ if (available)
+ out.println("<li><em>reqContext.getRequest(): </em>" + reqContext.getRequest() + "</li>");
+ }
+ catch (Exception ex)
+ {
+ log.log(Level.SEVERE, "Exception while testing Availability: ", ex);
+ }
+
+ out.println("<li><em>PortalRequestContext: </em>" + portalReqCtx + "</li>");
+ out.println("<li><em>PortalContainer: </em>" + currentContainer + "</li>");
+ out.println("</ul>");
+ out.println("</body></html>");
+ out.close();
+ }
+
+ public String getServletContextName()
+ {
+ try
+ {
+ String [] parsed = this.getServletContext().getResource("/").toExternalForm().split("/");
+ return parsed[parsed.length-1];
+ }
+ catch(Exception ex)
+ {
+ throw new RuntimeException("Failed to determine ServletContext name: ", ex);
+ }
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/beans.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/beans.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The contents of this file is permitted to be empty.
+ The schema definition is provided for your convenience.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/portlet.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/portlet.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+
+ <portlet>
+ <portlet-name>SimplePortlet</portlet-name>
+ <portlet-class>
+ org.gatein.cdi.examples.portlet.SimplePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Simple CDI Supported Portlet</title>
+ </portlet-info>
+ </portlet>
+</portlet-app>
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/portlet/src/main/webapp/WEB-INF/web.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.gatein.cdi.examples.portlet.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/TestServlet</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: sandbox/cdi_support/cdi/trunk/examples/traceextension/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/traceextension/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/traceextension/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gatein-cdi-example-traceextension</artifactId>
+ <name>GateIn CDI :: Examples :: Trace Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/traceextension/TraceExtension.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/traceextension/TraceExtension.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/java/org/gatein/cdi/examples/traceextension/TraceExtension.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,217 @@
+package org.gatein.cdi.examples.traceextension;
+
+import org.jboss.weld.bean.NewBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class TraceExtension implements Extension
+{
+ private static Logger log = Logger.getLogger(TraceExtension.class.getName());
+
+ public TraceExtension ()
+ {
+ log.info("TraceExtension loaded");
+ }
+
+ private BeanManagerImpl getBeanManagerImpl(BeanManager beanManager)
+ {
+ if (beanManager instanceof BeanManagerImpl == false)
+ throw new RuntimeException("TraceExtension only works on Weld!");
+
+ return (BeanManagerImpl) beanManager;
+ }
+
+ /*
+ * Startup / initialization phases
+ */
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
+ {
+ log.info("beforeBeanDiscovery: ");
+ BeanManagerImpl manager = getBeanManagerImpl(beanManager);
+ List<Bean<?>> beans = manager.getBeans();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof NewBean)
+ continue;
+ log.info(" (1) " + bean.getBeanClass() + " " + bean.getTypes());
+ }
+ }
+
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+ {
+ log.info("afterBeanDiscovery: ");
+ BeanManagerImpl mgr = getBeanManagerImpl(beanManager);
+ List<Bean<?>> beans = mgr.getBeans();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof NewBean)
+ continue;
+ log.info(" (2) " + bean.getBeanClass() + " " + bean.getTypes());
+ }
+ }
+
+ public void afterDeploymentValidation(@Observes AfterDeploymentValidation event, BeanManager beanManager)
+ {
+ log.info("afterDeploymentValidation: ");
+ BeanManagerImpl mgr = getBeanManagerImpl(beanManager);
+ List<Bean<?>> beans = mgr.getBeans();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof NewBean)
+ continue;
+ log.info(" (3) " + bean.getBeanClass() + " " + bean.getTypes());
+ }
+ }
+
+
+ /*
+ * Shutdown phase
+ */
+ public void beforeShutdown(@Observes BeforeShutdown event)
+ {
+ log.info("beforeShutdown");
+ }
+
+
+
+ /*
+ * Initialization events
+ */
+ public void processAnnotatedType(@Observes ProcessAnnotatedType event)
+ {
+ log.info(" (*) processAnnotatedType: ");
+ log.info(" baseType: " + event.getAnnotatedType().getBaseType());
+ log.info(" class: " + event.getAnnotatedType().getJavaClass());
+ log.info(" types: " + event.getAnnotatedType().getTypeClosure());
+ log.info(" annotations: " + event.getAnnotatedType().getAnnotations());
+
+ //event.setAnnotatedType( decorate( event.getAnnotatedType() ) );
+ }
+
+ public void processInjectionTarget(@Observes ProcessInjectionTarget event)
+ {
+ log.info(" (*) processInjectionTarget: ");
+ log.info(" annotatedType: " + event.getAnnotatedType());
+ log.info(" injectionTarget: " + event.getInjectionTarget());
+ log.info(" injectionPoints: " + event.getInjectionTarget().getInjectionPoints());
+
+ //event.setInjectionTarget(decorate(event.getInjectionTarget()));
+ }
+
+ public void processProducer(@Observes ProcessProducer event)
+ {
+ log.info(" (*) processProducer: ");
+ log.info(" producer: " + event.getProducer());
+ log.info(" injectionPoints: " + event.getProducer().getInjectionPoints());
+
+ //event.setProducer(decorate(event.getProducer()));
+ }
+
+ public void processBean(@Observes ProcessBean event)
+ {
+ log.info(" (*) processBean: " + event.getBean());
+ log.info(" beanClass: " + event.getBean().getBeanClass());
+ log.info(" name: " + event.getBean().getName());
+ log.info(" qualifiers: " + event.getBean().getQualifiers());
+ log.info(" scope: " + event.getBean().getScope());
+ log.info(" injectionPoints: " + event.getBean().getInjectionPoints());
+ log.info(" stereotypes: " + event.getBean().getStereotypes());
+ log.info(" types: " + event.getBean().getTypes());
+ log.info(" isAlternative: " + event.getBean().isAlternative());
+ log.info(" isNullable: " + event.getBean().isNullable());
+ log.info("");
+ log.info(" annotated: " + event.getAnnotated());
+ log.info(" baseType: " + event.getAnnotated().getBaseType());
+ log.info(" typeClosure: " + event.getAnnotated().getTypeClosure());
+ log.info(" annotations: " + event.getAnnotated().getAnnotations());
+ }
+
+ public void processSessionBean(@Observes ProcessSessionBean event)
+ {
+ log.info(" (*) processSessionBean: " + event.getEjbName());
+ }
+
+ public void processManagedBean(@Observes ProcessManagedBean event)
+ {
+ log.info(" (*) processManagedBean: " + event.getBean());
+ log.info(" beanClass: " + event.getBean().getBeanClass());
+ log.info(" name: " + event.getBean().getName());
+ log.info(" qualifiers: " + event.getBean().getQualifiers());
+ log.info(" scope: " + event.getBean().getScope());
+ log.info(" injectionPoints: " + event.getBean().getInjectionPoints());
+ log.info(" stereotypes: " + event.getBean().getStereotypes());
+ log.info(" types: " + event.getBean().getTypes());
+ log.info(" isAlternative: " + event.getBean().isAlternative());
+ log.info(" isNullable: " + event.getBean().isNullable());
+ log.info("");
+ log.info(" annotated: " + event.getAnnotated());
+ log.info(" baseType: " + event.getAnnotated().getBaseType());
+ log.info(" typeClosure: " + event.getAnnotated().getTypeClosure());
+ log.info(" annotations: " + event.getAnnotated().getAnnotations());
+ log.info("");
+ log.info(" annotatedBeanClass: " + event.getAnnotatedBeanClass());
+ }
+
+ public void processProducerMethod(@Observes ProcessProducerMethod event)
+ {
+ log.info(" (*) processProducerMethod: ");
+ log.info(" bean: " + event.getBean());
+ log.info(" beanClass: " + event.getBean().getBeanClass());
+ log.info(" name: " + event.getBean().getName());
+ log.info(" qualifiers: " + event.getBean().getQualifiers());
+ log.info(" scope: " + event.getBean().getScope());
+ log.info(" injectionPoints: " + event.getBean().getInjectionPoints());
+ log.info(" stereotypes: " + event.getBean().getStereotypes());
+ log.info(" types: " + event.getBean().getTypes());
+ log.info(" isAlternative: " + event.getBean().isAlternative());
+ log.info(" isNullable: " + event.getBean().isNullable());
+ log.info("");
+ log.info(" annotated: " + event.getAnnotated());
+ log.info(" baseType: " + event.getAnnotated().getBaseType());
+ log.info(" typeClosure: " + event.getAnnotated().getTypeClosure());
+ log.info(" annotations: " + event.getAnnotated().getAnnotations());
+ log.info("");
+ log.info(" annotatedProducerMethod: " + event.getAnnotatedProducerMethod());
+ log.info(" baseType: " + event.getAnnotatedProducerMethod().getBaseType());
+ log.info(" declaringType: " + event.getAnnotatedProducerMethod().getDeclaringType());
+ log.info(" typeClosure: " + event.getAnnotatedProducerMethod().getTypeClosure());
+ log.info(" annotations: " + event.getAnnotatedProducerMethod().getAnnotations());
+ log.info(" parameters: " + event.getAnnotatedProducerMethod().getParameters());
+ log.info(" javaMember: " + event.getAnnotatedProducerMethod().getJavaMember());
+
+// log.info("");
+// log.info(" annotatedDisposedParameter: " + event.getAnnotatedDisposedParameter());
+// log.info(" baseType: " + event.getAnnotatedDisposedParameter().getBaseType());
+// log.info(" annotations: " + event.getAnnotatedDisposedParameter().getAnnotations());
+// log.info(" typeClosure: " + event.getAnnotatedDisposedParameter().getTypeClosure());
+// log.info(" declaringCallable: " + event.getAnnotatedDisposedParameter().getDeclaringCallable());
+// log.info(" position: " + event.getAnnotatedDisposedParameter().getPosition());
+
+ }
+
+ public void processProducerField(@Observes ProcessProducerField event)
+ {
+ log.info(" (*) processProducerField: " + event.getAnnotatedProducerField());
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/beans.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/beans.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/beans.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The contents of this file is permitted to be empty.
+ The schema definition is provided for your convenience.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
Added: sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (rev 0)
+++ sandbox/cdi_support/cdi/trunk/examples/traceextension/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1 @@
+org.gatein.cdi.examples.traceextension.TraceExtension
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/impl/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gatein-cdi-impl</artifactId>
+ <name>GateIn CDI :: Impl</name>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Weld implementation - we use BeanManagerImpl directly -->
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!--dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ </dependency-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.portal</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.organization.api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency> <!-- TODO TODO: remove this -->
+ <groupId>org.jboss.web</groupId>
+ <artifactId>jbossweb</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/GateInExtension.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/GateInExtension.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/GateInExtension.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.impl;
+
+import org.gatein.cdi.api.annotations.PortalContainerScope;
+import org.gatein.cdi.api.annotations.RootContainerScope;
+import org.gatein.cdi.impl.annotations.GateInServiceLiteral;
+import org.gatein.cdi.impl.inject.GateInServiceProducerBean;
+import org.jboss.weld.bean.NewBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.logging.Logger;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInExtension implements Extension
+{
+ private static final String GATEIN_API_PACKAGE_PREFIX = "org.gatein.api.";
+
+ private static Logger log = Logger.getLogger(GateInExtension.class.getName());
+
+ private Set<String> supportedTypes;
+
+ /*
+ * Keep in mind that Extension is proxied so there may be another proxy instance created
+ */
+ public GateInExtension()
+ {
+ supportedTypes = new HashSet<String>();
+ supportedTypes.add("org.exoplatform.container.configuration.ConfigurationManager");
+ supportedTypes.add("org.exoplatform.services.cache.CacheService");
+ //supportedTypes.add("org.exoplatform.services.organization.OrganizationService");
+ }
+
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+ {
+ if (beanManager instanceof BeanManagerImpl == false)
+ throw new RuntimeException("GateInExtension requires Weld for CDI!");
+
+ Set<String> newlyAdded = new HashSet<String>();
+
+ BeanManagerImpl mgr = (BeanManagerImpl) beanManager;
+
+ List<Bean<?>> beans = mgr.getBeans();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof NewBean)
+ continue;
+
+ Set<InjectionPoint> ijs = bean.getInjectionPoints();
+ for (InjectionPoint ij: ijs)
+ {
+ Annotation[] anns = ij.getQualifiers().toArray(new Annotation[0]);
+ String newlyAddedKey = getAnnotatedTypeKey(ij.getType(), anns);
+ Set<Bean<?>> resolvedBeans = beanManager.getBeans(ij.getType(), anns);
+ if (!newlyAdded.contains(newlyAddedKey)
+ && !isInjectionPointSatisfied(ij, resolvedBeans, mgr)
+ && isInjectionProvidedByGateIn(ij)
+ && checkAnnotations(ij))
+ {
+
+ registerProducer(beanManager, event, ij);
+ newlyAdded.add(newlyAddedKey);
+ }
+ }
+ log.fine(bean.getBeanClass() + " " + bean.getTypes());
+ }
+ log.info("GateInExtension initialized.");
+ }
+
+ private String getAnnotatedTypeKey(Type type, Annotation[] annotations)
+ {
+ return type.toString() + "-" + new TreeSet(Arrays.asList(annotations)).toString();
+ }
+
+ protected boolean checkAnnotations(InjectionPoint ij)
+ {
+ Annotated annotated = ij.getAnnotated();
+ Annotation rootAnn = annotated.getAnnotation(RootContainerScope.class);
+ Annotation portalAnn = annotated.getAnnotation(PortalContainerScope.class);
+
+ if (rootAnn != null && portalAnn != null)
+ throw new RuntimeException("Can't have both @RootContainerScope and @PortalContainerScope on injection point: " + ij);
+
+ return true;
+ }
+
+ protected boolean isInjectionPointSatisfied(InjectionPoint ij, Set<?> resolvedBeans, BeanManagerImpl beanManager)
+ {
+ if (ij.getBean() instanceof Decorator<?>)
+ {
+ //if (beanManager.getEnabledClasses().getDecorators().contains(ij.getBean().getBeanClass()))
+ if (beanManager.getEnabledDecoratorClasses().contains(ij.getBean().getBeanClass()))
+ {
+ return resolvedBeans.size() > 0;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return resolvedBeans.size() > 0;
+ }
+ }
+
+ protected boolean isInjectionProvidedByGateIn(InjectionPoint ij)
+ {
+ Annotated annotated = ij.getAnnotated();
+ Set<Annotation> annSet = annotated.getAnnotations();
+ if (annSet.contains(GateInServiceLiteral.INSTANCE))
+ return true;
+
+ Set<Type> types = annotated.getTypeClosure();
+ for (Type type: types)
+ {
+ if (type instanceof Class)
+ {
+ String className = ((Class) type).getName();
+ if (className.startsWith(GATEIN_API_PACKAGE_PREFIX))
+ {
+ if (className.endsWith(".PortalRequestContext")
+ || className.endsWith(".WebuiRequestContext")
+ || className.endsWith(".PortletRequestContext")
+ || className.endsWith(".RootContainer")
+ || className.endsWith(".PortalContainer")
+ || className.endsWith(".RootContainer"))
+ return false;
+ else
+ return true;
+ }
+ if (className.endsWith(".OrganizationService")
+ || className.endsWith(".UserHandler"))
+ {
+ return false;
+ }
+
+ // TODO: FIXME: This is a temporary measure
+ if (getSupportedTypes().contains(className))
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+ protected Set<Type> getTypes(InjectionPoint ij)
+ {
+ Set<Type> types = new HashSet<Type>();
+ types.add(ij.getType());
+ return types;
+ }
+
+ protected void registerProducer(final BeanManager manager, final AfterBeanDiscovery event, final InjectionPoint ij)
+ {
+ event.addBean(new GateInServiceProducerBean(manager, ij.getType(), getTypes(ij), ij.getQualifiers()));
+ }
+
+ protected Set<String> getSupportedTypes()
+ {
+ return supportedTypes;
+ }
+}
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/OrganizationServiceExtension.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/OrganizationServiceExtension.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/OrganizationServiceExtension.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl;
+
+import org.gatein.cdi.impl.annotations.OrganizationServiceSession;
+import org.jboss.weld.bean.NewBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class OrganizationServiceExtension implements Extension
+{
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+ {
+/*
+ if (beanManager instanceof BeanManagerImpl == false)
+ throw new RuntimeException("GateInExtension requires Weld for CDI!");
+
+ BeanManagerImpl mgr = (BeanManagerImpl) beanManager;
+ mgr.
+ List<Bean<?>> beans = mgr.getBeans();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof NewBean)
+ continue;
+
+ Set<InjectionPoint> ijs = bean.getInjectionPoints();
+ for (InjectionPoint ij: ijs)
+ {
+ if (isInOrganizationServiceDomain(ij.getType()))
+ {
+ bean.
+ }
+ Annotation[] anns = ij.getQualifiers().toArray(new Annotation[0]);
+ Set<Bean<?>> resolvedBeans = beanManager.getBeans(ij.getType(), anns);
+ if (!isInjectionPointSatisfied(ij, resolvedBeans, mgr)
+ && isInjectionProvidedByGateIn(ij)
+ && checkAnnotations(ij))
+ {
+
+ registerProducer(beanManager, event, ij);
+ }
+ }
+ }
+*/
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/GateInServiceLiteral.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/GateInServiceLiteral.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/GateInServiceLiteral.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.impl.annotations;
+
+import org.gatein.api.annotations.GateInService;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInServiceLiteral extends AnnotationLiteral<GateInService> implements GateInService
+{
+ public static final GateInService INSTANCE = new GateInServiceLiteral();
+
+ private GateInServiceLiteral() {}
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/OrganizationServiceSession.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/OrganizationServiceSession.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/annotations/OrganizationServiceSession.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.annotations;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@Inherited
+@InterceptorBinding
+(a)Target({ElementType.TYPE, ElementType.METHOD})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface OrganizationServiceSession
+{
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProducerBean.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProducerBean.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProducerBean.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.gatein.cdi.impl.inject;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.RootContainer;
+import org.gatein.cdi.api.annotations.PortalContainerScope;
+import org.gatein.cdi.api.annotations.RootContainerScope;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInServiceProducerBean implements Bean
+{
+ private Class beanClass;
+ private Set<Type> types;
+ private BeanManager beanManager;
+ private Set<Annotation> qualifiers;
+
+ public GateInServiceProducerBean(BeanManager manager, Type beanClass, Set<Type> types, Set<Annotation> qualifiers)
+ {
+ beanManager = manager;
+ this.beanClass = (Class) beanClass;
+ this.types = types;
+ this.qualifiers = new HashSet<Annotation>(qualifiers);
+
+ boolean anyFound = false;
+ boolean defaultFound = false;
+ for (Annotation a: qualifiers)
+ {
+ if (a instanceof Any)
+ anyFound = true;
+ else if (a instanceof Default)
+ defaultFound = true;
+ }
+ if (!defaultFound)
+ this.qualifiers.add(DefaultLiteral.INSTANCE);
+ if (!anyFound)
+ this.qualifiers.add(AnyLiteral.INSTANCE);
+
+ this.qualifiers = Collections.unmodifiableSet(this.qualifiers);
+ }
+
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return beanClass;
+ }
+
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ public boolean isNullable()
+ {
+ return true;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public Object create(CreationalContext creationalContext)
+ {
+ // return null if RootContainer is not yet available
+ //ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
+ //if (container == null)
+ // return null;
+
+ Context ctx = beanManager.getContext(Dependent.class);
+ Bean<InjectionPoint> ipBean = (Bean<InjectionPoint>) beanManager.getBeans(InjectionPoint.class).iterator().next();
+ CreationalContext ipCC = beanManager.createCreationalContext(ipBean);
+ InjectionPoint ip = ctx.get(ipBean, ipCC);
+ Annotated annotated = ip.getAnnotated();
+ Set<Annotation> anns = annotated.getAnnotations();
+ Type type = ip.getType();
+
+ if (useProxy(type, anns))
+ return GateInServiceProxy.createProxy(this, (Class) type, anns);
+
+ return lookupService(type, anns);
+ }
+
+ private boolean useProxy(Type type, Set<Annotation> anns)
+ {
+ // use proxy if RootContainer is not yet available
+ return ExoContainerContext.getCurrentContainerIfPresent() == null;
+ }
+
+ public Object lookupService(Type type, Set<Annotation> anns)
+ {
+ if (containsAnnotation(anns, RootContainerScope.class))
+ {
+ // do a service lookup using RootContainer
+ if (type instanceof Class)
+ return RootContainer.getInstance().getComponentInstanceOfType((Class) type);
+ else
+ return RootContainer.getInstance().getComponentInstance(type);
+ }
+ else
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
+ if (container == null)
+ return null;
+ // don't do RootContainer lookup if PortalContainerScope is requested but is not available
+ if (container instanceof RootContainer && anns.contains(PortalContainerScope.class))
+ return null;
+
+ if (type instanceof Class)
+ return container.getComponentInstanceOfType((Class) type);
+ else
+ return container.getComponentInstance(type);
+ }
+ }
+
+ private boolean containsAnnotation(Set<Annotation> anns, Class<?> annClass)
+ {
+ for (Annotation ann: anns)
+ {
+ if (ann.annotationType().isAssignableFrom(annClass))
+ return true;
+ }
+ return false;
+ }
+
+ public void destroy(Object service, CreationalContext creationalContext)
+ {
+ System.out.println("destroy(): " + service);
+ }
+}
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProxy.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProxy.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GateInServiceProxy.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.inject;
+
+import org.exoplatform.container.ExoContainerContext;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInServiceProxy implements InvocationHandler
+{
+ private GateInServiceProducerBean producer;
+ private Class type;
+ private Set<Annotation> anns;
+
+ private GateInServiceProxy(GateInServiceProducerBean producer, Class type, Set<Annotation> anns)
+ {
+ this.producer = producer;
+ this.type = type;
+ this.anns = anns;
+ }
+
+ public static Object createProxy(GateInServiceProducerBean producer, Class type, Set<Annotation> anns)
+ {
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ getInterfaces(type),
+ new GateInServiceProxy(producer, type, anns));
+ }
+
+ private static Class<Object>[] getInterfaces(Class type)
+ {
+ return new Class[] {type};
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ Object service = producer.lookupService(type, anns);
+ if (service == null)
+ {
+ if (method.getDeclaringClass() == Object.class && "toString".equals(method.getName()))
+ return "-- No delegate (current container: " + ExoContainerContext.getCurrentContainerIfPresent() + ") --";
+
+ throw new IllegalStateException("Proxy operation failed to lookup delegate: " + type + " (current container: "
+ + ExoContainerContext.getCurrentContainerIfPresent() + ")");
+ }
+ return method.invoke(service, args);
+ }
+
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericProxy.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericProxy.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericProxy.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.inject;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public abstract class GenericProxy<T> implements InvocationHandler
+{
+ protected abstract T produceDelegate();
+
+ protected abstract Class<T> getType();
+
+ protected abstract T getDelegate();
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ T delegate = getDelegate();
+ if (delegate == null)
+ {
+ if (method.getDeclaringClass() == Object.class && "toString".equals(method.getName()))
+ return "-- No delegate (type: " + getType() + ") --";
+
+ throw new IllegalStateException("Proxy operation failed to lookup delegate: " + getType());
+ }
+ return method.invoke(delegate, args);
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericTLProxy.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericTLProxy.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/GenericTLProxy.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.inject;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public abstract class GenericTLProxy<T> extends GenericProxy<T>
+{
+ private ThreadLocal<T> tl = new ThreadLocal<T>();
+
+ protected T getDelegate()
+ {
+ T delegate = tl.get();
+
+ if (delegate != null)
+ return delegate;
+
+ delegate = produceDelegate();
+ tl.set(delegate);
+ return delegate;
+ }
+
+ public void clear()
+ {
+ tl.remove();
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceInterceptor.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceInterceptor.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceInterceptor.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.inject;
+
+import org.gatein.cdi.impl.annotations.OrganizationServiceSession;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.lang.reflect.Proxy;
+
+/**
+ * Experimental stuff
+ *
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@OrganizationServiceSession
+@Interceptor
+public class OrganizationServiceInterceptor
+{
+
+ @AroundInvoke
+ public Object manageOrganizationServiceSession(InvocationContext ctx) throws Exception
+ {
+ Object ret = ctx.proceed();
+ Object target = ctx.getTarget();
+ if (Proxy.isProxyClass(target.getClass()))
+ {
+ Object ih = Proxy.getInvocationHandler(target);
+ if (ih instanceof GenericTLProxy)
+ {
+ ((GenericTLProxy) ih).clear();
+ }
+ }
+ return ret;
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceProducers.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceProducers.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/inject/OrganizationServiceProducers.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.inject;
+
+import org.exoplatform.services.organization.GroupHandler;
+import org.exoplatform.services.organization.MembershipHandler;
+import org.exoplatform.services.organization.MembershipTypeHandler;
+import org.exoplatform.services.organization.OrganizationService;
+import org.exoplatform.services.organization.UserHandler;
+import org.exoplatform.services.organization.UserProfileHandler;
+
+import javax.enterprise.inject.Produces;
+import java.lang.reflect.Proxy;
+
+/**
+ * Experimental stuff
+ *
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class OrganizationServiceProducers
+{
+ //@Produces
+ public UserHandler produceUserHandler(final OrganizationService service)
+ {
+ return (UserHandler) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[] {UserHandler.class},
+ new GenericTLProxy<UserHandler>() {
+
+ @Override
+ protected UserHandler produceDelegate()
+ {
+ return service.getUserHandler();
+ }
+
+ @Override
+ protected Class getType()
+ {
+ return UserHandler.class;
+ }
+ });
+
+ }
+
+ //@Produces
+ public UserProfileHandler produceUserProfileHandler(final OrganizationService service)
+ {
+ return (UserProfileHandler) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[] {UserProfileHandler.class},
+ new GenericTLProxy<UserProfileHandler>() {
+
+ @Override
+ protected UserProfileHandler produceDelegate()
+ {
+ return service.getUserProfileHandler();
+ }
+
+ @Override
+ protected Class getType()
+ {
+ return UserProfileHandler.class;
+ }
+ });
+ }
+
+ //@Produces
+ public GroupHandler produceGroupHandler(final OrganizationService service)
+ {
+ return (GroupHandler) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[] {GroupHandler.class},
+ new GenericTLProxy<GroupHandler>() {
+
+ @Override
+ protected GroupHandler produceDelegate()
+ {
+ return service.getGroupHandler();
+ }
+
+ @Override
+ protected Class getType()
+ {
+ return GroupHandler.class;
+ }
+ });
+ }
+
+ //@Produces
+ public MembershipTypeHandler produceMembershipTypeHandler(final OrganizationService service)
+ {
+ return (MembershipTypeHandler) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[] {MembershipTypeHandler.class},
+ new GenericTLProxy<MembershipTypeHandler>() {
+
+ @Override
+ protected MembershipTypeHandler produceDelegate()
+ {
+ return service.getMembershipTypeHandler();
+ }
+
+ @Override
+ protected Class getType()
+ {
+ return MembershipTypeHandler.class;
+ }
+ });
+ }
+
+ //@Produces
+ public MembershipHandler produceMembershipHandler(final OrganizationService service)
+ {
+ return (MembershipHandler) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[] {MembershipHandler.class},
+ new GenericTLProxy<MembershipHandler>() {
+
+ @Override
+ protected MembershipHandler produceDelegate()
+ {
+ return service.getMembershipHandler();
+ }
+
+ @Override
+ protected Class getType()
+ {
+ return MembershipHandler.class;
+ }
+ });
+ }
+
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/producers/ProducersBean.java
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/producers/ProducersBean.java (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/java/org/gatein/cdi/impl/producers/ProducersBean.java 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.cdi.impl.producers;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.services.organization.OrganizationService;
+import org.exoplatform.services.organization.UserHandler;
+import org.gatein.api.app.PortalRequestContext;
+import org.gatein.api.app.PortletRequestContext;
+import org.gatein.api.app.WebuiRequestContext;
+import org.gatein.api.kernel.GateInContainer;
+import org.gatein.api.kernel.PortalContainer;
+import org.gatein.api.kernel.RootContainer;
+import org.gatein.cdi.api.annotations.PortalContainerScope;
+import org.gatein.cdi.api.annotations.RootContainerScope;
+import org.gatein.cdi.api.proxyproducer.ProxyProducer;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class ProducersBean
+{
+ @ProxyProducer
+ public WebuiRequestContext produceWebuiRequestContext()
+ {
+ org.exoplatform.webui.application.WebuiRequestContext
+ webuiReqContext = org.exoplatform.webui.application.WebuiRequestContext.getCurrentInstance();
+
+ return WebuiRequestContext.wrap(webuiReqContext);
+ }
+/*
+ @ProxyProducer
+ public PortalRequestContext producePortalRequestContext(WebuiRequestContext current)
+ {
+ if(current instanceof TargetInstanceProxy)
+ {
+ current = (WebuiRequestContext) ((TargetInstanceProxy)current).getTargetInstance();
+ }
+ if (current instanceof PortalRequestContext)
+ return (PortalRequestContext) current;
+
+ return null;
+ }
+
+ @ProxyProducer
+ public PortletRequestContext producePortletRequestContext(WebuiRequestContext current)
+ {
+ if(current instanceof TargetInstanceProxy)
+ {
+ current = (WebuiRequestContext) ((TargetInstanceProxy)current).getTargetInstance();
+ }
+ if (current instanceof PortletRequestContext)
+ return (PortletRequestContext) current;
+
+ return null;
+ }
+*/
+ @ProxyProducer
+ public PortalRequestContext producePortalRequestContext()
+ {
+ WebuiRequestContext current = produceWebuiRequestContext();
+ if (current instanceof PortalRequestContext)
+ return (PortalRequestContext) current;
+
+ return null;
+ }
+
+ @ProxyProducer
+ public PortletRequestContext producePortletRequestContext()
+ {
+ WebuiRequestContext current = produceWebuiRequestContext();
+ if (current instanceof PortletRequestContext)
+ return (PortletRequestContext) current;
+
+ return null;
+ }
+
+ @ProxyProducer
+ public GateInContainer produceCurrentContainer()
+ {
+ ExoContainer current = ExoContainerContext.getCurrentContainerIfPresent();
+ if (current == null)
+ return null;
+
+ return GateInContainer.wrap(current);
+ }
+
+ @ProxyProducer
+ public RootContainer produceRootContainer()
+ {
+ GateInContainer current = produceCurrentContainer();
+ if (current instanceof RootContainer)
+ return (RootContainer) current;
+
+ return null;
+ }
+
+ @ProxyProducer
+ public PortalContainer producePortalContainer()
+ {
+ GateInContainer current = produceCurrentContainer();
+ if (current instanceof PortalContainer)
+ return (PortalContainer) current;
+
+ return null;
+ }
+
+ @ProxyProducer
+ public OrganizationService produceOrganizationService(InjectionPoint ij)
+ {
+ return (OrganizationService) lookupService(OrganizationService.class, ij);
+ }
+
+ @ProxyProducer
+ public UserHandler produceUserHandler(InjectionPoint ij)
+ {
+ OrganizationService orgSvc = produceOrganizationService(ij);
+ return orgSvc.getUserHandler();
+ }
+
+ protected Object lookupService(Object type, InjectionPoint ij)
+ {
+ Set<Annotation> anns = ij.getAnnotated().getAnnotations();
+ if (anns.contains(RootContainerScope.class))
+ {
+ // do a service lookup using RootContainer
+ if (type instanceof Class)
+ return org.exoplatform.container.RootContainer.getInstance().getComponentInstanceOfType((Class) type);
+ else
+ return org.exoplatform.container.RootContainer.getInstance().getComponentInstance(type);
+ }
+ else
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
+ if (container == null)
+ return null;
+ // don't do RootContainer lookup if PortalContainerScope is requested but is not available
+ if (container instanceof org.exoplatform.container.RootContainer && anns.contains(PortalContainerScope.class))
+ return null;
+
+ if (type instanceof Class)
+ return container.getComponentInstanceOfType((Class) type);
+ else
+ return container.getComponentInstance(type);
+ }
+
+ }
+}
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/beans.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/beans.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/beans.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The contents of this file is permitted to be empty.
+ The schema definition is provided for your convenience.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
Added: sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (rev 0)
+++ sandbox/cdi_support/cdi/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,2 @@
+org.gatein.cdi.impl.GateInExtension
+org.gatein.cdi.impl.proxyproducer.ProxyProducerExtension
\ No newline at end of file
Added: sandbox/cdi_support/cdi/trunk/pom.xml
===================================================================
--- sandbox/cdi_support/cdi/trunk/pom.xml (rev 0)
+++ sandbox/cdi_support/cdi/trunk/pom.xml 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-parent</artifactId>
+ <version>9</version>
+ </parent>
+
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-parent</artifactId>
+ <name>GateIn CDI</name>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <properties>
+ <org.exoplatform.kernel.version>2.2.7-GA</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.7-GA</org.exoplatform.core.version>
+ <org.exoplatform.webui.version>3.2.0-Beta01-SNAPSHOT</org.exoplatform.webui.version>
+ <org.gatein.wci.version>2.1.0-Beta02</org.gatein.wci.version>
+ <org.gatein.pc.version>2.3.0-Beta02-SNAPSHOT</org.gatein.pc.version>
+ </properties>
+
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <!--module>docs/reference</module-->
+ <module>examples/portlet</module>
+ <!--module>examples/traceextension</module-->
+ <!--module>examples/bridgehello</module-->
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.cdi</groupId>
+ <artifactId>gatein-cdi-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>1.0.1-CR1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.web</groupId>
+ <artifactId>jbossweb</artifactId>
+ <version>3.0.0-beta-6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.core</artifactId>
+ <version>${org.exoplatform.webui.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.portal</artifactId>
+ <version>${org.exoplatform.webui.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.organization.api</artifactId>
+ <version>${org.exoplatform.core.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
Added: sandbox/cdi_support/cdi/trunk/readme.txt
===================================================================
--- sandbox/cdi_support/cdi/trunk/readme.txt (rev 0)
+++ sandbox/cdi_support/cdi/trunk/readme.txt 2011-04-23 20:10:49 UTC (rev 6335)
@@ -0,0 +1,4 @@
+Gatein CDI Integration
+======================
+
+TODO
13 years, 8 months
gatein SVN: r6334 - in sandbox/cdi_support/gatein-api/trunk: src and 11 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2011-04-23 16:02:26 -0400 (Sat, 23 Apr 2011)
New Revision: 6334
Added:
sandbox/cdi_support/gatein-api/trunk/pom.xml
sandbox/cdi_support/gatein-api/trunk/src/
sandbox/cdi_support/gatein-api/trunk/src/main/
sandbox/cdi_support/gatein-api/trunk/src/main/java/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/annotations/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/annotations/GateInService.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortalRequestContext.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortletRequestContext.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/RequestContext.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/WebuiRequestContext.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainer.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainerContext.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/PortalContainer.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/RootContainer.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/InputRenderParameters.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/OutputRenderParameters.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/security/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/security/ConversationState.java
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/util/
sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/util/Availability.java
Log:
CDI support for portlets - Injection friendly API that wraps exo classes
Added: sandbox/cdi_support/gatein-api/trunk/pom.xml
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/pom.xml (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/pom.xml 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+
+ <parent>
+ <groupId>org.gatein</groupId>
+ <artifactId>gatein-parent</artifactId>
+ <version>1.0.1-GA</version>
+ </parent>
+
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-api</artifactId>
+
+ <name>GateIn API</name>
+ <version>1.0.0-Alpha01-SNAPSHOT</version>
+
+ <packaging>jar</packaging>
+
+ <properties>
+ <org.exoplatform.kernel.version>2.2.7-GA</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.7-GA</org.exoplatform.core.version>
+ <org.exoplatform.webui.version>3.2.0-Beta01-SNAPSHOT</org.exoplatform.webui.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.framework</artifactId>
+ <version>${org.exoplatform.webui.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.portal</artifactId>
+ <version>${org.exoplatform.webui.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.organization.api</artifactId>
+ <version>${org.exoplatform.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.interceptor</groupId>
+ <artifactId>jboss-interceptor</artifactId>
+ <version>1.0.0-CR11</version>
+ <scope>provided</scope>
+ </dependency>
+ <!--dependency>
+ <groupId>picocontainer</groupId>
+ <artifactId>picocontainer</artifactId>
+ <version>1.1</version>
+ </dependency-->
+ </dependencies>
+</project>
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/annotations/GateInService.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/annotations/GateInService.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/annotations/GateInService.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+@Documented
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface GateInService
+{
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortalRequestContext.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortalRequestContext.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortalRequestContext.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.app;
+
+import org.w3c.dom.Element;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class PortalRequestContext extends WebuiRequestContext<org.exoplatform.portal.application.PortalRequestContext>
+{
+ public PortalRequestContext()
+ {}
+
+ public PortalRequestContext(org.exoplatform.portal.application.PortalRequestContext delegate)
+ {
+ super(delegate);
+ }
+
+ public HttpServletRequest getRequest() throws Exception
+ {
+ return delegate.getRequest();
+ }
+
+ public HttpServletResponse getResponse() throws Exception
+ {
+ return delegate.getResponse();
+ }
+
+ public void addExtraMarkupHeader(Element element, String portletWindowId)
+ {
+ delegate.addExtraMarkupHeader(element, portletWindowId);
+ }
+
+ public void refreshResourceBundle() throws Exception
+ {
+ delegate.refreshResourceBundle();
+ }
+
+ public String getTitle() throws Exception
+ {
+ return delegate.getTitle();
+ }
+
+ public Map<String, String> getMetaInformation()
+ {
+ return delegate.getMetaInformation();
+ }
+
+ public String getCacheLevel()
+ {
+ return delegate.getCacheLevel();
+ }
+
+ public Map<String, String[]> getPortletParameters()
+ {
+ return delegate.getPortletParameters();
+ }
+
+ public String getPortalOwner()
+ {
+ return delegate.getPortalOwner();
+ }
+
+ public String getNodePath()
+ {
+ return delegate.getNodePath();
+ }
+
+ public String getRequestURI()
+ {
+ return delegate.getRequestURI();
+ }
+
+ public String getPortalURI()
+ {
+ return delegate.getPortalURI();
+ }
+
+ public int getAccessPath()
+ {
+ return delegate.getAccessPath();
+ }
+
+ public void setHeaders(Map<String, String> headers)
+ {
+ delegate.setHeaders(headers);
+ }
+
+ public List<String> getExtraMarkupHeadersAsStrings() throws Exception
+ {
+ return delegate.getExtraMarkupHeadersAsStrings();
+ }
+
+ public List<Element> getExtraMarkupHeaders()
+ {
+ return delegate.getExtraMarkupHeaders();
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortletRequestContext.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortletRequestContext.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/PortletRequestContext.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.app;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class PortletRequestContext extends WebuiRequestContext<org.exoplatform.webui.application.portlet.PortletRequestContext>
+{
+
+ public PortletRequestContext()
+ {}
+
+ public PortletRequestContext(org.exoplatform.webui.application.portlet.PortletRequestContext delegate)
+ {
+ super(delegate);
+ }
+
+ public void init(Writer writer, PortletRequest req, PortletResponse res)
+ {
+ delegate.init(writer, req, res);
+ }
+
+ public PortletRequest getRequest()
+ {
+ return delegate.getRequest();
+ }
+
+ public PortletResponse getResponse()
+ {
+ return delegate.getResponse();
+ }
+
+ public PortletMode getApplicationMode()
+ {
+ return delegate.getApplicationMode();
+ }
+
+ public void setApplicationMode(PortletMode mode) throws PortletModeException
+ {
+ delegate.setApplicationMode(mode);
+ }
+
+ public boolean hasProcessAction()
+ {
+ return delegate.hasProcessAction();
+ }
+
+ public void setProcessAction(boolean b)
+ {
+ delegate.setProcessAction(b);
+ }
+
+ public String getWindowId()
+ {
+ return delegate.getWindowId();
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/RequestContext.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/RequestContext.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/RequestContext.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.app;
+
+import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.web.application.Application;
+import org.exoplatform.web.application.ApplicationSession;
+import org.exoplatform.web.application.JavascriptManager;
+import org.exoplatform.web.application.URLBuilder;
+
+import java.io.Writer;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class RequestContext<T extends org.exoplatform.web.application.RequestContext>
+{
+ protected T delegate;
+
+ public RequestContext()
+ {}
+
+ public RequestContext(T delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Orientation getOrientation()
+ {
+ return delegate.getOrientation();
+ }
+
+ public String getRequestParameter(String name)
+ {
+ return delegate.getRequestParameter(name);
+ }
+
+ public String[] getRequestParameterValues(String name)
+ {
+ return delegate.getRequestParameterValues(name);
+ }
+
+ public URLBuilder<?> getURLBuilder()
+ {
+ return delegate.getURLBuilder();
+ }
+
+ public boolean useAjax()
+ {
+ return delegate.useAjax();
+ }
+
+ public Application getApplication()
+ {
+ return delegate.getApplication();
+ }
+
+ public Locale getLocale()
+ {
+ return delegate.getLocale();
+ }
+
+ public ResourceBundle getApplicationResourceBundle()
+ {
+ return delegate.getApplicationResourceBundle();
+ }
+
+ public JavascriptManager getJavascriptManager()
+ {
+ return delegate.getJavascriptManager();
+ }
+
+ public String getRemoteUser()
+ {
+ return delegate.getRemoteUser();
+ }
+
+ public boolean isUserInRole(String roleUser)
+ {
+ return delegate.isUserInRole(roleUser);
+ }
+
+ public boolean getFullRender()
+ {
+ return delegate.getFullRender();
+ }
+
+ public ApplicationSession getApplicationSession()
+ {
+ return delegate.getApplicationSession();
+ }
+
+ public Writer getWriter() throws Exception
+ {
+ return delegate.getWriter();
+ }
+
+ public void setWriter(Writer writer)
+ {
+ delegate.setWriter(writer);
+ }
+
+ public RequestContext getParentAppRequestContext()
+ {
+ return WebuiRequestContext.wrap(delegate.getParentAppRequestContext());
+ }
+
+ public void setParentAppRequestContext(RequestContext context)
+ {
+ delegate.setParentAppRequestContext(context.getDelegate());
+ }
+
+ private org.exoplatform.web.application.RequestContext getDelegate()
+ {
+ return delegate;
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/WebuiRequestContext.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/WebuiRequestContext.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/app/WebuiRequestContext.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.app;
+
+import org.exoplatform.resolver.ResourceResolver;
+import org.exoplatform.web.application.URLBuilder;
+import org.exoplatform.webui.application.StateManager;
+import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+
+import java.util.ResourceBundle;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public abstract class WebuiRequestContext<T extends org.exoplatform.webui.application.WebuiRequestContext> extends RequestContext<T>
+{
+ public WebuiRequestContext()
+ {}
+
+ public WebuiRequestContext(T delegate)
+ {
+ super(delegate);
+ }
+
+ public String getSessionId()
+ {
+ return delegate.getSessionId();
+ }
+
+ public UIApplication getUIApplication()
+ {
+ return delegate.getUIApplication();
+ }
+
+ public void setUIApplication(UIApplication uiApplication) throws Exception
+ {
+ delegate.setUIApplication(uiApplication);
+ }
+
+ public ResourceBundle getApplicationResourceBundle()
+ {
+ return delegate.getApplicationResourceBundle();
+ }
+
+ public String getActionParameterName()
+ {
+ return delegate.getActionParameterName();
+ }
+
+ public String getUIComponentIdParameterName()
+ {
+ return delegate.getUIComponentIdParameterName();
+ }
+
+ public URLBuilder<UIComponent> getURLBuilder()
+ {
+ return delegate.getURLBuilder();
+ }
+
+ public String getRequestContextPath()
+ {
+ return delegate.getRequestContextPath();
+ }
+
+ public String getPortalContextPath()
+ {
+ return delegate.getPortalContextPath();
+ }
+
+ public abstract <T> T getRequest() throws Exception;
+
+ public abstract <T> T getResponse() throws Exception;
+
+ public boolean isResponseComplete()
+ {
+ return delegate.isResponseComplete();
+ }
+
+ public void setResponseComplete(boolean b)
+ {
+ delegate.setResponseComplete(b);
+ }
+
+ public void sendRedirect(String url) throws Exception
+ {
+ delegate.sendRedirect(url);
+ }
+
+ public boolean getProcessRender()
+ {
+ return delegate.getProcessRender();
+ }
+
+ public void setProcessRender(boolean b)
+ {
+ delegate.setProcessRender(b);
+ }
+
+ public Set<UIComponent> getUIComponentToUpdateByAjax()
+ {
+ return delegate.getUIComponentToUpdateByAjax();
+ }
+
+ public void addUIComponentToUpdateByAjax(UIComponent uicomponent)
+ {
+ delegate.addUIComponentToUpdateByAjax(uicomponent);
+ }
+
+ public ResourceResolver getResourceResolver(String uri)
+ {
+ return delegate.getResourceResolver(uri);
+ }
+
+ public StateManager getStateManager()
+ {
+ return delegate.getStateManager();
+ }
+
+ public void setStateManager(StateManager manager)
+ {
+ delegate.setStateManager(manager);
+ }
+
+ public static WebuiRequestContext wrap(org.exoplatform.web.application.RequestContext ctx)
+ {
+ if (ctx == null)
+ return null;
+ if (ctx instanceof org.exoplatform.portal.application.PortalRequestContext)
+ return new PortalRequestContext( (org.exoplatform.portal.application.PortalRequestContext) ctx);
+ else if (ctx instanceof org.exoplatform.webui.application.portlet.PortletRequestContext)
+ return new PortletRequestContext( (org.exoplatform.webui.application.portlet.PortletRequestContext) ctx);
+
+ throw new IllegalArgumentException("RequestContext of unexpected type: " + ctx.getClass());
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainer.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainer.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainer.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.kernel;
+
+import org.exoplatform.container.ConcurrentPicoContainer;
+import org.exoplatform.container.ContainerLifecyclePlugin;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.ComponentLifecyclePlugin;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.management.ManagementContext;
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.Parameter;
+import org.picocontainer.PicoContainer;
+import org.picocontainer.PicoException;
+import org.picocontainer.PicoRegistrationException;
+import org.picocontainer.PicoVisitor;
+import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInContainer<T extends ExoContainer>
+{
+ protected T delegate;
+
+ public GateInContainer()
+ {}
+
+ public GateInContainer(T delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public GateInContainerContext getContext()
+ {
+ return new GateInContainerContext(delegate.getContext());
+ }
+
+ public static GateInContainer wrap(ExoContainer container)
+ {
+ if (container == null)
+ return null;
+
+ if (container instanceof org.exoplatform.container.RootContainer)
+ return new RootContainer((org.exoplatform.container.RootContainer) container);
+ else if (container instanceof org.exoplatform.container.PortalContainer)
+ return new PortalContainer((org.exoplatform.container.PortalContainer) container);
+
+ throw new IllegalArgumentException("ExoContainer of unexpected type: " + container.getClass());
+ }
+/*
+ public void initContainer() throws Exception
+ {
+ delegate.initContainer();
+ }
+
+ public void dispose()
+ {
+ delegate.dispose();
+ }
+
+ public void start(boolean init)
+ {
+ delegate.start(init);
+ }
+
+ public void start()
+ {
+ delegate.start();
+ }
+
+ public void stop()
+ {
+ delegate.stop();
+ }
+
+ public void startContainer() throws Exception
+ {
+ delegate.startContainer();
+ }
+
+ public void stopContainer() throws Exception
+ {
+ delegate.stopContainer();
+ }
+
+ public void destroyContainer() throws Exception
+ {
+ delegate.destroyContainer();
+ }
+*/
+
+ public void addComponentLifecylePlugin(ComponentLifecyclePlugin plugin)
+ {
+ delegate.addComponentLifecylePlugin(plugin);
+ }
+
+ public void addContainerLifecylePlugin(ContainerLifecyclePlugin plugin)
+ {
+ delegate.addContainerLifecylePlugin(plugin);
+ }
+
+ public <T> T createComponent(Class<T> clazz) throws Exception
+ {
+ return delegate.createComponent(clazz);
+ }
+
+ public <T> T createComponent(Class<T> clazz, InitParams params) throws Exception
+ {
+ return delegate.createComponent(clazz, params);
+ }
+
+ public Set<String> getRegisteredComponentNames() throws PicoException
+ {
+ return delegate.getRegisteredComponentNames();
+ }
+
+ public ManagementContext getManagementContext()
+ {
+ return delegate.getManagementContext();
+ }
+
+ public ComponentAdapter registerComponent(ComponentAdapter componentAdapter) throws DuplicateComponentKeyRegistrationException
+ {
+ return delegate.registerComponent(componentAdapter);
+ }
+
+ public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws PicoRegistrationException
+ {
+ return delegate.registerComponentInstance(componentKey, componentInstance);
+ }
+
+ public ComponentAdapter getComponentAdapterOfType(Class componentType)
+ {
+ return delegate.getComponentAdapterOfType(componentType);
+ }
+
+ public List getComponentAdaptersOfType(Class componentType)
+ {
+ return delegate.getComponentAdaptersOfType(componentType);
+ }
+
+ public List getComponentInstancesOfType(Class componentType) throws PicoException
+ {
+ return delegate.getComponentInstancesOfType(componentType);
+ }
+
+ public Object getComponentInstance(Object componentKey) throws PicoException
+ {
+ return delegate.getComponentInstance(componentKey);
+ }
+
+ public Object getComponentInstanceOfType(Class componentType)
+ {
+ return delegate.getComponentInstanceOfType(componentType);
+ }
+
+ public ComponentAdapter unregisterComponent(Object componentKey)
+ {
+ return delegate.unregisterComponent(componentKey);
+ }
+
+ public ComponentAdapter registerComponentInstance(Object component) throws PicoRegistrationException
+ {
+ return delegate.registerComponentInstance(component);
+ }
+
+ public ComponentAdapter registerComponentImplementation(Class componentImplementation) throws PicoRegistrationException
+ {
+ return delegate.registerComponentImplementation(componentImplementation);
+ }
+
+ public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation) throws PicoRegistrationException
+ {
+ return delegate.registerComponentImplementation(componentKey, componentImplementation);
+ }
+
+ public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoRegistrationException
+ {
+ return delegate.registerComponentImplementation(componentKey, componentImplementation, parameters);
+ }
+
+ public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, List parameters) throws PicoRegistrationException
+ {
+ return delegate.registerComponentImplementation(componentKey, componentImplementation, parameters);
+ }
+
+ public Collection getComponentAdapters()
+ {
+ return delegate.getComponentAdapters();
+ }
+
+ public List getComponentInstances() throws PicoException
+ {
+ return delegate.getComponentInstances();
+ }
+
+ public PicoContainer getParent()
+ {
+ return delegate.getParent();
+ }
+
+ public ComponentAdapter unregisterComponentByInstance(Object componentInstance)
+ {
+ return delegate.unregisterComponentByInstance(componentInstance);
+ }
+
+/*
+ public void verify() throws PicoVerificationException
+ {
+ delegate.verify();
+ }
+
+ public MutablePicoContainer makeChildContainer()
+ {
+ return delegate.makeChildContainer();
+ }
+
+ public boolean addChildContainer(PicoContainer child)
+ {
+ return delegate.addChildContainer(child);
+ }
+
+ public boolean removeChildContainer(PicoContainer child)
+ {
+ return delegate.removeChildContainer(child);
+ }
+*/
+ public void accept(PicoVisitor visitor)
+ {
+ delegate.accept(visitor);
+ }
+/*
+ protected void accept(ConcurrentPicoContainer.ContainerVisitor visitor)
+ {
+ delegate.accept(visitor);
+ }
+*/
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainerContext.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainerContext.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/GateInContainerContext.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.kernel;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class GateInContainerContext
+{
+ private ExoContainerContext delegate;
+
+ public GateInContainerContext()
+ {}
+
+ public GateInContainerContext(ExoContainerContext delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public GateInContainer getContainer()
+ {
+ return GateInContainer.wrap(delegate.getContainer());
+ }
+
+ public String getPortalContainerName()
+ {
+ return delegate.getPortalContainerName();
+ }
+
+ public String getRestContextName()
+ {
+ return delegate.getRestContextName();
+ }
+
+ public String getRealmName()
+ {
+ return delegate.getRealmName();
+ }
+
+ public Object getSetting(String settingName)
+ {
+ return delegate.getSetting(settingName);
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public void setName(String name)
+ {
+ delegate.setName(name);
+ }
+
+ public Set<String> getAttributeNames()
+ {
+ return delegate.getAttributeNames();
+ }
+
+ public Object getAttribute(String name)
+ {
+ return delegate.getAttribute(name);
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ delegate.setAttribute(name, value);
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/PortalContainer.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/PortalContainer.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/PortalContainer.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.kernel;
+
+import org.exoplatform.container.SessionContainer;
+import org.exoplatform.container.SessionManager;
+import org.exoplatform.container.xml.PortalContainerInfo;
+
+import javax.servlet.ServletContext;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class PortalContainer extends GateInContainer<org.exoplatform.container.PortalContainer>
+{
+ public PortalContainer()
+ {}
+
+ public PortalContainer(org.exoplatform.container.PortalContainer delegate)
+ {
+ super(delegate);
+ }
+
+ public ClassLoader getWebAppClassLoader(ServletContext context)
+ {
+ return delegate.getWebAppClassLoader(context);
+ }
+
+ public ClassLoader getPortalClassLoader()
+ {
+ return delegate.getPortalClassLoader();
+ }
+
+ public ServletContext getPortalContext()
+ {
+ return delegate.getPortalContext();
+ }
+/*
+ public void registerContext(ServletContext context)
+ {
+ delegate.registerContext(context);
+ }
+
+ public void unregisterContext(ServletContext context)
+ {
+ delegate.unregisterContext(context);
+ }
+*/
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public String getConfigurationXML()
+ {
+ return delegate.getConfigurationXML();
+ }
+
+ public SessionContainer createSessionContainer(String id, String owner)
+ {
+ return delegate.createSessionContainer(id, owner);
+ }
+
+ public void removeSessionContainer(String sessionID)
+ {
+ delegate.removeSessionContainer(sessionID);
+ }
+
+ public List<SessionContainer> getLiveSessions()
+ {
+ return delegate.getLiveSessions();
+ }
+
+ public SessionManager getSessionManager()
+ {
+ return delegate.getSessionManager();
+ }
+
+ public PortalContainerInfo getPortalContainerInfo()
+ {
+ return delegate.getPortalContainerInfo();
+ }
+
+ public String getRestContextName()
+ {
+ return delegate.getRestContextName();
+ }
+
+ public String getRealmName()
+ {
+ return delegate.getRealmName();
+ }
+
+ public Object getSetting(String settingName)
+ {
+ return delegate.getSetting(settingName);
+ }
+
+ public boolean isStarted()
+ {
+ return delegate.isStarted();
+ }
+
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/RootContainer.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/RootContainer.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/kernel/RootContainer.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.kernel;
+
+import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
+import org.exoplatform.container.monitor.jvm.OperatingSystemInfo;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class RootContainer extends GateInContainer<org.exoplatform.container.RootContainer>
+{
+ public RootContainer()
+ {}
+
+ public RootContainer(org.exoplatform.container.RootContainer delegate)
+ {
+ super(delegate);
+ }
+
+ public OperatingSystemInfo getOSEnvironment()
+ {
+ return delegate.getOSEnvironment();
+ }
+
+ public boolean isPortalContainerConfigAware()
+ {
+ return delegate.isPortalContainerConfigAware();
+ }
+
+ public J2EEServerInfo getServerEnvironment()
+ {
+ return delegate.getServerEnvironment();
+ }
+/*
+ public PortalContainer getPortalContainer(String name)
+ {
+ return new PortalContainer(delegate.getPortalContainer(name));
+ }
+
+ public void registerPortalContainer(ServletContext context)
+ {
+ delegate.registerPortalContainer(context);
+ }
+
+ public void createPortalContainers()
+ {
+ delegate.createPortalContainers();
+ }
+
+ public void createPortalContainer(ServletContext context)
+ {
+ delegate.createPortalContainer(context);
+ }
+
+ public void removePortalContainer(ServletContext servletContext)
+ {
+ delegate.removePortalContainer(servletContext);
+ }
+*/
+ public String getConfigurationXML()
+ {
+ return delegate.getConfigurationXML();
+ }
+
+ public void addInitTask(ServletContext context, org.exoplatform.container.RootContainer.PortalContainerInitTask task)
+ {
+ delegate.addInitTask(context, task);
+ }
+
+ public void addInitTask(ServletContext context, org.exoplatform.container.RootContainer.PortalContainerInitTask task, String portalContainer)
+ {
+ delegate.addInitTask(context, task, portalContainer);
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/InputRenderParameters.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/InputRenderParameters.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/InputRenderParameters.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.portlet;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class InputRenderParameters
+{
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/OutputRenderParameters.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/OutputRenderParameters.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/portlet/OutputRenderParameters.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.portlet;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class OutputRenderParameters
+{
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/security/ConversationState.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/security/ConversationState.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/security/ConversationState.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.security;
+
+import org.exoplatform.services.security.Identity;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class ConversationState
+{
+ private org.exoplatform.services.security.ConversationState delegate;
+
+ public ConversationState()
+ {}
+
+ public ConversationState(org.exoplatform.services.security.ConversationState delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Identity getIdentity()
+ {
+ return delegate.getIdentity();
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ delegate.setAttribute(name, value);
+ }
+
+ public Object getAttribute(String name)
+ {
+ return delegate.getAttribute(name);
+ }
+
+ public Set<String> getAttributeNames()
+ {
+ return delegate.getAttributeNames();
+ }
+
+ public void removeAttribute(String name)
+ {
+ delegate.removeAttribute(name);
+ }
+}
Added: sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/util/Availability.java
===================================================================
--- sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/util/Availability.java (rev 0)
+++ sandbox/cdi_support/gatein-api/trunk/src/main/java/org/gatein/api/util/Availability.java 2011-04-23 20:02:26 UTC (rev 6334)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.api.util;
+
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public class Availability
+{
+ /**
+ * Use this method instead of testing object for null.
+ * This will also work when gatein-cdi is used to inject dependencies.
+ * In that case a proxy object is created at injection time, and performs a delegate lookup on every method call.
+ * A delegate may or may not be available inside a current method - it may be looked up via ThreadLocals.
+ *
+ * If this method returns false you should assume <em>o</em> is null.
+ *
+ * @param o object to test for availability
+ * @return true if object is available, false otherwise
+ */
+ public static boolean isObjectAvailable(Object o)
+ {
+ if (o instanceof TargetInstanceProxy == false)
+ {
+ return o != null;
+ }
+
+ return ((TargetInstanceProxy) o).getTargetInstance() != null;
+ }
+}
\ No newline at end of file
13 years, 8 months
gatein SVN: r6333 - in components/pc/trunk: api and 7 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-22 12:01:04 -0400 (Fri, 22 Apr 2011)
New Revision: 6333
Modified:
components/pc/trunk/api/pom.xml
components/pc/trunk/controller/pom.xml
components/pc/trunk/docs/pom.xml
components/pc/trunk/docs/user-guide/pom.xml
components/pc/trunk/mc/pom.xml
components/pc/trunk/pom.xml
components/pc/trunk/portal/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/samples/pom.xml
Log:
- Reverted version to 2.3.0-Beta03-SNAPSHOT.
Modified: components/pc/trunk/api/pom.xml
===================================================================
--- components/pc/trunk/api/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/api/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.pc</groupId>
Modified: components/pc/trunk/controller/pom.xml
===================================================================
--- components/pc/trunk/controller/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/controller/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: components/pc/trunk/docs/pom.xml
===================================================================
--- components/pc/trunk/docs/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/docs/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: components/pc/trunk/docs/user-guide/pom.xml
===================================================================
--- components/pc/trunk/docs/user-guide/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/docs/user-guide/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>docs-aggregator</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/mc/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: components/pc/trunk/pom.xml
===================================================================
--- components/pc/trunk/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -29,7 +29,7 @@
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
Modified: components/pc/trunk/portal/pom.xml
===================================================================
--- components/pc/trunk/portal/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/portal/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/portlet/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified: components/pc/trunk/samples/pom.xml
===================================================================
--- components/pc/trunk/samples/pom.xml 2011-04-22 15:54:02 UTC (rev 6332)
+++ components/pc/trunk/samples/pom.xml 2011-04-22 16:01:04 UTC (rev 6333)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-CR01-SNAPSHOT</version>
+ <version>2.3.0-Beta03-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-samples</artifactId>
13 years, 8 months
gatein SVN: r6332 - components/pc/tags.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-22 11:54:02 -0400 (Fri, 22 Apr 2011)
New Revision: 6332
Removed:
components/pc/tags/2.3.0-Beta03/
Log:
Remove tag for failed release. Again. >_<
13 years, 8 months
gatein SVN: r6331 - in components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer: handlers and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-22 11:18:24 -0400 (Fri, 22 Apr 2011)
New Revision: 6331
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/Utils.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/ServiceDescriptionHandler.java
Log:
- GTNWSRP-45: Improvements to locale management of portlet description generation code.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/Utils.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/Utils.java 2011-04-22 15:11:17 UTC (rev 6330)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/Utils.java 2011-04-22 15:18:24 UTC (rev 6331)
@@ -172,27 +172,71 @@
public static org.oasis.wsrp.v2.LocalizedString convertToWSRPLocalizedString(org.gatein.common.i18n.LocalizedString localizedString,
List<String> desiredLocales)
{
+ org.gatein.common.i18n.LocalizedString.Value match = getPreferredOrBestMatchFor(localizedString, desiredLocales);
+ if (match != null)
+ {
+
+ Locale locale = match.getLocale();
+ String value = match.getString();
+ String language = WSRPUtils.toString(locale);
+ return WSRPTypeFactory.createLocalizedString(language, null, value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static org.oasis.wsrp.v2.LocalizedString convertToWSRPLocalizedString(org.gatein.common.i18n.LocalizedString localizedString, Locale locale)
+ {
if (localizedString == null)
{
return null;
}
+ if (locale == null)
+ {
+ locale = Locale.getDefault();
+ }
+
+ String value = localizedString.getString(locale, true);
+ if (value != null)
+ {
+ return WSRPTypeFactory.createLocalizedString(WSRPUtils.toString(locale), null, value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Locale getPreferredOrBestLocaleFor(org.gatein.common.i18n.LocalizedString localizedString, List<String> desiredLocales)
+ {
+ org.gatein.common.i18n.LocalizedString.Value match = getPreferredOrBestMatchFor(localizedString, desiredLocales);
+ if (match != null)
+ {
+ return match.getLocale();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private static org.gatein.common.i18n.LocalizedString.Value getPreferredOrBestMatchFor(org.gatein.common.i18n.LocalizedString localizedString, List<String> desiredLocales)
+ {
+ if (localizedString == null)
+ {
+ return null;
+ }
+
if (desiredLocales == null || desiredLocales.isEmpty())
{
desiredLocales = Collections.singletonList(WSRPUtils.toString(Locale.getDefault()));
}
// todo: rewrite getPreferredOrBestLocalizedMappingFor to take a List as argument
- org.gatein.common.i18n.LocalizedString.Value bestMapping =
- localizedString.getPreferredOrBestLocalizedMappingFor(desiredLocales.toArray(new String[desiredLocales.size()]));
- if (bestMapping != null)
- {
- Locale locale = bestMapping.getLocale();
- String value = bestMapping.getString();
- String language = WSRPUtils.toString(locale);
- return WSRPTypeFactory.createLocalizedString(language, null, value);
- }
- return null;
+ return localizedString.getPreferredOrBestLocalizedMappingFor(desiredLocales.toArray(new String[desiredLocales.size()]));
}
public static void throwOperationFaultOnSessionOperation() throws OperationFailed
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-22 15:11:17 UTC (rev 6330)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-22 15:18:24 UTC (rev 6331)
@@ -173,7 +173,6 @@
UserContext userContext = getPortletPropertyDescription.getUserContext();
checkUserAuthorization(userContext);
- List<String> desiredLocales = getPortletPropertyDescription.getDesiredLocales();
Portlet portlet = getPortletFrom(portletContext, registration);
PortletInfo info = portlet.getInfo();
PreferencesInfo prefsInfo = info.getPreferences();
@@ -194,6 +193,7 @@
{
//todo: check what we should use key
//todo: right now we only support String properties
+ List<String> desiredLocales = getPortletPropertyDescription.getDesiredLocales();
PropertyDescription desc = WSRPTypeFactory.createPropertyDescription(prefInfo.getKey(), WSRPConstants.XSD_STRING);
desc.setLabel(Utils.convertToWSRPLocalizedString(prefInfo.getDisplayName(), desiredLocales));
desc.setHint(Utils.convertToWSRPLocalizedString(prefInfo.getDescription(), desiredLocales));
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/ServiceDescriptionHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/ServiceDescriptionHandler.java 2011-04-22 15:11:17 UTC (rev 6330)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/ServiceDescriptionHandler.java 2011-04-22 15:18:24 UTC (rev 6331)
@@ -135,7 +135,7 @@
boolean needsPortletDescriptions = !(registration == null && requirements.isRegistrationRequired()
&& requirements.isRegistrationRequiredForFullDescription());
- return serviceDescription.getServiceDescription(needsRegistrationProperties, needsPortletDescriptions, gs.getPortletHandles());
+ return serviceDescription.getServiceDescription(needsRegistrationProperties, needsPortletDescriptions, gs.getPortletHandles(), gs.getDesiredLocales());
}
finally
{
@@ -305,7 +305,7 @@
}
}
- private ServiceDescription getServiceDescription(boolean needsRegistrationProperties, boolean needsPortletDescriptions, List<String> portletHandles)
+ private ServiceDescription getServiceDescription(boolean needsRegistrationProperties, boolean needsPortletDescriptions, List<String> portletHandles, List<String> desiredLocales)
{
initIfNeeded();
@@ -313,11 +313,30 @@
ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(false);
serviceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
- serviceDescription.getLocales().addAll(producer.getSupportedLocales());
+ List<String> supportedLocales = producer.getSupportedLocales();
+ serviceDescription.getLocales().addAll(supportedLocales);
serviceDescription.getSupportedOptions().addAll(OPTIONS);
serviceDescription.setRegistrationPropertyDescription(registrationProperties);
serviceDescription.setRequiresRegistration(requireRegistrations);
+ // find the appropriate language to use
+ String language = null;
+ if (desiredLocales != null)
+ {
+ for (String desired : desiredLocales)
+ {
+ if (supportedLocales.contains(desired))
+ {
+ language = desired;
+ }
+ }
+ }
+ if (language == null)
+ {
+ language = WSRPUtils.toString(Locale.getDefault());
+ }
+
+
Collection<PortletDescription> portlets;
if (needsPortletDescriptions)
{
@@ -327,7 +346,7 @@
portlets = new ArrayList<PortletDescription>(portletHandles.size());
for (String handle : portletHandles)
{
- PortletDescription description = portletDescriptions.get(handle);
+ PortletDescription description = getPortletDescription(handle);
if (description != null)
{
portlets.add(description);
@@ -356,14 +375,14 @@
}
}
- private void addEventInfo(EventInfo info, List<String> desiredLocales)
+ private void addEventInfo(EventInfo info, Locale locale)
{
QName name = info.getName();
if (!eventDescriptions.containsKey(name))
{
EventDescription desc = WSRPTypeFactory.createEventDescription(name);
- desc.setDescription(Utils.convertToWSRPLocalizedString(info.getDescription(), desiredLocales));
- desc.setLabel(Utils.convertToWSRPLocalizedString(info.getDisplayName(), desiredLocales));
+ desc.setDescription(Utils.convertToWSRPLocalizedString(info.getDescription(), locale));
+ desc.setLabel(Utils.convertToWSRPLocalizedString(info.getDisplayName(), locale));
Collection<QName> aliases = info.getAliases();
if (ParameterValidation.existsAndIsNotEmpty(aliases))
{
@@ -407,6 +426,77 @@
portletDescriptions.put(handle, desc);
}
+ /**
+ * TODO: Adapt to desired locales
+ *
+ * @param context
+ * @param desiredLocales
+ * @param registration
+ * @return
+ */
+ public PortletDescription getPortletDescription(PortletContext context, List<String> desiredLocales, Registration registration)
+ {
+ initIfNeeded();
+
+ org.gatein.pc.api.PortletContext pcContext = WSRPUtils.convertToPortalPortletContext(context);
+ if (producer.getRegistrationManager().getPolicy().allowAccessTo(pcContext, registration, "getPortletDescription"))
+ {
+ PortletDescription description = getPortletDescription(context.getPortletHandle());
+
+ if (description == null)
+ {
+ // check if we asked for the description of a clone
+ if (registration.knows(pcContext))
+ {
+ try
+ {
+ // retrieve initial context from portlet info and get description from it
+ Portlet portlet = producer.getPortletWith(pcContext, registration);
+ PortletInfo info = portlet.getInfo();
+ org.gatein.pc.api.PortletContext original = org.gatein.pc.api.PortletContext.createPortletContext(info.getApplicationName(), info.getName());
+ return getPortletDescription(original.getId());
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't retrieve portlet " + pcContext, e);
+ return null;
+ }
+ }
+ }
+ return description;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private PortletDescription getPortletDescription(final String portletHandle)
+ {
+ return portletDescriptions.get(portletHandle);
+ }
+
+ public void removePortletDescription(org.gatein.pc.api.PortletContext pc)
+ {
+ String handle = WSRPUtils.convertToWSRPPortletContext(pc).getPortletHandle();
+
+ PortletDescription description = portletDescriptions.get(handle);
+ if (description != null)
+ {
+ // deal with events
+ for (QName event : description.getHandledEvents())
+ {
+ removeEvent(event);
+ }
+ for (QName event : description.getPublishedEvents())
+ {
+ removeEvent(event);
+ }
+
+ portletDescriptions.remove(handle);
+ }
+ }
+
private PortletDescription createPortletDescription(PortletInfo info, List<String> locales, String handle)
{
if (log.isDebugEnabled())
@@ -432,22 +522,37 @@
MetaInfo metaInfo = info.getMeta();
+ Set<Locale> supportedLocales = info.getCapabilities().getAllLocales();
+ // find the best locale to use to generate the description
+ Locale localeMatch = null;
+ for (String languageTag : locales)
+ {
+ Locale locale = WSRPUtils.getLocale(languageTag);
+ if (supportedLocales.contains(locale))
+ {
+ localeMatch = locale;
+ }
+ }
+ if (localeMatch == null)
+ {
+ localeMatch = Locale.getDefault();
+ }
+
// description
- desc.setDescription(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DESCRIPTION), locales));
+ desc.setDescription(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DESCRIPTION), localeMatch));
// short title
- desc.setShortTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.SHORT_TITLE), locales));
+ desc.setShortTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.SHORT_TITLE), localeMatch));
// title
- desc.setTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.TITLE), locales));
+ desc.setTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.TITLE), localeMatch));
// display name
- desc.setDisplayName(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME), locales));
+ desc.setDisplayName(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME), localeMatch));
// keywords
// metaInfo contains comma-separated keywords: we need to extract them into a list
- org.oasis.wsrp.v2.LocalizedString concatenatedKeywords =
- Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), locales);
+ org.oasis.wsrp.v2.LocalizedString concatenatedKeywords = Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), localeMatch);
if (concatenatedKeywords != null)
{
String commaSeparatedKeywords = concatenatedKeywords.getValue();
@@ -474,7 +579,7 @@
for (Map.Entry<QName, ? extends EventInfo> entry : producedEvents.entrySet())
{
publishedEvents.add(entry.getKey());
- addEventInfo(entry.getValue(), locales);
+ addEventInfo(entry.getValue(), localeMatch);
}
}
Map<QName, ? extends EventInfo> consumedEvents = eventsInfo.getConsumedEvents();
@@ -484,7 +589,7 @@
for (Map.Entry<QName, ? extends EventInfo> entry : consumedEvents.entrySet())
{
handledEvents.add(entry.getKey());
- addEventInfo(entry.getValue(), locales);
+ addEventInfo(entry.getValue(), localeMatch);
}
}
}
@@ -501,7 +606,7 @@
{
String id = parameterInfo.getId();
ParameterDescription paramDesc = WSRPTypeFactory.createParameterDescription(id);
- paramDesc.setDescription(Utils.convertToWSRPLocalizedString(parameterInfo.getDescription(), locales));
+ paramDesc.setDescription(Utils.convertToWSRPLocalizedString(parameterInfo.getDescription(), localeMatch));
paramDesc.setLabel(WSRPTypeFactory.createLocalizedString(id));
List<QName> names = paramDesc.getNames();
names.add(parameterInfo.getName());
@@ -541,70 +646,59 @@
return desc;
}
- /**
- * TODO: Adapt to desired locales
- *
- * @param context
- * @param desiredLocales
- * @param registration
- * @return
- */
- public PortletDescription getPortletDescription(PortletContext context, List<String> desiredLocales, Registration registration)
+ /*private class PortletDescriptionInfo
{
- initIfNeeded();
+ private Map<String, PortletDescription> languageToDescription;
+ private String defaultLanguage;
- org.gatein.pc.api.PortletContext pcContext = WSRPUtils.convertToPortalPortletContext(context);
- if (producer.getRegistrationManager().getPolicy().allowAccessTo(pcContext, registration, "getPortletDescription"))
+ private PortletDescriptionInfo(String defaultLanguage, PortletDescription description, Set<String> supportedLanguages)
{
- PortletDescription description = portletDescriptions.get(context.getPortletHandle());
-
- if (description == null)
+ this.defaultLanguage = defaultLanguage;
+ languageToDescription = new HashMap<String, PortletDescription>(supportedLanguages.size());
+ for (String supportedLanguage : supportedLanguages)
{
- // check if we asked for the description of a clone
- if (registration.knows(pcContext))
- {
- try
- {
- // retrieve initial context from portlet info and get description from it
- Portlet portlet = producer.getPortletWith(pcContext, registration);
- PortletInfo info = portlet.getInfo();
- org.gatein.pc.api.PortletContext original = org.gatein.pc.api.PortletContext.createPortletContext(info.getApplicationName(), info.getName());
- return portletDescriptions.get(original.getId());
- }
- catch (Exception e)
- {
- log.debug("Couldn't retrieve portlet " + pcContext, e);
- return null;
- }
- }
+ languageToDescription.put(supportedLanguage, null);
}
- return description;
+ languageToDescription.put(defaultLanguage, description);
}
- else
+
+ public Set<String> getSupportedLanguages()
{
- return null;
+ return languageToDescription.keySet();
}
- }
- public void removePortletDescription(org.gatein.pc.api.PortletContext pc)
- {
- String handle = WSRPUtils.convertToWSRPPortletContext(pc).getPortletHandle();
-
- PortletDescription description = portletDescriptions.get(handle);
- if (description != null)
+ public PortletDescription getBestDescriptionFor(List<String> desiredLanguages, final PortletInfo info)
{
- // deal with events
- for (QName event : description.getHandledEvents())
+ Set<String> supportedLanguages = getSupportedLanguages();
+ String language = null;
+ for (String languageTag : desiredLanguages)
{
- removeEvent(event);
+ if (supportedLanguages.contains(languageTag))
+ {
+ language = languageTag;
+ }
}
- for (QName event : description.getPublishedEvents())
+
+ if (language == null)
{
- removeEvent(event);
+ return languageToDescription.get(defaultLanguage);
}
-
- portletDescriptions.remove(handle);
+ else
+ {
+ PortletDescription description = languageToDescription.get(language);
+ String handle = languageToDescription.get(defaultLanguage).getPortletHandle();
+ if (description == null)
+ {
+ PortletDescription portletDescription = createPortletDescription(info, desiredLanguages, handle);
+ languageToDescription.put(language, portletDescription);
+ return portletDescription;
+ }
+ else
+ {
+ return description;
+ }
+ }
}
- }
+ }*/
}
}
13 years, 8 months
gatein SVN: r6330 - in components/pc/trunk: api and 7 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-22 11:11:17 -0400 (Fri, 22 Apr 2011)
New Revision: 6330
Modified:
components/pc/trunk/api/pom.xml
components/pc/trunk/controller/pom.xml
components/pc/trunk/docs/pom.xml
components/pc/trunk/docs/user-guide/pom.xml
components/pc/trunk/mc/pom.xml
components/pc/trunk/pom.xml
components/pc/trunk/portal/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/samples/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: components/pc/trunk/api/pom.xml
===================================================================
--- components/pc/trunk/api/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/api/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.pc</groupId>
Modified: components/pc/trunk/controller/pom.xml
===================================================================
--- components/pc/trunk/controller/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/controller/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: components/pc/trunk/docs/pom.xml
===================================================================
--- components/pc/trunk/docs/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/docs/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: components/pc/trunk/docs/user-guide/pom.xml
===================================================================
--- components/pc/trunk/docs/user-guide/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/docs/user-guide/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>docs-aggregator</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/mc/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: components/pc/trunk/pom.xml
===================================================================
--- components/pc/trunk/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -29,7 +29,7 @@
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
@@ -39,9 +39,9 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/tags/2.3.0-Be...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/tags/2.3.0-Beta03</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/pc/tags/2.3.0-Beta03</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/pc/trunk</url>
</scm>
<properties>
Modified: components/pc/trunk/portal/pom.xml
===================================================================
--- components/pc/trunk/portal/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/portal/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/portlet/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified: components/pc/trunk/samples/pom.xml
===================================================================
--- components/pc/trunk/samples/pom.xml 2011-04-22 15:10:57 UTC (rev 6329)
+++ components/pc/trunk/samples/pom.xml 2011-04-22 15:11:17 UTC (rev 6330)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.3.0-Beta03</version>
+ <version>2.3.0-CR01-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-samples</artifactId>
13 years, 8 months
gatein SVN: r6329 - components/pc/tags.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-22 11:10:57 -0400 (Fri, 22 Apr 2011)
New Revision: 6329
Added:
components/pc/tags/2.3.0-Beta03/
Log:
[maven-scm] copy for tag 2.3.0-Beta03
13 years, 8 months