JBoss Portal SVN: r13788 - in jbossexo/modules/wsrp/trunk: common/src/main/java/org/jboss/portal/wsrp and 13 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-08-25 09:40:47 -0400 (Tue, 25 Aug 2009)
New Revision: 13788
Added:
jbossexo/modules/wsrp/trunk/consumer/
jbossexo/modules/wsrp/trunk/consumer/pom.xml
jbossexo/modules/wsrp/trunk/consumer/src/
jbossexo/modules/wsrp/trunk/consumer/src/main/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/WSRPConsumer.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ActionHandler.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerException.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/InvocationHandler.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerInfo.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RefreshResult.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfoPostLoadEventListener.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RenderHandler.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestContextWrapper.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/SessionHandler.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/info/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/handler/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/handler/RequestHeaderClientHandler.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/CachingServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ManageableServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceFactory.java
jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceWrapper.java
Modified:
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPTypeFactory.java
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java
jbossexo/modules/wsrp/trunk/pom.xml
Log:
- Re-added consumer module, updated to use JAX-WS. Now compiles but still need to work on packaging.
- Adapted to changes to PortletContext (getState method doesn't exist anymore).
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPTypeFactory.java 2009-08-25 10:21:50 UTC (rev 13787)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPTypeFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -29,9 +29,11 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.api.ActionURL;
import org.jboss.portal.portlet.api.OpaqueStateString;
+import org.jboss.portal.portlet.api.PortletStateType;
import org.jboss.portal.portlet.api.PortletURL;
import org.jboss.portal.portlet.api.RenderURL;
import org.jboss.portal.portlet.api.StateString;
+import org.jboss.portal.portlet.api.StatefulPortletContext;
import org.jboss.portal.portlet.api.URLFormat;
import org.jboss.portal.portlet.api.spi.PortletInvocationContext;
import org.oasis.wsrp.v1.BlockingInteractionResponse;
@@ -210,7 +212,17 @@
org.jboss.portal.portlet.api.PortletContext portletContext)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
- PortletContext wsrpPC = createPortletContext(portletContext.getId(), portletContext.getState());
+
+ PortletContext wsrpPC = createPortletContext(portletContext.getId());
+ if (portletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext context = (StatefulPortletContext)portletContext;
+ if (PortletStateType.OPAQUE.equals(context.getType()))
+ {
+ wsrpPC.setPortletState(((StatefulPortletContext<byte[]>)context).getState());
+ }
+ }
+
GetPortletDescription getPortletDescription = new GetPortletDescription();
getPortletDescription.setRegistrationContext(registrationContext);
getPortletDescription.setPortletContext(wsrpPC);
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java 2009-08-25 10:21:50 UTC (rev 13787)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -30,8 +30,10 @@
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.api.ActionURL;
import org.jboss.portal.portlet.api.PortletContext;
+import org.jboss.portal.portlet.api.PortletStateType;
import org.jboss.portal.portlet.api.PortletURL;
import org.jboss.portal.portlet.api.RenderURL;
+import org.jboss.portal.portlet.api.StatefulPortletContext;
import org.jboss.portal.portlet.api.state.AccessMode;
import org.jboss.portal.wsrp.registration.LocalizedString;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
@@ -287,7 +289,14 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "portlet id", "PortletContext");
org.oasis.wsrp.v1.PortletContext result = WSRPTypeFactory.createPortletContext(id);
- result.setPortletState(portletContext.getState());
+ if (portletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext context = (StatefulPortletContext)portletContext;
+ if (PortletStateType.OPAQUE.equals(context.getType()))
+ {
+ result.setPortletState(((StatefulPortletContext<byte[]>)context).getState());
+ }
+ }
return result;
}
Added: jbossexo/modules/wsrp/trunk/consumer/pom.xml
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/pom.xml (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/pom.xml 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,174 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.wsrp</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>consumer</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal WSRP Consumer</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.wsrp</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.wsrp</groupId>
+ <artifactId>api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.wsrp</groupId>
+ <artifactId>wsrp1-ws</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>${version.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-portal</artifactId>
+ <version>${version.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.registration</groupId>
+ <artifactId>registration-api</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${version.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-federation</artifactId>
+ <version>${version.portlet}</version>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.jboss.portal.jems</groupId>
+ <artifactId>jems</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>-->
+
+ <!-- JBoss dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>2.0.1.GA</version>
+ </dependency>
+ <!-- For JBoss AOP -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>${version.jbossas}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- other dependencies -->
+ <dependency>
+ <groupId>javax.xml</groupId>
+ <artifactId>jaxrpc-api</artifactId>
+ <version>${version.jaxrpc}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>${version.slf4j}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>wsrp-consumer</finalName>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>1.0.0.GA</version>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <configuration>
+ <!-- if you want to include dependencies from the current module
+ (only needed if a class inherits a class thats not defined in this module
+ -->
+ <includeProjectDependency>true</includeProjectDependency>
+ <aoppaths>
+ <aoppath>src/main/resources/portal-wsrp-sar/wsrp-aop.xml</aoppath>
+ <!-- for a second jboss-aop.xml file
+ <aoppath>src/main/resources/jboss-aop.xml</aoppath>
+ -->
+ </aoppaths>
+ <includes>
+ <include>org/jboss/portal/wsrp/consumer/ConsumerRegistryService.class</include>
+ </includes>
+ </configuration>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/WSRPConsumer.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/WSRPConsumer.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/WSRPConsumer.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp;
+
+import org.jboss.portal.portlet.api.PortletInvoker;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.wsrp.api.SessionEventListener;
+import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.wsrp.WSRPConsumer">Chris Laprun</a>
+ * @version $Revision: 8782 $
+ * @since 2.4
+ */
+public interface WSRPConsumer extends PortletInvoker, SessionEventListener
+{
+ /**
+ * Retrieves the identifier for the producer this consumer is associated with.
+ *
+ * @return the identifier of the associated producer
+ */
+ String getProducerId();
+
+ /**
+ * Retrieves the session information for the producer associated with this consumer.
+ *
+ * @param invocation a portlet invocation from which the session information should be extracted.
+ * @return the session information for the producer associated with this consumer.
+ * @see ProducerSessionInformation
+ */
+ ProducerSessionInformation getProducerSessionInformationFrom(PortletInvocation invocation);
+
+ /**
+ * Retrieves the session information for the producer associated with this consumer.
+ *
+ * @param session the session from the information should be extracted.
+ * @return the session information for the producer associated with this consumer.
+ * @see ProducerSessionInformation
+ */
+ ProducerSessionInformation getProducerSessionInformationFrom(HttpSession session);
+
+ /**
+ * @return
+ * @since 2.6
+ */
+ ProducerInfo getProducerInfo();
+
+ /**
+ * @param producerInfo
+ * @since 2.6
+ */
+ void setProducerInfo(ProducerInfo producerInfo);
+
+ /**
+ * @throws PortletInvokerException
+ * @since 2.6
+ */
+ void refreshProducerInfo() throws PortletInvokerException;
+
+ /**
+ * Releases all the sessions held by this Consumer
+ *
+ * @since 2.6
+ */
+ void releaseSessions() throws PortletInvokerException;
+
+ /**
+ * Prepares this Consumer to be used: service is started, endpoints are ready.
+ *
+ * @throws Exception
+ * @since 2.6
+ */
+ void activate() throws Exception;
+
+ /**
+ * Removes this Consumer from service. It cannot be used before being activated again.
+ *
+ * @throws Exception
+ * @since 2.6
+ */
+ void deactivate() throws Exception;
+
+ /**
+ * @return
+ * @since 2.6
+ */
+ boolean isActive();
+
+ /**
+ * @return
+ * @since 2.6
+ */
+ boolean isRefreshNeeded();
+
+ /**
+ * @param forceRefresh
+ * @return
+ * @since 2.6
+ */
+ RefreshResult refresh(boolean forceRefresh) throws PortletInvokerException;
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ActionHandler.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ActionHandler.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,345 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.apache.commons.fileupload.FileItemIterator;
+import org.apache.commons.fileupload.FileItemStream;
+import org.apache.commons.fileupload.FileUpload;
+import org.apache.commons.fileupload.util.Streams;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.OpaqueStateString;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.StateEvent;
+import org.jboss.portal.portlet.api.StateString;
+import org.jboss.portal.portlet.api.invocation.ActionInvocation;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.portlet.api.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.api.invocation.response.HTTPRedirectionResponse;
+import org.jboss.portal.portlet.api.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.api.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.api.spi.InstanceContext;
+import org.jboss.portal.portlet.api.state.AccessMode;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.BlockingInteractionResponse;
+import org.oasis.wsrp.v1.Extension;
+import org.oasis.wsrp.v1.InteractionParams;
+import org.oasis.wsrp.v1.NamedString;
+import org.oasis.wsrp.v1.PerformBlockingInteraction;
+import org.oasis.wsrp.v1.PortletContext;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.oasis.wsrp.v1.UpdateResponse;
+import org.oasis.wsrp.v1.UploadContext;
+import org.oasis.wsrp.v1.UserContext;
+
+import javax.xml.ws.Holder;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13121 $
+ * @since 2.4 (May 31, 2006)
+ */
+public class ActionHandler extends InvocationHandler
+{
+ public ActionHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @SuppressWarnings({"CastToConcreteClass"})
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof ActionInvocation))
+ {
+ throw new IllegalArgumentException("ActionHandler can only handle ActionInvocations!");
+ }
+
+ ActionInvocation actionInvocation = (ActionInvocation)invocation;
+
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+ log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
+
+ // access mode
+ InstanceContext instanceContext = invocation.getInstanceContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
+ AccessMode accessMode = instanceContext.getAccessMode();
+ ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
+ log.debug("Portlet is requesting " + accessMode + " access mode");
+ InteractionParams interactionParams =
+ WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
+
+ // interaction state
+ StateString interactionState = actionInvocation.getInteractionState();
+ if (interactionState != null)
+ {
+ String state = interactionState.getStringValue();
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ {
+ interactionParams.setInteractionState(state);
+ }
+ }
+
+ // check for multi-part
+ RequestContextWrapper requestContext = new RequestContextWrapper(actionInvocation.getRequestContext());
+ try
+ {
+ if (FileUpload.isMultipartContent(requestContext))
+ {
+ // content is multipart, we need to parse it (that includes form parameters)
+ FileUpload upload = new FileUpload();
+ FileItemIterator iter = upload.getItemIterator(requestContext);
+ List<UploadContext> uploadContexts = new ArrayList<UploadContext>(7);
+ List<NamedString> formParameters = new ArrayList<NamedString>(7);
+ while (iter.hasNext())
+ {
+ FileItemStream item = iter.next();
+ InputStream stream = item.openStream();
+ if (!item.isFormField())
+ {
+ String contentType = item.getContentType();
+ log.debug("File field " + item.getFieldName() + " with file name " + item.getName() + " and content type "
+ + contentType + " detected.");
+ BufferedInputStream bufIn = new BufferedInputStream(stream);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ BufferedOutputStream bos = new BufferedOutputStream(baos);
+
+ int c = bufIn.read();
+ while (c != -1)
+ {
+ bos.write(c);
+ c = bufIn.read();
+ }
+
+ bos.flush();
+ baos.flush();
+ bufIn.close();
+ bos.close();
+
+ UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, baos.toByteArray());
+
+ List<NamedString> mimeAttributes = new ArrayList<NamedString>(2);
+
+ NamedString mimeAttribute = new NamedString();
+ mimeAttribute.setName(FileUpload.CONTENT_DISPOSITION);
+ mimeAttribute.setValue(FileUpload.FORM_DATA + ";"
+ + " name=\"" + item.getFieldName() + "\";"
+ + " filename=\"" + item.getName() + "\"");
+ mimeAttributes.add(mimeAttribute);
+
+ mimeAttribute = new NamedString();
+ mimeAttribute.setName(FileUpload.CONTENT_TYPE);
+ mimeAttribute.setValue(item.getContentType());
+ mimeAttributes.add(mimeAttribute);
+
+ uploadContext.getMimeAttributes().addAll(mimeAttributes);
+
+ uploadContexts.add(uploadContext);
+ }
+ else
+ {
+ NamedString formParameter = new NamedString();
+ formParameter.setName(item.getFieldName());
+ formParameter.setValue(Streams.asString(stream));
+ formParameters.add(formParameter);
+ }
+ }
+ interactionParams.getUploadContexts().addAll(uploadContexts);
+ interactionParams.getFormParameters().addAll(formParameters);
+ }
+ else
+ {
+ // if the content is not multipart, then check for form parameters
+ Map<String, String[]> params = actionInvocation.getForm();
+ if (params != null && !params.isEmpty())
+ {
+ int capacity = params.size();
+ List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
+ for (Map.Entry param : params.entrySet())
+ {
+ String name = (String)param.getKey();
+ String[] values = (String[])param.getValue();
+ NamedString formParameter = new NamedString();
+ for (String value : values)
+ {
+ formParameter.setName(name);
+ formParameter.setValue(value);
+ formParameters.add(formParameter);
+ }
+ }
+ interactionParams.getFormParameters().addAll(formParameters);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't create UploadContext", e);
+ }
+
+ // todo: need to deal with GET method in forms
+
+ log.debug(WSRPUtils.toString(interactionParams));
+
+ // Create the blocking action request
+ return WSRPTypeFactory.createPerformBlockingInteraction(portletContext, requestPrecursor.runtimeContext,
+ requestPrecursor.markupParams, interactionParams);
+ }
+
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
+ {
+ BlockingInteractionResponse blockingInteractionResponse = (BlockingInteractionResponse)response;
+ log.debug("Starting processing response");
+
+ String redirectURL = blockingInteractionResponse.getRedirectURL();
+ UpdateResponse updateResponse = blockingInteractionResponse.getUpdateResponse();
+ if (redirectURL != null && updateResponse != null)
+ {
+ return new ErrorResponse(new IllegalArgumentException("Response cannot both redirect and update state."));
+ }
+
+ if (redirectURL != null)
+ {
+ return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
+ }
+ else
+ {
+ // updateResponse.getMarkupContext(); // ignore bundled markup for now.
+
+ UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();
+ // new mode
+ String newMode = updateResponse.getNewMode();
+ if (newMode != null)
+ {
+ result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
+ }
+ // new window state
+ String newWindowState = updateResponse.getNewWindowState();
+ if (newWindowState != null)
+ {
+ result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
+ }
+ // navigational state
+ String navigationalState = updateResponse.getNavigationalState();
+ if (navigationalState != null)
+ {
+ result.setNavigationalState(new OpaqueStateString(navigationalState));
+ }
+
+ // check if the portlet was cloned
+ PortletContext portletContext = updateResponse.getPortletContext();
+ if (portletContext != null)
+ {
+ PortletContext originalContext = requestPrecursor.getPortletContext();
+ InstanceContext context = invocation.getInstanceContext();
+
+ String handle = portletContext.getPortletHandle();
+ if (!originalContext.getPortletHandle().equals(handle))
+ {
+ log.debug("Portlet '" + requestPrecursor.getPortletHandle() + "' was implicitely cloned. New handle is '"
+ + handle + "'");
+ StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_CLONED_EVENT);
+ context.onStateEvent(event);
+ }
+ else
+ {
+ // check if the state was modified
+ byte[] originalState = originalContext.getPortletState();
+ byte[] newState = portletContext.getPortletState();
+ if (!Arrays.equals(originalState, newState))
+ {
+ StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_MODIFIED_EVENT);
+ context.onStateEvent(event);
+ }
+ }
+
+ // update the session information associated with the portlet handle
+ consumer.getSessionHandler().updateSessionInfoFor(originalContext.getPortletHandle(), handle, invocation);
+ }
+ else
+ {
+ portletContext = requestPrecursor.getPortletContext();
+ }
+
+ // update the session info, using either the original or cloned portlet context, as appropriate
+ consumer.getSessionHandler().updateSessionIfNeeded(updateResponse.getSessionContext(), invocation,
+ portletContext.getPortletHandle());
+
+ log.debug("Response processed");
+ return result;
+ }
+ }
+
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ getActionRequest(request).setUserContext(userContext);
+ }
+
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ getActionRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ return getActionRequest(request).getRuntimeContext();
+ }
+
+ protected Object performRequest(Object request) throws Exception
+ {
+ PerformBlockingInteraction interaction = getActionRequest(request);
+ Holder<UpdateResponse> updateResponseHolder = new Holder<UpdateResponse>();
+ Holder<String> redirectURL = new Holder<String>();
+
+ // invocation
+ log.debug("performBlockingInteraction on '" + interaction.getPortletContext().getPortletHandle() + "'");
+ consumer.getMarkupService().performBlockingInteraction(interaction.getRegistrationContext(),
+ interaction.getPortletContext(), interaction.getRuntimeContext(), interaction.getUserContext(),
+ interaction.getMarkupParams(), interaction.getInteractionParams(), updateResponseHolder, redirectURL,
+ new Holder<List<Extension>>());
+
+ // construct response
+ BlockingInteractionResponse response = new BlockingInteractionResponse();
+ response.setRedirectURL(redirectURL.value);
+ response.setUpdateResponse(updateResponseHolder.value);
+ return response;
+ }
+
+ private PerformBlockingInteraction getActionRequest(Object request)
+ {
+ if (request instanceof PerformBlockingInteraction)
+ {
+ return (PerformBlockingInteraction)request;
+ }
+
+ throw new IllegalArgumentException("ActionHandler: request is not a PerformBlockingInteraction request!");
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerException.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerException.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerException.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ConsumerException extends RuntimeException
+{
+ public ConsumerException()
+ {
+ super();
+ }
+
+ public ConsumerException(String message)
+ {
+ super(message);
+ }
+
+ public ConsumerException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ConsumerException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.WSRPConsumer;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12693 $
+ * @since 2.6
+ */
+public interface ConsumerRegistry
+{
+ List<WSRPConsumer> getConfiguredConsumers();
+
+ WSRPConsumer getConsumer(String id);
+
+ FederatingPortletInvoker getFederatingPortletInvoker();
+
+ WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds) throws ConsumerException;
+
+ void persistConsumer(WSRPConsumer consumer) throws ConsumerException;
+
+ /**
+ * Activates the consumer associated with the specified identifier if and only if access to the remote producer is
+ * properly setup (i.e. the associated service factory MUST be available).
+ *
+ * @param id the identifier of the consumer to be activated
+ * @throws ConsumerException
+ */
+ void activateConsumerWith(String id) throws ConsumerException;
+
+ void updateProducerInfo(ProducerInfo producerInfo) throws ConsumerException;
+
+ void deactivateConsumerWith(String id) throws ConsumerException;
+
+ void registerOrDeregisterConsumerWith(String id, boolean register) throws ConsumerException;
+
+ void destroyConsumer(String id) throws ConsumerException;
+
+ void reloadConsumers();
+}
\ No newline at end of file
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,434 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.PortletInvoker;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.api.SessionEventBroadcaster;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12693 $
+ * @since 2.6
+ */
+public class ConsumerRegistryService implements ConsumerRegistry
+{
+ /** Gives access to the Portal's portlet invokers */
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ private SortedMap<String, WSRPConsumer> consumers;
+
+ private SessionFactory sessionFactory;
+
+ private String sessionFactoryJNDIName;
+
+ private SessionEventBroadcaster sessionEventBroadcaster;
+
+ private static final String CONSUMER_WITH_ID = "Consumer with id '";
+ private static final String RELEASE_SESSIONS_LISTENER = "release_sessions_listener_";
+
+ private static final Logger log = LoggerFactory.getLogger(ConsumerRegistryService.class);
+
+ public FederatingPortletInvoker getFederatingPortletInvoker()
+ {
+ return federatingPortletInvoker;
+ }
+
+ public void setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster)
+ {
+ this.sessionEventBroadcaster = sessionEventBroadcaster;
+ }
+
+ public WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Creating a Consumer");
+
+ if (getConsumer(id) != null)
+ {
+ throw new ConsumerException(CONSUMER_WITH_ID + id + "' already exists!");
+ }
+
+
+ ProducerInfo info = new ProducerInfo();
+ info.setId(id);
+ info.setRegistry(this);
+ info.setExpirationCacheSeconds(expirationCacheSeconds);
+
+ try
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.persist(info);
+ }
+ catch (HibernateException e)
+ {
+ throw new ConsumerException("Couldn't create Consumer '" + id + "'", e);
+ }
+
+ log.info(CONSUMER_WITH_ID + id + "' created");
+ return createConsumerFrom(info);
+ }
+
+ public void destroyConsumer(String id)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Destroying a Consumer");
+
+ WSRPConsumer consumer = getConsumer(id);
+ if (consumer != null)
+ {
+ ProducerInfo info = consumer.getProducerInfo();
+
+ try
+ {
+ consumer.releaseSessions();
+ }
+ catch (PortletInvokerException e)
+ {
+ log.debug("releaseSessions failed when attempting to destroy " + CONSUMER_WITH_ID + id + "'");
+ }
+
+ // if the consumer is registered, deregister it
+ if (info.isRegistered())
+ {
+ registerOrDeregisterConsumerWith(id, false);
+ }
+
+ deactivateConsumerWith(id);
+ consumers.remove(id);
+
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete(info);
+ }
+ else
+ {
+ throw new ConsumerException(CONSUMER_WITH_ID + id + "' doesn't exist!");
+ }
+
+ log.info(CONSUMER_WITH_ID + id + "' destroyed");
+ }
+
+ public void persistConsumer(WSRPConsumer consumer)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
+
+ ProducerInfo info = consumer.getProducerInfo();
+
+ try
+ {
+ Session session = sessionFactory.getCurrentSession();
+ session.persist(info);
+ }
+ catch (HibernateException e)
+ {
+ throw new ConsumerException(CONSUMER_WITH_ID + info.getId() + "' couldn't be persisted!");
+ }
+
+ createConsumerFrom(info);
+ }
+
+ public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
+ {
+ this.federatingPortletInvoker = federatingPortletInvoker;
+ }
+
+ public String getSessionFactoryJNDIName()
+ {
+ return sessionFactoryJNDIName;
+ }
+
+ public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
+ {
+ this.sessionFactoryJNDIName = sessionFactoryJNDIName;
+ }
+
+ private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
+ {
+ WSRPConsumer consumer = new WSRPConsumerImpl(producerInfo);
+ consumers.put(producerInfo.getId(), consumer);
+
+ return consumer;
+ }
+
+ public void activateConsumerWith(String id) throws ConsumerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Activating a Consumer");
+
+ // if the consumer associated with the given id is already registered, don't do anything
+ if (federatingPortletInvoker.getFederatedInvoker(id) == null)
+ {
+ startOrStopConsumer(id, true);
+ }
+ else
+ {
+ // todo: fix-me federated portlet invoker gets desynchronized...
+ WSRPConsumer consumer = getConsumer(id);
+ if (consumer != null && !consumer.isActive())
+ {
+ federatingPortletInvoker.unregisterInvoker(id);
+ startOrStopConsumer(id, true);
+ }
+ }
+ }
+
+ public void deactivateConsumerWith(String id) throws ConsumerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Deactivating a Consumer");
+
+ // only process if there is a registered Consumer with the specified id
+ if (federatingPortletInvoker.getFederatedInvoker(id) != null)
+ {
+ startOrStopConsumer(id, false);
+ }
+ else
+ {
+ // todo: fix-me federated portlet invoker gets desynchronized...
+ WSRPConsumer consumer = getConsumer(id);
+ if (consumer != null && consumer.isActive())
+ {
+ federatingPortletInvoker.registerInvoker(id, consumer);
+ startOrStopConsumer(id, false);
+ }
+ }
+ }
+
+ public void updateProducerInfo(ProducerInfo producerInfo)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
+
+ Session session = sessionFactory.getCurrentSession();
+ try
+ {
+
+ // Retrieve the previous id of the given ProducerInfo to update local consumers map if needed
+ String oldId = (String)session.createQuery("select pi.persistentId from ProducerInfo pi where pi.id = :key")
+ .setParameter("key", producerInfo.getKey()).uniqueResult();
+ if (producerInfo.getId().equals(oldId))
+ {
+ oldId = null; // reset oldId as the ProducerInfo's id hasn't been modified
+ }
+
+ // merge old producer info with new data
+ session.update(producerInfo);
+
+ // if we updated and oldId is not null, we need to update the local consumers map
+ if (oldId != null)
+ {
+ WSRPConsumer consumer = consumers.remove(oldId);
+ consumers.put(producerInfo.getId(), consumer);
+ }
+ }
+ catch (HibernateException e)
+ {
+ throw new ConsumerException("Couldn't update ProducerInfo for Consumer '" + producerInfo.getId() + "'", e);
+ }
+ }
+
+ protected void startService() throws Exception
+ {
+ InitialContext initialContext = new InitialContext();
+ sessionFactory = (SessionFactory)initialContext.lookup(sessionFactoryJNDIName);
+ reloadConsumers();
+ }
+
+ public void reloadConsumers()
+ {
+ // load the configured consumers
+ consumers = new TreeMap<String, WSRPConsumer>();
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Iterator producerInfos = session.createQuery("from ProducerInfo pi order by pi.persistentId").iterate();
+
+ // load the configured producers
+ ProducerInfo producerInfo;
+ while (producerInfos.hasNext())
+ {
+ producerInfo = (ProducerInfo)producerInfos.next();
+
+ // need to set the registry after loading from DB since registry is not persisted.
+ producerInfo.setRegistry(this);
+
+ createConsumerFrom(producerInfo);
+
+ try
+ {
+ // if the producer is marked as active, activate it fo' real! :)
+ if (producerInfo.isActive())
+ {
+ activateConsumerWith(producerInfo.getId());
+ }
+ }
+ catch (Exception e)
+ {
+ producerInfo.setActive(false);
+ updateProducerInfo(producerInfo);
+ }
+
+ }
+ }
+
+ protected void stopService() throws Exception
+ {
+ sessionFactory = null;
+
+ for (WSRPConsumer consumer : consumers.values())
+ {
+ // if producer is not active, it shouldn't be registered with the federating portlet invoker, hence do not
+ // unregister it.
+ if (consumer.getProducerInfo().isActive())
+ {
+ federatingPortletInvoker.unregisterInvoker(consumer.getProducerId());
+ }
+
+ try
+ {
+ consumer.stop();
+ }
+ catch (Exception e)
+ {
+ // ignore and continue
+ }
+ }
+
+ consumers.clear();
+ consumers = null;
+ }
+
+ public List<WSRPConsumer> getConfiguredConsumers()
+ {
+ return new ArrayList<WSRPConsumer>(consumers.values());
+ }
+
+ public WSRPConsumer getConsumer(String id)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer id", null);
+ return consumers.get(id);
+ }
+
+ public void registerOrDeregisterConsumerWith(String id, boolean register)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Registering or deregistering a Consumer");
+
+ WSRPConsumer consumer = getConsumer(id);
+
+ if (consumer == null)
+ {
+ throw new ConsumerException(CONSUMER_WITH_ID + id + "' doesn't exist!");
+ }
+
+ try
+ {
+ if (register)
+ {
+ consumer.getProducerInfo().register();
+ }
+ else
+ {
+ consumer.getProducerInfo().deregister();
+ }
+ }
+ catch (Exception e)
+ {
+ // unexpected exception: deactivate the consumer
+ deactivateConsumerWith(id);
+ Throwable cause = e.getCause();
+ throw new ConsumerException("Couldn't " + (register ? "register" : "deregister") + CONSUMER_WITH_ID + id + "'",
+ cause != null ? cause : e);
+ }
+ }
+
+ private void startOrStopConsumer(String id, boolean start)
+ {
+ WSRPConsumer consumer;
+
+ try
+ {
+ if (start)
+ {
+ consumer = getConsumer(id);
+
+ if (consumer == null)
+ {
+ throw new IllegalArgumentException(CONSUMER_WITH_ID + id + "' doesn't exist!");
+ }
+
+ consumer.activate();
+ federatingPortletInvoker.registerInvoker(id, consumer);
+ sessionEventBroadcaster.registerListener(getListenerIdFrom(id), consumer);
+ }
+ else
+ {
+ FederatedPortletInvoker fedInvoker = federatingPortletInvoker.getFederatedInvoker(id);
+ if (fedInvoker != null)
+ {
+ PortletInvoker invoker = fedInvoker.getPortletInvoker();
+ if (invoker instanceof WSRPConsumer)
+ {
+ consumer = (WSRPConsumer)invoker;
+ consumer.deactivate();
+ federatingPortletInvoker.unregisterInvoker(id);
+ sessionEventBroadcaster.unregisterListener(getListenerIdFrom(id));
+ }
+ else
+ {
+ throw new IllegalArgumentException("PortletInvoker with id '" + id + "' is not a WSRPConsumer!");
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("There is no registered PortletInvoker with id '" + id + "'");
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new ConsumerException("Couldn't " + (start ? "start" : "stop") + " Consumer service '" + id + "'", e);
+ }
+
+ // update ProducerInfo
+ updateProducerInfo(consumer.getProducerInfo());
+ }
+
+ private String getListenerIdFrom(String id)
+ {
+ return RELEASE_SESSIONS_LISTENER + id;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,500 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.InvokerUnavailableException;
+import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
+import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
+import org.jboss.portal.wsrp.services.ServiceFactory;
+import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.BitSet;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13122 $
+ * @since 2.6
+ */
+public class EndpointConfigurationInfo
+{
+ private final static Logger log = LoggerFactory.getLogger(EndpointConfigurationInfo.class);
+
+ /** DB primary key */
+ private Long key;
+
+ private String persistentServiceDescriptionURL = UNSET;
+ private String persistentMarkupURL = UNSET;
+ private String persistentRegistrationURL;
+ private String persistentPortletManagementURL;
+ private String persistentWsdlDefinitionURL = UNSET;
+
+ // transient variables
+ /** Access to the WS */
+ private ServiceFactory serviceFactory;
+ private transient String remoteHostAddress;
+
+ static final String SERVICE_DESCRIPTION = "service description";
+ static final String MARKUP = "markup";
+ static final String PORTLET_MANAGEMENT = "portlet management";
+ static final String REGISTRATION = "registration";
+
+ // Used to ensure that even invalid values can be persisted to DB so that it can be accessed from the GUI
+ public final static String UNSET = "MUST BE SET";
+
+ // maintain the dirty status of each URL
+ private BitSet clean = new BitSet();
+ private final static int SD = 0;
+ private final static int M = 1;
+ private final static int PM = 2;
+ private final static int R = 3;
+
+ /** Whether we're using information from a WSDL or not. */
+ private boolean usingWSDL = true;
+ private boolean isModifiedWSDL;
+
+ // todo: public for tests
+ public EndpointConfigurationInfo()
+ {
+ }
+
+ public EndpointConfigurationInfo(ProducerInfo producerInfo)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
+ producerInfo.setEndpointConfigurationInfo(this);
+ }
+
+ public EndpointConfigurationInfo(ProducerInfo producerInfo, ServiceFactory serviceFactory)
+ {
+ this(producerInfo);
+ setServiceFactory(serviceFactory);
+ }
+
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public boolean usesWSDL()
+ {
+ return (isWSDLNotNullAndSet() && !isModifiedWSDL) || usingWSDL;
+ }
+
+ public void setUsesWSDL(boolean useWSDL)
+ {
+ usingWSDL = useWSDL;
+ }
+
+ public String getWsdlDefinitionURL()
+ {
+ if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ {
+ persistentWsdlDefinitionURL = ((RemoteSOAPInvokerServiceFactory)serviceFactory).getWsdlDefinitionURL();
+ }
+
+ return persistentWsdlDefinitionURL;
+ }
+
+ public String getServiceDescriptionURL()
+ {
+ if (serviceFactory != null)
+ {
+ persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
+ }
+ return persistentServiceDescriptionURL;
+ }
+
+ public String getMarkupURL()
+ {
+ if (serviceFactory != null)
+ {
+ persistentMarkupURL = serviceFactory.getMarkupURL();
+ }
+ return persistentMarkupURL;
+ }
+
+ public String getPortletManagementURL()
+ {
+ if (serviceFactory != null)
+ {
+ persistentPortletManagementURL = serviceFactory.getPortletManagementURL();
+ }
+ return persistentPortletManagementURL;
+ }
+
+ public String getRegistrationURL()
+ {
+ if (serviceFactory != null)
+ {
+ persistentRegistrationURL = serviceFactory.getRegistrationURL();
+ }
+ return persistentRegistrationURL;
+ }
+
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
+ {
+ if (serviceFactory != null)
+ {
+ serviceFactory.setServiceDescriptionURL(serviceDescriptionURL);
+ }
+ this.persistentServiceDescriptionURL = modifyIfNeeded(this.persistentServiceDescriptionURL, serviceDescriptionURL, SD);
+
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ if (serviceFactory != null)
+ {
+ serviceFactory.setMarkupURL(markupURL);
+ }
+ this.persistentMarkupURL = modifyIfNeeded(this.persistentMarkupURL, markupURL, M);
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ if (serviceFactory != null)
+ {
+ serviceFactory.setRegistrationURL(registrationURL);
+ }
+ this.persistentRegistrationURL = modifyIfNeeded(this.persistentRegistrationURL, registrationURL, R);
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ if (serviceFactory != null)
+ {
+ serviceFactory.setPortletManagementURL(portletManagementURL);
+ }
+ this.persistentPortletManagementURL = modifyIfNeeded(this.persistentPortletManagementURL, portletManagementURL, PM);
+ }
+
+ public void setWsdlDefinitionURL(String wsdlDefinitionURL) throws RuntimeException
+ {
+ this.persistentWsdlDefinitionURL = wsdlDefinitionURL;
+
+ // WSDL url is optional so can be null (and in particular, it is when loaded from Hibernate most of the time)
+ // do not attempt to set the URL if the service factory hasn't been created yet to avoid issues when
+ // ConsumerRegistry starts (in particular, raising an exception if the WSDL is not available)
+ if (isWSDLNotNullAndSet())
+ {
+ usingWSDL = true;
+
+ if (serviceFactory != null)
+ {
+ if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
+ {
+ serviceFactory = new RemoteSOAPInvokerServiceFactory();
+ }
+ internalSetWsdlURL();
+ }
+ }
+ else
+ {
+ usingWSDL = false;
+ }
+ }
+
+ private boolean isWSDLNotNullAndSet()
+ {
+ return persistentWsdlDefinitionURL != null && !UNSET.equals(persistentWsdlDefinitionURL);
+ }
+
+ private String modifyIfNeeded(String oldValue, String newValue, int whichURL)
+ {
+ if ((oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null))
+ {
+ if (usesWSDL())
+ {
+ if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ {
+ isModifiedWSDL = true;
+ }
+
+ usingWSDL = false;
+ }
+
+ oldValue = newValue;
+ clean.clear(whichURL);
+ }
+
+ return oldValue;
+ }
+
+ private ServiceFactory initServiceFactoryIfNeeded() throws RuntimeException
+ {
+ if (serviceFactory == null)
+ {
+ if (usesWSDL())
+ {
+ serviceFactory = new RemoteSOAPInvokerServiceFactory();
+ internalSetWsdlURL();
+ }
+ else
+ {
+ if (!UNSET.equals(persistentServiceDescriptionURL) && !UNSET.equals(persistentMarkupURL))
+ {
+ serviceFactory = new PerEndpointSOAPInvokerServiceFactory();
+ serviceFactory.setServiceDescriptionURL(persistentServiceDescriptionURL);
+ serviceFactory.setMarkupURL(persistentMarkupURL);
+ serviceFactory.setPortletManagementURL(persistentPortletManagementURL);
+ serviceFactory.setRegistrationURL(persistentRegistrationURL);
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot initialize ServiceFactory: missing either service description or markup URLs!");
+ }
+ }
+
+ startServiceFactoryIfNeeded();
+ }
+
+ return serviceFactory;
+ }
+
+ private void startServiceFactoryIfNeeded()
+ {
+ if (!serviceFactory.isAvailable())
+ {
+ if (!serviceFactory.isFailed())
+ {
+ try
+ {
+ serviceFactory.start();
+ refreshServices(serviceFactory);
+ }
+ catch (Exception e)
+ {
+ throw new ConsumerException("Couldn't start ServiceFactory", e);
+ }
+ }
+ else
+ {
+ throw new ConsumerException("ServiceFactory has an error condition that couldn't be recovered from.");
+ }
+ }
+ }
+
+ private void internalSetWsdlURL()
+ {
+ try
+ {
+ ((RemoteSOAPInvokerServiceFactory)serviceFactory).setWsdlDefinitionURL(persistentWsdlDefinitionURL);
+
+ // update the URLs based on WSDL information
+ persistentMarkupURL = serviceFactory.getMarkupURL();
+ persistentPortletManagementURL = serviceFactory.getPortletManagementURL();
+ persistentRegistrationURL = serviceFactory.getRegistrationURL();
+ persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
+
+ clean.set(0, 4); // if setting the WSDL URL worked, consider everything clean
+ isModifiedWSDL = false;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void start() throws Exception
+ {
+ initServiceFactoryIfNeeded();
+ }
+
+ public void stop() throws Exception
+ {
+ if (serviceFactory != null)
+ {
+ serviceFactory.stop();
+ }
+ }
+
+ // todo: public for tests
+ public ServiceFactory getServiceFactory()
+ {
+ initServiceFactoryIfNeeded();
+ startServiceFactoryIfNeeded();
+ return serviceFactory;
+ }
+
+ // todo: public for tests
+ public void setServiceFactory(ServiceFactory serviceFactory)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(serviceFactory, "ServiceFactory");
+
+ this.serviceFactory = serviceFactory;
+ persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
+ persistentMarkupURL = serviceFactory.getMarkupURL();
+ persistentPortletManagementURL = serviceFactory.getPortletManagementURL();
+ persistentRegistrationURL = serviceFactory.getRegistrationURL();
+
+ if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ {
+ persistentWsdlDefinitionURL = ((RemoteSOAPInvokerServiceFactory)serviceFactory).getWsdlDefinitionURL();
+ }
+
+ }
+
+ // todo: public for tests
+ public WSRPV1ServiceDescriptionPortType getServiceDescriptionService() throws InvokerUnavailableException
+ {
+ return getService(WSRPV1ServiceDescriptionPortType.class);
+ }
+
+ // todo: public for tests
+ public WSRPV1MarkupPortType getMarkupService() throws InvokerUnavailableException
+ {
+ return getService(WSRPV1MarkupPortType.class);
+ }
+
+ // todo: public for tests
+ public WSRPV1PortletManagementPortType getPortletManagementService() throws InvokerUnavailableException
+ {
+ return getService(WSRPV1PortletManagementPortType.class);
+ }
+
+ // todo: public for tests
+ public WSRPV1RegistrationPortType getRegistrationService() throws InvokerUnavailableException
+ {
+ return getService(WSRPV1RegistrationPortType.class);
+ }
+
+ private <T> T getService(Class<T> clazz) throws InvokerUnavailableException
+ {
+ return getService(clazz, getServiceFactory());
+ }
+
+ private <T> T getService(Class<T> clazz, ServiceFactory serviceFactory) throws InvokerUnavailableException
+ {
+ try
+ {
+ T service = serviceFactory.getService(clazz);
+ clean.set(getIndexFor(clazz));
+ return service;
+ }
+ catch (Exception e)
+ {
+ throw new InvokerUnavailableException("Couldn't access " + clazz.getSimpleName() + " service. Cause: "
+ + e.getLocalizedMessage(), e);
+ }
+ }
+
+ private int getIndexFor(Class clazz)
+ {
+ if (clazz == WSRPV1ServiceDescriptionPortType.class)
+ {
+ return SD;
+ }
+ if (clazz == WSRPV1MarkupPortType.class)
+ {
+ return M;
+ }
+ if (clazz == WSRPV1PortletManagementPortType.class)
+ {
+ return PM;
+ }
+ return R;
+ }
+
+ public boolean isAvailable()
+ {
+ try
+ {
+ return getServiceFactory().isAvailable();
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
+
+ public boolean isRefreshNeeded()
+ {
+ boolean result = !isAvailable() || areURLsDirty();
+ if (result)
+ {
+ log.debug("Refresh needed");
+ }
+ return result;
+ }
+
+ private boolean areURLsDirty()
+ {
+ return !clean.get(SD) || !clean.get(M) || (persistentPortletManagementURL != null && !clean.get(PM))
+ || (persistentRegistrationURL != null && !clean.get(R));
+ }
+
+ public void refresh() throws InvokerUnavailableException
+ {
+ if (isRefreshNeeded())
+ {
+ forceRefresh();
+ }
+ }
+
+ void forceRefresh() throws InvokerUnavailableException
+ {
+ ServiceFactory serviceFactory = initServiceFactoryIfNeeded();
+ refreshServices(serviceFactory);
+ }
+
+ private void refreshServices(ServiceFactory serviceFactory) throws InvokerUnavailableException
+ {
+ if (areURLsDirty())
+ {
+ getService(WSRPV1ServiceDescriptionPortType.class, serviceFactory);
+ getService(WSRPV1MarkupPortType.class, serviceFactory);
+ if (persistentPortletManagementURL != null)
+ {
+ getService(WSRPV1PortletManagementPortType.class, serviceFactory);
+ }
+ if (persistentRegistrationURL != null)
+ {
+ getService(WSRPV1RegistrationPortType.class, serviceFactory);
+ }
+ }
+ }
+
+ public String getRemoteHostAddress()
+ {
+ if (remoteHostAddress == null || areURLsDirty())
+ {
+ // extract host URL
+ int hostBegin = persistentMarkupURL.indexOf("://") + 3;
+ remoteHostAddress = persistentMarkupURL.substring(0, persistentMarkupURL.indexOf('/', hostBegin));
+ }
+
+ return remoteHostAddress;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/InvocationHandler.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,279 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.portlet.api.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.api.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.api.spi.InstanceContext;
+import org.jboss.portal.portlet.api.spi.WindowContext;
+import org.oasis.wsrp.v1.InvalidCookie;
+import org.oasis.wsrp.v1.InvalidRegistration;
+import org.oasis.wsrp.v1.InvalidSession;
+import org.oasis.wsrp.v1.OperationFailed;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.oasis.wsrp.v1.UserContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13121 $
+ * @since 2.4 (May 31, 2006)
+ */
+public abstract class InvocationHandler
+{
+ protected WSRPConsumerImpl consumer;
+
+ protected static Logger log = LoggerFactory.getLogger(InvocationHandler.class);
+
+ /**
+ * Value indicating that we should not try further (unrecoverable error) for getMarkup and
+ * processBlockingInteraction
+ */
+ private static final int DO_NOT_RETRY = -1;
+
+ /** Maximum number of tries before giving up. */
+ private static final int MAXIMUM_RETRY_NUMBER = 3;
+
+
+ public InvocationHandler(WSRPConsumerImpl consumer)
+ {
+ this.consumer = consumer;
+ }
+
+ PortletInvocationResponse handle(PortletInvocation invocation) throws PortletInvokerException
+ {
+ // Extracts basic required information from invocation
+ RequestPrecursor requestPrecursor = new RequestPrecursor(consumer, invocation);
+
+ // create the specific request
+ Object request = prepareRequest(requestPrecursor, invocation);
+
+ // Perform the request
+ Object response = performRequest(request, invocation);
+ if (response instanceof ErrorResponse)
+ {
+ return unwrapWSRPError((ErrorResponse)response);
+ }
+
+ return processResponse(response, invocation, requestPrecursor);
+ }
+
+ protected Object performRequest(Object request, PortletInvocation invocation) throws PortletInvokerException
+ {
+ int retryCount = 0;
+ Object response = null;
+
+ // as long as we don't get a non-null response and we're allowed to try again, try to perform the request
+ while (response == null && retryCount++ <= MAXIMUM_RETRY_NUMBER)
+ {
+ log.debug("performRequest: " + retryCount + " attempt(s) out of " + MAXIMUM_RETRY_NUMBER + " possible");
+ SessionHandler sessionHandler = consumer.getSessionHandler();
+
+ // prepare everything for the request
+ updateRegistrationContext(request);
+ RuntimeContext runtimeContext = getRuntimeContextFrom(request);
+
+ WindowContext windowContext = invocation.getWindowContext();
+ runtimeContext.setNamespacePrefix(getNamespaceFrom(windowContext));
+
+ InstanceContext instanceContext = invocation.getInstanceContext();
+ runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());
+
+ updateUserContext(request, consumer.getUserContextFrom(invocation, runtimeContext));
+ consumer.setTemplatesIfNeeded(invocation, runtimeContext);
+
+ try
+ {
+ sessionHandler.initCookieIfNeeded(invocation);
+
+ // if we need cookies, set the current group id
+ sessionHandler.initProducerSessionInformation(invocation);
+
+ response = performRequest(request);
+
+ sessionHandler.updateCookiesIfNeeded(invocation);
+ }
+ catch (Exception e)
+ {
+ ErrorResponse errorResponse = dealWithError(e, invocation, runtimeContext);
+ if (errorResponse != null)
+ {
+ return errorResponse;
+ }
+ }
+ finally
+ {
+ // we're done: reset currently held information
+ sessionHandler.resetCurrentlyHeldInformation();
+ }
+ }
+
+ if (retryCount >= MAXIMUM_RETRY_NUMBER)
+ {
+ return new ErrorResponse(new RuntimeException("Tried to perform request " + MAXIMUM_RETRY_NUMBER
+ + " times before giving up. This usually happens if an error in the WS stack prevented the messages to be " +
+ "properly transmitted. Look at server.log for clues as to what happened..."));
+ }
+
+ log.debug("performRequest finished. Response is " + (response != null ? response.getClass().getName() : null));
+ return response;
+ }
+
+ protected String getNamespaceFrom(WindowContext windowContext)
+ {
+ // todo: use URLTools.EncodeForHTMLId when it's available in common
+ if (windowContext != null)
+ {
+ String id = windowContext.getId();
+ id = id.replace('=', '_');
+ id = id.replace('/', '_');
+ id = id.replace('.', '_');
+ return id.replace('+', '_');
+ }
+
+ return null;
+ }
+
+ /**
+ * Deals with common error conditions.
+ *
+ * @param error the error that is to be dealt with
+ * @param invocation the invocation that caused the error to occur
+ * @param runtimeContext the current WSRP RuntimeContext
+ * @return an ErrorResponse if the error couldn't be dealt with or <code>null</code> if the error was correctly
+ * handled
+ */
+ private ErrorResponse dealWithError(Exception error, PortletInvocation invocation, RuntimeContext runtimeContext)
+ throws PortletInvokerException
+ {
+ log.error("The portlet threw an exception", error);
+
+ SessionHandler sessionHandler = consumer.getSessionHandler();
+
+ // recoverable errors
+ if (error instanceof InvalidCookie)
+ {
+ // we need to re-init the cookies
+ log.debug("Re-initializing cookies after InvalidCookieFault.");
+ // force a producer info refresh because the invalid cookie might be due to a change of cookie policy on the producer
+ consumer.refreshProducerInfo();
+ try
+ {
+ sessionHandler.initCookieIfNeeded(invocation);
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't init cookie: " + e.getLocalizedMessage());
+ return new ErrorResponse(e);
+ }
+ }
+ else if (error instanceof InvalidSession)
+ {
+ log.debug("Session invalidated after InvalidSessionFault, will re-send session-stored information.");
+ sessionHandler.handleInvalidSessionFault(invocation, runtimeContext);
+ }
+ else if (error instanceof InvalidRegistration)
+ {
+ log.debug("Invalid registration");
+ consumer.handleInvalidRegistrationFault();
+ }
+ else if (error instanceof RemoteException)
+ {
+ // todo: remove when we upgrade to 1.0.3+ see: http://jira.jboss.com/jira/browse/JBWS-955
+ RemoteException re = (RemoteException)error;
+ Throwable detail = re.detail;
+ if (detail instanceof SOAPFaultException)
+ {
+ SOAPFaultException faultException = (SOAPFaultException)detail;
+ QName faultCode = faultException.getFaultCode();
+ if (faultCode != null)
+ {
+ String localPart = faultCode.getLocalPart();
+ if ("InvalidRegistration".equalsIgnoreCase(localPart))
+ {
+ consumer.handleInvalidRegistrationFault();
+ }
+ else if ("InvalidSession".equalsIgnoreCase(localPart))
+ {
+ sessionHandler.handleInvalidSessionFault(invocation, runtimeContext);
+ }
+ else
+ {
+ return new ErrorResponse(error);
+ }
+ }
+ }
+ }
+ else
+ {
+ // other errors cannot be dealt with: we have an error condition
+ return new ErrorResponse(error);
+ }
+ return null;
+ }
+
+ protected ErrorResponse unwrapWSRPError(ErrorResponse errorResponse)
+ {
+ Throwable cause = errorResponse.getCause();
+ if (cause != null)
+ {
+ // unwrap original exception...
+ if (cause instanceof OperationFailed && cause.getCause() != null)
+ {
+ cause = cause.getCause();
+ }
+ else if (cause instanceof RemoteException)
+ {
+ cause = ((RemoteException)cause).detail;
+ }
+ log.debug("Invocation of action failed: " + cause.getMessage(), cause); // fix-me?
+ return new ErrorResponse(cause);
+ }
+ else
+ {
+ log.debug("Invocation of action failed: " + errorResponse.getMessage());
+ return errorResponse;
+ }
+ }
+
+ protected abstract void updateUserContext(Object request, UserContext userContext);
+
+ protected abstract void updateRegistrationContext(Object request) throws PortletInvokerException;
+
+ protected abstract RuntimeContext getRuntimeContextFrom(Object request);
+
+ protected abstract Object performRequest(Object request) throws Exception;
+
+ protected abstract Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation);
+
+ protected abstract PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException;
+
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerInfo.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,1078 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.InvokerUnavailableException;
+import org.jboss.portal.portlet.api.NoSuchPortletException;
+import org.jboss.portal.portlet.api.Portlet;
+import org.jboss.portal.portlet.api.PortletContext;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.consumer.portlet.WSRPPortlet;
+import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
+import org.jboss.portal.wsrp.servlet.UserAccess;
+import org.oasis.wsrp.v1.CookieProtocol;
+import org.oasis.wsrp.v1.Extension;
+import org.oasis.wsrp.v1.InvalidHandle;
+import org.oasis.wsrp.v1.InvalidRegistration;
+import org.oasis.wsrp.v1.ItemDescription;
+import org.oasis.wsrp.v1.ModelDescription;
+import org.oasis.wsrp.v1.OperationFailed;
+import org.oasis.wsrp.v1.PortletDescription;
+import org.oasis.wsrp.v1.PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v1.RegistrationContext;
+import org.oasis.wsrp.v1.RegistrationData;
+import org.oasis.wsrp.v1.ResourceList;
+import org.oasis.wsrp.v1.ServiceDescription;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.ws.Holder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12692 $
+ * @since 2.6
+ */
+public class ProducerInfo
+{
+ private final static Logger log = LoggerFactory.getLogger(ProducerInfo.class);
+
+ // Persistent information
+
+ /** DB primary key */
+ private Long key;
+
+ /** Configuration of the remote WS endpoints */
+ private EndpointConfigurationInfo persistentEndpointInfo;
+
+ /** Registration information */
+ private RegistrationInfo persistentRegistrationInfo;
+
+ /** The Producer's identifier */
+ private String persistentId;
+
+ /** The cache expiration duration (in seconds) for cached values */
+ private Integer persistentExpirationCacheSeconds;
+
+ /** The activated status of the associated Consumer */
+ private boolean persistentActive;
+
+ // Transient information
+
+ /** The Cookie handling policy required by the Producer */
+ private CookieProtocol requiresInitCookie;
+
+ /** The Producer-Offered Portlets (handle -> WSRPPortlet) */
+ private Map<String, Portlet> popsMap;
+
+ /** A cache for Consumer-Configured Portlets (handle -> WSRPPortlet) */
+ private Map<String, Portlet> ccpsMap;
+
+ /** Portlet groups. */
+ private Map<String, Set<Portlet>> portletGroups;
+
+ /** Time at which the cache expires */
+ private long expirationTimeMillis;
+
+ private boolean isModifyRegistrationRequired;
+
+ private ConsumerRegistry registry;
+ private static final String ERASED_LOCAL_REGISTRATION_INFORMATION = "Erased local registration information!";
+
+ private Map<String, ItemDescription> customModes;
+ private Map<String, ItemDescription> customWindowStates;
+
+ /*protected org.oasis.wsrp.v1.ItemDescription[] userCategoryDescriptions;
+ protected org.oasis.wsrp.v1.ItemDescription[] customUserProfileItemDescriptions;
+
+ protected java.lang.String[] locales;
+ protected org.oasis.wsrp.v1.ResourceList resourceList;*/
+
+
+ public ProducerInfo()
+ {
+ persistentEndpointInfo = new EndpointConfigurationInfo(this);
+ persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
+ }
+
+ public ConsumerRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(ConsumerRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public Set<String> getSupportedCustomModes()
+ {
+ if (customModes == null)
+ {
+ return Collections.emptySet();
+ }
+ return Collections.unmodifiableSet(customModes.keySet());
+ }
+
+ public Set<String> getSupportedCustomWindowStates()
+ {
+ if (customWindowStates == null)
+ {
+ return Collections.emptySet();
+ }
+ return Collections.unmodifiableSet(customWindowStates.keySet());
+ }
+
+ public EndpointConfigurationInfo getEndpointConfigurationInfo()
+ {
+ return persistentEndpointInfo;
+ }
+
+ void setEndpointConfigurationInfo(EndpointConfigurationInfo endpointConfigurationInfo)
+ {
+ this.persistentEndpointInfo = endpointConfigurationInfo;
+ }
+
+ public RegistrationInfo getRegistrationInfo()
+ {
+ // update parent since it might not be set when unfrozen from Hibernate
+ persistentRegistrationInfo.setParent(this);
+ return persistentRegistrationInfo;
+ }
+
+ public void setRegistrationInfo(RegistrationInfo registrationInfo)
+ {
+ this.persistentRegistrationInfo = registrationInfo;
+ }
+
+ public boolean isRegistered()
+ {
+ Boolean valid = persistentRegistrationInfo.isRegistrationValid();
+ if (valid == null)
+ {
+ return persistentRegistrationInfo.getRegistrationHandle() != null;
+ }
+ else
+ {
+ return valid;
+ }
+ }
+
+ public boolean isRegistrationRequired()
+ {
+ return persistentRegistrationInfo.isRegistrationDeterminedRequired();
+ }
+
+ public boolean isRegistrationChecked()
+ {
+ return persistentRegistrationInfo.isRegistrationRequired() != null;
+ }
+
+ public boolean hasLocalRegistrationInfo()
+ {
+ return persistentRegistrationInfo.hasLocalInfo();
+ }
+
+ /**
+ * Determines whether the associated consumer is active.
+ *
+ * @return
+ */
+ public boolean isActive()
+ {
+ return persistentActive && persistentEndpointInfo.isAvailable();
+ }
+
+ /**
+ * Activates or de-activate this Consumer. Note that this shouldn't be called directly as ConsumersRegistry will
+ * handle activation.
+ *
+ * @param active
+ */
+ public void setActive(boolean active)
+ {
+ this.persistentActive = active;
+ }
+
+ public void setActiveAndSave(boolean active)
+ {
+ setActive(active);
+ registry.updateProducerInfo(this);
+ }
+
+ public boolean isModifyRegistrationRequired()
+ {
+ return isModifyRegistrationRequired || persistentRegistrationInfo.isModifyRegistrationNeeded();
+ }
+
+ // FIX-ME: remove when a better dirty management is in place at property level
+ public void setModifyRegistrationRequired(boolean modifyRegistrationRequired)
+ {
+ this.isModifyRegistrationRequired = modifyRegistrationRequired;
+ }
+
+ public CookieProtocol getRequiresInitCookie()
+ {
+ return requiresInitCookie;
+ }
+
+ /**
+ * Refreshes the producer's information from the service description if required.
+ *
+ * @param forceRefresh whether or not to force a refresh regardless of whether one would have been required based on
+ * cache expiration
+ * @return <code>true</code> if the producer's information was just refreshed, <code>false</code> otherwise
+ * @throws PortletInvokerException if registration was required but couldn't be achieved properly
+ */
+ public boolean refresh(boolean forceRefresh) throws PortletInvokerException
+ {
+ return detailedRefresh(forceRefresh).didRefreshHappen();
+ }
+
+ public RefreshResult detailedRefresh(boolean forceRefresh) throws PortletInvokerException
+ {
+ RefreshResult result = internalRefresh(forceRefresh);
+
+ // update DB
+ if (result.didRefreshHappen())
+ {
+ // mark as inactive if the refresh had issues...
+ if (result.hasIssues())
+ {
+ setActive(false);
+ }
+ else
+ {
+ // mark as active if it wasn't already
+ if (!isActive())
+ {
+ setActive(true);
+ }
+ }
+
+ registry.updateProducerInfo(this);
+ }
+
+ return result;
+ }
+
+ private RefreshResult internalRefresh(boolean forceRefresh) throws PortletInvokerException
+ {
+ ServiceDescription serviceDescription;
+
+ if (isModifyRegistrationRequired)
+ {
+ return new RefreshResult(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED);
+ }
+
+ // might neeed a different cache value: right now, we cache the whole producer info but we might want to cache
+ // POPs and rest of producer info separetely...
+ if (forceRefresh || isRefreshNeeded(true))
+ {
+ log.debug("Refreshing info for producer '" + getId() + "'");
+
+
+ RefreshResult result = new RefreshResult(); // success by default!
+
+ try
+ {
+ persistentEndpointInfo.refresh();
+ }
+ catch (InvokerUnavailableException e)
+ {
+ log.debug("Couldn't refresh endpoint information, attempting a second time: " + e);
+
+ // try again as refresh on a failed service factory will fail without attempting the refresh
+ persistentEndpointInfo.forceRefresh();
+ // todo: should we fail fast here?
+ // throw new PortletInvokerException("Couldn't refresh endpoint information: " + e.getLocalizedMessage());
+ }
+ finally
+ {
+ // save changes to endpoint
+ registry.updateProducerInfo(this);
+ }
+
+ // get the service description from the producer
+ try
+ {
+ // if we don't yet have registration information, get an unregistered service description
+ serviceDescription = getUnmanagedServiceDescription(persistentRegistrationInfo.isUndetermined());
+ result.setServiceDescription(serviceDescription);
+ }
+ catch (OperationFailed operationFailedFault)
+ {
+ // if we have local registration info, the OperationFailedFault might indicate a need to call modifyRegistration
+ if (hasLocalRegistrationInfo())
+ {
+ log.debug("OperationFailedFault occurred, might indicate a need to modify registration");
+
+ // attempt to get unregistered service description
+ serviceDescription = getServiceDescription(true);
+ result.setServiceDescription(serviceDescription);
+
+ // re-validate the registration information
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
+ if (registrationResult.hasIssues())
+ {
+ // if the registration validation has issues, we need to modify our local information
+ isModifyRegistrationRequired = true;
+ setActiveAndSave(false);
+ }
+ else
+ {
+ // we might be in a situation where the producer changed the registration back to the initial state
+ // which is, granted, pretty rare... attempt modifyRegistration
+ log.debug("modifyRegistration was called after OperationFailedFault when a check of registration data didn't reveal any issue...");
+ modifyRegistration();
+ }
+
+ result.setRegistrationResult(registrationResult);
+ return result;
+ }
+ else
+ {
+ serviceDescription = rethrowAsInvokerUnvailable(operationFailedFault);
+ }
+ }
+ catch (InvalidRegistration invalidRegistrationFault)
+ {
+ log.debug("InvalidRegistrationFault occurred");
+
+ // attempt to get unregistered service description
+ serviceDescription = getServiceDescription(true);
+ result.setServiceDescription(serviceDescription);
+
+ // check our registration information against what is sent in the service description
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
+ if (registrationResult.hasIssues())
+ {
+ setActiveAndSave(false);
+ rethrowAsInvokerUnvailable(invalidRegistrationFault);
+ }
+
+ return refreshInfo(false, serviceDescription, result);
+ }
+
+ return refreshInfo(forceRefresh, serviceDescription, result);
+ }
+
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
+ }
+
+ private RefreshResult refreshInfo(boolean forceRefresh, ServiceDescription serviceDescription, RefreshResult result)
+ throws PortletInvokerException
+ {
+ // do we need to call initCookie or not?
+ requiresInitCookie = serviceDescription.getRequiresInitCookie();
+
+ // custom mode descriptions
+ customModes = toMap(serviceDescription.getCustomModeDescriptions());
+
+ // custom window state descriptions
+ customWindowStates = toMap(serviceDescription.getCustomWindowStateDescriptions());
+
+ // do we need to register?
+ if (serviceDescription.isRequiresRegistration())
+ {
+ // refresh and force check for extra props if the registered SD failed
+ // todo: deal with forcing check of extra registration properties properly (if needed)
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, false);
+ registry.updateProducerInfo(this);
+
+ // attempt to register and determine if the current service description can be used to extract POPs
+ if (!registrationResult.hasIssues())
+ {
+ registrationResult = register(serviceDescription, false);
+ if (!registrationResult.hasIssues())
+ {
+ // registration occurred, so we should ask for a new service description
+ serviceDescription = getServiceDescription(false);
+ }
+
+ // extract the POPs
+ extractOfferedPortlets(serviceDescription);
+ }
+
+ result.setRegistrationResult(registrationResult);
+
+ return result;
+ }
+ else
+ {
+ log.debug("Registration not required");
+ persistentRegistrationInfo = new RegistrationInfo(this, false);
+ extractOfferedPortlets(serviceDescription);
+ return result;
+ }
+ }
+
+ private Map<String, ItemDescription> toMap(List<ItemDescription> itemDescriptions)
+ {
+ if (itemDescriptions == null)
+ {
+ return null;
+ }
+ else
+ {
+ Map<String, ItemDescription> result = new HashMap<String, ItemDescription>(itemDescriptions.size());
+ for (ItemDescription itemDescription : itemDescriptions)
+ {
+ result.put(itemDescription.getItemName(), itemDescription);
+ }
+ return result;
+ }
+ }
+
+ public String getId()
+ {
+ return persistentId;
+ }
+
+ public void setId(String id)
+ {
+ this.persistentId = id;
+ }
+
+ /**
+ * Extracts a map of offered Portlet objects from ServiceDescription
+ *
+ * @param sd
+ * @return a Map (portlet handle -> Portlet) of the offered portlets.
+ */
+ private Map extractOfferedPortlets(ServiceDescription sd)
+ {
+ if (sd == null)
+ {
+ throw new IllegalArgumentException("Provided ServiceDescription can't be null");
+ }
+
+ List<PortletDescription> portletDescriptions = sd.getOfferedPortlets();
+
+ if (portletDescriptions != null)
+ {
+ int length = portletDescriptions.size();
+ log.debug("Extracting " + length + " portlets.");
+ popsMap = new LinkedHashMap<String, Portlet>(length);
+ portletGroups = new HashMap<String, Set<Portlet>>();
+
+ for (PortletDescription portletDescription : portletDescriptions)
+ {
+ WSRPPortlet wsrpPortlet = createWSRPPortletFromPortletDescription(portletDescription);
+
+ if (wsrpPortlet != null)
+ {
+ popsMap.put(wsrpPortlet.getContext().getId(), wsrpPortlet);
+ }
+ }
+ }
+ else
+ {
+ popsMap = Collections.emptyMap();
+ portletGroups = Collections.emptyMap();
+ }
+
+ //todo: could extract more information here... and rename method more appropriately
+ resetCacheTimerIfNeeded();
+
+ return popsMap;
+ }
+
+ /**
+ * @param portletDescription
+ * @return
+ * @since 2.6
+ */
+ WSRPPortlet createWSRPPortletFromPortletDescription(PortletDescription portletDescription)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletDescription, "PortletDescription");
+ String portletHandle = portletDescription.getPortletHandle();
+ log.debug("Extracting info for '" + portletHandle + "' portlet");
+ WSRPPortletInfo info = new WSRPPortletInfo(portletDescription, this);
+ WSRPPortlet wsrpPortlet = null;
+ if (info.isUsesMethodGet())
+ {
+ log.warn("Portlet '" + portletHandle
+ + "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
+ "the list of offered portlets for producer " + persistentId);
+ }
+ else
+ {
+ if (info.isHasUserSpecificState())
+ {
+ log.debug("Portlet '" + portletHandle + "' will store persistent state for each user. NOT WELL TESTED!");
+ }
+
+ wsrpPortlet = new WSRPPortlet(PortletContext.createPortletContext(portletHandle), info);
+
+ // add the portlet to the appropriate group if needed
+ String portletGroupId = portletDescription.getGroupID();
+ if (portletGroupId != null)
+ {
+ Set<Portlet> groupedPortlets = portletGroups.get(portletGroupId);
+ if (groupedPortlets == null)
+ {
+ groupedPortlets = new HashSet<Portlet>();
+ portletGroups.put(portletGroupId, groupedPortlets);
+ }
+ groupedPortlets.add(wsrpPortlet);
+ }
+ }
+ return wsrpPortlet;
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws PortletInvokerException
+ {
+ String portletHandle = portletContext.getId();
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "Portlet handle", "getPortlet");
+ log.debug("Retrieving portlet '" + portletHandle + "'");
+
+ // check if we need to refresh
+ boolean justRefreshed = refresh(false);
+
+ // First try caches if caches are still valid or we just refreshed
+ Portlet portlet = getPortletFromCaches(portletHandle, justRefreshed);
+
+ if (portlet != null) // we had a match in cache, return it
+ {
+ log.debug("Portlet was cached");
+ return portlet;
+ }
+ else // otherwise, retrieve just the information for the appropriate portlet
+ {
+ log.debug("Trying to retrieve portlet via getPortletDescription");
+
+ try
+ {
+ Holder<PortletDescription> descriptionHolder = new Holder<PortletDescription>();
+ persistentEndpointInfo.getPortletManagementService().getPortletDescription(
+ getRegistrationContext(),
+ WSRPUtils.convertToWSRPPortletContext(portletContext),
+ UserAccess.getUserContext(),
+ WSRPConstants.getDefaultLocales(), // todo: deal with locales better
+ descriptionHolder,
+ new Holder<ResourceList>(),
+ new Holder<List<Extension>>());
+ portlet = createWSRPPortletFromPortletDescription(descriptionHolder.value);
+
+ // add the portlet to the CCP cache
+ if (ccpsMap == null)
+ {
+ ccpsMap = new HashMap<String, Portlet>();
+ }
+ ccpsMap.put(portletHandle, portlet);
+
+ return portlet;
+ }
+ catch (InvalidHandle invalidHandleFault)
+ {
+ throw new NoSuchPortletException(invalidHandleFault, portletHandle);
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't get portlet via getPortletDescription for producer '" + persistentId
+ + "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
+
+ justRefreshed = refresh(true);
+ portlet = getPortletFromCaches(portletHandle, justRefreshed);
+
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletHandle);
+ }
+ else
+ {
+ return portlet;
+ }
+ }
+ }
+ }
+
+ private Portlet getPortletFromCaches(String portletHandle, boolean justRefreshed)
+ {
+ Portlet portlet = null;
+
+ if (justRefreshed || (useCache() && !isCacheExpired()))
+ {
+ log.debug("Trying cached POPs");
+
+ portlet = popsMap.get(portletHandle);
+
+ if (portlet == null && ccpsMap != null)
+ {
+ log.debug("Trying cached CCPs");
+ portlet = ccpsMap.get(portletHandle);
+ }
+ }
+ return portlet;
+ }
+
+ Map<String, Set<Portlet>> getPortletGroupMap() throws PortletInvokerException
+ {
+ return portletGroups;
+ }
+
+ public Map<String, Portlet> getPortletMap() throws PortletInvokerException
+ {
+ refresh(false);
+ return popsMap;
+ }
+
+ // Cache support ****************************************************************************************************
+
+ private boolean useCache()
+ {
+ return persistentExpirationCacheSeconds != null && persistentExpirationCacheSeconds > 0;
+ }
+
+ private void resetCacheTimerIfNeeded()
+ {
+ if (useCache())
+ {
+ // reset expiration time
+ expirationTimeMillis = System.currentTimeMillis() + (persistentExpirationCacheSeconds * 1000);
+ }
+ }
+
+ /**
+ * @return
+ * @since 2.6
+ */
+ private boolean isCacheExpired()
+ {
+ boolean result = !useCache() || System.currentTimeMillis() > expirationTimeMillis || popsMap == null
+ || portletGroups == null;
+ if (result)
+ {
+ log.debug("Cache expired or not used");
+ }
+ return result;
+ }
+
+ public Integer getExpirationCacheSeconds()
+ {
+ return persistentExpirationCacheSeconds;
+ }
+
+ public void setExpirationCacheSeconds(Integer expirationCacheSeconds)
+ {
+ this.persistentExpirationCacheSeconds = expirationCacheSeconds;
+ }
+
+ private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration
+ {
+ //todo: might need to implement customization of default service description
+ ServiceDescription serviceDescription;
+ try
+ {
+ Holder<Boolean> requiresRegistration = new Holder<Boolean>();
+ Holder<List<PortletDescription>> offeredPortlets = new Holder<List<PortletDescription>>();
+ Holder<List<ItemDescription>> userCategoryDescriptions = new Holder<List<ItemDescription>>();
+ Holder<List<ItemDescription>> userProfileItemDescriptions = new Holder<List<ItemDescription>>();
+ Holder<List<ItemDescription>> windowStateDescriptions = new Holder<List<ItemDescription>>();
+ Holder<List<ItemDescription>> modeDescriptions = new Holder<List<ItemDescription>>();
+ Holder<CookieProtocol> initCookie = new Holder<CookieProtocol>();
+ Holder<ModelDescription> registrationPropertyDescription = new Holder<ModelDescription>();
+ Holder<List<String>> locales = new Holder<List<String>>();
+ Holder<ResourceList> resourceList = new Holder<ResourceList>();
+
+ // invocation
+ persistentEndpointInfo.getServiceDescriptionService().getServiceDescription(
+ asUnregistered ? null : getRegistrationContext(),
+ WSRPConstants.getDefaultLocales(), // todo: deal with locales better
+ requiresRegistration,
+ offeredPortlets,
+ userCategoryDescriptions,
+ userProfileItemDescriptions,
+ windowStateDescriptions,
+ modeDescriptions,
+ initCookie,
+ registrationPropertyDescription,
+ locales,
+ resourceList,
+ new Holder<List<Extension>>());
+
+ serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration.value);
+ serviceDescription.setRegistrationPropertyDescription(registrationPropertyDescription.value);
+ serviceDescription.setRequiresInitCookie(initCookie.value);
+ serviceDescription.setResourceList(resourceList.value);
+ serviceDescription.getCustomModeDescriptions().addAll(modeDescriptions.value);
+ serviceDescription.getCustomUserProfileItemDescriptions().addAll(userProfileItemDescriptions.value);
+ serviceDescription.getCustomWindowStateDescriptions().addAll(windowStateDescriptions.value);
+ serviceDescription.getLocales().addAll(locales.value);
+ serviceDescription.getOfferedPortlets().addAll(offeredPortlets.value);
+ serviceDescription.getUserCategoryDescriptions().addAll(userCategoryDescriptions.value);
+
+ return serviceDescription;
+ }
+ catch (Exception e)
+ {
+ log.debug("Caught Exception in getServiceDescription:\n", e);
+
+ // de-activate
+ setActiveAndSave(false);
+
+ if (e instanceof InvalidRegistration)
+ {
+ resetRegistration();
+
+ throw (InvalidRegistration)e;
+ }
+ else if (e instanceof OperationFailed)
+ {
+ throw (OperationFailed)e; // rethrow to deal at higher level as meaning can vary depending on context
+ }
+
+ return rethrowAsInvokerUnvailable(e);
+ }
+ }
+
+ ServiceDescription getServiceDescription(boolean asUnregistered) throws PortletInvokerException
+ {
+ try
+ {
+ return getUnmanagedServiceDescription(asUnregistered);
+ }
+ catch (OperationFailed operationFailedFault)
+ {
+ return rethrowAsInvokerUnvailable(operationFailedFault);
+ }
+ catch (InvalidRegistration invalidRegistrationFault)
+ {
+ return rethrowAsInvokerUnvailable(invalidRegistrationFault);
+ }
+ }
+
+ private ServiceDescription rethrowAsInvokerUnvailable(Exception e) throws InvokerUnavailableException
+ {
+ Throwable cause = e.getCause();
+ throw new InvokerUnavailableException("Problem getting service description for producer "
+ + persistentId + ", please see the logs for more information. ", cause == null ? e : cause);
+ }
+
+ public RegistrationContext getRegistrationContext() throws PortletInvokerException
+ {
+ if (persistentRegistrationInfo.isUndetermined())
+ {
+ refresh(false);
+ }
+
+ return persistentRegistrationInfo.getRegistrationContext();
+ }
+
+ public void resetRegistration() throws PortletInvokerException
+ {
+ persistentRegistrationInfo.resetRegistration();
+
+ invalidateCache();
+ registry.updateProducerInfo(this);
+ }
+
+ // make package only after package reorg
+ public PortletPropertyDescriptionResponse getPropertyDescriptionsFor(String portletHandle)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
+ try
+ {
+ WSRPV1PortletManagementPortType service = getEndpointConfigurationInfo().getPortletManagementService();
+
+ Holder<ModelDescription> modelDescription = new Holder<ModelDescription>();
+ Holder<ResourceList> resourceList = new Holder<ResourceList>();
+ service.getPortletPropertyDescription(
+ getRegistrationContext(),
+ WSRPTypeFactory.createPortletContext(portletHandle),
+ UserAccess.getUserContext(),
+ WSRPConstants.getDefaultLocales(),
+ modelDescription,
+ resourceList,
+ new Holder<List<Extension>>());
+
+ PortletPropertyDescriptionResponse response = WSRPTypeFactory.createPortletPropertyDescriptionResponse(null);
+ response.setModelDescription(modelDescription.value);
+ response.setResourceList(resourceList.value);
+
+ return response;
+ }
+ catch (InvalidHandle invalidHandleFault)
+ {
+ throw new IllegalArgumentException("Unknown portlet '" + portletHandle + "'");
+ }
+ catch (InvalidRegistration invalidRegistrationFault)
+ {
+ try
+ {
+ resetRegistration();
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new RuntimeException("Couldn't reset registration", e);
+ }
+ throw new IllegalArgumentException("Couldn't get property descriptions for portlet '" + portletHandle
+ + "' because the provided registration is invalid!");
+ }
+ catch (Exception e)
+ {
+ // if we receive an exception that we cannot handle, since the support for PortletManagement is optional,
+ // just return null as if the portlet had no properties
+ log.debug("Couldn't get property descriptions for portlet '" + portletHandle + "'", e);
+ return null;
+ }
+ }
+
+ public void register() throws PortletInvokerException
+ {
+ register(null, false);
+ }
+
+ /**
+ * Attempts to register with the producer.
+ *
+ * @param serviceDescription
+ * @param forceRefresh
+ * @return <code>true</code> if the client code should ask for a new service description, <code>false</code> if the
+ * specified description is good to be further processed
+ * @throws PortletInvokerException
+ * @since 2.6
+ */
+ private RefreshResult register(ServiceDescription serviceDescription, boolean forceRefresh) throws PortletInvokerException
+ {
+ if (!isRegistered())
+ {
+ persistentEndpointInfo.refresh();
+
+ if (serviceDescription == null)
+ {
+ serviceDescription = getServiceDescription(false);
+ }
+
+ if (serviceDescription.isRequiresRegistration())
+ {
+ // check if the configured registration information is correct and if we can get the service description
+ RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, true, forceRefresh, false);
+ if (!result.hasIssues())
+ {
+ try
+ {
+ log.debug("Attempting registration");
+ RegistrationData registrationData = persistentRegistrationInfo.getRegistrationData();
+ Holder<String> registrationHandle = new Holder<String>();
+ Holder<byte[]> registrationState = new Holder<byte[]>();
+
+ // invocation
+ persistentEndpointInfo.getRegistrationService().register(
+ registrationData.getConsumerName(),
+ registrationData.getConsumerAgent(),
+ registrationData.isMethodGetSupported(),
+ registrationData.getConsumerModes(),
+ registrationData.getConsumerWindowStates(),
+ registrationData.getConsumerUserScopes(),
+ registrationData.getCustomUserProfileData(),
+ registrationData.getRegistrationProperties(),
+ new Holder<List<Extension>>(),
+ registrationHandle,
+ registrationState
+ );
+
+ RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registrationHandle.value);
+ registrationContext.setRegistrationState(registrationState.value);
+
+ persistentRegistrationInfo.setRegistrationContext(registrationContext);
+ String msg = "Consumer with id '" + persistentId + "' successfully registered with handle: '"
+ + registrationContext.getRegistrationHandle() + "'";
+ log.debug(msg);
+ RefreshResult res = new RefreshResult();
+ res.setRegistrationResult(result);
+ return res;
+ }
+ catch (Exception e)
+ {
+ persistentRegistrationInfo.resetRegistration();
+ setActive(false);
+ throw new PortletInvokerException("Couldn't register with producer '" + persistentId + "'", e);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
+ }
+ else
+ {
+ log.debug(result.getStatus().toString());
+ setActiveAndSave(false);
+ throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
+ }
+ }
+ }
+
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
+ }
+
+ public void deregister() throws PortletInvokerException
+ {
+ if (isRegistered())
+ {
+ persistentEndpointInfo.refresh();
+
+ try
+ {
+ RegistrationContext registrationContext = getRegistrationContext();
+ persistentEndpointInfo.getRegistrationService().deregister(
+ registrationContext.getRegistrationHandle(),
+ registrationContext.getRegistrationState(),
+ new ArrayList<Extension>());
+ log.info("Consumer with id '" + persistentId + "' deregistered.");
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't deregister with producer '" + persistentId + "'", e);
+ }
+ finally
+ {
+ resetRegistration();
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot deregister producer '" + persistentId + "' as it's not registered");
+ }
+
+ }
+
+ public void modifyRegistration() throws PortletInvokerException
+ {
+ if (persistentRegistrationInfo.getRegistrationHandle() != null)
+ {
+ persistentEndpointInfo.refresh();
+
+ try
+ {
+ RegistrationContext registrationContext = getRegistrationContext();
+ Holder<byte[]> registrationState = new Holder<byte[]>();
+
+ // invocation
+ persistentEndpointInfo.getRegistrationService().modifyRegistration(
+ registrationContext,
+ persistentRegistrationInfo.getRegistrationData(),
+ registrationState,
+ new Holder<List<Extension>>());
+
+ // force refresh of internal RegistrationInfo state
+ persistentRegistrationInfo.setRegistrationValidInternalState();
+
+ // registration is not modified anymore :)
+ isModifyRegistrationRequired = false;
+
+ // update state
+ persistentRegistrationInfo.setRegistrationState(registrationState.value);
+
+ log.info("Consumer with id '" + persistentId + "' sucessfully modified its registration.");
+
+ // reset cache to be able to see new offered portlets on the next refresh
+ invalidateCache();
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't modify registration with producer '" + persistentId + "'", e);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot modify registration for producer '" + persistentId
+ + "' as it's not registered");
+ }
+ }
+
+ private void invalidateCache()
+ {
+ if (useCache())
+ {
+ expirationTimeMillis = System.currentTimeMillis();
+ }
+ }
+
+ private RefreshResult internalRefreshRegistration(ServiceDescription serviceDescription, boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps) throws PortletInvokerException
+ {
+ RefreshResult result =
+ persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
+
+ log.debug("Refreshed registration information for consumer with id '" + persistentId + "'");
+
+ return result;
+ }
+
+ public boolean isRefreshNeeded(boolean considerCache)
+ {
+ boolean result = (considerCache && isCacheExpired())
+ || persistentRegistrationInfo.isRefreshNeeded()
+ || persistentEndpointInfo.isRefreshNeeded();
+ if (result)
+ {
+ log.debug("Refresh needed for producer '" + persistentId + "'");
+ }
+ return result;
+ }
+
+ void removeHandleFromCaches(String portletHandle)
+ {
+ log.debug("Removing '" + portletHandle + "' from caches.");
+ ccpsMap.remove(portletHandle);
+ popsMap.remove(portletHandle);
+ }
+
+ public void eraseRegistrationInfo()
+ {
+ persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
+
+ registry.updateProducerInfo(this);
+
+ log.warn(ERASED_LOCAL_REGISTRATION_INFORMATION);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,531 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.apache.commons.httpclient.Cookie;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.oasis.wsrp.v1.SessionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Records session and cookie information for a producer.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12736 $
+ * @since 2.4 (May 30, 2006)
+ */
+public class ProducerSessionInformation implements Serializable
+{
+ private static Logger log = LoggerFactory.getLogger(ProducerSessionInformation.class);
+
+ private boolean initCookieDone = false;
+ private boolean perGroupCookies = false;
+
+ /** group id -> Cookie[] */
+ private Map<String, Cookie[]> groupCookies;
+
+ /** portlet handle -> SessionInfo */
+ private Map<String, SessionInfo> portletSessions;
+
+ /** session id -> portlet handle */
+ private Map<String, String> sessionId2PortletHandle;
+
+ /** Cookies sent by the remote producer */
+ private Cookie[] userCookie;
+
+ /** Parent SessionHandler so that session mappings can be updated */
+ private transient SessionHandler parent;
+
+ /** The identifier of the Session containing this ProducerSessionInformation */
+ private String parentSessionId;
+
+ /**
+ * public only for tests
+ *
+ * @return
+ * @since 2.6
+ */
+ public String getParentSessionId()
+ {
+ return parentSessionId;
+ }
+
+ /**
+ * public only for tests
+ *
+ * @param parentSessionId
+ * @throws IllegalStateException if an attempt is made to set the parent session id to a different one when it has
+ * already been set.
+ * @since 2.6
+ */
+ public void setParentSessionId(String parentSessionId)
+ {
+ if (this.parentSessionId != null && !this.parentSessionId.equals(parentSessionId))
+ {
+ throw new IllegalStateException("Cannot modify Parent Session id once it has been set!");
+ }
+
+ this.parentSessionId = parentSessionId;
+ }
+
+ public String getUserCookie()
+ {
+ if (userCookie == null)
+ {
+ return null;
+ }
+
+ userCookie = purgeExpiredCookies(userCookie);
+ if (userCookie.length == 0)
+ {
+ setInitCookieDone(false);
+ }
+ return outputToExternalForm(userCookie);
+ }
+
+ public void setUserCookie(Cookie[] userCookie)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userCookie, "cookies");
+
+ this.userCookie = userCookie;
+ }
+
+ public boolean isInitCookieDone()
+ {
+ return initCookieDone;
+ }
+
+ public void setInitCookieDone(boolean initCookieDone)
+ {
+ this.initCookieDone = initCookieDone;
+ }
+
+ public boolean isPerGroupCookies()
+ {
+ return perGroupCookies;
+ }
+
+ public void setPerGroupCookies(boolean perGroupCookies)
+ {
+ this.perGroupCookies = perGroupCookies;
+ }
+
+ public void setGroupCookieFor(String groupId, Cookie[] cookies)
+ {
+ if (!isPerGroupCookies())
+ {
+ throw new IllegalStateException("Cannot add group cookie when cookie protocol is perUser.");
+ }
+
+ if (groupId == null)
+ {
+ throw new IllegalArgumentException("Cannot set cookie for a null portlet group id!");
+ }
+
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(cookies, "cookies");
+
+ if (groupCookies == null)
+ {
+ groupCookies = new HashMap<String, Cookie[]>();
+ }
+
+ if (groupCookies.containsKey(groupId))
+ {
+ log.debug("Trying to set a cookie for an existing group: " + groupId);
+ }
+
+ groupCookies.put(groupId, cookies);
+ }
+
+ public String getGroupCookieFor(String groupId)
+ {
+ if (groupCookies == null)
+ {
+ return null;
+ }
+
+ // purge expired cookies
+ Cookie[] cookies = groupCookies.get(groupId);
+ if (cookies != null)
+ {
+ cookies = purgeExpiredCookies(cookies);
+
+ // if there are no non-expired cookies left, we will need to re-init them
+ if (cookies.length == 0)
+ {
+ setInitCookieDone(false);
+ }
+
+ // update cookies for the considered group id
+ groupCookies.put(groupId, cookies);
+
+ return outputToExternalForm(cookies);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void clearGroupCookies()
+ {
+ groupCookies = null;
+ }
+
+ public void addSessionForPortlet(String portletHandle, SessionContext sessionContext)
+ {
+ // sessionContext is validated in SessionInfo constructor
+ SessionInfo info = new SessionInfo(sessionContext, portletHandle);
+
+ if (portletSessions == null)
+ {
+ portletSessions = new HashMap<String, SessionInfo>();
+ sessionId2PortletHandle = new HashMap<String, String>();
+ }
+
+ portletSessions.put(portletHandle, info);
+ sessionId2PortletHandle.put(sessionContext.getSessionID(), portletHandle);
+
+ if (parent != null)
+ {
+ parent.addSessionMapping(sessionContext.getSessionID(), this);
+ }
+ }
+
+ /**
+ * Retrieves the session id for the portlet with the specified handle. Note that this will "touch" the session, hence
+ * resetting the time since the last use of the session.
+ *
+ * @param portletHandle the handle of the portlet for which the session id is to be retrieved
+ * @return the session id for the specified portlet, <code>null</code> if there is no session associated with the
+ * portlet or if the session has expired.
+ */
+ public String getSessionIdForPortlet(String portletHandle)
+ {
+ ProducerSessionInformation.SessionIdResult idResult = internalGetSessionIdForPortlet(portletHandle);
+ if (idResult.expired)
+ {
+ return null;
+ }
+
+ return idResult.id;
+ }
+
+ public int getNumberOfSessions()
+ {
+ if (portletSessions != null)
+ {
+ return portletSessions.size();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /**
+ * @param sessionId
+ * @return the id of the removed session or <code>null</code> if the session had already expired
+ */
+ public String removeSession(String sessionId)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(sessionId, "session id");
+
+ String portletHandle = sessionId2PortletHandle.get(sessionId);
+ if (portletHandle == null)
+ {
+ throw new IllegalArgumentException("No such session id: '" + sessionId + "'");
+ }
+
+ return removeSessionForPortlet(portletHandle);
+ }
+
+ /**
+ * @return a list containing the session ids that were still valid when they were removed and would need to be
+ * released
+ */
+ public List<String> removeSessions()
+ {
+ List<String> idsToRelease = new ArrayList<String>(getNumberOfSessions());
+
+ // copy to avoid ConcurrentModificationException
+ List<String> handlesCopy = new ArrayList<String>(portletSessions.keySet());
+
+ for (String handle : handlesCopy)
+ {
+ SessionIdResult result = removeSessionIdForPortlet(handle);
+
+ // only release sessions that are still valid
+ if (!result.expired)
+ {
+ idsToRelease.add(result.id);
+ }
+ }
+
+ return idsToRelease;
+ }
+
+ /**
+ * @param portletHandle
+ * @return the id of the removed session or <code>null</code> if the session had already expired
+ */
+ public String removeSessionForPortlet(String portletHandle)
+ {
+ SessionIdResult result = removeSessionIdForPortlet(portletHandle);
+
+ return result.expired ? null : result.id;
+ }
+
+ private SessionIdResult removeSessionIdForPortlet(String portletHandle)
+ {
+ ProducerSessionInformation.SessionIdResult result = internalGetSessionIdForPortlet(portletHandle);
+ final String id = result.id;
+
+ if (id == null)
+ {
+ throw new IllegalArgumentException("There is no Session associated with portlet '" + portletHandle + "'");
+ }
+
+ // if the session is still valid, release it and remove the associated mappings
+ if (!result.expired)
+ {
+ portletSessions.remove(portletHandle);
+ sessionId2PortletHandle.remove(id);
+ if (parent != null)
+ {
+ parent.removeSessionId(id);
+ }
+ }
+
+ return result;
+ }
+
+ public void replaceUserCookiesWith(ProducerSessionInformation currentSessionInfo)
+ {
+ if (currentSessionInfo != null && currentSessionInfo.userCookie != null && currentSessionInfo.userCookie.length > 0)
+ {
+ this.userCookie = currentSessionInfo.userCookie;
+ }
+ }
+
+ /**
+ * Create a String representation of the specified array of Cookies.
+ *
+ * @param cookies the cookies to be output to external form
+ * @return a String representation of the cookies, ready to be sent over the wire.
+ */
+ private String outputToExternalForm(Cookie[] cookies)
+ {
+ if (cookies != null && cookies.length != 0)
+ {
+ int cookieNumber = cookies.length;
+ StringBuffer sb = new StringBuffer(128 * cookieNumber);
+ for (int i = 0; i < cookieNumber; i++)
+ {
+ sb.append(cookies[i].toExternalForm());
+ if (i != cookieNumber - 1)
+ {
+ sb.append(","); // multiple cookies are separated by commas: http://www.ietf.org/rfc/rfc2109.txt, 4.2.2
+ }
+ }
+ return sb.toString();
+ }
+ return null;
+ }
+
+ /**
+ * Purges the expired cookies in the specified array.
+ *
+ * @param cookies the cookies to be purged
+ * @return an array of Cookies containing only still valid cookies
+ */
+ private Cookie[] purgeExpiredCookies(Cookie[] cookies)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(cookies, "cookies");
+
+ List<Cookie> cleanCookies = Tools.toList(cookies);
+
+ for (Cookie cookie : cookies)
+ {
+ if (cookie.isExpired())
+ {
+ cleanCookies.remove(cookie);
+ }
+ }
+ return cleanCookies.toArray(new Cookie[cleanCookies.size()]);
+ }
+
+ private SessionIdResult internalGetSessionIdForPortlet(String portletHandle)
+ {
+ SessionInfo session = getSessionInfoFor(portletHandle);
+ if (session != null)
+ {
+ String id = session.getSessionId();
+ if (!session.isStillValid())
+ {
+ portletSessions.remove(session.getPortletHandle());
+ sessionId2PortletHandle.remove(session.getSessionId());
+ if (parent != null)
+ {
+ parent.removeSessionId(session.getSessionId());
+ }
+ return new SessionIdResult(id, true);
+ }
+ else
+ {
+ return new SessionIdResult(id, false);
+ }
+ }
+ return new SessionIdResult(null, false);
+ }
+
+ private SessionInfo getSessionInfoFor(String portletHandle)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
+
+ if (portletSessions == null)
+ {
+ return null;
+ }
+
+ return portletSessions.get(portletHandle);
+ }
+
+ /**
+ * @return the known session id
+ * @since 2.6
+ */
+ Collection<String> getSessionIds()
+ {
+ return sessionId2PortletHandle.keySet();
+ }
+
+ /**
+ * @param sessionHandler
+ * @since 2.6
+ */
+ void setParent(SessionHandler sessionHandler)
+ {
+ parent = sessionHandler;
+ }
+
+ /**
+ * Update the mappings that were associated with the specified original portlet handle after it has been modified as
+ * a result of a clone operation to the specified new handle.
+ *
+ * @param originalHandle
+ * @param newHandle
+ * @since 2.6
+ */
+ public void updateHandleAssociatedInfo(String originalHandle, String newHandle)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(originalHandle, "original handle",
+ "Updating information associated with a portlet handle");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(newHandle, "new handle",
+ "Updating information associated with a portlet handle");
+
+ String sessionId = getSessionIdForPortlet(originalHandle);
+ ProducerSessionInformation.SessionInfo info = getSessionInfoFor(originalHandle);
+ if (sessionId != null && info != null)
+ {
+ portletSessions.put(newHandle, info);
+ portletSessions.remove(originalHandle);
+ sessionId2PortletHandle.put(sessionId, newHandle);
+ log.debug("Updated mapping information for '" + originalHandle + "' to reference '" + newHandle + "' instead.");
+ }
+ }
+
+ private class SessionInfo implements Serializable
+ {
+ private SessionContext sessionContext;
+ private long lastInvocationTime;
+ private String portletHandle;
+
+ public SessionInfo(SessionContext sessionContext, String portletHandle)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(sessionContext, "SessionContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(sessionContext.getSessionID(), "session id", "SessionContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "SessionInfo");
+
+ this.sessionContext = sessionContext;
+ this.portletHandle = portletHandle;
+ lastInvocationTime = System.currentTimeMillis();
+ }
+
+ /**
+ * Checks that the session associated with the session context hasn't expired and update the last invocation time
+ *
+ * @return
+ */
+ private boolean isStillValid()
+ {
+ int expires = sessionContext.getExpires();
+ if (expires == WSRPConstants.SESSION_NEVER_EXPIRES)
+ {
+ return true;
+ }
+
+ long now = System.currentTimeMillis();
+ long secondsSinceLastInvocation = (now - lastInvocationTime) / 1000;
+ lastInvocationTime = now;
+
+ long diff = expires - secondsSinceLastInvocation;
+ log.debug("Session ID '" + sessionContext.getSessionID() + "' is " + ((diff > 0) ? "" : "not")
+ + " valid (time since last invocation: " + diff + ")");
+ return diff > 0;
+ }
+
+ private String getSessionId()
+ {
+ return sessionContext.getSessionID();
+ }
+
+ private String getPortletHandle()
+ {
+ return portletHandle;
+ }
+ }
+
+ private class SessionIdResult
+ {
+ private String id;
+ private boolean expired;
+
+ public SessionIdResult(String id, boolean expired)
+ {
+ this.id = id;
+ this.expired = expired;
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RefreshResult.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RefreshResult.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RefreshResult.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import static org.jboss.portal.wsrp.consumer.RefreshResult.Status.*;
+import org.oasis.wsrp.v1.ServiceDescription;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11575 $
+ * @since 2.6
+ */
+public class RefreshResult
+{
+ public enum Status
+ {
+ SUCCESS, FAILURE, UNAVAILABLE, BYPASSED, UNKNOWN, MODIFY_REGISTRATION_REQUIRED
+ }
+
+ private ServiceDescription serviceDescription;
+ private Status status;
+ private RefreshResult registrationResult;
+
+ /** A RefreshResult is assumed successful unless proven otherwise. Same as RefreshResult(SUCCESS). */
+ public RefreshResult()
+ {
+ this(SUCCESS);
+ }
+
+ public RefreshResult(Status status)
+ {
+ this.status = status;
+ }
+
+ public RefreshResult getRegistrationResult()
+ {
+ return registrationResult;
+ }
+
+ public void setRegistrationResult(RefreshResult registrationResult)
+ {
+ if (registrationResult != null)
+ {
+ this.registrationResult = registrationResult;
+
+ // result of registration only impacts the result of the total refresh if it wasn't bypassed
+ RefreshResult.Status regStatus = registrationResult.getStatus();
+ if (!BYPASSED.equals(regStatus))
+ {
+ status = regStatus;
+ }
+ }
+ }
+
+ public boolean didRefreshHappen()
+ {
+ return SUCCESS.equals(status) || FAILURE.equals(status);
+ }
+
+ public boolean hasIssues()
+ {
+ return !(SUCCESS.equals(status) || BYPASSED.equals(status));
+ }
+
+ public Status getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(Status status)
+ {
+ this.status = status;
+ }
+
+ public void setServiceDescription(ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ public ServiceDescription getServiceDescription()
+ {
+ return serviceDescription;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfo.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,734 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+import org.oasis.wsrp.v1.ModelDescription;
+import org.oasis.wsrp.v1.Property;
+import org.oasis.wsrp.v1.PropertyDescription;
+import org.oasis.wsrp.v1.RegistrationContext;
+import org.oasis.wsrp.v1.RegistrationData;
+import org.oasis.wsrp.v1.ServiceDescription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12686 $
+ * @since 2.6
+ */
+public class RegistrationInfo implements RegistrationProperty.PropertyChangeListener
+{
+ private static final Logger log = LoggerFactory.getLogger(RegistrationInfo.class);
+
+ private Long key;
+ private String persistentConsumerName;
+ private String persistentRegistrationHandle;
+ private byte[] persistentRegistrationState;
+ private Map<String, RegistrationProperty> persistentRegistrationProperties;
+
+ private transient Boolean requiresRegistration;
+ private transient Boolean consistentWithProducerExpectations;
+ private transient RegistrationData registrationData;
+ private transient boolean modifiedSinceLastRefresh;
+ private transient boolean modifyRegistrationNeeded;
+ private transient ProducerInfo parent;
+
+ /**
+ * Marker string to identify a RegistrationInfo created for a producer that might not require registration as a work
+ * around https://jira.jboss.org/jira/browse/JBPORTAL-2284
+ */
+ private static final String UNDETERMINED_REGISTRATION = "__JBP__UNDETERMINED__REGISTRATION__";
+
+ public RegistrationInfo(ProducerInfo producerInfo)
+ {
+ this();
+ ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
+ producerInfo.setRegistrationInfo(this);
+ parent = producerInfo;
+ }
+
+ static RegistrationInfo createUndeterminedRegistration(ProducerInfo producerInfo)
+ {
+ RegistrationInfo info = new RegistrationInfo(producerInfo);
+ info.setConsumerName(UNDETERMINED_REGISTRATION);
+ return info;
+ }
+
+ public boolean isUndetermined()
+ {
+ return UNDETERMINED_REGISTRATION.equals(persistentConsumerName);
+ }
+
+ public RegistrationInfo(ProducerInfo producerInfo, boolean requiresRegistration)
+ {
+ this(producerInfo);
+ this.requiresRegistration = requiresRegistration;
+ }
+
+ public RegistrationInfo()
+ {
+ persistentConsumerName = WSRPConstants.DEFAULT_CONSUMER_NAME;
+ }
+
+ public RegistrationInfo(RegistrationInfo other)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(other, "RegistrationInfo to clone from");
+ this.persistentConsumerName = other.persistentConsumerName;
+ this.persistentRegistrationHandle = other.persistentRegistrationHandle;
+ this.parent = other.parent;
+
+ if (other.persistentRegistrationState != null)
+ {
+ this.persistentRegistrationState = new byte[other.persistentRegistrationState.length];
+ System.arraycopy(other.persistentRegistrationState, 0, this.persistentRegistrationState, 0, other.persistentRegistrationState.length);
+ }
+
+ if (other.persistentRegistrationProperties != null)
+ {
+ this.persistentRegistrationProperties = new HashMap<String, RegistrationProperty>(other.persistentRegistrationProperties.size());
+ for (RegistrationProperty otherProp : other.persistentRegistrationProperties.values())
+ {
+ String name = otherProp.getName();
+ RegistrationProperty prop = new RegistrationProperty(name, otherProp.getValue(), otherProp.getLang(), this);
+ prop.setStatus(otherProp.getStatus());
+ this.persistentRegistrationProperties.put(name, prop);
+ }
+ }
+ }
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public String getRegistrationHandle()
+ {
+ return persistentRegistrationHandle;
+ }
+
+ public void setRegistrationHandle(String registrationHandle)
+ {
+ this.persistentRegistrationHandle = registrationHandle;
+ }
+
+ public byte[] getRegistrationState()
+ {
+ return persistentRegistrationState;
+ }
+
+ public void setRegistrationState(byte[] registrationState)
+ {
+ this.persistentRegistrationState = registrationState;
+ }
+
+ public ProducerInfo getParent()
+ {
+ return parent;
+ }
+
+ public void setParent(ProducerInfo parent)
+ {
+ this.parent = parent;
+ }
+
+ public boolean isRefreshNeeded()
+ {
+ boolean result = requiresRegistration == null || isModifiedSinceLastRefresh();
+ if (result)
+ {
+ log.debug("Refresh needed");
+ }
+ return result;
+ }
+
+ public Boolean isRegistrationValid()
+ {
+ if (consistentWithProducerExpectations == null || requiresRegistration == null)
+ {
+ return null;
+ }
+ return consistentWithProducerExpectations && hasRegisteredIfNeeded();
+ }
+
+ private boolean hasRegisteredIfNeeded()
+ {
+ return (persistentRegistrationHandle != null && isRegistrationDeterminedRequired()) || isRegistrationDeterminedNotRequired();
+ }
+
+ public Boolean isConsistentWithProducerExpectations()
+ {
+ return consistentWithProducerExpectations;
+ }
+
+ /**
+ * Determines whether the associated Producer requires registration.
+ *
+ * @return <code>null</code> if this RegistrationInfo hasn't queried the Producer yet and thus, doesn't have a
+ * definitive answer on whether or not the associated Producer requires registration,
+ * <code>Boolean.TRUE</code> if the associated Producer requires registration, <code>Boolean.FALSE</code>
+ * otherwise.
+ */
+ public Boolean isRegistrationRequired()
+ {
+ return requiresRegistration;
+ }
+
+ /**
+ * Determines whether it has been determined after querying the associated Producer that it requires registration.
+ *
+ * @return <code>true</code> if and only if the associated Producer has been queried and mandates registration,
+ * <code>false</code> otherwise.
+ * @throws IllegalStateException if {@link #refresh} has not yet been called
+ */
+ public boolean isRegistrationDeterminedRequired()
+ {
+ if (requiresRegistration == null)
+ {
+ throw new IllegalStateException("Registration status not yet known: call refresh first!");
+ }
+
+ return requiresRegistration;
+ }
+
+ /**
+ * Determines whether it has been determined after querying the associated Producer that it does <strong>NOT</strong>
+ * require registration.
+ *
+ * @return <code>true</code> if and only if the associated Producer has been queried and does NOT mandate
+ * registration, <code>false</code> otherwise.
+ * @throws IllegalStateException if {@link #refresh} has not yet been called
+ */
+ public boolean isRegistrationDeterminedNotRequired()
+ {
+ if (requiresRegistration == null)
+ {
+ throw new IllegalStateException("Registration status not yet known: call refresh first!");
+ }
+
+ return !requiresRegistration;
+ }
+
+ public boolean hasLocalInfo()
+ {
+ return persistentRegistrationHandle != null || isRegistrationPropertiesEmpty();
+ }
+
+ public boolean isRegistrationPropertiesEmpty()
+ {
+ return persistentRegistrationProperties != null && !persistentRegistrationProperties.isEmpty();
+ }
+
+ public RegistrationData getRegistrationData()
+ {
+ registrationData = WSRPTypeFactory.createDefaultRegistrationData();
+ registrationData.setConsumerName(persistentConsumerName);
+ List<Property> properties = new ArrayList<Property>();
+ Map regProps = getRegistrationProperties(false);
+ if (!regProps.isEmpty())
+ {
+ for (Object o : regProps.values())
+ {
+ RegistrationProperty prop = (RegistrationProperty)o;
+ String value = prop.getValue();
+ if (value != null && !prop.isDeterminedInvalid())
+ {
+ properties.add(WSRPTypeFactory.createProperty(prop.getName(), prop.getLang(), prop.getValue()));
+ }
+ }
+
+ registrationData.getRegistrationProperties().addAll(properties);
+ }
+
+ return registrationData;
+ }
+
+ public String getConsumerName()
+ {
+ return persistentConsumerName;
+ }
+
+ public void setConsumerName(String consumerName)
+ {
+ this.persistentConsumerName = consumerName;
+ }
+
+ public String getConsumerAgent()
+ {
+ return WSRPConstants.CONSUMER_AGENT;
+ }
+
+ public RegistrationProperty getRegistrationProperty(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.getRegistrationProperty");
+ return getRegistrationProperties(false).get(name);
+ }
+
+ public RegistrationProperty setRegistrationPropertyValue(String name, String value)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.setRegistrationPropertyValue");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(value, "registration property value", "RegistrationInfo.setRegistrationPropertyValue");
+
+ RegistrationProperty prop = getOrCreateRegistrationPropertiesMap(true).get(name);
+ if (prop != null)
+ {
+ prop.setValue(value);
+ }
+ else
+ {
+ // todo: deal with language more appropriately
+ prop = new RegistrationProperty(name, value, WSRPUtils.toString(Locale.getDefault()), this);
+ getOrCreateRegistrationPropertiesMap(false).put(name, prop);
+ setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
+ }
+
+ return prop;
+ }
+
+ public void removeRegistrationProperty(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.removeRegistrationProperty");
+ Map<String, RegistrationProperty> propertiesMap = getOrCreateRegistrationPropertiesMap(false);
+ if (propertiesMap == null || propertiesMap.remove(name) == null)
+ {
+ throw new IllegalArgumentException("Cannot remove inexistent registration property '" + name + "'");
+ }
+ setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
+ }
+
+ private Map<String, RegistrationProperty> getOrCreateRegistrationPropertiesMap(boolean forceCreate)
+ {
+ if (forceCreate && persistentRegistrationProperties == null)
+ {
+ persistentRegistrationProperties = new HashMap<String, RegistrationProperty>();
+ }
+
+ return persistentRegistrationProperties;
+ }
+
+ public Map<String, RegistrationProperty> getRegistrationProperties()
+ {
+ return getRegistrationProperties(true);
+ }
+
+ private Map<String, RegistrationProperty> getRegistrationProperties(boolean immutable)
+ {
+ Map<String, RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
+ if (properties != null)
+ {
+ if (immutable)
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+ else
+ {
+ return properties;
+ }
+ }
+ else
+ {
+ return Collections.emptyMap();
+ }
+ }
+
+ public void setRegistrationProperties(Map registrationProperties)
+ {
+ this.persistentRegistrationProperties = registrationProperties;
+ }
+
+ public Set getRegistrationPropertyNames()
+ {
+ return getRegistrationProperties().keySet();
+ }
+
+ /**
+ * @param serviceDescription
+ * @param producerId
+ * @param mergeWithLocalInfo
+ * @param forceRefresh
+ * @param forceCheckOfExtraProps
+ * @return
+ */
+ public RegistrationRefreshResult refresh(ServiceDescription serviceDescription, String producerId,
+ boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps)
+ {
+ log.debug("RegistrationInfo refresh requested");
+
+ if (forceRefresh || isRefreshNeeded())
+ {
+ // if we were previously undetermined, become determined! :)
+ if (isUndetermined())
+ {
+ setConsumerName(WSRPConstants.DEFAULT_CONSUMER_NAME);
+ }
+
+ // get a service description if we don't already have one
+ String msg = "Couldn't get a service description to refresh from!";
+ if (serviceDescription == null && parent != null)
+ {
+ try
+ {
+ serviceDescription = parent.getServiceDescription(true);
+ }
+ catch (PortletInvokerException e)
+ {
+ log.debug(msg, e);
+ serviceDescription = null;
+ }
+ }
+
+ // if we still don't have a service description, we have a problem!
+ if (serviceDescription == null)
+ {
+ throw new IllegalArgumentException(msg);
+ }
+
+ persistentRegistrationProperties = getOrCreateRegistrationPropertiesMap(true);
+
+ RegistrationRefreshResult result = new RegistrationRefreshResult();
+ result.setServiceDescription(serviceDescription);
+
+ // if we're not merging, we need to copy the current properties so that we can collect validation results.
+ if (!mergeWithLocalInfo)
+ {
+ result.setRegistrationProperties(new HashMap<String, RegistrationProperty>(persistentRegistrationProperties));
+ }
+ setModifiedSinceLastRefresh(false);
+ modifyRegistrationNeeded = false;
+
+ if (serviceDescription.isRequiresRegistration())
+ {
+ requiresRegistration = Boolean.TRUE;
+ log.debug("Producer '" + producerId + "' requires registration");
+
+ // check if the configured registration properties match the producer expectations
+ ModelDescription regPropDescs = serviceDescription.getRegistrationPropertyDescription();
+ if (regPropDescs != null)
+ {
+ result.setStatus(RefreshResult.Status.SUCCESS);
+ List<PropertyDescription> propertyDescriptions = regPropDescs.getPropertyDescriptions();
+ if (propertyDescriptions != null && !propertyDescriptions.isEmpty())
+ {
+ Map<String, RegistrationProperty> descriptionsMap = getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
+
+ // check that we don't have unexpected registration properties and if so, mark them as invalid or remove them
+ Set<String> expectedNames = descriptionsMap.keySet();
+ checkForExtraProperties(producerId, result, expectedNames, persistentRegistrationProperties, !mergeWithLocalInfo);
+
+ // Merge existing properties
+ for (RegistrationProperty prop : descriptionsMap.values())
+ {
+ String name = prop.getName();
+ RegistrationProperty existing = getRegistrationProperty(name);
+ if (existing != null)
+ {
+ // take the opportunity to add the property description... ^_^
+ existing.setDescription(prop.getDescription());
+ if (existing.isDeterminedInvalid())
+ {
+ result.setStatus(RefreshResult.Status.FAILURE);
+ }
+ }
+ else
+ {
+ if (mergeWithLocalInfo)
+ {
+ persistentRegistrationProperties.put(name, prop);
+ }
+ else
+ {
+ prop.setStatus(RegistrationProperty.Status.MISSING);
+ result.getRegistrationProperties().put(name, prop);
+ }
+
+ log.debug("Missing value for property '" + name + "'");
+ setResultAsFailedOrModifyNeeded(result);
+ }
+ }
+ }
+ else
+ {
+ handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo, forceCheckOfExtraProps);
+ }
+ }
+ else
+ {
+ handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo, forceCheckOfExtraProps);
+ }
+ }
+ else
+ {
+ log.debug("Producer '" + producerId + "' doesn't require registration");
+ requiresRegistration = Boolean.FALSE;
+ result.setStatus(RefreshResult.Status.SUCCESS);
+ }
+
+ // if we're merging, the resulting properties are the saved properties
+ if (mergeWithLocalInfo)
+ {
+ result.setRegistrationProperties(persistentRegistrationProperties);
+ }
+
+ // if issues have been detected, mark the registration as invalid (but do not reset the data)
+ // todo: check if the state is consistent with the producer expectations for example if we have registration
+ // properties when the producer does not require registration?
+ consistentWithProducerExpectations = !result.hasIssues();
+
+ log.debug("Registration configuration is " + (consistentWithProducerExpectations ? "" : "NOT ") + "valid");
+ return result;
+ }
+ else
+ {
+ RegistrationRefreshResult result = new RegistrationRefreshResult();
+ result.setStatus(RefreshResult.Status.BYPASSED);
+ result.setRegistrationProperties(persistentRegistrationProperties);
+ result.setServiceDescription(serviceDescription);
+ return result;
+ }
+ }
+
+ private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra, boolean forceCheckOfExtraProps)
+ {
+ log.debug("The producer didn't require any specific registration properties");
+ Map<String, RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
+ if (properties != null && !properties.isEmpty())
+ {
+ if (forceCheckOfExtraProps || !hasRegisteredIfNeeded())
+ {
+ log.debug("Registration data is available when none is expected by the producer");
+ checkForExtraProperties(producerId, result, Collections.<String>emptySet(), properties, keepExtra);
+ }
+ else
+ {
+ log.debug("Consumer is registered: producer most likely did not resend property descriptions");
+ result.setStatus(RefreshResult.Status.SUCCESS);
+ }
+ }
+ else
+ {
+ log.debug("Using default registration data for producer '" + producerId + "'");
+ registrationData = WSRPTypeFactory.createDefaultRegistrationData();
+ result.setStatus(RefreshResult.Status.SUCCESS);
+ }
+ }
+
+ /**
+ * @param producerId
+ * @param result
+ * @param expectedNames
+ * @param properties
+ */
+ private void checkForExtraProperties(String producerId, RegistrationRefreshResult result, Set<String> expectedNames, Map<String, RegistrationProperty> properties, boolean keepExtra)
+ {
+ Set<String> unexpected = new HashSet<String>(properties.keySet());
+ unexpected.removeAll(expectedNames);
+ if (!unexpected.isEmpty())
+ {
+ StringBuffer message = new StringBuffer("Unexpected registration properties:\n");
+ int size = unexpected.size();
+ int index = 0;
+ for (String name : unexpected)
+ {
+ message.append("'").append(name).append("'");
+ if (keepExtra)
+ {
+ // mark the prop as invalid
+ RegistrationProperty prop = properties.get(name);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.Status.INVALID_VALUE);
+
+ // do the same in the result
+ prop = result.getRegistrationProperties().get(name);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.Status.INEXISTENT);
+ }
+ else
+ {
+ message.append(" (was removed)");
+ properties.remove(name);
+ }
+
+ if (index++ != size - 1)
+ {
+ message.append(";");
+ }
+ }
+ log.debug(message.toString());
+ setResultAsFailedOrModifyNeeded(result);
+ }
+ }
+
+ private void setResultAsFailedOrModifyNeeded(RegistrationRefreshResult result)
+ {
+ if (persistentRegistrationHandle != null)
+ {
+ result.setStatus(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED);
+ modifyRegistrationNeeded = true;
+ }
+ else
+ {
+ result.setStatus(RefreshResult.Status.FAILURE);
+ }
+ }
+
+ /**
+ * @param descriptions
+ * @return
+ */
+ private Map<String, RegistrationProperty> getRegistrationPropertyDescriptionsFromWSRP(List<PropertyDescription> descriptions)
+ {
+ if (descriptions != null)
+ {
+ Map<String, RegistrationProperty> result = new HashMap<String, RegistrationProperty>(descriptions.size());
+ for (PropertyDescription description : descriptions)
+ {
+ String name = description.getName();
+ RegistrationPropertyDescription desc = WSRPUtils.convertToRegistrationPropertyDescription(description);
+ RegistrationProperty prop = new RegistrationProperty(name, null, WSRPUtils.toString(desc.getLang()), this);
+ prop.setDescription(desc);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.Status.MISSING_VALUE);
+ result.put(name, prop);
+ }
+
+ return result;
+ }
+ else
+ {
+ return Collections.emptyMap();
+ }
+ }
+
+ void resetRegistration()
+ {
+ persistentRegistrationHandle = null;
+ persistentRegistrationState = null;
+ }
+
+ public void setRegistrationContext(RegistrationContext registrationContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationContext, "RegistrationContext");
+ String handle = registrationContext.getRegistrationHandle();
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(handle, "registration handle", "RegistrationContext");
+ persistentRegistrationHandle = handle;
+ persistentRegistrationState = registrationContext.getRegistrationState();
+ setRegistrationValidInternalState();
+ }
+
+ /** todo: revert to package-only once the tests are moved to same package */
+ public void setRegistrationValidInternalState()
+ {
+ // update RegistrationData if needed
+ getRegistrationData();
+
+ // mark the registration properties as valid
+ if (persistentRegistrationProperties != null)
+ {
+ for (Object o : persistentRegistrationProperties.values())
+ {
+ RegistrationProperty prop = (RegistrationProperty)o;
+ prop.setInvalid(Boolean.FALSE, RegistrationProperty.Status.VALID);
+ }
+ }
+
+ consistentWithProducerExpectations = Boolean.TRUE; // since we have a registration context, we're consistent with the Producer
+ requiresRegistration = Boolean.TRUE; // we know we require registration
+ setModifiedSinceLastRefresh(false); // our state is clean :)
+ modifyRegistrationNeeded = false;
+ }
+
+ public RegistrationContext getRegistrationContext()
+ {
+ if (persistentRegistrationHandle != null)
+ {
+ RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(persistentRegistrationHandle);
+ registrationContext.setRegistrationState(persistentRegistrationState);
+ return registrationContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public boolean isModifyRegistrationNeeded()
+ {
+ return modifyRegistrationNeeded || isModifiedSinceLastRefresh();
+ }
+
+ public boolean isModifiedSinceLastRefresh()
+ {
+ return modifiedSinceLastRefresh;
+ }
+
+ public void setModifiedSinceLastRefresh(boolean modifiedSinceLastRefresh)
+ {
+ this.modifiedSinceLastRefresh = modifiedSinceLastRefresh;
+ }
+
+ /** todo: Should be package-only, public for tests... */
+ public void propertyValueChanged(RegistrationProperty property, Object oldValue, Object newValue)
+ {
+ setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
+ }
+
+ public class RegistrationRefreshResult extends RefreshResult
+ {
+ private Map<String, RegistrationProperty> registrationProperties;
+
+ public RegistrationRefreshResult()
+ {
+ super();
+ }
+
+ public Map<String, RegistrationProperty> getRegistrationProperties()
+ {
+ return registrationProperties;
+ }
+
+ public void setRegistrationProperties(Map<String, RegistrationProperty> registrationProperties)
+ {
+ this.registrationProperties = registrationProperties;
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfoPostLoadEventListener.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfoPostLoadEventListener.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationInfoPostLoadEventListener.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.hibernate.event.PostLoadEvent;
+import org.hibernate.event.def.DefaultPostLoadEventListener;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationInfoPostLoadEventListener extends DefaultPostLoadEventListener
+{
+ /**
+ * Once the object is loaded from Hibernate, greedily load the associated RegistrationProperties and register with
+ * them as a listener for changes in their value.
+ *
+ * @param event
+ */
+ public void onPostLoad(PostLoadEvent event)
+ {
+ Object entity = event.getEntity();
+ if (entity instanceof RegistrationInfo)
+ {
+ RegistrationInfo info = (RegistrationInfo)entity;
+
+ for (RegistrationProperty property : info.getRegistrationProperties().values())
+ {
+ property.setListener(info);
+ }
+ }
+
+ super.onPostLoad(event);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationProperty.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,256 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import static org.jboss.portal.wsrp.consumer.RegistrationProperty.Status.*;
+import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12019 $
+ * @since 2.6
+ */
+public class RegistrationProperty implements Comparable<RegistrationProperty>
+{
+ private Long persistentId;
+ private RegistrationPropertyDescription persistentDescription;
+ private Boolean persistentInvalid;
+ private String persistentLang;
+ private String persistentName;
+ private String persistentValue;
+
+ private transient PropertyChangeListener listener;
+ private transient Status status;
+
+ public int compareTo(RegistrationProperty o)
+ {
+ return persistentName.compareTo(o.persistentName);
+ }
+
+ public enum Status
+ {
+ INEXISTENT("registration_property_status_inexistent"),
+ MISSING("registration_property_status_missing"),
+ MISSING_VALUE("registration_property_status_missing_value"),
+ UNCHECKED_VALUE("registration_property_status_unchecked_value"),
+ INVALID_VALUE("registration_property_status_invalid_value"),
+ VALID("registration_property_status_valid");
+
+ Status(String localizationKey)
+ {
+ this.localizationKey = localizationKey;
+ }
+
+ public String getLocalizationKey()
+ {
+ return localizationKey;
+ }
+
+ private String localizationKey;
+ }
+
+ public RegistrationProperty()
+ {
+ }
+
+ public RegistrationProperty(String name, String stringValue, String lang, PropertyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Name", "RegistrationProperty");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "Lang", "RegistrationProperty");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "listener", "RegistrationProperty");
+ this.persistentName = name;
+ this.persistentLang = lang;
+ this.listener = listener;
+ setValue(stringValue);
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (!(o instanceof RegistrationProperty))
+ {
+ return false;
+ }
+
+ RegistrationProperty that = (RegistrationProperty)o;
+
+ if (persistentId != null ? !persistentId.equals(that.persistentId) : that.persistentId != null)
+ {
+ return false;
+ }
+ if (!persistentName.equals(that.persistentName))
+ {
+ return false;
+ }
+ return !(persistentValue != null ? !persistentValue.equals(that.persistentValue) : that.persistentValue != null);
+
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result;
+ result = (persistentId != null ? persistentId.hashCode() : 0);
+ result = 31 * result + persistentName.hashCode();
+ result = 31 * result + (persistentValue != null ? persistentValue.hashCode() : 0);
+ return result;
+ }
+
+ public Long getKey()
+ {
+ return persistentId;
+ }
+
+ public void setKey(Long key)
+ {
+ this.persistentId = key;
+ }
+
+ public String getName()
+ {
+ return persistentName;
+ }
+
+ public void setName(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Name", "RegistrationProperty");
+ this.persistentName = name;
+ }
+
+ public String getValue()
+ {
+ return persistentValue;
+ }
+
+ public RegistrationPropertyDescription getDescription()
+ {
+ return persistentDescription;
+ }
+
+ public void setDescription(RegistrationPropertyDescription description)
+ {
+ this.persistentDescription = description;
+ }
+
+ public Boolean isInvalid()
+ {
+ return persistentInvalid;
+ }
+
+ void setInvalid(Boolean invalid)
+ {
+ this.persistentInvalid = invalid;
+ }
+
+ public boolean isDeterminedInvalid()
+ {
+ return persistentInvalid != null && persistentInvalid && !UNCHECKED_VALUE.equals(getStatus());
+ }
+
+ public void setInvalid(Boolean invalid, Status status)
+ {
+ this.persistentInvalid = invalid;
+ if (!invalid)
+ {
+ this.status = VALID;
+ }
+ else
+ {
+ if (status == null || VALID.equals(status))
+ {
+ throw new IllegalArgumentException("Invalid status: " + status + " for an invalid property!");
+ }
+
+ this.status = status;
+ }
+ }
+
+ public void setValue(String stringValue)
+ {
+ // only change the value if it's not the same as the old one
+ if ((persistentValue != null && !persistentValue.equals(stringValue)) || (persistentValue == null && stringValue != null))
+ {
+ String oldValue = persistentValue;
+ persistentValue = stringValue;
+ persistentInvalid = null;
+ if (persistentValue == null)
+ {
+ status = MISSING_VALUE;
+ }
+ else
+ {
+ status = UNCHECKED_VALUE;
+ }
+
+ // notify listeners
+ notifyListener(oldValue, persistentValue);
+ }
+ }
+
+ public String getLang()
+ {
+ return persistentLang;
+ }
+
+ public void setLang(String lang)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "Lang", "RegistrationProperty");
+ this.persistentLang = lang;
+ }
+
+ public Status getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(Status status)
+ {
+ this.status = status;
+ }
+
+ private void notifyListener(String oldValue, String newValue)
+ {
+ // listener can be null, especially when props are unfrozen from Hibernate
+ if (listener != null)
+ {
+ listener.propertyValueChanged(this, oldValue, newValue);
+ }
+ }
+
+ public void setListener(PropertyChangeListener listener)
+ {
+ this.listener = listener;
+ }
+
+ /** todo: Should be package-only, public for tests... */
+ public static interface PropertyChangeListener
+ {
+ void propertyValueChanged(RegistrationProperty property, Object oldValue, Object newValue);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RenderHandler.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RenderHandler.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,307 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.URLFormat;
+import org.jboss.portal.portlet.api.cache.CacheScope;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.portlet.api.invocation.RenderInvocation;
+import org.jboss.portal.portlet.api.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.api.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.api.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.api.spi.PortletInvocationContext;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.WSRPPortletURL;
+import org.jboss.portal.wsrp.WSRPResourceURL;
+import org.jboss.portal.wsrp.WSRPRewritingConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.oasis.wsrp.v1.CacheControl;
+import org.oasis.wsrp.v1.Extension;
+import org.oasis.wsrp.v1.GetMarkup;
+import org.oasis.wsrp.v1.MarkupContext;
+import org.oasis.wsrp.v1.MarkupResponse;
+import org.oasis.wsrp.v1.PortletContext;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.oasis.wsrp.v1.SessionContext;
+import org.oasis.wsrp.v1.UserContext;
+
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12082 $
+ * @since 2.4 (May 31, 2006)
+ */
+public class RenderHandler extends InvocationHandler
+{
+
+ /** The separator constant. */
+ private static final String SEPARATOR = "_";
+
+ private static final org.jboss.portal.portlet.api.cache.CacheControl DEFAULT_CACHE_CONTROL = new org.jboss.portal.portlet.api.cache.CacheControl(0, CacheScope.PRIVATE, null);
+
+ public RenderHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof RenderInvocation))
+ {
+ throw new IllegalArgumentException("RenderHandler can only handle RenderInvocations!");
+ }
+
+ // Create the markup request
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+ log.debug("Consumer about to attempt rendering portlet '" + portletContext.getPortletHandle() + "'");
+ return WSRPTypeFactory.createMarkupRequest(portletContext, requestPrecursor.runtimeContext, requestPrecursor.markupParams);
+ }
+
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor)
+ {
+ MarkupResponse markupResponse = (MarkupResponse)response;
+ log.debug("Starting processing response");
+
+ // process the response
+ consumer.getSessionHandler().updateSessionIfNeeded(markupResponse.getSessionContext(), invocation,
+ requestPrecursor.getPortletHandle());
+
+ MarkupContext markupContext = markupResponse.getMarkupContext();
+ String markup = markupContext.getMarkupString();
+ byte[] binary = markupContext.getMarkupBinary();
+ if (markup != null && binary != null)
+ {
+ return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
+ "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ }
+
+ if (markup == null && binary == null)
+ {
+ if (markupContext.isUseCachedMarkup())
+ {
+ //todo: deal with cache
+ }
+ else
+ {
+ return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
+ " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ }
+ }
+
+ if (markup != null && markup.length() > 0)
+ {
+ markup = processMarkup(markup, invocation, Boolean.TRUE.equals(markupContext.isRequiresUrlRewriting()));
+ }
+ else
+ {
+ // todo: need to deal with binary
+ }
+
+ String mimeType = markupContext.getMimeType();
+ if (mimeType == null || mimeType.length() == 0)
+ {
+ return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
+ }
+
+ // generate appropriate CacheControl
+ org.jboss.portal.portlet.api.cache.CacheControl cacheControl = createCacheControl(markupContext);
+
+ FragmentResponse result = new FragmentResponse(null, null, mimeType, null, markup,
+ markupContext.getPreferredTitle(), cacheControl, invocation.getPortalContext().getModes());
+
+ log.debug("Response processed");
+ return result;
+ }
+
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ getRenderRequest(request).setUserContext(userContext);
+ }
+
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ getRenderRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ return getRenderRequest(request).getRuntimeContext();
+ }
+
+ protected Object performRequest(Object request) throws Exception
+ {
+ GetMarkup renderRequest = getRenderRequest(request);
+ log.debug("getMarkup on '" + renderRequest.getPortletContext().getPortletHandle() + "'");
+
+ // invocation
+ Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
+ Holder<MarkupContext> markupContextHolder = new Holder<MarkupContext>();
+ consumer.getMarkupService().getMarkup(renderRequest.getRegistrationContext(), renderRequest.getPortletContext(),
+ renderRequest.getRuntimeContext(), renderRequest.getUserContext(), renderRequest.getMarkupParams(),
+ markupContextHolder, sessionContextHolder, new Holder<List<Extension>>());
+ MarkupResponse markupResponse = new MarkupResponse();
+ markupResponse.setMarkupContext(markupContextHolder.value);
+ markupResponse.setSessionContext(sessionContextHolder.value);
+ return markupResponse;
+ }
+
+ private GetMarkup getRenderRequest(Object request)
+ {
+ if (request instanceof GetMarkup)
+ {
+ return (GetMarkup)request;
+ }
+
+ throw new IllegalArgumentException("RenderHandler: Request is not a GetMarkup request!");
+ }
+
+ private String processMarkup(String markup, PortletInvocation invocation, boolean rewriteURLs)
+ {
+ // fix-me: how to deal with fragment header? => interceptor?
+ String prefix = getNamespaceFrom(invocation.getWindowContext());
+
+ markup = Tools.replace(markup, WSRPRewritingConstants.WSRP_REWRITE_TOKEN, prefix);
+
+ if (rewriteURLs)
+ {
+ URLFormat format = new URLFormat(invocation.getSecurityContext().isSecure(),
+ invocation.getSecurityContext().isAuthenticated(), true, true);
+ WSRPURLRewriter rewriter = new WSRPURLRewriter(invocation.getContext(), format, consumer);
+ markup = URLTools.replaceURLsBy(markup, rewriter);
+ }
+
+ // means that the producer generated the URLs, so handle resources...
+ ResourceURLRewriter rewriter = new ResourceURLRewriter();
+ return URLTools.replaceURLsBy(markup, rewriter);
+ }
+
+ private org.jboss.portal.portlet.api.cache.CacheControl createCacheControl(MarkupContext markupContext)
+ {
+ CacheControl cacheControl = markupContext.getCacheControl();
+ org.jboss.portal.portlet.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;
+
+ int expires;
+ if (cacheControl != null)
+ {
+ expires = cacheControl.getExpires();
+ String userScope = cacheControl.getUserScope();
+
+ // check that we support the user scope...
+ if (consumer.supportsUserScope(userScope))
+ {
+ log.debug("RenderHandler.processRenderRequest: trying to cache markup " + userScope + " for " + expires + " seconds.");
+ CacheScope scope;
+ if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
+ {
+ scope = CacheScope.PUBLIC;
+ }
+ else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
+ {
+ scope = CacheScope.PRIVATE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
+ }
+
+ result = new org.jboss.portal.portlet.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
+ }
+ }
+
+ return result;
+ }
+
+ private static class WSRPURLRewriter extends URLTools.URLReplacementGenerator
+ {
+ private PortletInvocationContext context;
+ private URLFormat format;
+ private WSRPConsumer consumer;
+ private static final String SLASH = "/";
+
+ private WSRPURLRewriter(PortletInvocationContext context, URLFormat format, WSRPConsumer consumer)
+ {
+ this.context = context;
+ this.format = format;
+ this.consumer = consumer;
+ }
+
+ public String getReplacementFor(int currentIndex, URLTools.URLMatch currentMatch)
+ {
+ String urlAsString = currentMatch.getURLAsString();
+ ProducerInfo info = consumer.getProducerInfo();
+ if (urlAsString.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
+ {
+ WSRPPortletURL portletURL = WSRPPortletURL.create(urlAsString,
+ info.getSupportedCustomModes(), info.getSupportedCustomWindowStates());
+ if (portletURL instanceof WSRPResourceURL)
+ {
+ log.debug("URL '" + urlAsString + "' seems to refer to a resource which are not currently supported. " +
+ "Trying to use the raw URL but this probably won't work...");
+ return portletURL.toString();
+ }
+
+ // todo: this is a hack to circumvent frameworks that don't properly request resource encoding (icefaces)
+ if (urlAsString.startsWith(SLASH))
+ {
+ return info.getEndpointConfigurationInfo().getRemoteHostAddress() + urlAsString;
+ }
+
+ return context.renderURL(portletURL, format);
+ }
+ return urlAsString;
+ }
+ }
+
+ // @todo: public for tests
+ public static class ResourceURLRewriter extends URLTools.URLReplacementGenerator
+ {
+ public String getReplacementFor(int currentIndex, URLTools.URLMatch currentMatch)
+ {
+ String urlAsString = currentMatch.getURLAsString();
+ String prefix = WSRPRewritingConstants.FAKE_RESOURCE_START;
+ if (urlAsString.startsWith(prefix))
+ {
+ int index = urlAsString.indexOf(WSRPRewritingConstants.FAKE_RESOURCE_REQ_REW);
+ String requireRewriteStr = urlAsString.substring(index + WSRPRewritingConstants.FAKE_RESOURCE_REQ_REW.length());
+ boolean requireRewrite = Boolean.valueOf(requireRewriteStr);
+
+ urlAsString = urlAsString.substring(prefix.length(), index);
+ if (requireRewrite)
+ {
+ // FIX-ME: do something
+ log.debug("Required re-writing but this is not yet implemented...");
+ }
+ return URLTools.decodeXWWWFormURL(urlAsString);
+ }
+
+ return urlAsString;
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestContextWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestContextWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestContextWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.portlet.api.spi.RequestContext;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 10198 $
+ * @since 2.6
+ */
+public class RequestContextWrapper implements org.apache.commons.fileupload.RequestContext
+{
+ private RequestContext requestContext;
+
+ public RequestContextWrapper(RequestContext requestContext)
+ {
+ this.requestContext = requestContext;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return requestContext.getCharacterEncoding();
+ }
+
+ public String getContentType()
+ {
+ return requestContext.getContentType();
+ }
+
+ public int getContentLength()
+ {
+ return requestContext.getContentLength();
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return requestContext.getInputStream();
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestPrecursor.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.StateString;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.portlet.api.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.api.spi.SecurityContext;
+import org.jboss.portal.portlet.api.spi.UserContext;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.MarkupParams;
+import org.oasis.wsrp.v1.PortletContext;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+
+/**
+ * Extracts basic required elements for all invocation requests.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13121 $
+ * @since 2.4
+ */
+class RequestPrecursor
+{
+ private final static Logger log = LoggerFactory.getLogger(RequestPrecursor.class);
+
+ private PortletContext portletContext;
+ RuntimeContext runtimeContext;
+ MarkupParams markupParams;
+ private static final String PORTLET_HANDLE = "portlet handle";
+ private static final String SECURITY_CONTEXT = "security context";
+ private static final String USER_CONTEXT = "user context";
+ private static final String INVOCATION_CONTEXT = "invocation context";
+ private static final String STREAM_INFO = "stream info in invocation context";
+ private static final String USER_AGENT = "User-Agent";
+
+ public RequestPrecursor(WSRPConsumerImpl wsrpConsumer, PortletInvocation invocation) throws PortletInvokerException
+ {
+ // retrieve handle
+ portletContext = WSRPUtils.convertToWSRPPortletContext(WSRPConsumerImpl.getPortletContext(invocation));
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(getPortletHandle(), PORTLET_HANDLE, null);
+ log.debug("About to invoke on portlet: " + getPortletHandle());
+
+ // create runtime context
+ SecurityContext securityContext = invocation.getSecurityContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
+ String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
+ runtimeContext = WSRPTypeFactory.createRuntimeContext(authType);
+
+ // set the session id if needed
+ wsrpConsumer.getSessionHandler().setSessionIdIfNeeded(invocation, runtimeContext, getPortletHandle());
+
+ wsrpConsumer.setTemplatesIfNeeded(invocation, runtimeContext);
+
+ // create markup params
+ UserContext userContext = invocation.getUserContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
+ PortletInvocationContext context = invocation.getContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
+ ContentInfo streamInfo = context.getMarkupInfo();
+ ParameterValidation.throwIllegalArgExceptionIfNull(streamInfo, STREAM_INFO);
+
+ String mode;
+ try
+ {
+ mode = WSRPUtils.getWSRPNameFromJSR168PortletMode(invocation.getMode());
+ }
+ catch (Exception e)
+ {
+ log.debug("Mode was null in context.");
+ mode = WSRPConstants.VIEW_MODE;
+ }
+
+ String windowState;
+ try
+ {
+ windowState = WSRPUtils.getWSRPNameFromJSR168WindowState(invocation.getWindowState());
+ }
+ catch (Exception e)
+ {
+ log.debug("WindowState was null in context.");
+ windowState = WSRPConstants.NORMAL_WINDOW_STATE;
+ }
+
+ markupParams = WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
+ WSRPUtils.convertLocalesToRFC3066LanguageTags(userContext.getLocales()),
+ Collections.singletonList(streamInfo.getMediaType().getValue()), mode, windowState);
+ String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
+ markupParams.setClientData(WSRPTypeFactory.createClientData(userAgent));
+ StateString navigationalState = invocation.getNavigationalState();
+ if (navigationalState != null)
+ {
+ String state = navigationalState.getStringValue();
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ {
+ markupParams.setNavigationalState(state);
+ }
+ }
+
+ log.debug(WSRPUtils.toString(markupParams));
+ }
+
+ public String getPortletHandle()
+ {
+ return portletContext.getPortletHandle();
+ }
+
+
+ public PortletContext getPortletContext()
+ {
+ return portletContext;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/SessionHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/SessionHandler.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/SessionHandler.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,435 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.InvokerUnavailableException;
+import org.jboss.portal.portlet.api.Portlet;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.wsrp.api.SessionEvent;
+import org.jboss.portal.wsrp.api.SessionEventListener;
+import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
+import org.jboss.portal.wsrp.handler.RequestHeaderClientHandler;
+import org.oasis.wsrp.v1.CookieProtocol;
+import org.oasis.wsrp.v1.InvalidRegistration;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.oasis.wsrp.v1.SessionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpSession;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Manages session informations on behalf of a consumer.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9360 $
+ * @since 2.4 (May 31, 2006)
+ */
+public class SessionHandler implements SessionEventListener
+{
+ protected WSRPConsumerImpl consumer;
+ private static Logger log = LoggerFactory.getLogger(SessionHandler.class);
+
+ /** Cookie protocol required by the producer with the consumer */
+ private CookieProtocol requiresInitCookie;
+
+ /** The prefix used to isolate WSRP-related session information in the actual session object. */
+ private static final String SESSION_ID_PREFIX = "org.jboss.portal.wsrp.session.";
+
+ /** session id -> ProducerSessionInformation */
+ private Map<String, ProducerSessionInformation> sessionInfos = new HashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
+
+ /**
+ * Constructs a new SessionHandler.
+ *
+ * @param consumer the consumer this SessionHandler is associated with.
+ */
+ public SessionHandler(WSRPConsumerImpl consumer)
+ {
+ this.consumer = consumer;
+ }
+
+ public boolean isPerUserCookieInit()
+ {
+ return CookieProtocol.PER_USER.equals(requiresInitCookie);
+ }
+
+ public boolean requiresInitCookie()
+ {
+ return requiresInitCookie != null && !CookieProtocol.NONE.equals(requiresInitCookie);
+ }
+
+ public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
+ {
+ this.requiresInitCookie = requiresInitCookie;
+ }
+
+ void initProducerSessionInformation(PortletInvocation invocation) throws PortletInvokerException
+ {
+ // if we need cookies, set the current group id
+ String groupId;
+ if (requiresGroupInitCookie())
+ {
+ WSRPPortletInfo info = consumer.getPortletInfo(invocation);
+ groupId = info.getGroupId();
+ }
+ else
+ {
+ groupId = null;
+ }
+
+ RequestHeaderClientHandler.setCurrentInfo(groupId, getProducerSessionInformation(invocation, true));
+ }
+
+ private boolean requiresGroupInitCookie()
+ {
+ return requiresInitCookie() && CookieProtocol.PER_GROUP.equals(requiresInitCookie);
+ }
+
+ /** Resets the information held by RequestHeaderClientHandler for the current interaction. */
+ public void resetCurrentlyHeldInformation()
+ {
+ RequestHeaderClientHandler.resetCurrentInfo();
+ }
+
+ public void initCookieIfNeeded(PortletInvocation invocation) throws PortletInvokerException
+ {
+ initCookieIfNeeded(invocation, true);
+ }
+
+ private void initCookieIfNeeded(PortletInvocation invocation, boolean retryIfFails) throws PortletInvokerException
+ {
+ // check if the cookie protocol requires cookie initialization
+ if (!requiresInitCookie())
+ {
+ return;
+ }
+
+ // check if we have already initialized cookies for this user
+ ProducerSessionInformation sessionInformation = getProducerSessionInformation(invocation);
+ if (sessionInformation.isInitCookieDone())
+ {
+ return;
+ }
+ RequestHeaderClientHandler.setCurrentInfo(null, sessionInformation);
+
+ if (isPerUserCookieInit())
+ {
+ log.debug("Cookie initialization per user requested.");
+ sessionInformation.setPerGroupCookies(false);
+ initCookie(invocation, retryIfFails);
+ }
+ else
+ {
+ log.debug("Cookie initialization per group requested.");
+ sessionInformation.setPerGroupCookies(true);
+ Map<String, Set<Portlet>> groups = consumer.getPortletGroupMap();
+
+ try
+ {
+ for (String groupId : groups.keySet())
+ {
+ RequestHeaderClientHandler.setCurrentGroupId(groupId);
+ log.debug("Initializing cookie for group '" + groupId + "'.");
+ initCookie(invocation, retryIfFails);
+ }
+ }
+ finally
+ {
+ resetCurrentlyHeldInformation();
+ }
+ }
+
+ sessionInformation.setInitCookieDone(true);
+ }
+
+ private void initCookie(PortletInvocation invocation, boolean retryIfFails) throws PortletInvokerException
+ {
+ try
+ {
+ consumer.getMarkupService().initCookie(consumer.getRegistrationContext());
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ consumer.handleInvalidRegistrationFault();
+ if (retryIfFails)
+ {
+ initCookieIfNeeded(invocation, false);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new InvokerUnavailableException("Couldn't init cookies!", e);
+ }
+ }
+
+ void setSessionIdIfNeeded(PortletInvocation invocation, RuntimeContext runtimeContext, String portletHandle)
+ {
+ ProducerSessionInformation producerSessionInfo = getProducerSessionInformation(invocation, false);
+ if (producerSessionInfo != null)
+ {
+ String sessionId = producerSessionInfo.getSessionIdForPortlet(portletHandle);
+ runtimeContext.setSessionID(sessionId);
+ }
+ }
+
+ void updateSessionIfNeeded(SessionContext sessionContext, PortletInvocation invocation, String portletHandle)
+ {
+ if (sessionContext != null)
+ {
+ log.debug("Portlet '" + portletHandle + "' created session with id '" + sessionContext.getSessionID() + "'");
+ ProducerSessionInformation sessionInfo = getProducerSessionInformation(invocation);
+ sessionInfo.addSessionForPortlet(portletHandle, sessionContext);
+ }
+ }
+
+ void updateCookiesIfNeeded(PortletInvocation invocation)
+ {
+ ProducerSessionInformation sessionInfo = getProducerSessionInformation(invocation, true);
+ ProducerSessionInformation currentSessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
+ sessionInfo.replaceUserCookiesWith(currentSessionInfo);
+ }
+
+ ProducerSessionInformation getProducerSessionInformation(PortletInvocation invocation)
+ {
+ return getProducerSessionInformation(invocation, true);
+ }
+
+ private ProducerSessionInformation getProducerSessionInformation(PortletInvocation invocation, boolean create)
+ {
+ HttpSession session = WSRPConsumerImpl.getHttpSession(invocation);
+ return getProducerSessionInformation(session, create);
+ }
+
+ ProducerSessionInformation getProducerSessionInformation(HttpSession session)
+ {
+ return getProducerSessionInformation(session, false);
+ }
+
+ private ProducerSessionInformation getProducerSessionInformation(HttpSession session, boolean create)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(session, "Session");
+ String producerSessionKey = getProducerSessionInformationKey();
+ ProducerSessionInformation sessionInformation = (ProducerSessionInformation)session.getAttribute(producerSessionKey);
+
+ if (sessionInformation != null)
+ {
+ sessionInformation.setParent(this);
+ sessionInformation.setParentSessionId(session.getId());
+ }
+ else
+ {
+ if (create)
+ {
+ sessionInformation = new ProducerSessionInformation();
+ sessionInformation.setParentSessionId(session.getId());
+ session.setAttribute(producerSessionKey, sessionInformation);
+ sessionInformation.setParent(this);
+ }
+ }
+
+ return sessionInformation;
+ }
+
+ private String getProducerSessionInformationKey()
+ {
+ return SESSION_ID_PREFIX + consumer.getProducerId();
+ }
+
+ void handleInvalidSessionFault(PortletInvocation invocation, RuntimeContext runtimeContext)
+ {
+ log.info("Resending information after InvalidSessionFault");
+ // invalidate current session
+ invalidateSession(invocation);
+
+ // set the session id to null
+ runtimeContext.setSessionID(null);
+ }
+
+ private void invalidateSession(PortletInvocation invocation)
+ {
+ HttpSession session = WSRPConsumerImpl.getHttpSession(invocation);
+
+ // remove the associated info from the known producer session informations
+
+ ProducerSessionInformation info = getProducerSessionInformation(session, false);
+ if (info != null)
+ {
+ try
+ {
+ internalReleaseSessions(info.removeSessions());
+ }
+ catch (PortletInvokerException e)
+ {
+ // ignore since it's logged by internalReleaseSessions already
+ }
+ }
+
+
+ session.removeAttribute(getProducerSessionInformationKey());
+ RequestHeaderClientHandler.resetCurrentInfo();
+ }
+
+ /** @since 2.6 */
+ void releaseSessions() throws PortletInvokerException
+ {
+ List<String> idsToRelease = new ArrayList<String>();
+
+ Set<ProducerSessionInformation> uniqueInfos = new HashSet<ProducerSessionInformation>(sessionInfos.values());
+
+ for (ProducerSessionInformation info : uniqueInfos)
+ {
+ idsToRelease.addAll(info.removeSessions());
+ }
+
+ internalReleaseSessions(idsToRelease);
+ }
+
+ /**
+ * @param sessionIds
+ * @throws PortletInvokerException
+ * @since 2.6
+ */
+ void releaseSessions(String[] sessionIds) throws PortletInvokerException
+ {
+ if (sessionIds != null)
+ {
+ List<String> idsToRelease = new ArrayList<String>();
+
+ for (String sessionId : sessionIds)
+ {
+ ProducerSessionInformation info = sessionInfos.get(sessionId);
+ sessionId = info.removeSession(sessionId);
+ if (sessionId != null)
+ {
+ idsToRelease.add(sessionId);
+ }
+ }
+
+ internalReleaseSessions(idsToRelease);
+ }
+ }
+
+ private void internalReleaseSessions(List<String> idsToRelease) throws PortletInvokerException
+ {
+ if (idsToRelease != null && !idsToRelease.isEmpty())
+ {
+ try
+ {
+ consumer.getMarkupService().releaseSessions(consumer.getRegistrationContext(), idsToRelease);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ log.debug("Invalid Registration");
+ consumer.handleInvalidRegistrationFault();
+ }
+ catch (Exception e)
+ {
+ String message = "Couldn't release sessions " + idsToRelease;
+ log.debug(message, e);
+ throw new PortletInvokerException(message, e);
+ }
+ }
+ }
+
+ // ProducerSessionInformation callbacks
+
+ /**
+ * Update session mappings when a session has expired
+ *
+ * @param id
+ * @since 2.6
+ */
+ void removeSessionId(String id)
+ {
+ sessionInfos.remove(id);
+ }
+
+ /**
+ * Update session mappings when a new session id is added to the specified ProducerSessionInformation
+ *
+ * @param sessionID
+ * @param producerSessionInformation
+ * @since 2.6
+ */
+ void addSessionMapping(String sessionID, ProducerSessionInformation producerSessionInformation)
+ {
+ sessionInfos.put(sessionID, producerSessionInformation);
+ }
+
+ // End ProducerSessionInformation callbacks
+
+ // SessionEventListener implementation
+
+ public void sessionCreated(SessionEvent event)
+ {
+ // nothing to do
+ }
+
+ public void sessionDestroyed(SessionEvent event)
+ {
+ String id = event.getSession().getId();
+
+ // check if the session being destroyed is the one associated with this thread
+ ProducerSessionInformation info = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
+ if (info != null)
+ {
+ if (id != null && id.equals(info.getParentSessionId()))
+ {
+ try
+ {
+ internalReleaseSessions(info.removeSessions());
+ }
+ catch (PortletInvokerException e)
+ {
+ // already logged...
+ }
+ log.debug("Released session '" + id + "' after session was destroyed by Portal.");
+ }
+ }
+ }
+
+ /**
+ * @param originalHandle
+ * @param newHandle
+ * @param invocation
+ * @since 2.6
+ */
+ public void updateSessionInfoFor(String originalHandle, String newHandle, PortletInvocation invocation)
+ {
+ ProducerSessionInformation info = getProducerSessionInformation(invocation, false);
+ if (info != null)
+ {
+ info.updateHandleAssociatedInfo(originalHandle, newHandle);
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,689 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.InvokerUnavailableException;
+import org.jboss.portal.portlet.api.NoSuchPortletException;
+import org.jboss.portal.portlet.api.Portlet;
+import org.jboss.portal.portlet.api.PortletContext;
+import org.jboss.portal.portlet.api.PortletInvokerException;
+import org.jboss.portal.portlet.api.invocation.ActionInvocation;
+import org.jboss.portal.portlet.api.invocation.PortletInvocation;
+import org.jboss.portal.portlet.api.invocation.RenderInvocation;
+import org.jboss.portal.portlet.api.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.api.spi.UserContext;
+import org.jboss.portal.portlet.api.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.api.state.PropertyChange;
+import org.jboss.portal.portlet.api.state.PropertyMap;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.wsrp.UserContextConverter;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.api.SessionEvent;
+import org.jboss.portal.wsrp.consumer.portlet.WSRPPortlet;
+import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
+import org.jboss.portal.wsrp.services.ServiceFactory;
+import org.jboss.portal.wsrp.servlet.UserAccess;
+import org.oasis.wsrp.v1.DestroyFailed;
+import org.oasis.wsrp.v1.Extension;
+import org.oasis.wsrp.v1.Property;
+import org.oasis.wsrp.v1.PropertyList;
+import org.oasis.wsrp.v1.RegistrationContext;
+import org.oasis.wsrp.v1.RegistrationData;
+import org.oasis.wsrp.v1.ResetProperty;
+import org.oasis.wsrp.v1.RuntimeContext;
+import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.xml.ws.Holder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11692 $
+ * @since 2.4
+ */
+public class WSRPConsumerImpl implements WSRPConsumer
+{
+ private ActionHandler actionHandler;
+ private RenderHandler renderHandler;
+ private SessionHandler sessionHandler;
+
+ private ProducerInfo producerInfo;
+
+ /** A registration data element used to indicate when no registration was required by the producer */
+ private final static RegistrationData REGISTRATION_NOT_NEEDED = WSRPTypeFactory.createDefaultRegistrationData();
+
+ private final static Logger log = LoggerFactory.getLogger(WSRPConsumer.class);
+
+ static
+ {
+ REGISTRATION_NOT_NEEDED.setConsumerAgent("INVALID AGENT");
+ REGISTRATION_NOT_NEEDED.setConsumerName("INVALID NAME");
+ }
+
+ /** The default user scopes as per the specification (6.1.4) */
+ private static final Set<String> WSRP_DEFAULT_USER_SCOPE = new HashSet<String>(2);
+
+ static
+ {
+ WSRP_DEFAULT_USER_SCOPE.add(WSRPConstants.CACHE_FOR_ALL);
+ WSRP_DEFAULT_USER_SCOPE.add(WSRPConstants.CACHE_PER_USER);
+ }
+
+ /** The set of supported user scopes */
+ private Set supportedUserScopes = WSRP_DEFAULT_USER_SCOPE; // todo: make it possible to support different user scopes
+ private transient boolean started;
+
+ public WSRPConsumerImpl()
+ {
+ this(new ProducerInfo());
+ }
+
+ WSRPConsumerImpl(ProducerInfo info)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(info, "ProducerInfo");
+
+ producerInfo = info;
+ actionHandler = new ActionHandler(this);
+ renderHandler = new RenderHandler(this);
+ sessionHandler = new SessionHandler(this);
+ }
+
+ public ProducerInfo getProducerInfo()
+ {
+ return producerInfo;
+ }
+
+ public void setProducerInfo(ProducerInfo producerInfo)
+ {
+ this.producerInfo = producerInfo;
+ }
+
+ // PortletInvoker implementation ************************************************************************************
+
+ public Set getPortlets() throws InvokerUnavailableException
+ {
+ try
+ {
+ Map portletMap = producerInfo.getPortletMap();
+ return new LinkedHashSet(portletMap.values());
+ }
+ catch (Exception e)
+ {
+ throw new InvokerUnavailableException(e.getMessage(), e.getCause());
+ }
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
+
+ Portlet portlet = producerInfo.getPortlet(portletContext);
+
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletContext.getId());
+ }
+ else
+ {
+ return portlet;
+ }
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ InvocationHandler handler;
+
+ if (invocation instanceof RenderInvocation)
+ {
+ handler = renderHandler;
+ }
+ else if (invocation instanceof ActionInvocation)
+ {
+ handler = actionHandler;
+ }
+ else
+ {
+ throw new InvocationException("Unknown invocation type: " + invocation);
+ }
+
+ return handler.handle(invocation);
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
+
+ WSRPPortlet original = getWSRPPortlet(portletContext);
+ if (original == null)
+ {
+ throw new PortletInvokerException("No portlet '" + portletContext.getId() + "' to clone!");
+ }
+
+ try
+ {
+ Holder<String> handle = new Holder<String>();
+ Holder<byte[]> portletState = new Holder<byte[]>();
+ getPortletManagementService().clonePortlet(getRegistrationContext(),
+ WSRPUtils.convertToWSRPPortletContext(portletContext), UserAccess.getUserContext(), handle, portletState,
+ new Holder<List<Extension>>()
+ );
+ return WSRPUtils.convertToPortalPortletContext(handle.value, portletState.value);
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't clone portlet '" + portletContext.getId() + "'", e);
+ }
+ }
+
+ public List destroyClones(List portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContexts, "Portlet identifiers");
+
+ int numberOfClones = portletContexts.size();
+ if (numberOfClones == 0)
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ List<String> handles = new ArrayList<String>(numberOfClones);
+ for (Object portletContext : portletContexts)
+ {
+ PortletContext context = (PortletContext)portletContext;
+ String id = context.getId();
+ handles.add(id);
+ }
+ log.debug("Attempting to destroy clones: " + handles);
+
+ try
+ {
+ Holder<List<DestroyFailed>> destroyFailed = new Holder<List<DestroyFailed>>();
+
+ getPortletManagementService().destroyPortlets(getRegistrationContext(), handles, destroyFailed, new Holder<List<Extension>>());
+
+ List<DestroyFailed> failures = destroyFailed.value;
+ List<DestroyCloneFailure> result = Collections.emptyList();
+ if (failures != null)
+ {
+ result = new ArrayList<DestroyCloneFailure>(failures.size());
+ // list all the failures and successes
+ for (DestroyFailed failure : failures)
+ {
+ String handle = failure.getPortletHandle();
+ result.add(new DestroyCloneFailure(handle, failure.getReason()));
+ handles.remove(handle);
+ log.debug("Couldn't destroy clone '" + handle + "'");
+ }
+ }
+
+ // update ProducerInfo's caches by removing all the successfully destroyed clones
+ if (!handles.isEmpty())
+ {
+ for (String handle : handles)
+ {
+ producerInfo.removeHandleFromCaches(handle);
+ }
+ }
+
+ return result;
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't destroy clones.", e);
+ }
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(keys, "Portlet ids");
+
+ return getProperties(portletContext, new ArrayList<String>(keys));
+ }
+
+ private PropertyMap getProperties(PortletContext portletContext, List<String> keys) throws PortletInvokerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
+
+ try
+ {
+ Holder<List<Property>> properties = new Holder<List<Property>>();
+ Holder<List<ResetProperty>> resetProperties = new Holder<List<ResetProperty>>();
+ getPortletManagementService().getPortletProperties(
+ getRegistrationContext(),
+ WSRPUtils.convertToWSRPPortletContext(portletContext),
+ UserAccess.getUserContext(),
+ keys,
+ properties,
+ resetProperties,
+ new Holder<List<Extension>>()
+ );
+
+ List<Property> props = properties.value;
+ if (props != null)
+ {
+ PropertyMap result = new SimplePropertyMap(props.size());
+
+ for (Property prop : props)
+ {
+ String name = prop.getName();
+ String value = prop.getStringValue();
+ List<String> list = new ArrayList<String>();
+ list.add(value);
+ result.put(name, list); // todo: is that all?!?
+ }
+
+ return result;
+ }
+ else
+ {
+ return new SimplePropertyMap();
+ }
+ }
+ catch (Exception e)
+ {
+ // something went wrong but support for getPortletProperties is optional so return an empty PropertyMap
+ log.debug("Couldn't get properties for portlet '" + portletContext.getId() + "'", e);
+ return new SimplePropertyMap();
+ }
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ return getProperties(portletContext, Collections.<String>emptyList());
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException,
+ PortletInvokerException, UnsupportedOperationException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(changes, "Property changes");
+
+ WSRPPortlet portlet = getWSRPPortlet(portletContext);
+ if (portlet == null)
+ {
+ throw new PortletInvokerException("Cannot set properties on portlet '" + portletContext.getId()
+ + "' because there is no such portlet.");
+ }
+
+ PropertyList propertyList = WSRPTypeFactory.createPropertyList();
+ int changesNumber = changes.length;
+ List<Property> updates = new ArrayList<Property>(changesNumber);
+ List<ResetProperty> resets = new ArrayList<ResetProperty>(changesNumber);
+ for (int i = 0; i < changesNumber; i++)
+ {
+ PropertyChange change = changes[i];
+ switch (change.getType())
+ {
+ case PropertyChange.PREF_RESET:
+ resets.add(WSRPTypeFactory.createResetProperty(change.getKey()));
+ break;
+
+ case PropertyChange.PREF_UPDATE:
+ // todo: deal with language more appropriately
+ updates.add(WSRPTypeFactory.createProperty(change.getKey(),
+ WSRPUtils.toString(Locale.getDefault()), change.getValue().get(0)));
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unexpected property change type: " + change.getType());
+ }
+ }
+ propertyList.getProperties().addAll(updates);
+ propertyList.getResetProperties().addAll(resets);
+
+ try
+ {
+ Holder<String> handle = new Holder<String>();
+ Holder<byte[]> portletState = new Holder<byte[]>();
+ getPortletManagementService().setPortletProperties(getRegistrationContext(),
+ WSRPUtils.convertToWSRPPortletContext(portletContext),
+ UserAccess.getUserContext(),
+ propertyList,
+ handle,
+ portletState,
+ new Holder<List<Extension>>()
+ );
+ PortletContext newPortletContext = PortletContext.createPortletContext(handle.value, portletState.value);
+ portlet.setPortletContext(newPortletContext);
+ return newPortletContext;
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Unable to set properties for portlet '" + portletContext.getId() + "'", e);
+ }
+ }
+
+ // Accessors ********************************************************************************************************
+
+ public String getProducerId()
+ {
+ return producerInfo.getId();
+ }
+
+ public SessionHandler getSessionHandler()
+ {
+ return sessionHandler;
+ }
+
+ // Portlet-related methods ******************************************************************************************
+
+ public Map<String, Set<Portlet>> getPortletGroupMap() throws PortletInvokerException
+ {
+ return producerInfo.getPortletGroupMap();
+ }
+
+ /**
+ * @param invocation
+ * @return
+ * @since 2.6
+ */
+ static PortletContext getPortletContext(PortletInvocation invocation)
+ {
+ return invocation.getTarget();
+ }
+
+ WSRPPortletInfo getPortletInfo(PortletInvocation invocation) throws PortletInvokerException
+ {
+ return (WSRPPortletInfo)getWSRPPortlet(getPortletContext(invocation)).getInfo();
+ }
+
+ WSRPPortlet getWSRPPortlet(PortletContext portletContext) throws PortletInvokerException
+ {
+ return (WSRPPortlet)getPortlet(portletContext);
+ }
+
+ public Set getSupportedUserScopes()
+ {
+ return Collections.unmodifiableSet(supportedUserScopes);
+ }
+
+ /**
+ * Determines whether the specified user scope (for markup caching) is supported.
+ *
+ * @param userScope the user scope which support is to be determined
+ * @return <code>true</code> if the given user scope is supported, <code>false</code> otherwise
+ */
+ public boolean supportsUserScope(String userScope)
+ {
+ return supportedUserScopes.contains(userScope);
+ }
+
+ // Registration *****************************************************************************************************
+
+ void handleInvalidRegistrationFault() throws PortletInvokerException
+ {
+ // reset registration data and try again
+ producerInfo.resetRegistration();
+ refreshProducerInfo(true);
+ }
+
+ RegistrationContext getRegistrationContext() throws PortletInvokerException
+ {
+ return producerInfo.getRegistrationContext();
+ }
+
+ // Session information access ***************************************************************************************
+
+ public ProducerSessionInformation getProducerSessionInformationFrom(PortletInvocation invocation)
+ {
+ return sessionHandler.getProducerSessionInformation(invocation);
+ }
+
+ public ProducerSessionInformation getProducerSessionInformationFrom(HttpSession session)
+ {
+ return sessionHandler.getProducerSessionInformation(session);
+ }
+
+
+ public void activate() throws Exception
+ {
+ internalStart();
+ producerInfo.setActiveAndSave(getEndpointConfigurationInfo().isAvailable());
+ }
+
+ private void internalStart() throws Exception
+ {
+ if (!started)
+ {
+ try
+ {
+ start();
+ }
+ catch (Exception e)
+ {
+ // mark the consumer as inactive if it cannot be started
+ producerInfo.setActiveAndSave(false);
+ throw e;
+ }
+
+ log.info("Consumer with id '" + getProducerId() + "' activated");
+ }
+ }
+
+ public void deactivate() throws Exception
+ {
+ producerInfo.setActiveAndSave(false);
+ if (started)
+ {
+ stop();
+ log.info("Consumer with id '" + getProducerId() + "' deactivated");
+ }
+ }
+
+ public boolean isActive()
+ {
+ return producerInfo.isActive() && started;
+ }
+
+ public boolean isRefreshNeeded()
+ {
+ return !started || producerInfo.isRefreshNeeded(false);
+ }
+
+ public RefreshResult refresh(boolean forceRefresh) throws PortletInvokerException
+ {
+ try
+ {
+ internalStart();
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException(e);
+ }
+
+ RefreshResult refreshResult = producerInfo.detailedRefresh(forceRefresh);
+ sessionHandler.setRequiresInitCookie(producerInfo.getRequiresInitCookie());
+ return refreshResult;
+ }
+
+ // Service implementation *******************************************************************************************
+
+ public void start() throws Exception
+ {
+ getEndpointConfigurationInfo().start();
+ started = true;
+ log.info("Consumer with id '" + getProducerId() + "' started");
+ }
+
+ public void stop() throws Exception
+ {
+ getEndpointConfigurationInfo().stop();
+ started = false;
+ log.info("Consumer with id '" + getProducerId() + "' stopped");
+ }
+
+ // Web services access **********************************************************************************************
+
+ /**
+ * Needed to wire Consumer tests.
+ *
+ * @param serviceFactory
+ */
+ public void setServiceFactory(ServiceFactory serviceFactory)
+ {
+ getEndpointConfigurationInfo().setServiceFactory(serviceFactory);
+ }
+
+ private EndpointConfigurationInfo getEndpointConfigurationInfo()
+ {
+ return producerInfo.getEndpointConfigurationInfo();
+ }
+
+ public WSRPV1ServiceDescriptionPortType getServiceDescriptionService() throws PortletInvokerException
+ {
+ refreshProducerInfo(false);
+ return getEndpointConfigurationInfo().getServiceDescriptionService();
+ }
+
+ public WSRPV1MarkupPortType getMarkupService() throws PortletInvokerException
+ {
+ refreshProducerInfo(false);
+ return getEndpointConfigurationInfo().getMarkupService();
+ }
+
+ public WSRPV1PortletManagementPortType getPortletManagementService() throws PortletInvokerException
+ {
+ refreshProducerInfo(false);
+ return getEndpointConfigurationInfo().getPortletManagementService();
+ }
+
+ public WSRPV1RegistrationPortType getRegistrationService() throws PortletInvokerException
+ {
+ refreshProducerInfo(false);
+ return getEndpointConfigurationInfo().getRegistrationService();
+ }
+
+ public void refreshProducerInfo() throws PortletInvokerException
+ {
+ refreshProducerInfo(true);
+ }
+
+ private void refreshProducerInfo(boolean forceRefresh) throws PortletInvokerException
+ {
+ producerInfo.refresh(forceRefresh);
+ sessionHandler.setRequiresInitCookie(producerInfo.getRequiresInitCookie());
+ }
+
+ public void releaseSessions() throws PortletInvokerException
+ {
+ sessionHandler.releaseSessions();
+ }
+
+// Support methods **************************************************************************************************
+
+ private String getUserContextKeyFor(UserContext userContext)
+ {
+ // fix-me: probably need to have an Id attribute on userId context.
+ String userId = userContext.getId();
+ if (userId != null)
+ {
+ return userId;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ // fix-me!
+ org.oasis.wsrp.v1.UserContext getUserContextFrom(PortletInvocation invocation, RuntimeContext runtimeContext) throws PortletInvokerException
+ {
+ // first decide if we need to pass the user context...
+ WSRPPortletInfo info = getPortletInfo(invocation);
+
+ if (info != null && info.isUserContextStoredInSession() && runtimeContext.getSessionID() != null)
+ {
+ return null; // the user context is most likely in the session already
+ }
+
+ // todo: deal with user categories and user context key properly
+ UserContext userContext = invocation.getUserContext();
+ if (userContext != null)
+ {
+ String userContextKey = getUserContextKeyFor(userContext);
+ if (userContextKey == null)
+ {
+ return null;
+ }
+
+ return UserContextConverter.createWSRPUserContextFrom(userContext, userContextKey, null);
+ }
+ return null;
+ }
+
+ void setTemplatesIfNeeded(PortletInvocation invocation, RuntimeContext runtimeContext) throws PortletInvokerException
+ {
+ // todo: could store templates in producer session info to avoid to re-generate them all the time?
+ WSRPPortletInfo info = getPortletInfo(invocation);
+
+ if (info != null && info.isDoesUrlTemplateProcessing()
+ && (!info.isTemplatesStoredInSession() || runtimeContext.getSessionID() == null))
+ {
+ // we need to supply the templates since the portlet does URL processing and either doesn't store
+ // templates in the session or no session has been established yet
+ runtimeContext.setTemplates(WSRPTypeFactory.createTemplates(invocation.getContext()));
+ }
+ }
+
+ static HttpServletRequest getHttpRequest(PortletInvocation invocation)
+ {
+ AbstractPortletInvocationContext invocationContext = (AbstractPortletInvocationContext)invocation.getContext();
+ return invocationContext.getClientRequest();
+ }
+
+ static HttpSession getHttpSession(PortletInvocation invocation)
+ {
+ return getHttpRequest(invocation).getSession();
+ }
+
+ public void sessionCreated(SessionEvent event)
+ {
+ sessionHandler.sessionCreated(event);
+ }
+
+ public void sessionDestroyed(SessionEvent event)
+ {
+ sessionHandler.sessionDestroyed(event);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer.portlet;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.Portlet;
+import org.jboss.portal.portlet.api.PortletContext;
+import org.jboss.portal.portlet.api.info.PortletInfo;
+import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
+
+/**
+ * Simple implementation of org.jboss.portal.portlet.Portlet interface
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 8784 $
+ */
+public class WSRPPortlet implements Portlet
+{
+
+ private PortletContext portletContext;
+ private PortletInfo info;
+
+ public WSRPPortlet()
+ {
+ }
+
+ /**
+ *
+ */
+ public WSRPPortlet(PortletContext context, PortletInfo info)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(context, "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(info, "PortletInfo");
+ this.portletContext = context;
+ this.info = info;
+ }
+
+ public static WSRPPortlet createClone(PortletContext newContext, WSRPPortletInfo originalInfo)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(newContext, "PortletContext");
+ return new WSRPPortlet(newContext, new WSRPPortletInfo(originalInfo, newContext.getId()));
+ }
+
+ /** Portlet interface implemented methods */
+
+ public PortletContext getContext()
+ {
+ return portletContext;
+ }
+
+ public PortletInfo getInfo()
+ {
+ if (info == null)
+ {
+ throw new IllegalStateException("No PortletInfo was set for WSRPPortlet '" + portletContext.getId() + "'");
+ }
+ return info;
+ }
+
+ public boolean isRemote()
+ {
+ return true;
+ }
+
+ public void setInfo(PortletInfo info)
+ {
+ this.info = info;
+ }
+
+
+ public WSRPPortletInfo getWSRPInfo()
+ {
+ return (WSRPPortletInfo)getInfo();
+ }
+
+ public void setPortletContext(PortletContext context)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(context, "PortletContext");
+ this.portletContext = context;
+ }
+
+
+ public String toString()
+ {
+ return "WSRPPortlet[context=" + portletContext + "]";
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,711 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.consumer.portlet.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.api.TransportGuarantee;
+import org.jboss.portal.portlet.api.info.CacheInfo;
+import org.jboss.portal.portlet.api.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.api.info.EventInfo;
+import org.jboss.portal.portlet.api.info.EventingInfo;
+import org.jboss.portal.portlet.api.info.MetaInfo;
+import org.jboss.portal.portlet.api.info.ModeInfo;
+import org.jboss.portal.portlet.api.info.NavigationInfo;
+import org.jboss.portal.portlet.api.info.ParameterInfo;
+import org.jboss.portal.portlet.api.info.PreferenceInfo;
+import org.jboss.portal.portlet.api.info.PreferencesInfo;
+import org.jboss.portal.portlet.api.info.RuntimeOptionInfo;
+import org.jboss.portal.portlet.api.info.SecurityInfo;
+import org.jboss.portal.portlet.api.info.WindowStateInfo;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.oasis.wsrp.v1.LocalizedString;
+import org.oasis.wsrp.v1.MarkupType;
+import org.oasis.wsrp.v1.ModelDescription;
+import org.oasis.wsrp.v1.PortletDescription;
+import org.oasis.wsrp.v1.PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v1.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12025 $
+ * @since 2.4 (Apr 30, 2006)
+ */
+public class WSRPPortletInfo implements org.jboss.portal.portlet.api.info.PortletInfo
+{
+
+ private WSRPCapabilitiesInfo capabilities;
+ private MetaInfo metaInfo;
+ private boolean usesMethodGet;
+ private boolean defaultMarkupSecure;
+ private boolean onlySecure;
+ private boolean hasUserSpecificState;
+ private boolean userContextStoredInSession;
+ private boolean templatesStoredInSession;
+ private boolean doesUrlTemplateProcessing;
+ private String groupId;
+ private PreferencesInfo prefInfo;
+ private ProducerInfo originatingProducer;
+ private String portletHandle;
+
+ public WSRPPortletInfo(final PortletDescription portletDescription, ProducerInfo originatingProducerInfo)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletDescription, "PortletDescription");
+ ParameterValidation.throwIllegalArgExceptionIfNull(originatingProducerInfo, "ProducerInfo");
+
+ createCapabilitiesInfo(portletDescription);
+
+ createMetaInfo(portletDescription);
+
+ createWSRPInfo(portletDescription);
+
+ this.originatingProducer = originatingProducerInfo;
+ this.portletHandle = portletDescription.getPortletHandle();
+ }
+
+
+ public WSRPPortletInfo(WSRPPortletInfo other, String newHandle)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(other, "WSRPPortletInfo");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(newHandle, "new portlet handle", "WSRPPortletInfo");
+
+ usesMethodGet = other.usesMethodGet;
+ defaultMarkupSecure = other.defaultMarkupSecure;
+ onlySecure = other.onlySecure;
+ hasUserSpecificState = other.hasUserSpecificState;
+ userContextStoredInSession = other.userContextStoredInSession;
+ templatesStoredInSession = other.templatesStoredInSession;
+ doesUrlTemplateProcessing = other.doesUrlTemplateProcessing;
+ groupId = other.groupId; // should be duplicate group id?
+
+ WSRPCapabilitiesInfo otherCapabilities = (WSRPCapabilitiesInfo)other.getCapabilities();
+ capabilities = new WSRPCapabilitiesInfo(new HashMap<MediaType, MediaTypeInfo>(otherCapabilities.mediaTypes),
+ new HashSet<ModeInfo>(otherCapabilities.modes), new HashSet<WindowStateInfo>(otherCapabilities.windowStates),
+ new HashSet<Locale>(otherCapabilities.locales));
+
+ WSRPMetaInfo otherMeta = (WSRPMetaInfo)other.getMeta();
+ metaInfo = new WSRPMetaInfo(new HashMap<String, org.jboss.portal.common.i18n.LocalizedString>(otherMeta.metaInfos));
+ WSRPPreferencesInfo otherPref = (WSRPPreferencesInfo)other.getPreferences();
+ prefInfo = new WSRPPreferencesInfo(new HashMap<String, PreferenceInfo>(otherPref.preferences));
+
+ originatingProducer = other.originatingProducer;
+ portletHandle = newHandle;
+ }
+
+ public String getName()
+ {
+ return portletHandle;
+ }
+
+ public String getApplicationName()
+ {
+ return groupId;
+ }
+
+ public CapabilitiesInfo getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public PreferencesInfo getPreferences()
+ {
+ // lazy initialization of preference information since it requires an access to PortletManagement which would be
+ // too bandwidth intensive if it was done when the service description is parsed...
+ if (prefInfo == null)
+ {
+ PortletPropertyDescriptionResponse propertyDescs = originatingProducer.getPropertyDescriptionsFor(portletHandle);
+ Map<String, PreferenceInfo> prefInfos = null;
+
+ if (propertyDescs != null)
+ {
+ ModelDescription modelDesc = propertyDescs.getModelDescription();
+ if (modelDesc != null)
+ {
+ List<PropertyDescription> descs = modelDesc.getPropertyDescriptions();
+ if (descs != null)
+ {
+ prefInfos = new HashMap<String, PreferenceInfo>(descs.size());
+ for (PropertyDescription desc : descs)
+ {
+ String key = desc.getName();
+ prefInfos.put(key, new WSRPPreferenceInfo(key, getPortalLocalizedStringOrNullFrom(desc.getLabel()),
+ getPortalLocalizedStringOrNullFrom(desc.getHint())));
+ }
+ }
+ else
+ {
+ prefInfos = Collections.emptyMap();
+ }
+ }
+ }
+
+ if (prefInfos == null)
+ {
+ prefInfos = Collections.emptyMap();
+ }
+
+ prefInfo = new WSRPPreferencesInfo(prefInfos);
+ }
+
+ return prefInfo;
+ }
+
+ public MetaInfo getMeta()
+ {
+ return metaInfo;
+ }
+
+ public SecurityInfo getSecurity()
+ {
+ // todo: get more details on the SecurityInfo contract...
+ return new SecurityInfo()
+ {
+ public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
+ {
+ return TransportGuarantee.NONE.equals(transportGuarantee);
+ }
+
+ public Set<TransportGuarantee> getTransportGuarantees()
+ {
+ return Collections.singleton(TransportGuarantee.NONE);
+ }
+ };
+ }
+
+ public CacheInfo getCache()
+ {
+ return new CacheInfo()
+ {
+ public int getExpirationSecs()
+ {
+ Integer expirationCacheSeconds = originatingProducer.getExpirationCacheSeconds();
+ return expirationCacheSeconds != null ? expirationCacheSeconds : 0;
+ }
+ };
+ }
+
+ public Boolean isRemotable()
+ {
+ return Boolean.FALSE;
+ }
+
+ public EventingInfo getEventing()
+ {
+ //todo: revisit when implementing WSRP 2
+ return new EventingInfo()
+ {
+ public Map<QName, ? extends EventInfo> getProducedEvents()
+ {
+ return Collections.emptyMap();
+ }
+
+ public Map<QName, ? extends EventInfo> getConsumedEvents()
+ {
+ return Collections.emptyMap();
+ }
+ };
+ }
+
+ public NavigationInfo getNavigation()
+ {
+ //todo: revisit when implementing WSRP 2
+ return new NavigationInfo()
+ {
+ public ParameterInfo getPublicParameter(String s)
+ {
+ return null;
+ }
+
+ public ParameterInfo getPublicParameter(QName qName)
+ {
+ return null;
+ }
+
+ public Collection<? extends ParameterInfo> getPublicParameters()
+ {
+ return Collections.emptyList();
+ }
+ };
+ }
+
+ public <T> T getAttachment(Class<T> tClass) throws IllegalArgumentException
+ {
+ return null;
+ }
+
+ public Map<String, RuntimeOptionInfo> getRuntimeOptionsInfo()
+ {
+ return Collections.emptyMap();
+ }
+
+ public boolean isUsesMethodGet()
+ {
+ return usesMethodGet;
+ }
+
+ public boolean isDefaultMarkupSecure()
+ {
+ return defaultMarkupSecure;
+ }
+
+ public boolean isOnlySecure()
+ {
+ return onlySecure;
+ }
+
+ public boolean isHasUserSpecificState()
+ {
+ return hasUserSpecificState;
+ }
+
+ public boolean isUserContextStoredInSession()
+ {
+ return userContextStoredInSession;
+ }
+
+ public boolean isTemplatesStoredInSession()
+ {
+ return templatesStoredInSession;
+ }
+
+ public boolean isDoesUrlTemplateProcessing()
+ {
+ return doesUrlTemplateProcessing;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ private void createWSRPInfo(PortletDescription portletDescription)
+ {
+// String[] userCategories = portletDescription.getUserCategories();
+// String[] userProfileItems = portletDescription.getUserProfileItems();
+
+ usesMethodGet = Boolean.TRUE.equals(portletDescription.isUsesMethodGet());
+
+ defaultMarkupSecure = Boolean.TRUE.equals(portletDescription.isDefaultMarkupSecure());
+ onlySecure = Boolean.TRUE.equals(portletDescription.isOnlySecure());
+ userContextStoredInSession = Boolean.TRUE.equals(portletDescription.isUserContextStoredInSession());
+ templatesStoredInSession = Boolean.TRUE.equals(portletDescription.isTemplatesStoredInSession());
+ hasUserSpecificState = Boolean.TRUE.equals(portletDescription.isHasUserSpecificState());
+ doesUrlTemplateProcessing = Boolean.TRUE.equals(portletDescription.isDoesUrlTemplateProcessing());
+
+ groupId = portletDescription.getGroupID();
+ }
+
+ private void createCapabilitiesInfo(PortletDescription portletDescription)
+ {
+ final List<MarkupType> markupTypes = portletDescription.getMarkupTypes();
+ final Map<MediaType, MediaTypeInfo> mediaTypes = new HashMap<MediaType, MediaTypeInfo>(markupTypes.size());
+ capabilities = new WSRPCapabilitiesInfo();
+
+ for (MarkupType markupType : markupTypes)
+ {
+ MediaType mediaType = MediaType.create(markupType.getMimeType());
+ MediaTypeInfo mediaTypeInfo = new MediaTypeInfo(markupType);
+ mediaTypes.put(mediaType, mediaTypeInfo);
+ capabilities.addModes(mediaTypeInfo.modes);
+ capabilities.addWindowStates(mediaTypeInfo.windowStates);
+ capabilities.addLocales(mediaTypeInfo.locales);
+ }
+
+ capabilities.setMediaTypes(mediaTypes);
+ }
+
+ private void createMetaInfo(PortletDescription portletDescription)
+ {
+ final Map<String, org.jboss.portal.common.i18n.LocalizedString> metaInfos = new HashMap<String, org.jboss.portal.common.i18n.LocalizedString>();
+ metaInfos.put(MetaInfo.DESCRIPTION, getPortalLocalizedStringOrNullFrom(portletDescription.getDescription()));
+ metaInfos.put(MetaInfo.DISPLAY_NAME, getPortalLocalizedStringOrNullFrom(portletDescription.getDisplayName()));
+ metaInfos.put(MetaInfo.SHORT_TITLE, getPortalLocalizedStringOrNullFrom(portletDescription.getShortTitle()));
+ metaInfos.put(MetaInfo.TITLE, getPortalLocalizedStringOrNullFrom(portletDescription.getTitle()));
+
+ // keywords need to be concatenated
+ List<LocalizedString> keywords = portletDescription.getKeywords();
+ String keywordsString = "";
+ Locale locale = Locale.ENGLISH;
+ if (keywords != null)
+ {
+ int keywordsNb = keywords.size();
+ if (keywordsNb > 0)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < keywordsNb; i++)
+ {
+ LocalizedString keyword = keywords.get(i);
+ sb.append(keyword.getValue());
+ if (i != keywordsNb - 1)
+ {
+ sb.append(","); // not the last one, so concatenate a comma to separate
+ }
+ }
+ keywordsString = sb.toString();
+ // fix-me: for now assume that they all have the same language... this could get messy!
+ locale = WSRPUtils.getLocale(keywords.get(0).getLang());
+ }
+ }
+
+ metaInfos.put(MetaInfo.KEYWORDS, new org.jboss.portal.common.i18n.LocalizedString(keywordsString, locale));
+
+ metaInfo = new WSRPMetaInfo(metaInfos);
+ }
+
+ private org.jboss.portal.common.i18n.LocalizedString getPortalLocalizedStringOrNullFrom(LocalizedString wsrpLocalizedString)
+ {
+ if (wsrpLocalizedString != null)
+ {
+ return new org.jboss.portal.common.i18n.LocalizedString(wsrpLocalizedString.getValue(),
+ WSRPUtils.getLocale(wsrpLocalizedString.getLang()));
+ }
+
+ return null;
+ }
+
+ class MediaTypeInfo
+ {
+ public MediaTypeInfo(MarkupType markupType)
+ {
+ mimeType = MediaType.create(markupType.getMimeType());
+
+ List<String> modeNames = markupType.getModes();
+ modes = new HashSet<ModeInfo>(modeNames.size());
+ for (String modeName : modeNames)
+ {
+ modes.add(new BasicModeInfo(WSRPUtils.getJSR168PortletModeFromWSRPName(modeName)));
+ }
+
+ List<String> windStateNames = markupType.getWindowStates();
+ windowStates = new HashSet<WindowStateInfo>(windStateNames.size());
+ for (String windStateName : windStateNames)
+ {
+ windowStates.add(new BasicWindowStateInfo(WSRPUtils.getJSR168WindowStateFromWSRPName(windStateName)));
+ }
+
+ List<String> localeNames = markupType.getLocales();
+ if (localeNames != null)
+ {
+ locales = new HashSet<Locale>(localeNames.size());
+ for (String localeName : localeNames)
+ {
+ locales.add(WSRPUtils.getLocale(localeName));
+ }
+ }
+ else
+ {
+ locales = Collections.emptySet();
+ }
+ }
+
+ MediaType mimeType;
+ Set<ModeInfo> modes;
+ Set<WindowStateInfo> windowStates;
+ Set<Locale> locales;
+ }
+
+ class BasicWindowStateInfo implements WindowStateInfo
+ {
+ WindowState state;
+
+ public BasicWindowStateInfo(WindowState state)
+ {
+ this.state = state;
+ }
+
+ public org.jboss.portal.common.i18n.LocalizedString getDescription()
+ {
+ return new org.jboss.portal.common.i18n.LocalizedString(getWindowStateName() + " window state", Locale.ENGLISH);
+ }
+
+ public WindowState getWindowState()
+ {
+ return state;
+ }
+
+ public String getWindowStateName()
+ {
+ return state.toString();
+ }
+ }
+
+ class BasicModeInfo implements ModeInfo
+ {
+ Mode mode;
+
+ public BasicModeInfo(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ public org.jboss.portal.common.i18n.LocalizedString getDescription()
+ {
+ return new org.jboss.portal.common.i18n.LocalizedString(getModeName() + " mode", Locale.ENGLISH);
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public String getModeName()
+ {
+ return mode.toString();
+ }
+ }
+
+ private class WSRPCapabilitiesInfo implements CapabilitiesInfo
+ {
+ private Map<MediaType, MediaTypeInfo> mediaTypes;
+ private Set<ModeInfo> modes;
+ private Set<WindowStateInfo> windowStates;
+ private Set<Locale> locales;
+
+ private WSRPCapabilitiesInfo()
+ {
+ }
+
+ private void setMediaTypes(Map<MediaType, MediaTypeInfo> mediaTypes)
+ {
+ this.mediaTypes = mediaTypes;
+ }
+
+ public WSRPCapabilitiesInfo(Map<MediaType, MediaTypeInfo> mediaTypes, Set<ModeInfo> modes, Set<WindowStateInfo> windowStates, Set<Locale> locales)
+ {
+ this.mediaTypes = mediaTypes;
+ this.modes = modes;
+ this.windowStates = windowStates;
+ this.locales = locales;
+ }
+
+ public Set<MediaType> getMediaTypes()
+ {
+ return mediaTypes.keySet();
+ }
+
+ public Set<ModeInfo> getAllModes()
+ {
+ return modes;
+ }
+
+ public Set<ModeInfo> getModes(MediaType mediaType)
+ {
+ MediaTypeInfo mimeTypeInfo = mediaTypes.get(mediaType);
+ if (mimeTypeInfo == null)
+ {
+ return Collections.emptySet();
+ }
+
+ return Collections.unmodifiableSet(mimeTypeInfo.modes);
+ }
+
+ public ModeInfo getMode(Mode mode)
+ {
+ for (ModeInfo info : modes)
+ {
+ if (info.getMode().equals(mode))
+ {
+ return info;
+ }
+ }
+ return null;
+ }
+
+ public Set<WindowStateInfo> getAllWindowStates()
+ {
+ return windowStates;
+ }
+
+ public Set<WindowStateInfo> getWindowStates(MediaType mediaType)
+ {
+ MediaTypeInfo mimeTypeInfo = mediaTypes.get(mediaType);
+ if (mimeTypeInfo == null)
+ {
+ return Collections.emptySet();
+ }
+
+ return Collections.unmodifiableSet(mimeTypeInfo.windowStates);
+ }
+
+ public WindowStateInfo getWindowState(WindowState windowState)
+ {
+ for (WindowStateInfo info : windowStates)
+ {
+ if (info.getWindowState().equals(windowState))
+ {
+ return info;
+ }
+ }
+ return null;
+ }
+
+ public Set<Locale> getAllLocales()
+ {
+ return locales;
+ }
+
+ public Set<Locale> getLocales(MediaType mediaType)
+ {
+ MediaTypeInfo mimeTypeInfo = mediaTypes.get(mediaType);
+ if (mimeTypeInfo == null)
+ {
+ return Collections.emptySet();
+ }
+
+ return Collections.unmodifiableSet(mimeTypeInfo.locales);
+ }
+
+ private void addModes(Set<ModeInfo> modes)
+ {
+ if (modes != null)
+ {
+ int size = modes.size();
+ if (this.modes == null)
+ {
+ this.modes = new HashSet<ModeInfo>(size);
+ }
+
+ this.modes.addAll(modes);
+ }
+ }
+
+ private void addWindowStates(Set<WindowStateInfo> windowStates)
+ {
+ if (windowStates != null)
+ {
+ int size = windowStates.size();
+ if (this.windowStates == null)
+ {
+ this.windowStates = new HashSet<WindowStateInfo>(size);
+ }
+
+ this.windowStates.addAll(windowStates);
+ }
+ }
+
+ private void addLocales(Set<Locale> locales)
+ {
+ if (locales != null)
+ {
+ int size = locales.size();
+ if (this.locales == null)
+ {
+ this.locales = new HashSet<Locale>(size);
+ }
+
+ this.locales.addAll(locales);
+ }
+ }
+ }
+
+ private static class WSRPMetaInfo implements MetaInfo
+ {
+ private final Map<String, org.jboss.portal.common.i18n.LocalizedString> metaInfos;
+
+ public WSRPMetaInfo(Map<String, org.jboss.portal.common.i18n.LocalizedString> metaInfos)
+ {
+ this.metaInfos = metaInfos;
+ }
+
+ public org.jboss.portal.common.i18n.LocalizedString getMetaValue(String key)
+ {
+ return metaInfos.get(key);
+ }
+ }
+
+ static class WSRPPreferencesInfo implements PreferencesInfo
+ {
+ private Map<String, PreferenceInfo> preferences;
+
+ public WSRPPreferencesInfo(Map<String, PreferenceInfo> preferences)
+ {
+ this.preferences = preferences;
+ }
+
+ public Set<String> getKeys()
+ {
+ return Collections.unmodifiableSet(preferences.keySet());
+ }
+
+ public PreferenceInfo getPreference(String key) throws IllegalArgumentException
+ {
+ return preferences.get(key);
+ }
+ }
+
+ static class WSRPPreferenceInfo implements PreferenceInfo
+ {
+ private String key;
+ private org.jboss.portal.common.i18n.LocalizedString displayName;
+ private org.jboss.portal.common.i18n.LocalizedString description;
+
+ public WSRPPreferenceInfo(String key, org.jboss.portal.common.i18n.LocalizedString displayName, org.jboss.portal.common.i18n.LocalizedString description)
+ {
+ this.key = key;
+ this.displayName = displayName;
+ this.description = description;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public org.jboss.portal.common.i18n.LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public org.jboss.portal.common.i18n.LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Boolean isReadOnly()
+ {
+ // cannot be determined, so returning null per javadoc
+ // note : it will be possible to implement it using WSRP 2.0 which defines this notion
+ // in the protocol
+ return null;
+ }
+
+ public List<String> getDefaultValue()
+ {
+ return null;
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/handler/RequestHeaderClientHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/handler/RequestHeaderClientHandler.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/handler/RequestHeaderClientHandler.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,298 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.handler;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.cookie.MalformedCookieException;
+import org.apache.commons.httpclient.cookie.RFC2109Spec;
+import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Stub;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * A request handler that uses a thread local to setup cookies on the wire.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.wsrp.handler.RequestHeaderClientHandler">Chris
+ * Laprun</a>
+ */
+public class RequestHeaderClientHandler extends GenericHandler
+{
+ private static final ThreadLocal local = new ThreadLocal();
+ private static final RFC2109Spec cookieParser = new RFC2109Spec();
+ private static final Logger log = LoggerFactory.getLogger(RequestHeaderClientHandler.class);
+
+ public QName[] getHeaders()
+ {
+ return null;
+ }
+
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ CurrentInfo info = getCurrentInfo(false);
+ if (info == null)
+ {
+ return super.handleRequest(msgContext);
+ }
+
+ ProducerSessionInformation sessionInfo = info.sessionInfo;
+ if (sessionInfo == null)
+ {
+ return super.handleRequest(msgContext);
+ }
+
+ SOAPMessageContext smc = (SOAPMessageContext)msgContext;
+ SOAPMessage message = smc.getMessage();
+ MimeHeaders mimeHeaders = message.getMimeHeaders();
+ StringBuffer cookie = new StringBuffer(64);
+ if (sessionInfo.isPerGroupCookies())
+ {
+ if (info.groupId == null)
+ {
+ throw new IllegalStateException("Was expecting a current group Id...");
+ }
+
+ String groupCookie = sessionInfo.getGroupCookieFor(info.groupId);
+ if (groupCookie != null)
+ {
+ cookie.append(groupCookie);
+ }
+ }
+
+ String userCookie = sessionInfo.getUserCookie();
+ if (userCookie != null)
+ {
+ if (cookie.length() != 0)
+ {
+ cookie.append(','); // multiple cookies are separated by commas: http://www.ietf.org/rfc/rfc2109.txt, 4.2.2
+ }
+ cookie.append(userCookie);
+ }
+
+ if (cookie.length() != 0)
+ {
+ mimeHeaders.setHeader("Cookie", cookie.toString());
+ }
+
+ return super.handleRequest(msgContext);
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ SOAPMessageContext smc = (SOAPMessageContext)msgContext;
+ SOAPMessage message = smc.getMessage();
+ MimeHeaders mimeHeaders = message.getMimeHeaders();
+ String[] cookieValues = mimeHeaders.getHeader("Set-Cookie");
+
+ if (cookieValues != null)
+ {
+ String cookieValue = coalesceCookies(cookieValues);
+
+ Cookie[] cookies = extractCookies((String)msgContext.getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY), cookieValue);
+
+ CurrentInfo info = getCurrentInfo(true);
+ ProducerSessionInformation sessionInfo = info.sessionInfo;
+
+ if (sessionInfo.isPerGroupCookies())
+ {
+ if (info.groupId == null)
+ {
+ throw new IllegalStateException("Was expecting a current group Id...");
+ }
+
+ sessionInfo.setGroupCookieFor(info.groupId, cookies);
+ }
+ else
+ {
+ sessionInfo.setUserCookie(cookies);
+ }
+ }
+
+ return super.handleResponse(msgContext);
+ }
+
+ /**
+ * Coalesce several Set-Cookie headers into one and returning the resulting concatenated String.
+ *
+ * @param cookieValues the array containing the values of the different Set-Cookie headers to be coalesced
+ * @return the concatenated value that could be used as one Set-Cookie header
+ */
+ private String coalesceCookies(String[] cookieValues)
+ {
+ assert cookieValues != null;
+
+ StringBuffer logBuffer = null;
+ if (log.isDebugEnabled())
+ {
+ logBuffer = new StringBuffer(128);
+ logBuffer.append("Cookie headers:\n");
+ }
+
+ int cookieNumber = cookieValues.length;
+ StringBuffer cookieBuffer = new StringBuffer(cookieNumber * 128);
+ String cookieValue;
+ for (int i = 0; i < cookieNumber; i++)
+ {
+ cookieValue = cookieValues[i];
+ cookieBuffer.append(cookieValue);
+
+ // multiple cookies are separated by commas: http://www.ietf.org/rfc/rfc2109.txt, 4.2.2
+ if (i < cookieNumber - 1)
+ {
+ cookieBuffer.append(',');
+ }
+
+ if (log.isDebugEnabled())
+ {
+ logBuffer.append("\t").append(i).append(":\t").append(cookieValue).append("\n");
+ }
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug(logBuffer.toString());
+ }
+
+ return cookieBuffer.toString();
+ }
+
+ private Cookie[] extractCookies(String endpointAddress, String cookieValue)
+ {
+ if (endpointAddress == null)
+ {
+ throw new NullPointerException("Was expecting an endpoint address but none was provided in the MessageContext");
+ }
+
+ URL hostURL;
+ try
+ {
+ hostURL = new URL(endpointAddress);
+ }
+ catch (MalformedURLException e)
+ {
+ // should not happen
+ throw new IllegalArgumentException(endpointAddress + " is not a valid URL for the endpoint address.");
+ }
+
+ Cookie[] cookies;
+ try
+ {
+ String host = hostURL.getHost();
+ int port = hostURL.getPort();
+ if (port == -1)
+ {
+ port = 80; // if the port is not set in the endpoint address, assume it's 80.
+ }
+ String path = hostURL.getPath();
+ boolean secure = hostURL.getProtocol().endsWith("s"); // todo: is that correct?
+
+ cookies = cookieParser.parse(host, port, path, secure, cookieValue);
+
+ for (Cookie cookie : cookies)
+ {
+ cookieParser.validate(host, port, path, secure, cookie);
+ }
+ }
+ catch (MalformedCookieException e)
+ {
+ throw new IllegalArgumentException("Malformed cookie: " + cookieValue);
+ }
+ return cookies;
+ }
+
+ public static void setCurrentInfo(String groupId, ProducerSessionInformation sessionInformation)
+ {
+ local.set(new CurrentInfo(groupId, sessionInformation));
+ }
+
+ public static void resetCurrentInfo()
+ {
+ local.set(null);
+ }
+
+ public static ProducerSessionInformation getCurrentProducerSessionInformation()
+ {
+ CurrentInfo info = getCurrentInfo(false);
+
+ if (info != null)
+ {
+ return info.sessionInfo;
+ }
+
+ return null;
+ }
+
+ public static String getCurrentGroupId()
+ {
+ CurrentInfo info = getCurrentInfo(false);
+ if (info != null)
+ {
+ return info.groupId;
+ }
+ return null;
+ }
+
+ public static void setCurrentGroupId(String groupId)
+ {
+ CurrentInfo currentInfo = (CurrentInfo)local.get();
+ if (currentInfo == null)
+ {
+ throw new IllegalStateException("Cannot set current group id when the current info hasn't been initialized.");
+ }
+ currentInfo.groupId = groupId;
+ }
+
+ private static CurrentInfo getCurrentInfo(boolean createIfNeeded)
+ {
+ CurrentInfo info = (CurrentInfo)local.get();
+ if (info == null && createIfNeeded)
+ {
+ info = new CurrentInfo(null, new ProducerSessionInformation());
+ local.set(info);
+ }
+ return info;
+ }
+
+ static class CurrentInfo
+ {
+ public CurrentInfo(String groupId, ProducerSessionInformation sessionInfo)
+ {
+ this.groupId = groupId;
+ this.sessionInfo = sessionInfo;
+ }
+
+ String groupId;
+ ProducerSessionInformation sessionInfo;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractJNDIServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.common.io.IOTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.InitialContext;
+import javax.xml.ws.Service;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * A service factory implementation that get the services using JNDI lookups.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11484 $
+ * @noinspection ALL
+ * @since 2.4
+ */
+public abstract class AbstractJNDIServiceFactory implements ManageableServiceFactory
+{
+
+ /** The logger. */
+ protected final Logger log = LoggerFactory.getLogger(getClass());
+
+ /** The JNDI configuration. */
+ private Properties env;
+
+ /** Default mapping between WSRP port type class and associated JNDI name */
+ private static Properties DEFAULT_FACTORY_MAPPING;
+
+ /** Whether or not this ServiceFactory has an unrecoverable error condition */
+ protected boolean failed = false;
+
+ /** Whether or not this ServiceFactory is availble to provide services */
+ protected boolean available = true;
+
+ static
+ {
+ // fix-me: this is hardcoded from values from portal-wsrp-client.jar/META-INF/jboss-client.xml... NOT GOOD!
+ DEFAULT_FACTORY_MAPPING = new Properties();
+ DEFAULT_FACTORY_MAPPING.setProperty(
+ "org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType",
+ "wsrp-client/service/ServiceDescriptionService");
+ DEFAULT_FACTORY_MAPPING.setProperty(
+ "org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType",
+ "wsrp-client/service/MarkupService");
+ DEFAULT_FACTORY_MAPPING.setProperty(
+ "org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType",
+ "wsrp-client/service/RegistrationService");
+ DEFAULT_FACTORY_MAPPING.setProperty(
+ "org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType",
+ "wsrp-client/service/PortletManagementService");
+ }
+
+ /** A Map recording the mapping between WSRP port type class name and JDNI name of the implementing service. */
+ protected Properties portJNDIMapping = DEFAULT_FACTORY_MAPPING;
+
+ protected void createService() throws Exception
+ {
+ if (env != null)
+ {
+ for (Iterator i = env.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String value = (String)entry.getValue();
+ log.debug("Use env property " + name + "=" + value);
+ }
+ return;
+ }
+ log.debug("createService: null env");
+ }
+
+ public Properties getEnv()
+ {
+ return env;
+ }
+
+ public void setEnv(Properties env)
+ {
+ this.env = env;
+ }
+
+ protected <T> Service getServiceFor(Class<T> serviceClass) throws Exception
+ {
+ if (serviceClass == null)
+ {
+ throw new IllegalArgumentException("Null class not accepted to perform lookup");
+ }
+
+ if (!isAvailable())
+ {
+ throw new IllegalStateException("This ServiceFactory is not ready to service clients!");
+ }
+
+ //
+ String key = serviceClass.getName();
+ if (!portJNDIMapping.containsKey(key))
+ {
+ setFailed(true);
+ throw new IllegalArgumentException("Unknown service class: " + key);
+ }
+
+ String jndiName = (String)portJNDIMapping.get(key);
+ log.debug("Looking up service for class " + key + " using JNDI name " + jndiName);
+ if (jndiName == null)
+ {
+ setFailed(true);
+ throw new IllegalArgumentException("No such service " + serviceClass);
+ }
+
+ //
+ InitialContext ctx = null;
+ try
+ {
+ if (env != null)
+ {
+ ctx = new InitialContext(env);
+ }
+ else
+ {
+ ctx = new InitialContext();
+ }
+
+ //
+ Object service = ctx.lookup(jndiName);
+ if (log.isTraceEnabled())
+ {
+ log.trace("JNDI lookup for " + jndiName + " returned " + service);
+ }
+
+ //
+ return (Service)service;
+ }
+ finally
+ {
+ IOTools.safeClose(ctx);
+ }
+ }
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+
+ public void start()
+ {
+ // todo: implement as needed
+ }
+
+ public void stop()
+ {
+ // todo: implement as needed
+ }
+
+ public void setFailed(boolean failed)
+ {
+ this.failed = failed;
+ }
+
+ public boolean isAvailable()
+ {
+ return available && !failed;
+ }
+
+ public void setAvailable(boolean available)
+ {
+ this.available = available;
+ }
+
+ public Properties getPortJNDIMapping()
+ {
+ return portJNDIMapping;
+ }
+
+ public void setPortJNDIMapping(Properties portJNDIMapping)
+ {
+ this.portJNDIMapping = portJNDIMapping;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/AbstractSOAPServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import javax.xml.ws.Service;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Perform common logic to soap based service factories. This one caches the service retrieved from the JNDI lookup.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11484 $
+ */
+public abstract class AbstractSOAPServiceFactory extends AbstractJNDIServiceFactory
+{
+
+ /** Cache the services. */
+ private Map<String, Service> services = new ConcurrentHashMap<String, Service>();
+
+ /**
+ * Retrieve the stub from the service. The stub is not thread safe and must be customized for each thead.
+ *
+ * @param serviceClass the requested service class
+ * @param service the service implementation obtained from the JNDI lookup
+ * @return an implementation based on the provided service
+ * @throws Exception
+ */
+ protected abstract <T> T getStubFromService(Class<T> serviceClass, Service service) throws Exception;
+
+ public <T> T getService(Class<T> serviceClass) throws Exception
+ {
+ if (serviceClass == null)
+ {
+ throw new IllegalArgumentException("Null class not accepted to perform lookup");
+ }
+
+ //
+ String key = serviceClass.getName();
+
+ // Get the cached service, it's ok because they are thread safe
+ Service service = services.get(key);
+ if (service == null)
+ {
+ service = super.getServiceFor(serviceClass);
+
+ //
+ if (service != null)
+ {
+ services.put(key, service);
+ }
+ }
+
+ // Get the stub from the service, remember that the stub itself is not threadsafe
+ // and must be customized for every request to this method.
+ if (service != null)
+ {
+ T result = ServiceWrapper.getServiceWrapper(serviceClass, getStubFromService(serviceClass, service), this);
+
+ // if we managed to retrieve a service, we're probably available
+ setFailed(false);
+ setAvailable(true);
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/CachingServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/CachingServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/CachingServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A service factory that statically cache implementations. It is mainly used in the test environment to void the very
+ * expensive creation of SOAP service proxies.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11517 $
+ */
+public class CachingServiceFactory implements ManageableServiceFactory
+{
+
+ /** . */
+ private static final Map<String, Object> cache = new ConcurrentHashMap<String, Object>();
+
+ /** . */
+ private ManageableServiceFactory delegate;
+
+ public <T> T getService(Class<T> clazz) throws Exception
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Object service = cache.get(clazz.getName());
+ if (service == null)
+ {
+ service = delegate.getService(clazz);
+ if (service != null)
+ {
+ cache.put(clazz.getName(), service);
+ }
+ }
+ return clazz.cast(service);
+ }
+
+ public ManageableServiceFactory getDelegate()
+ {
+ return delegate;
+ }
+
+ public void setDelegate(ManageableServiceFactory delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public boolean isAvailable()
+ {
+ return delegate != null && delegate.isAvailable();
+ }
+
+ public boolean isFailed()
+ {
+ return delegate == null || delegate.isFailed();
+ }
+
+ public void setFailed(boolean failed)
+ {
+ if (delegate != null)
+ {
+ delegate.setFailed(failed);
+ }
+ }
+
+ public void setAvailable(boolean available)
+ {
+ if (delegate != null)
+ {
+ delegate.setAvailable(available);
+ }
+ }
+
+ public String getServiceDescriptionURL()
+ {
+ if (delegate != null)
+ {
+ return delegate.getServiceDescriptionURL();
+ }
+ return null;
+ }
+
+ public String getMarkupURL()
+ {
+ if (delegate != null)
+ {
+ return delegate.getMarkupURL();
+ }
+ return null;
+ }
+
+ public String getRegistrationURL()
+ {
+ if (delegate != null)
+ {
+ return delegate.getRegistrationURL();
+ }
+ return null;
+ }
+
+ public String getPortletManagementURL()
+ {
+ if (delegate != null)
+ {
+ return delegate.getPortletManagementURL();
+ }
+ return null;
+ }
+
+
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.setServiceDescriptionURL(serviceDescriptionURL);
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.setMarkupURL(markupURL);
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.setRegistrationURL(registrationURL);
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.setPortletManagementURL(portletManagementURL);
+ }
+
+ public void start()
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.start();
+ }
+
+ public void stop()
+ {
+ if (delegate == null)
+ {
+ throw new IllegalStateException("No delegate service factory");
+ }
+ delegate.stop();
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ManageableServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ManageableServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ManageableServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface ManageableServiceFactory extends ServiceFactory
+{
+ void setFailed(boolean failed);
+
+ void setAvailable(boolean available);
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/MarkupServiceWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+class MarkupServiceWrapper /*extends ServiceWrapper<WSRP_v1_Markup_PortType> implements WSRP_v1_Markup_PortType*/
+{
+ /*public MarkupServiceWrapper(Object service, ManageableServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public MarkupResponse getMarkup(GetMarkup getMarkup) throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault, InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault, OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, UnsupportedMimeTypeFault, RemoteException
+ {
+ try
+ {
+ return service.getMarkup(getMarkup);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction) throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault, UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault, InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault, InvalidHandleFault, InvalidCookieFault, RemoteException
+ {
+ try
+ {
+ return service.performBlockingInteraction(performBlockingInteraction);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny releaseSessions(ReleaseSessions releaseSessions) throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
+ {
+ try
+ {
+ return service.releaseSessions(releaseSessions);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.initCookie(initCookie);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }*/
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
+import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11484 $
+ * @since 2.4
+ */
+public class PerEndpointSOAPInvokerServiceFactory extends AbstractSOAPServiceFactory
+{
+
+ /** . */
+ protected String serviceDescriptionURL = EndpointConfigurationInfo.UNSET;
+
+ /** . */
+ protected String markupURL = EndpointConfigurationInfo.UNSET;
+
+ /** . */
+ protected String registrationURL;
+
+ /** . */
+ protected String portletManagementURL;
+
+ public String getServiceDescriptionURL()
+ {
+ return serviceDescriptionURL;
+ }
+
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(serviceDescriptionURL, "Mandatory Service Description interface", null);
+ this.serviceDescriptionURL = serviceDescriptionURL;
+ setFailed(false); // reset failed status to false since we can't assert it anymore
+ }
+
+ public String getMarkupURL()
+ {
+ return markupURL;
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(markupURL, "Mandatory Markup interface", null);
+ this.markupURL = markupURL;
+ setFailed(false); // reset failed status to false since we can't assert it anymore
+ }
+
+ public String getRegistrationURL()
+ {
+ return registrationURL;
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ this.registrationURL = registrationURL;
+ setFailed(false); // reset failed status to false since we can't assert it anymore
+ }
+
+ public String getPortletManagementURL()
+ {
+ return portletManagementURL;
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ this.portletManagementURL = portletManagementURL;
+ setFailed(false); // reset failed status to false since we can't assert it anymore
+ }
+
+ /** If retrieved object is of javax.xml.rpc.Service class, we're using the WS stack and we need to get the port. */
+ protected <T> T getStubFromService(Class<T> serviceClass, Service service) throws Exception
+ {
+ log.debug("Unwrapping service " + service + " for class " + serviceClass);
+ T stub = service.getPort(serviceClass);
+
+ //
+ String portAddress = null;
+ boolean isMandatoryInterface = false;
+ if (WSRPV1ServiceDescriptionPortType.class.isAssignableFrom(serviceClass))
+ {
+ portAddress = serviceDescriptionURL;
+ isMandatoryInterface = true;
+ }
+ else if (WSRPV1MarkupPortType.class.isAssignableFrom(serviceClass))
+ {
+ portAddress = markupURL;
+ isMandatoryInterface = true;
+ }
+ else if (WSRPV1RegistrationPortType.class.isAssignableFrom(serviceClass))
+ {
+ portAddress = registrationURL;
+ }
+ else if (WSRPV1PortletManagementPortType.class.isAssignableFrom(serviceClass))
+ {
+ portAddress = portletManagementURL;
+ }
+
+ //
+ if (portAddress != null)
+ {
+ log.debug("Setting the end point to: " + portAddress);
+ ((BindingProvider)stub).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, portAddress);
+ }
+ else
+ {
+ if (isMandatoryInterface)
+ {
+ setFailed(true);
+ throw new IllegalStateException("Mandatory interface URLs were not properly initialized: no proper service URL for "
+ + serviceClass.getName());
+ }
+ else
+ {
+ throw new IllegalStateException("No URL was provided for optional interface "
+ + serviceClass.getName());
+ }
+ }
+
+ //
+ return stub;
+ }
+
+
+ public boolean isAvailable()
+ {
+ return super.isAvailable() && !EndpointConfigurationInfo.UNSET.equals(serviceDescriptionURL)
+ && !EndpointConfigurationInfo.UNSET.equals(markupURL);
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/PortletManagementServiceWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+class PortletManagementServiceWrapper /*extends ServiceWrapper<WSRP_v1_PortletManagement_PortType> implements WSRP_v1_PortletManagement_PortType*/
+{
+ /*public PortletManagementServiceWrapper(Object service, ManageableServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription) throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletDescription(getPortletDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
+ {
+ try
+ {
+ return service.clonePortlet(clonePortlet);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.destroyPortlets(destroyPortlets);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletContext setPortletProperties(SetPortletProperties setPortletProperties) throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.setPortletProperties(setPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletProperties(getPortletProperties);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.getPortletPropertyDescription(getPortletPropertyDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }*/
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RegistrationServiceWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+class RegistrationServiceWrapper /*extends ServiceWrapper<WSRPV1RegistrationPortType> implements WSRPV1RegistrationPortType*/
+{
+ /*public void modifyRegistration(@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext registrationContext, @WebParam(name = "registrationData", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationData registrationData, @WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState, @WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<Extension>> extensions) throws MissingParameters, InvalidRegistration, OperationFailed
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public RegistrationServiceWrapper(Object service, ManageableServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
+ {
+ try
+ {
+ return service.register(register);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.deregister(deregister);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.modifyRegistration(modifyRegistration);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public void register(
+ @WebParam(name = "consumerName", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") String consumerName,
+ @WebParam(name = "consumerAgent", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") String consumerAgent,
+ @WebParam(name = "methodGetSupported", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") boolean methodGetSupported,
+ @WebParam(name = "consumerModes", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String> consumerModes,
+ @WebParam(name = "consumerWindowStates", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String> consumerWindowStates,
+ @WebParam(name = "consumerUserScopes", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String> consumerUserScopes,
+ @WebParam(name = "customUserProfileData", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String> customUserProfileData,
+ @WebParam(name = "registrationProperties", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<Property> registrationProperties,
+ @WebParam(mode = WebParam.Mode.INOUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<Extension>> extensions,
+ @WebParam(mode = WebParam.Mode.OUT, name = "registrationHandle", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<String> registrationHandle,
+ @WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState
+ ) throws MissingParameters, OperationFailed
+ {
+ try
+ {
+ service.register(consumerName, consumerAgent, methodGetSupported, consumerModes, consumerWindowStates,
+ consumerUserScopes, customUserProfileData, registrationProperties, extensions, registrationHandle, registrationState);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }
+
+ public List<Extension> deregister(@WebParam(name = "registrationHandle", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") String registrationHandle, @WebParam(name = "registrationState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") byte[] registrationState, @WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<Extension> extensions) throws InvalidRegistration, OperationFailed
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }*/
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,333 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12056 $
+ * @since 2.4 (May 3, 2006)
+ */
+public class RemoteSOAPInvokerServiceFactory extends PerEndpointSOAPInvokerServiceFactory
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private String wsdlDefinitionURL;
+
+ private static final String WSRP_URN = "urn:oasis:names:tc:wsrp:v1:wsdl";
+ private static final String DEFAULT_SERVICE_NAME = "WSRPService";
+
+ // Used to heuristically determine which interface to use for a port based on its name
+ private static final String DESCRIPTION = "description";
+ private static final String MARKUP = "markup";
+ private static final String BASE = "base"; // some WSDL use WSRPBaseService instead of Markup
+ private static final String MANAGEMENT = "management";
+ private static final String REGISTRATION = "registration";
+
+
+ public String getWsdlDefinitionURL()
+ {
+ return wsdlDefinitionURL;
+ }
+
+ public void setWsdlDefinitionURL(String wsdlDefinitionURL) throws Exception
+ {
+ if (wsdlDefinitionURL == null || wsdlDefinitionURL.length() == 0)
+ {
+ throw new IllegalArgumentException("Require a non-empty, non-null URL specifying where to find the WSRP " +
+ "services definition");
+ }
+
+ if (!wsdlDefinitionURL.equals(this.wsdlDefinitionURL))
+ {
+ this.wsdlDefinitionURL = wsdlDefinitionURL;
+
+ try
+ {
+ initServices();
+ setFailed(false);
+ setAvailable(true);
+ }
+ catch (MalformedURLException e)
+ {
+ setFailed(true);
+ throw new IllegalArgumentException("Require a well-formed URL specifying where to find the WSRP services definition", e);
+ }
+ catch (Exception e)
+ {
+ log.info("Couldn't access WSDL information. Service won't be available", e);
+ setAvailable(false);
+ setFailed(true);
+ throw e;
+ }
+ }
+ }
+
+ private void initServices() throws MalformedURLException
+ {
+ try
+ {
+ URL wsdlURL = new URL(wsdlDefinitionURL);
+
+ Definition def = getWSDLDefinition(wsdlURL);
+ javax.wsdl.Service serve = def.getService(new QName(WSRP_URN, DEFAULT_SERVICE_NAME));
+ Collection ports = serve.getPorts().values();
+ for (Object o : ports)
+ {
+ Port port = (Port)o;
+ initServiceURL(port.getName(), getLocation(port));
+ }
+ }
+ catch (WSDLException e)
+ {
+ throw new RuntimeException("Couldn't initialize services for WSDL at '" + wsdlDefinitionURL + "'", e);
+ }
+ }
+
+ /**
+ * Heuristically try to determine which service we're trying to configure.
+ *
+ * @param serviceURL the port location as defined in the given WSDL file
+ * @param portName the port name as defined in the given WSDL file
+ */
+ private void initServiceURL(String portName, String serviceURL)
+ {
+ String normalizedPortName = portName.toLowerCase();
+ log.debug("Service URL: " + serviceURL);
+
+ if (doesString1ContainString2(normalizedPortName, DESCRIPTION))
+ {
+ log.info("Found service description port from port name: " + portName);
+ serviceDescriptionURL = serviceURL;
+ return;
+ }
+ if (doesString1ContainString2(normalizedPortName, MARKUP) || doesString1ContainString2(normalizedPortName, BASE))
+ {
+ log.info("Found markup port from port name: " + portName);
+ markupURL = serviceURL;
+ return;
+ }
+ if (doesString1ContainString2(normalizedPortName, MANAGEMENT))
+ {
+ log.info("Found porlet management port from port name: " + portName);
+ portletManagementURL = serviceURL;
+ return;
+ }
+ if (doesString1ContainString2(normalizedPortName, REGISTRATION))
+ {
+ log.info("Found registration port from port name: " + portName);
+ registrationURL = serviceURL;
+ return;
+ }
+ log.warn("Could not find service port matching port name: " + portName);
+ }
+
+ private boolean doesString1ContainString2(String string1, String string2)
+ {
+ return string1.indexOf(string2) > 0;
+ }
+
+ //Requires wsdl4j
+ private Definition getWSDLDefinition(URL url) throws WSDLException
+ {
+ log.info("Retrieving WSDL from " + url);
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ javax.wsdl.xml.WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ try
+ {
+ return wsdlReader.readWSDL(new WSDLLocatorImpl(url));
+ }
+ catch (RuntimeException e)
+ {
+ throw new WSDLException(WSDLException.PARSER_ERROR, "Error while reading WSDL", e);
+ }
+ }
+
+
+ /** A WSDLLocator that can handle wsdl imports */
+ public static class WSDLLocatorImpl implements WSDLLocator
+ {
+ private URL wsdlURL;
+ private String latestImportURI;
+ private final Logger log = LoggerFactory.getLogger(getClass());
+ private static final int TIME_OUT_MS = 10000;
+
+ private static final String XML_XSD = "http://www.w3.org/2001/xml.xsd";
+ private static final String LOCAL_XML_XSD = "xsd/xml.xsd";
+
+ public WSDLLocatorImpl(URL wsdlFile)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(wsdlFile, "WSDL URL");
+
+ this.wsdlURL = wsdlFile;
+ }
+
+ public void close()
+ {
+ // nothing to do since we don't hold any resources
+ }
+
+ public InputSource getBaseInputSource()
+ {
+ log.debug("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
+
+ try
+ {
+ return new InputSource(URLTools.getContentAsInputStream(wsdlURL, TIME_OUT_MS, TIME_OUT_MS));
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Couldn't retrieve WSDL for " + wsdlURL, e);
+ }
+ }
+
+ public String getBaseURI()
+ {
+ return wsdlURL.toExternalForm();
+ }
+
+ public InputSource getImportInputSource(String parent, String resource)
+ {
+ log.debug("getImportInputSource [parent=" + parent + ",resource=" + resource + "]");
+
+ URL parentURL;
+ try
+ {
+ parentURL = new URL(parent);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Not a valid URL: " + parent);
+ return null;
+ }
+
+ String wsdlImport;
+ String external = parentURL.toExternalForm();
+
+ // An external URL
+ if (resource.startsWith("http://") || resource.startsWith("https://"))
+ {
+ wsdlImport = resource;
+ if (XML_XSD.equals(resource))
+ {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(LOCAL_XML_XSD);
+ log.debug("Using local xml.xsd");
+ return getWSDLImport(wsdlImport, is);
+ }
+ }
+
+ // Absolute path
+ else if (resource.startsWith("/"))
+ {
+ String beforePath = external.substring(0, external.indexOf(parentURL.getPath()));
+ wsdlImport = beforePath + resource;
+ }
+
+ // A relative path
+ else
+ {
+ String parentDir = external.substring(0, external.lastIndexOf("/"));
+
+ // remove references to current dir
+ while (resource.startsWith("./"))
+ {
+ resource = resource.substring(2);
+ }
+
+ // remove references to parentdir
+ while (resource.startsWith("../"))
+ {
+ parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
+ resource = resource.substring(3);
+ }
+
+ wsdlImport = parentDir + "/" + resource;
+ }
+
+ try
+ {
+ return getWSDLImport(wsdlImport, new URL(wsdlImport).openStream());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Cannot access imported wsdl [" + wsdlImport + "], " + e.getMessage());
+ }
+ }
+
+ private InputSource getWSDLImport(String wsdlImport, InputStream inputStream)
+ {
+ log.debug("Resolved to: " + wsdlImport);
+ InputStream is = IOTools.safeBufferedWrapper(inputStream);
+ if (is == null)
+ {
+ throw new IllegalArgumentException("Cannot import wsdl from [" + wsdlImport + "]");
+ }
+
+ latestImportURI = wsdlImport;
+ return new InputSource(is);
+ }
+
+ public String getLatestImportURI()
+ {
+ return latestImportURI;
+ }
+ }
+
+ private String getLocation(Port port)
+ {
+ String loc = "";
+ Iterator iter = port.getExtensibilityElements().iterator();
+ while (iter.hasNext())
+ {
+ ExtensibilityElement ext = (ExtensibilityElement)iter.next();
+ if (ext instanceof SOAPAddress)
+ {
+ SOAPAddress add = (SOAPAddress)ext;
+ loc = add.getLocationURI();
+ }
+ }
+ return loc;
+ }
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceDescriptionServiceWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+class ServiceDescriptionServiceWrapper /*extends ServiceWrapper<WSRP_v1_ServiceDescription_PortType> implements WSRP_v1_ServiceDescription_PortType*/
+{
+
+ /*protected ServiceDescriptionServiceWrapper(Object service, ManageableServiceFactory parentFactory)
+ {
+ super(service, parentFactory);
+ }
+
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ try
+ {
+ return service.getServiceDescription(getServiceDescription);
+ }
+ catch (RemoteException e)
+ {
+ handleRemoteException(e);
+ return null; // should not happen
+ }
+ }*/
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceFactory.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceFactory.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceFactory.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.wsrp.services;
+
+/**
+ * A factory that gives access to remote services.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11484 $
+ */
+public interface ServiceFactory
+{
+ <T> T getService(Class<T> clazz) throws Exception;
+
+ /**
+ * Determines whether or not this ServiceFactory is able to provide services. A non-available ServiceFactory might be
+ * in a temporary state of non-availability (e.g. if the remote host is not currently reachable) or permanently
+ * (because, e.g. its configuration is invalid). Permanent failure is indicated by {@link #isFailed()} status.
+ *
+ * @return <code>true</code> if this ServiceFactory is ready to provide services, <code>false</code> otherwise.
+ */
+ boolean isAvailable();
+
+ /**
+ * Determines whether or not this ServiceFactory is in a permanent state of failure which cannot be recovered from
+ * without user intervention. This notably happens if the configuration is incorrect (i.e. remote host URLs are
+ * invalid).
+ *
+ * @return <code>true</code> if this ServiceFactory is not configured properly, <code>false</code> otherwise.
+ */
+ boolean isFailed();
+
+ String getServiceDescriptionURL();
+
+ String getMarkupURL();
+
+ String getRegistrationURL();
+
+ String getPortletManagementURL();
+
+ void setServiceDescriptionURL(String serviceDescriptionURL);
+
+ void setMarkupURL(String markupURL);
+
+ void setRegistrationURL(String registrationURL);
+
+ void setPortletManagementURL(String portletManagementURL);
+
+ void start();
+
+ void stop();
+}
Added: jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceWrapper.java
===================================================================
--- jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceWrapper.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/consumer/src/main/java/org/jboss/portal/wsrp/services/ServiceWrapper.java 2009-08-25 13:40:47 UTC (rev 13788)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.services;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.soap.SOAPFaultException;
+import java.lang.reflect.ParameterizedType;
+import java.rmi.RemoteException;
+import java.util.Map;
+
+/**
+ * Wraps endpoints to be able to intercept RemoteExceptions on WSRP calls and fail the associated service factory if the
+ * error is not a business exception.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+class ServiceWrapper<T>
+{
+ protected T service;
+ protected ManageableServiceFactory parentFactory;
+ private static final int TIMEOUT_MS = 3 * 1000; //todo: expose timeout so that it can be changed from the GUI
+
+ /**
+ * HTTP request timeout property. JAX-WS doesn't standardize that value, so needs to be adapted per used
+ * implementation
+ */
+ private static final String JBOSS_WS_TIMEOUT = "org.jboss.ws.timeout";
+ private static final String SUN_WS_TIMEOUT = "com.sun.xml.ws.request.timeout";
+ private static final String IBM_WS_TIMEOUT = "com.ibm.SOAP.requestTimeout";
+
+ protected ServiceWrapper(Object service, ManageableServiceFactory parentFactory)
+ {
+ if (service == null)
+ {
+ throw new IllegalArgumentException("Cannot create a ServiceWrapper without a valid service!");
+ }
+
+ Class serviceClass = service.getClass();
+
+ // set timeout properties for different WS stacks
+ BindingProvider bindingProvider = (BindingProvider)service;
+ setTimeout(bindingProvider);
+
+
+ Class tClass = (Class)((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+ if (tClass.isAssignableFrom(serviceClass))
+ {
+ this.service = (T)service;
+ }
+ else
+ {
+ throw new IllegalArgumentException(service + " is not an instance of " + tClass.getSimpleName());
+ }
+ this.parentFactory = parentFactory;
+ }
+
+ private static void setTimeout(BindingProvider bindingProvider)
+ {
+ Map<String, Object> requestContext = bindingProvider.getRequestContext();
+ requestContext.put(JBOSS_WS_TIMEOUT, TIMEOUT_MS);
+ requestContext.put(SUN_WS_TIMEOUT, TIMEOUT_MS);
+ requestContext.put(IBM_WS_TIMEOUT, TIMEOUT_MS);
+ }
+
+ public static <T> T getServiceWrapper(Class<T> expectedServiceInterface, Object service, ManageableServiceFactory parentFactory)
+ {
+ /*ServiceWrapper wrapper;
+ if (WSRPV1ServiceDescriptionPortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new ServiceDescriptionServiceWrapper(service, parentFactory);
+ }
+ else if (WSRPV1MarkupPortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new MarkupServiceWrapper(service, parentFactory);
+ }
+ else if (WSRPV1RegistrationPortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new RegistrationServiceWrapper(service, parentFactory);
+ }
+ else if (WSRPV1PortletManagementPortType.class.isAssignableFrom(expectedServiceInterface))
+ {
+ wrapper = new PortletManagementServiceWrapper(service, parentFactory);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown endpoint interface " + expectedServiceInterface);
+ }
+
+ return expectedServiceInterface.cast(wrapper);*/
+
+ // for now, only set timeouts
+ setTimeout((BindingProvider)service);
+ return expectedServiceInterface.cast(service);
+ }
+
+ protected void handleRemoteException(RemoteException e) throws RemoteException
+ {
+ // if the remote exception happens to be a SOAPFaultException, this is a business exception, do NOT fail the factory in this case
+ // todo: not sure if this is still needed, will need testing
+ if (!(e.getCause() instanceof SOAPFaultException))
+ {
+ parentFactory.setAvailable(false);
+ }
+
+ throw e;
+ }
+}
Modified: jbossexo/modules/wsrp/trunk/pom.xml
===================================================================
--- jbossexo/modules/wsrp/trunk/pom.xml 2009-08-25 10:21:50 UTC (rev 13787)
+++ jbossexo/modules/wsrp/trunk/pom.xml 2009-08-25 13:40:47 UTC (rev 13788)
@@ -49,14 +49,14 @@
<modules>
<module>build</module>
- <!--<module>api</module>-->
+ <module>api</module>
<!--<module>wsrp1-rpc</module>-->
<module>wsrp1-ws</module>
<module>common</module>
<!--<module>test-support</module>-->
<module>producer</module>
- <!--<module>consumer</module>
- <module>admin-gui</module>-->
+ <module>consumer</module>
+ <!--<module>admin-gui</module>-->
<!--<module>service</module>-->
<!--<module>package</module>-->
</modules>
14 years, 9 months
JBoss Portal SVN: r13787 - docs/enterprise/trunk/Installation_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-25 06:21:50 -0400 (Tue, 25 Aug 2009)
New Revision: 13787
Modified:
docs/enterprise/trunk/Installation_Guide/ja-JP/Author_Group.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Book_Info.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Configuration.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Databases.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Getting_Started.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Installation.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Post_Installation.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Preface.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Revision_History.po
docs/enterprise/trunk/Installation_Guide/ja-JP/Test_Your_Installation.po
Log:
some copy&pastes
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Author_Group.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Author_Group.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Author_Group.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,20 +1,24 @@
+# translation of Author_Group.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Author_Group\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:10+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: author
#: Author_Group.xml:6
#, no-c-format
msgid "<firstname>Red Hat</firstname> <surname></surname>"
-msgstr ""
+msgstr "<firstname>Red Hat</firstname> <surname></surname>"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Book_Info.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Book_Info.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Book_Info.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Book_Info.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: 0\n"
+"Project-Id-Version: Book_Info\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:11+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Book_Info.xml:6
@@ -31,4 +34,5 @@
#: Book_Info.xml:25
#, no-c-format
msgid "&HOLDER;"
-msgstr ""
+msgstr "&HOLDER;"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Configuration.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Configuration.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Configuration.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Configuration.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Configuration\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:15+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Configuration.xml:5
@@ -146,3 +149,18 @@
" </local-tx-datasource>\n"
"</datasources>"
msgstr ""
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<datasources>\n"
+" <local-tx-datasource>\n"
+" <jndi-name>PortalDS</jndi-name>\n"
+" <connection-url>jdbc:mysql://localhost:3306/jbossportal?\n"
+" useServerPrepStmts=false&amp;jdbcCompliantTruncation=false</"
+"connection-url>\n"
+" <driver-class>com.mysql.jdbc.Driver</driver-class>\n"
+" <user-name><replaceable>portal</replaceable></user-"
+"name>\n"
+" <password><replaceable>portalpassword</replaceable></"
+"password> \n"
+" </local-tx-datasource>\n"
+"</datasources>"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Databases.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Databases.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Databases.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Databases.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Databases\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:18+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Databases.xml:6
@@ -96,6 +99,8 @@
"ERROR JDBCExceptionReporter Data truncation: Data too long for column '"
"jbp_viewrealemail' at row 1"
msgstr ""
+"ERROR JDBCExceptionReporter Data truncation: Data too long for column '"
+"jbp_viewrealemail' at row 1"
#. Tag: para
#: Databases.xml:46
@@ -131,6 +136,8 @@
"mysqladmin -u root password '<replaceable>new-root-user-password</"
"replaceable>'"
msgstr ""
+"mysqladmin -u root password '<replaceable>new-root-user-password</"
+"replaceable>'"
#. Tag: para
#: Databases.xml:60
@@ -144,7 +151,7 @@
#: Databases.xml:64
#, no-c-format
msgid "mysql -u root -p"
-msgstr ""
+msgstr "mysql -u root -p"
#. Tag: para
#: Databases.xml:68
@@ -161,7 +168,7 @@
#: Databases.xml:72
#, no-c-format
msgid "mysql> CREATE DATABASE jbossportal;"
-msgstr ""
+msgstr "mysql> CREATE DATABASE jbossportal;"
#. Tag: para
#: Databases.xml:74 Databases.xml:97
@@ -173,7 +180,7 @@
#: Databases.xml:78
#, no-c-format
msgid "Query OK, 1 row affected (0.00 sec)"
-msgstr ""
+msgstr "Query OK, 1 row affected (0.00 sec)"
#. Tag: para
#: Databases.xml:80
@@ -197,6 +204,15 @@
"+--------------------+\n"
"3 rows in set (0.00 sec)"
msgstr ""
+"mysql> SHOW DATABASES;\n"
+"+--------------------+\n"
+"| Database |\n"
+"+--------------------+\n"
+"| information_schema | \n"
+"| jbossportal | \n"
+"| mysql | \n"
+"+--------------------+\n"
+"3 rows in set (0.00 sec)"
#. Tag: para
#: Databases.xml:86
@@ -225,12 +241,16 @@
"IDENTIFIED BY '<replaceable>portalpassword</replaceable>' WITH GRANT "
"OPTION;"
msgstr ""
+"mysql> GRANT ALL PRIVILEGES ON jbossportal.* TO '<replaceable>portal</"
+"replaceable>'@'localhost' \n"
+"IDENTIFIED BY '<replaceable>portalpassword</replaceable>' WITH GRANT "
+"OPTION;"
#. Tag: screen
#: Databases.xml:101
#, no-c-format
msgid "Query OK, 0 rows affected (0.00 sec)"
-msgstr ""
+msgstr "Query OK, 0 rows affected (0.00 sec)"
#. Tag: para
#: Databases.xml:103
@@ -311,3 +331,17 @@
"doesn't exist\n"
"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02"
msgstr ""
+"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02\n"
+"ERROR [JDBCExceptionReporter] Table 'jbossportal."
+"jbp_cms_repositoryentry' doesn't exist\n"
+"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02\n"
+"ERROR [JDBCExceptionReporter] Table 'jbossportal."
+"jbp_cms_version_refs' doesn't exist\n"
+"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02\n"
+"ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_wsp_node' "
+"doesn't exist\n"
+"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02\n"
+"ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_cmsentry' "
+"doesn't exist\n"
+"WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Getting_Started.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Getting_Started.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Getting_Started.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Getting_Started.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Getting_Started\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:18+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Getting_Started.xml:6
@@ -182,9 +185,8 @@
#. Tag: screen
#: Getting_Started.xml:304
#, no-c-format
-msgid ""
-"<command moreinfo=\"none\">/usr/sbin/alternatives --config java</command>"
-msgstr ""
+msgid "<command moreinfo=\"none\">/usr/sbin/alternatives --config java</command>"
+msgstr "<command moreinfo=\"none\">/usr/sbin/alternatives --config java</command>"
#. Tag: para
#: Getting_Started.xml:305
@@ -206,8 +208,7 @@
#. Tag: title
#: Getting_Started.xml:315
#, no-c-format
-msgid ""
-"Installing and Configuring 32-bit Sun JDK 5.0 on a generic Linux platform"
+msgid "Installing and Configuring 32-bit Sun JDK 5.0 on a generic Linux platform"
msgstr ""
#. Tag: para
@@ -344,6 +345,10 @@
"Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)\n"
"Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)"
msgstr ""
+"[root@vsr ~]$ java -version\n"
+"java version \"1.5.0_11\"\n"
+"Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)\n"
+"Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)"
#. Tag: title
#: Getting_Started.xml:373
@@ -375,3 +380,4 @@
"View if necessary, open the System Control Panel applet, select the Advanced "
"Tab, and click on the Environment Variables button."
msgstr ""
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Installation.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Installation.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Installation.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Installation.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Installation\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:20+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Installation.xml:6
@@ -71,6 +74,9 @@
" [vsr]$ <literal>jar -xvf jboss-epp-<replaceable><release></"
"replaceable>.zip</literal>"
msgstr ""
+"[vsr]$ <literal>cd jbeppinstallationdir</literal>\n"
+" [vsr]$ <literal>jar -xvf jboss-epp-<replaceable><release></"
+"replaceable>.zip</literal>"
#. Tag: para
#: Installation.xml:30
@@ -131,3 +137,4 @@
"literal> to <literal>production/deploy</literal>. Don't forget to remove "
"<literal>jboss-portal-ha.sar</literal> though."
msgstr ""
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Post_Installation.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Post_Installation.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Post_Installation.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Post_Installation.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Post_Installation\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:19+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Post_Installation.xml:5
@@ -99,7 +102,7 @@
#: Post_Installation.xml:36
#, no-c-format
msgid "-Xms1303m -Xmx1303m -XX:PermSize=256m -XX:MaxPermSize=256m"
-msgstr ""
+msgstr "-Xms1303m -Xmx1303m -XX:PermSize=256m -XX:MaxPermSize=256m"
#. Tag: title
#: Post_Installation.xml:40
@@ -129,7 +132,7 @@
#: Post_Installation.xml:50
#, no-c-format
msgid "$JBOSS_HOME/server/$CONFIG/conf/props/jmx-console-users.properties"
-msgstr ""
+msgstr "$JBOSS_HOME/server/$CONFIG/conf/props/jmx-console-users.properties"
#. Tag: title
#: Post_Installation.xml:54
@@ -144,6 +147,8 @@
"$JBOSS_HOME/server/$CONFIG/deploy/management/console-mgr.sar/\n"
" web-console.war/WEB-INF/classes/web-console-users.properties"
msgstr ""
+"$JBOSS_HOME/server/$CONFIG/deploy/management/console-mgr.sar/\n"
+" web-console.war/WEB-INF/classes/web-console-users.properties"
#. Tag: para
#: Post_Installation.xml:56
@@ -201,6 +206,23 @@
" ...\n"
" </mbean>"
msgstr ""
+"<mbean code=\"org.jboss.jms.server.ServerPeer\"\n"
+" name=\"jboss.messaging:service=ServerPeer\"\n"
+" xmbean-dd=\"xmdesc/ServerPeer-xmbean.xml\">\n"
+" ...\n"
+" ...\n"
+" ...\n"
+" ...\n"
+" <!-- The password used by the message sucker connections to create "
+"connections.\n"
+" THIS SHOULD ALWAYS BE CHANGED AT INSTALL TIME TO SECURE SYSTEM "
+"-->\n"
+" <attribute name=\"SuckerPassword\"></attribute>\n"
+"\n"
+" ...\n"
+" ...\n"
+" ...\n"
+" </mbean>"
#. Tag: title
#: Post_Installation.xml:72
@@ -254,6 +276,21 @@
" </auth-constraint>\n"
"</security-constraint>"
msgstr ""
+"<security-constraint>\n"
+" <web-resource-collection>\n"
+" <web-resource-name>HtmlAdaptor</web-resource-name>\n"
+" <description>An example security config that only allows\n"
+"users with the\n"
+"role JBossAdmin to access the HTML JMX console web application\n"
+" </description>\n"
+" <url-pattern>/*</url-pattern>\n"
+" <http-method>GET</http-method>\n"
+" <http-method>POST</http-method>\n"
+" </web-resource-collection>\n"
+" <auth-constraint>\n"
+" <role-name>JBossAdmin</role-name>\n"
+" </auth-constraint>\n"
+"</security-constraint>"
#. Tag: title
#: Post_Installation.xml:86
@@ -293,6 +330,21 @@
" </auth-constraint>\n"
"</security-constraint>"
msgstr ""
+"<security-constraint>\n"
+" <web-resource-collection>\n"
+" <web-resource-name>HtmlAdaptor</web-resource-name>\n"
+" <description>An example security config that only allows\n"
+"users with the role JBossAdmin to access the HTML JMX console web "
+"application\n"
+" </description>\n"
+" <url-pattern>/*</url-pattern>\n"
+" <http-method>GET</http-method>\n"
+" <http-method>POST</http-method>\n"
+" </web-resource-collection>\n"
+" <auth-constraint>\n"
+" <role-name>JBossAdmin</role-name>\n"
+" </auth-constraint>\n"
+"</security-constraint>"
#. Tag: title
#: Post_Installation.xml:95
@@ -332,6 +384,20 @@
" </auth-constraint>\n"
" </security-constraint>"
msgstr ""
+"<security-constraint>\n"
+" <web-resource-collection>\n"
+" <web-resource-name>HttpInvokers</web-resource-name>\n"
+" <description>An example security config that only allows \n"
+"users with the role HttpInvoker to access the HTTP invoker servlets\n"
+" </description>\n"
+" <url-pattern>/restricted/*</url-pattern>\n"
+" <http-method>GET</http-method>\n"
+" <http-method>POST</http-method>\n"
+" </web-resource-collection>\n"
+" <auth-constraint>\n"
+" <role-name>HttpInvoker</role-name>\n"
+" </auth-constraint>\n"
+" </security-constraint>"
#. Tag: title
#: Post_Installation.xml:104
@@ -369,3 +435,16 @@
" </interceptors>\n"
"</descriptors>"
msgstr ""
+"<descriptors>\n"
+" <interceptors>\n"
+" <!-- Uncomment to require authenticated users -->\n"
+" <interceptor code=\"org.jboss.jmx.connector.invoker."
+"AuthenticationInterceptor\"\n"
+" securityDomain=\"java:/jaas/jmx-console\"/>\n"
+" <!-- Interceptor that deals with non-serializable results -->\n"
+" <interceptor code=\"org.jboss.jmx.connector.invoker."
+"SerializableInterceptor\"\n"
+" policyClass=\"StripModelMBeanInfoPolicy\"/>\n"
+" </interceptors>\n"
+"</descriptors>"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Preface.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Preface.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Preface.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,20 +1,24 @@
+# translation of Preface.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Preface\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:12+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Preface.xml:6
#, no-c-format
msgid "Preface"
-msgstr ""
+msgstr "序文"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Revision_History.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Revision_History.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Revision_History.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,26 +1,30 @@
+# translation of Revision_History.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Revision_History\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:12+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Revision_History.xml:6
#, no-c-format
msgid "Revision History"
-msgstr ""
+msgstr "改訂履歴"
#. Tag: author
#: Revision_History.xml:12
#, no-c-format
msgid "<firstname></firstname> <surname></surname> <email></email>"
-msgstr ""
+msgstr "<firstname></firstname> <surname></surname> <email></email>"
+
Modified: docs/enterprise/trunk/Installation_Guide/ja-JP/Test_Your_Installation.po
===================================================================
--- docs/enterprise/trunk/Installation_Guide/ja-JP/Test_Your_Installation.po 2009-08-25 09:08:35 UTC (rev 13786)
+++ docs/enterprise/trunk/Installation_Guide/ja-JP/Test_Your_Installation.po 2009-08-25 10:21:50 UTC (rev 13787)
@@ -1,17 +1,20 @@
+# translation of Test_Your_Installation.po to Japanese
# Language ja-JP translations for Installation_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: Installation_Guide VERSION\n"
+"Project-Id-Version: Test_Your_Installation\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:21+0000\n"
-"PO-Revision-Date: 2009-08-14 00:21+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-25 19:20+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Test_Your_Installation.xml:6 Test_Your_Installation.xml:22
@@ -74,6 +77,40 @@
"18:45:59,659 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: "
"resour ce:jboss-log4j.xml"
msgstr ""
+"[user@localhost bin]$ ./run.sh \n"
+"=====================================================\n"
+"\n"
+" JBoss Bootstrap Environment\n"
+"\n"
+" JBOSS_HOME: /home/user/jboss-eap-4.3/jboss-as\n"
+"\n"
+" JAVA: /usr/java/jdk1.5.0_11/bin/java\n"
+"\n"
+" JAVA_OPTS: -Dprogram.name=run.sh -server -Xms1503m -Xmx1503m -Dsun.rmi.dgc."
+"cli ent.gcInterval=3600000 \n"
+" -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.prefer "
+"IPv4Stack=true\n"
+"\n"
+" CLASSPATH: /home/user/jboss-eap-4.3/jboss-as/bin/run.jar:/u sr/java/"
+"jdk1.5.0_11/lib/tools.jar\n"
+"\n"
+"=====================================================\n"
+"\n"
+"18:45:49,550 INFO [Server] Starting JBoss (MX MicroKernel)...\n"
+".\n"
+".\n"
+".\n"
+".\n"
+"18:45:50,449 INFO [ServerInfo] Java version: 1.5.0_11,Sun Microsystems "
+"Inc.\n"
+"18:45:50,449 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_11-"
+"b03 ,Sun Microsystems Inc.\n"
+"18:45:50,449 INFO [ServerInfo] OS-System: Linux 2.6.9-42.0.3.EL,i386\n"
+"18:45:51,824 INFO [Server] Core system initialized\n"
+"18:45:59,622 INFO [WebService] Using RMI server codebase: "
+"http://127.0.0.1:8083 /\n"
+"18:45:59,659 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: "
+"resour ce:jboss-log4j.xml"
#. Tag: para
#: Test_Your_Installation.xml:12
@@ -107,3 +144,4 @@
"User Guide and Reference Guide for more information about the platform "
"layout and example applications showcasing JBoss Portal in action."
msgstr ""
+
14 years, 9 months
JBoss Portal SVN: r13786 - docs/enterprise/trunk/User_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-25 05:08:35 -0400 (Tue, 25 Aug 2009)
New Revision: 13786
Modified:
docs/enterprise/trunk/User_Guide/ja-JP/Administration_CMS_Portlet.po
docs/enterprise/trunk/User_Guide/ja-JP/Book_Info.po
docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
docs/enterprise/trunk/User_Guide/ja-JP/User_Role.po
Log:
some changes in kbabel
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Administration_CMS_Portlet.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Administration_CMS_Portlet.po 2009-08-24 13:56:27 UTC (rev 13785)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Administration_CMS_Portlet.po 2009-08-25 09:08:35 UTC (rev 13786)
@@ -8,7 +8,7 @@
"Project-Id-Version: Administration_CMS_Portlet\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-18 17:50+0900\n"
+"PO-Revision-Date: 2009-08-25 11:57+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@
#: Administration_CMS_Portlet.xml:6
#, no-c-format
msgid "Administration Content Management System (CMS) Portlet"
-msgstr "管理コンテンツマネージメントシステム (CMSAdmin) Portlet"
+msgstr "Administration Content Management System (CMS) Portlet"
#. Tag: title
#: Administration_CMS_Portlet.xml:11
@@ -42,7 +42,7 @@
"admin) and navigating to the admin portal and then the CMS Page tab."
msgstr ""
"CMSAdmin Portlet を表示するには、admin としてログインして (admin/admin)、 "
-"admin portal まで移動し、それから CMS Page タブへと進みます。"
+"admin portal まで移動し、それから CMS ページのタブへと進みます。"
#. Tag: para
#: Administration_CMS_Portlet.xml:22
@@ -121,13 +121,13 @@
msgstr ""
"バージョンとロケールの情報もこの画面に含まれています。<mediaobject> <imageobject> <imagedata fileref="
"\"images/admincms/live.png\" format=\"PNG\"/> </imageobject> </mediaobject> のラベルが付いたバージョンは "
-"全て、ユーザーに示される現在のライブバージョンです。"
+"全て、ユーザーに示される現在の \"live\"(ライブ)バージョンです。"
#. Tag: title
#: Administration_CMS_Portlet.xml:103
#, no-c-format
msgid "Copying Files/Directories"
-msgstr "ファイル/ディレクトリの複製(コピー)"
+msgstr "ファイル/ディレクトリの複写"
#. Tag: para
#: Administration_CMS_Portlet.xml:105
@@ -136,7 +136,7 @@
"Clicking on the \"Copy\" action, displays the copy file/directory dialog "
"window."
msgstr ""
-"\"Copy\"(複製)アクションをクリックすると、「ファイル/ディレクトリの複製」ダイアログ "
+"\"Copy\"(複写)アクションをクリックすると、「ファイル/ディレクトリの複写」ダイアログ "
"ウィンドウが表示されます。"
#. Tag: para
@@ -152,13 +152,13 @@
"name of the directory within the tree sets it as the destination directory "
"for the copied resource."
msgstr ""
-"「リソースの複製」ウィンドウの使用により、ユーザーはファイルをシステム上の "
-"どのフォルダにでも複製することが出来て、更にディレクトリツリー全体をシステム上の "
-"どのディレクトリにも複製することができます。ユーザーはディレクトリ閲覧を使用することで "
-"どの複製先ディレクトリにリソースを複製するかを選択できます。<mediaobject> <imageobject> "
+"「リソースの複写」ウィンドウの使用により、ユーザーはファイルをシステム上の "
+"どのフォルダにでも複写することが出来て、更にディレクトリツリー全体をシステム上の "
+"どのディレクトリにも複写することができます。ユーザーはディレクトリ閲覧を使用することで "
+"どの複写先ディレクトリにリソースを複写するかを選択できます。<mediaobject> <imageobject> "
"<imagedata fileref=\"images/admincms/plus.png\" format=\"PNG\"/> </"
"imageobject> </mediaobject> アイコンをクリックすると、ディレクトリツリーが展開します。 "
-"そのツリー内のディレクトリ名をクリックすると、それが複製するリソースの複製先ディレクトリとして "
+"そのツリー内のディレクトリ名をクリックすると、それが複写するリソースの複写先ディレクトリとして "
"セットされます。"
#. Tag: title
@@ -264,7 +264,7 @@
msgstr ""
"「ディレクトリリソースの作成」ウィンドウの使用により、ユーザーは選択したパス内に "
"ディレクトリを作成できます。このウィンドウでユーザーは新規の空ディレクトリの名前を "
-"指定することができ、それに説明を割り当てることができます。"
+"指定することができ、それに記述を割り当てることができます。"
#. Tag: title
#: Administration_CMS_Portlet.xml:205
@@ -297,11 +297,11 @@
msgstr ""
"「ファイルの作成」ウィンドウの使用により、ユーザーは組み込み型の WYSIWYG HTML "
"エディタを使ってテキスト、又は HTML のファイルを作成することができます。このエディタは "
-"HTML 機能を多数持つ全機能型 HTML エディタです。これにはまた、<mediaobject> "
+"HTML 機能を多数持つ全機能型 HTML エディタです。これにはまた、プレビュー用の <mediaobject> "
"<imageobject> <imagedata fileref=\"images/admincms/editorpreview.png\" "
-"format=\"PNG\"/> </imageobject> </mediaobject> button and a source view "
+"format=\"PNG\"/> </imageobject> </mediaobject> ボタンと、ソース表示用の "
"<mediaobject> <imageobject> <imagedata fileref=\"images/admincms/"
-"editorsource.png\" format=\"PNG\"/> </imageobject> </mediaobject> のプレビュー "
+"editorsource.png\" format=\"PNG\"/> </imageobject> </mediaobject> "
"ボタンも含まれています。"
#. Tag: para
@@ -317,7 +317,7 @@
"このエディタに関する詳細説明はこのドキュメントの管轄範囲を越えるものです。 "
"しかし、このエディタはその中にヘルプページを含んでおり、<mediaobject> <imageobject> <imagedata fileref=\"images/"
"admincms/editorhelp.png\" format=\"PNG\"/> </imageobject> </mediaobject> アイコンをクリックすることで "
-"そのヘルプにアクセスができますのでご覧下さい。"
+"そのヘルプにアクセスできますのでご覧下さい。"
#. Tag: para
#: Administration_CMS_Portlet.xml:249
@@ -509,11 +509,11 @@
msgstr ""
"「ファイルの編集」ウィンドウの使用により、ユーザーは組み込み型 WYSIWYG HTML エディタを "
"使ってテキスト、又は HTML ファイルを編集できます。このエディタは HTML 機能を数多く持った "
-"全機能型 HTML エディタです。これはまた、<mediaobject> "
+"全機能型 HTML エディタです。これはまた、プレビュー用の <mediaobject> "
"<imageobject> <imagedata fileref=\"images/admincms/editorpreview.png\" "
-"format=\"PNG\"/> </imageobject> </mediaobject> プレビューボタンと "
+"format=\"PNG\"/> </imageobject> </mediaobject> ボタンと、ソース表示用の "
"<mediaobject> <imageobject> <imagedata fileref=\"images/admincms/"
-"editorsource.png\" format=\"PNG\"/> </imageobject> </mediaobject> ソースビューボタンも "
+"editorsource.png\" format=\"PNG\"/> </imageobject> </mediaobject> ボタンも "
"含んでいます。"
#. Tag: para
@@ -586,7 +586,7 @@
"割り当てされたロール/ユーザーはリソースを編集、又はノードの作成ができます(フォルダと同様) "
"</para> </listitem> <listitem> <para> "
"<emphasis role=\"bold\">Manage Permissions(管理権限):</emphasis> この権限には "
-"複製、移動、削除、及びエキスポートが含まれます。</para> </listitem> </"
+"複写、移動、削除、及びエキスポートが含まれます。</para> </listitem> </"
"itemizedlist>"
#. Tag: title
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Book_Info.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Book_Info.po 2009-08-24 13:56:27 UTC (rev 13785)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Book_Info.po 2009-08-25 09:08:35 UTC (rev 13786)
@@ -8,7 +8,7 @@
"Project-Id-Version: Book_Info\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-17 13:40+0900\n"
+"PO-Revision-Date: 2009-08-25 13:23+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -30,7 +30,7 @@
"a \"Where do I Click?\" Guide."
msgstr ""
"このドキュメントは JBoss Portal をエンドユーザーとしてご使用の人を対象としています。 "
-"これは、\"Where do I Click?\" (どこをクリックしたらいいの?)ガイドです。"
+"これは、\"Where do I Click?\" (どこをクリックしたらいいの?)的なガイドです。"
#. Tag: para
#: Book_Info.xml:14
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-24 13:56:27 UTC (rev 13785)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-25 09:08:35 UTC (rev 13786)
@@ -8,7 +8,7 @@
"Project-Id-Version: Dynamicity\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-22 14:02+0900\n"
+"PO-Revision-Date: 2009-08-25 16:37+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -40,8 +40,8 @@
msgstr ""
"Dynamicity の概念は、すべての portal オブジェクトがランタイム時に動的に修正可能であり、 "
"大量の xml ファイルとの奮闘やその変更を反映するためのサーバーの再起動の必要性を "
-"抹消してしまう事実を示します。Dynamicity の有効範囲では、portal オブジェクトが定義 "
-"されて以下のように変更することができます:"
+"解消してしまう事実を示します。Dynamicity の有効範囲では、portal オブジェクトは "
+"以下のように定義されて、そして変更することができます:"
#. Tag: para
#: Dynamicity.xml:21
@@ -102,7 +102,7 @@
"of the above components."
msgstr ""
"テーマ/レイアウト: ホットデプロイが可能で、portal に登録します。これらは "
-"マネージメント portlet に現れて、上記のコンポーネンツのいずれでも動的 "
+"マネージメント portlet に現れて、上記のコンポーネンツのいずれでも動的な "
"カスタマイズを可能にします。"
#. Tag: para
@@ -204,13 +204,13 @@
"emphasis> tab, the context is the list of portals as shown in the picture "
"above."
msgstr ""
-"<emphasis role=\"bold\">Portal Objects</emphasis> は、この Portal サーバーに "
-"定義してある利用可能な portal インスタンスの一覧を示すページへ管理者を導きます。 "
-"重要な点がいくつかあります。まず、ナビゲーション指標、すなわち \"breadcrumbs\" は "
+"<emphasis role=\"bold\">Portal Objects</emphasis> は、管理者に対し、この Portal サーバーで "
+"定義してある利用可能な portal インスタンスの一覧ページを提示します。 "
+"重要な点がいくつかあります。まず、ナビゲーション指標、所謂 \"breadcrumbs\" は "
"タブ群の真下に位置しています。これが portal objects の階級の中で現在の画面が存在する "
-"位置についてのコンテキストを提供します。画面のいくつかは階級の数種のレベルで見られます。 "
+"位置についてコンテキストを提供します。画面のいくつかは階級の数レベルで出現します。 "
"迷ってしまった場合は、 \"breadcrumbs\" を参照してコンテキストを求めます。初めて "
-"<emphasis role=\"bold\">Portal Objects</emphasis> タブをクリックする時は、上記の "
+"<emphasis role=\"bold\">Portal Objects</emphasis> タブをクリックする場合は、上記の "
"画像で示してあるように、コンテキストは portals の一覧となります。"
#. Tag: para
@@ -274,7 +274,7 @@
"それらで実行できる可能性のあるアクションをリストした表です。portal 名をクリック "
"すると、該当する portal インスタンス用の情報を示す画面が現れます。そこから利用 "
"可能な portal オブジェクトの階級が下に向かいます。アクション名を1つクリックすると、 "
-"関連した portal インスタンス上の特定のアクションを実行します。これらのアクションは "
+"関連した portal インスタンスの特定のアクションを実行します。これらのアクションは "
"これから見ていくように、各個別の portal 画面で利用可能です。特記すべき例外は <literal>Make "
"Default/Default</literal> アクションで、これは特定の portal 用ではなく portal 群全域の "
"アクションであるため、このレベルで表示される利点があることからこのリスト内でのみ利用 "
@@ -294,14 +294,14 @@
"and, finally, look at specific window information."
msgstr ""
"次のセクションでは階級を段階的に降下して行くことにより、マネージメント portlet の機能を提示して "
-"デフォルトの portal とそのページの1つを見ていき、ページの内容の設定の方法を示して、 "
-"最後に特定のウィンドウの情報を見ていきます。"
+"デフォルトの portal とそのページの1つを見ていき、ページ内容の設定方法を示して、 "
+"最後に特定ウィンドウの情報を見ていきます。"
#. Tag: title
#: Dynamicity.xml:170
#, no-c-format
msgid "Looking at portal instance information"
-msgstr "portal instance 情報を見る"
+msgstr "portal インスタンスの情報を見る"
#. Tag: para
#: Dynamicity.xml:172
@@ -340,7 +340,7 @@
"この portal インスタンスに影響する他の情報やオペレーションへのリンクは "
"breadcrumbs の下に位置しています。名前が暗示するように、管理者が現在の "
"portal インスタンスを破壊できるようにする <literal>Destroy</literal> オペレーション "
-"は除外して、それぞれを後で説明していきます。<literal>Make Default/Default</"
+"は除外して、他のそれぞれを後で説明していきます。<literal>Make Default/Default</"
"literal> 以外は、これらのリンクはトップレベルページの portal インスタンスリスト内で "
"利用できるリンクのミラーになっています。"
@@ -375,13 +375,13 @@
msgstr ""
"最後として、この portal インスタンス用に利用可能なページのリストを表示している "
"表はこの画面の底辺に位置しています。最初のカラムはページ名を示しており、これを "
-"クリックすると階級を下降して行き、この特定のページ特有の情報を表示します。2つめの "
+"クリックして階級を下降して行くと、この特定のページ特有の情報を表示します。2つめの "
"カラムは、関連したページ上のアクションリンクのリストを提供します。これらのリンクは "
"個別のページ画面でも出現して、portal アクションリンクが portal インスタンスリストに "
"出現したのと同様に、個別の portal ページでも出現します。繰り返しになりますが、 "
-"<literal>Make Default/Default</literal> アクションは、その対応する portal として動作して "
+"<literal>Make Default/Default</literal> アクションは、その相当する portal として動作して "
"このリストのみに出現します。ここが、ユーザーが初めて portal インスタンスにアクセスした時に "
-"どのページがデフォルトであるかを指定する場所です。"
+"デフォルト表示となるページを指定する場所です。"
#. Tag: para
#: Dynamicity.xml:214
@@ -399,7 +399,7 @@
msgstr ""
"さて、デフォルト portal の <literal>Security</literal> 情報画面を見てみましょう。 "
"この画面は、portal ページの <literal>Security</literal> アクションリンクをクリック "
-"するとアクセスできます。ここでは、管理者はこの portal インスタンス用オブジェクトの "
+"するとアクセスできます。ここで、管理者はこの portal インスタンス用オブジェクトの "
"セキュリティに関するデフォルトポリシーを設定できます。<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
"default_portal_security.png\" format=\"PNG\"/> </imageobject> </mediaobject> "
"portal オブジェクトのセキュリティの設定に関する詳細情報には、リファレンスガイドの "
@@ -466,8 +466,8 @@
"literal> page, by clicking its name in the pages list."
msgstr ""
"これで portal レベルの情報を見終りましたので、再度階級を下降してページリスト内の "
-"名前をクリックすることにより、ページ、精確には <literal>default</"
-"literal> ページを見てみましょう。"
+"名前をクリックすることにより、ページ(精確には <literal>default</"
+"literal> ページ)を見てみましょう。"
#. Tag: title
#: Dynamicity.xml:284
@@ -743,8 +743,8 @@
msgstr ""
"<literal>Portlet Instances</literal> タブは管理者に、実行中の portal 内で作成された "
"インスタンスのリストを提示します。このページでは、ユーザーは(一定のロールにのみアクセスを許可するため) "
-"その portlet 用のセキュリティ制約を修正すること、1つのインスタンスを破壊すること、又は上書きの "
-"個人設定がある場合は、特定のインスタンス用の portlet 定義の個人設定を上書きすることができます。 "
+"その portlet 用のセキュリティ制約を修正すること、1つのインスタンスを破壊すること、又は上書き可能な "
+"個人設定がある場合は特定のインスタンス用の portlet 定義の個人設定を上書きすることができます。 "
#. Tag: title
#: Dynamicity.xml:513
@@ -801,7 +801,7 @@
"WSRP プロデューサによって発行された portlets を消費するように設定されています。これは、 "
"Portal の WSRP 機能のクイックテストを許可すること以外には、大した意味を持ちません。 "
"</para> </listitem> </itemizedlist> このリストにはもっと多くのプロバイダを追加する "
-"ことができます。アクティブで正しく設定された WSRP コンシューマはドロップダウンメニュー "
+"ことができます。アクティブであり、正しく設定された WSRP コンシューマはドロップダウンメニュー "
"にも出てきます。このトピックの詳細情報についてはリファレンスガイドの <ulink url=\"http://docs.jboss.com/jbportal/v2.6/reference-guide/en/html/"
"wsrp.html#consumer_configuration\">Consuming remote WSRP portlets in JBoss "
"Portal </ulink> の章をご覧下さい。"
Modified: docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-24 13:56:27 UTC (rev 13785)
+++ docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-25 09:08:35 UTC (rev 13786)
@@ -8,7 +8,7 @@
"Project-Id-Version: JBoss_Portal_Basics\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-21 14:33+0900\n"
+"PO-Revision-Date: 2009-08-25 17:31+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -36,7 +36,7 @@
"concepts used within JBoss Portal and throughout this document."
msgstr ""
"このセクションでは、基本的な Portal 用語と、JBoss Portal 及び "
-"このドキュメント内で使用されている概念を読者の皆さんに紹介しています。"
+"このドキュメント内で使用されている概念を紹介しています。"
#. Tag: title
#: JBoss_Portal_Basics.xml:19
@@ -76,7 +76,7 @@
"portal/<replaceable>[portal_name]</replaceable></emphasis> で到達できます。 "
"デフォルト/ローカルのインストールでは、 <emphasis>default</emphasis> portal "
"インスタンスは http://localhost:8080/portal/portal/default で到達できます。利用可能な "
-"portal インスタンスについての情報は、該当する portal 管理者に相談して下さい。その "
+"portal インスタンスについての情報は、担当の portal 管理者に相談して下さい。その "
"一部ではログインが制限されています。"
#. Tag: title
@@ -94,7 +94,7 @@
"all of the HTML markup created by the individual portlets, decorates them "
"with window controls, and presents them to the user as a consolidated page."
msgstr ""
-"Portal Page は Portlet Windows の集約です。これは反応フェーズ中に portal によって "
+"Portal Page は Portlet Windows の集約です。これはレスポンスフェーズ中に portal によって "
"生成されます。このフェーズ中に portal は、個別の portlets によって作成された HTML "
"markup の全てを集約し、それらをウィンドウ制御で装飾して、それからそれらを結合した "
"ページとしてユーザーに提供します。"
@@ -111,7 +111,7 @@
"default . Likewise, the News Page in a default install can be reached at "
"http://localhost:8080/portal/portal/default/News"
msgstr ""
-"それぞれの portal page は url 形式: <emphasis>http://<replaceable>"
+"それぞれの portal page は url 書式: <emphasis>http://<replaceable>"
"[domain]</replaceable>/<replaceable>[context]</replaceable>/portal/"
"<replaceable>[portal_name]</replaceable>/<replaceable>[page_name]</"
"replaceable></emphasis> で到達できます。デフォルト/ローカルのインストールでは、 "
@@ -141,7 +141,7 @@
"mediaobject> The diagram above shows the default JBoss Portal page with "
"certain window-related items highlighted (in red). Lets look at these items:"
msgstr ""
-"Portlet Windows は Portal Pages で見ることができるもので、特定の portlet インスタンスに "
+"Portlet Windows は Portal Pages で見ることができ、特定の portlet インスタンスに "
"関する HTML markup を収納しています。<mediaobject> <imageobject> <imagedata fileref="
"\"images/intro/window.jpg\" format=\"JPG\" scalefit=\"1\"/> </imageobject> </"
"mediaobject> 上記の表では、(赤字で)強調した特定の window 関連の項目を持つデフォルトの "
@@ -271,7 +271,7 @@
msgstr ""
"<emphasis role=\"bold\">Portlet Modes とその意味:</emphasis>Portlet Modes は "
"常に利用できる訳ではありません(任意のモード用の portlet サポートにより変化)。更には、 "
-"Edit mode では portlet 個人設定が特定のユーザーニーズに対応するように個別に修正可能なため "
+"Edit mode では portlet 個人設定が特定のユーザーニーズに対応するように個別に修正可能なため、 "
"このモードでは ログインしたユーザーにのみ利用可能です。"
#. Tag: para
@@ -374,7 +374,7 @@
msgstr ""
"Portal を無記名で使用することはできるのですが、 "
"<xref linkend=\"Portal_User_Guide-JBoss_Portal_Basics-Dashboard\"/> で説明があるように、 "
-"ログインすると見たいコンテンツをカスタマイズしたり、自分自身の Dashboard を作成したりする機会を "
+"ログインすれば見たいコンテンツをカスタマイズしたり、自分自身の Dashboard を作成したりする機会を "
"得るため、作業がもっと興味深いものになります。"
#. Tag: title
@@ -415,7 +415,7 @@
"instances, they will be shown here as well."
msgstr ""
"ログインすると、右上のメニューが変化してユーザー個人の dashboard に移動するか、 "
-"又はログアウトすることができるようになります。他の portal インスタンスにアクセスを "
+"又はログアウトすることができるようになります。他の portal インスタンスへのアクセス権を "
"所有している場合は、それらもここで表示されます。"
#. Tag: para
@@ -555,7 +555,7 @@
"password and e-mail address at any time by clicking on the <emphasis role="
"\"bold\">Edit profile</emphasis> link, when logged in."
msgstr ""
-"ユーザーはログイン時に <emphasis role=\"bold\">Edit profile</emphasis> リンクをクリックして "
+"ユーザーはログインした時に <emphasis role=\"bold\">Edit profile</emphasis> リンクをクリックして "
"その個人情報の編集や、パスワードの変更、及び電子メールアドレスの変更などを実行する能力を与えられて "
"います。"
@@ -590,10 +590,10 @@
"displayed outside of the portal pages, but text/html are displayed inside "
"the CMSPortlet Window."
msgstr ""
-"Content は portal を介してパスマッパーを使用して表示されます。例えば、<emphasis>/default/foo/bar.zip</"
+"Content は portal を介してパスマッパー(path mapper)を使用して表示されます。例えば、<emphasis>/default/foo/bar.zip</"
"emphasis> に存在する zip ファイルを表示したい場合は、URL <emphasis>http://localhost:8080/content/"
"default/foo/bar.zip</emphasis> を記入します。コンテンツへのパスが <emphasis role=\"bold\">/content</emphasis> を "
-"先頭に配置している方法に注意して下さい。この例では、バイナリコンテンツの取り込みを説明していますが、同様なことが "
+"先頭に配置していることに注意して下さい。この例では、バイナリコンテンツの取り込みを説明していますが、同様なことが "
"テキスト/html ファイルにも言えます。但し、バイナリファイルは portal ページの外部で表示されて、 "
"テキスト/html ファイルは CMSPortlet ウィンドウの内部で表示されることを忘れないで下さい。"
@@ -613,7 +613,7 @@
"そのブラウザでスペイン語にセットしてあり、要求が URL: default/index.html である場合は、 "
"CMSPortlet は最初にそのファイルのスペイン語バージョンを取り込む試みをするでしょう。 "
"スペイン語バージョンが見付からない場合は、CMSPortlet はそれ自身用にセットしてある "
-"デフォルトの言語のバージョン(例:デフォルトで英語)を取り込み試みをするでしょう。"
+"デフォルト言語のバージョン(例:デフォルトで英語)の取り込みを試みるでしょう。"
#. Tag: para
#: JBoss_Portal_Basics.xml:461
@@ -737,7 +737,7 @@
"ico_edit.gif\" format=\"GIF\"/> </imageobject> </mediaobject> をクリックしてから、 "
"Portlet の <emphasis role=\"bold\">Edit Mode</emphasis> を使用することでユーザーの地域 "
"設定を変更することができます。有効な米国の郵便番号はどれもここで入力できます。その書式が "
-"提出された後は、そのプロパティがユーザーの個人設定に保存されるため、ユーザーはログインした時は "
+"提出された後は、そのプロパティがユーザーの個人設定に保存されるため、ユーザーはログインした時に "
"いつでもその同じ地域の気候情報を見ることができます。"
#. Tag: para
@@ -775,7 +775,7 @@
"in this case):"
msgstr ""
"<emphasis role=\"bold\">Search Results(検出結果)</emphasis> の中のリストから "
-"地元の位置を見つけて、それをクリックします(例では、<emphasis>Marseille, France</emphasis>):"
+"地元の地域を見つけて、それをクリックします(例では、<emphasis>Marseille, France</emphasis>):"
#. Tag: para
#: JBoss_Portal_Basics.xml:600
@@ -845,7 +845,7 @@
"will clone the page and add it to your personal dashboard as a page with the "
"same name."
msgstr ""
-"また、共有のページの内容もユーザーの dashboard にコピーできますので、それも "
+"また、共有ページの内容もユーザーの dashboard にコピーできますので、それも "
"好みでカスタマイズできます。ページ右上の <emphasis role=\"bold"
"\">Copy to my dashboard</emphasis> リンクをクリックします。これが "
"そのページをクローンして、それを同じ名前のページとしてユーザーの "
Modified: docs/enterprise/trunk/User_Guide/ja-JP/User_Role.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/User_Role.po 2009-08-24 13:56:27 UTC (rev 13785)
+++ docs/enterprise/trunk/User_Guide/ja-JP/User_Role.po 2009-08-25 09:08:35 UTC (rev 13786)
@@ -8,7 +8,7 @@
"Project-Id-Version: User_Role\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-17 17:19+0900\n"
+"PO-Revision-Date: 2009-08-25 18:01+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -35,8 +35,8 @@
"change between user and role management by clicking on the corresponding "
"links in the top of the portlet."
msgstr ""
-"この章では、ユーザー管理 Portlet によって利用できる管理者の機能を説明 "
-"しています。エンドユーザーの操作には、<xref linkend="
+"この章では、User management(ユーザー管理) Portlet によって利用できる "
+"管理者の機能を説明 しています。エンドユーザーの操作には、<xref linkend="
"\"Portal_User_Guide-Home_Page-Intro_user_portlet\"/> をご覧下さい。 "
"管理用機能は、適切な信任状(admin/admin)でログインした時に使用可能となり、 "
"<xref linkend=\"Portal_User_Guide-JBoss_Portal_Basics-Admin_Portal\"/> に "
@@ -70,7 +70,7 @@
"JBoss_Portal_Basics-Admin_Portal\"/>."
msgstr ""
"<xref linkend=\"Portal_User_Guide-"
-"JBoss_Portal_Basics-Admin_Portal\"/> 内のユーザーのページ"
+"JBoss_Portal_Basics-Admin_Portal\"/> 内のメンバーページ"
#. Tag: title
#: User_Role.xml:37 User_Role.xml:207
@@ -105,7 +105,7 @@
#: User_Role.xml:49
#, no-c-format
msgid "The User management portlet."
-msgstr "ユーザー管理の Portlet"
+msgstr "ユーザー管理 Portlet"
#. Tag: title
#: User_Role.xml:57
@@ -123,7 +123,7 @@
msgstr ""
"ユーザーを検索するには、リンク <emphasis role=\"bold\">Search users</"
"emphasis> をクリックして、それからテキストフィールド内に名前の一部を入力します。 "
-"これがその基準に一致するユーザー名を検出します。"
+"これがその部分的名前に一致するユーザー名群を検出します。"
#. Tag: para
#: User_Role.xml:67
@@ -216,7 +216,7 @@
"on <emphasis>select all</emphasis> to approve or reject all selected users."
msgstr ""
"<emphasis role=\"bold\">Show pending registrations</emphasis> リンクをクリックすると、 "
-"妥当性確認を受けた電子メールアドレスを持つ全ての登録を表示することができます。各ユーザーを "
+"妥当性検証済の電子メールアドレスを持つ全ての登録を表示することができます。各ユーザーを "
"認可、又は否定するにはその該当するアクションをクリックするか、又は <emphasis>select all "
"</emphasis> をクリックして全ての選択済みユーザーを認可する,又は、否定することができます。"
" "
@@ -245,7 +245,7 @@
#: User_Role.xml:179
#, no-c-format
msgid "Managing Roles"
-msgstr "管理ロール"
+msgstr "ロールの管理"
#. Tag: para
#: User_Role.xml:181
@@ -264,7 +264,7 @@
#: User_Role.xml:187
#, no-c-format
msgid "Introduction"
-msgstr "導入"
+msgstr "案内"
#. Tag: para
#: User_Role.xml:189
14 years, 9 months
JBoss Portal SVN: r13785 - in modules/authorization/trunk/documentation: reference-guide/en and 1 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-08-24 09:56:27 -0400 (Mon, 24 Aug 2009)
New Revision: 13785
Added:
modules/authorization/trunk/documentation/authz-component-spec.braindump
modules/authorization/trunk/documentation/dev-api.braindump
modules/authorization/trunk/documentation/reference-guide/en/modules/framework.xml
Removed:
modules/authorization/trunk/documentation/reference-guide/en/modules/api.xml
Modified:
modules/authorization/trunk/documentation/reference-guide/en/master.xml
Log:
some docs backup
* note: delete the .braindump files once incorporated into organized docbook modules
Added: modules/authorization/trunk/documentation/authz-component-spec.braindump
===================================================================
--- modules/authorization/trunk/documentation/authz-component-spec.braindump (rev 0)
+++ modules/authorization/trunk/documentation/authz-component-spec.braindump 2009-08-24 13:56:27 UTC (rev 13785)
@@ -0,0 +1,57 @@
+"Authorization Component" spec represents the "contract" between the various domain oriented security components and the framework. The framework
+processes these components during both the Authorization phases. During the Enforcement Phase, these components are translated into "facts" that
+Rule Engine bases its access decision upon. In the Provisioning Phase, the framework processes these components to produce the "facts" and "expressions"
+that will make up the new policy.
+
+
+Here are the rules that an "Authorization component" must meet in order to be properly processed by the framework.
+
+* The component are simple java beans or POJOs.
+* They must have an empty constructor
+* The fields that represent the "facts" must have corresponding accessors (getters and setters)
+* The various members of the component must be appropriately annotated to provide meta data information for the framework. The Annotations are covered
+in greater detail a little later in this chapter
+
+
+Annotations
+
+Component: A "Type" level component used to indicate that an instance of the annotated class must be treated as an "Authorization Component"
+by the framework.
+ name: represents the unique name of the component
+ type: represents whether the component represents the "Target" aspect or the "Logic" aspect of the Policy
+ category: represents what kind of data it represents. There are 4 main categories that "facts" can belong to:
+ Resource: what resource am I trying to access?
+ Subject: who am I?
+ Action: what action/operation am I trying to perform upon the Resource
+ Environment: what other interesting facts can I provide such as "current date", "client ip address", "portlet preferences", etc
+
+
+ComponentType:
+
+ComponentCategory:
+
+SecurityContextData:
+
+LogicExpression:
+
+ImpliedActions:
+
+Core Components:
+
+ Identity:
+
+ Roles:
+
+ URIResource:
+
+ Read:
+
+ Write:
+
+ Manage:
+
+More to Come based on the XACML Spec scenarios:
+
+
+
+
\ No newline at end of file
Added: modules/authorization/trunk/documentation/dev-api.braindump
===================================================================
--- modules/authorization/trunk/documentation/dev-api.braindump (rev 0)
+++ modules/authorization/trunk/documentation/dev-api.braindump 2009-08-24 13:56:27 UTC (rev 13785)
@@ -0,0 +1,143 @@
+The Authorization Framework relies on a Rule based approach for enforcing access control. A rule engine matches the current Enforcement State of the application
+against the various Policies stored in the Policy Store. A matching policy is found based on "facts" presented within the incoming Enforcmenet State.
+Once a Policy match is found, all the Rules associated with this Policy are evaluated against the "facts" presented by the Enforcement State.
+Each Policy Rule consists of a Pattern Matching component and an optional Conditional component that evaluates a boolean expression against the incoming
+"facts". A Rule results in a "Permit" or "Deny" assertion and a Policy Combining Algorithm processes these assertions to make a "Yes", or "No"
+decision.
+
+
+
+A Policy forms the central concept of this framework. A Policy is composed of the following components:
+
+* One Target - A Policy Target component consists of "facts" to once matched appropriately with the "facts" included with the incoming Enforcement Request,
+qualifies that particular Policy instance for evaluation inside the Rule Engine
+
+* One or More Rules - Each Rule inside a Policy is evaluated against the "facts" of the incoming Enforcement Request. A Rule execution results in a "Permit"
+or "Deny" state. A Rule itself is composed of multiple components.
+
+* One Rule Target - A Rule is selected for execution if the "facts" represented within its Target component match the "facts" within the incoming request.
+
+* One (optional) Conditional Expression - If a Rule contains a Conditional Expression, it is evaluated for a boolean result against the "facts" within the
+incoming request. If the result is "true", then the appropriate Rule Effect "Permit" or "Deny" becomes the state of this Rule evaludation
+
+
+A typical Authorization system operates in two phases.
+
+* Enforcement - This is where Access Control is enforced during application request execution.
+
+* Provisioning - This is where Security Policies are administered in the system.
+This is done via tools like GUI based Admin tool, a command line tool, or xml based configuration tool etc. It uses the Provisioning API of the framework
+
+
+Enforcement
+
+* Enforcement is the cross cutting concern of the application and injected into the application request life cycle as a system service
+
+* Enforcement Interceptor – This is the component that intercepts incoming request for access control evaluation.
+The term Interceptor needs clarification. I use the term Interceptor in a logical sense, and not in low level technical terms.
+What that means that interceptor does not mean it has to be an AOP interceptor only.
+What component performs the interception is at the discretion of the Application Developer/System Integrator.
+Some examples of interceptors could be:
+
+* In the Http Layer it could be a Servlet Filter or a Tomcat Valve
+
+* In the Portal Layer it could actually be an AOP based Interceptor
+
+* In the Portlet Layer it could be a Portlet Filter
+
+* In the Seam Layer it could be a Phase Listener
+
+EnforcementContext – This consists of runtime application state populated by the Enforcement Interceptor against which Policy Rules are evaluated.
+This state is arbitrary and depends upon what data is useful in coming up with an access control decision. EnforcementContext answers the ”This is what I am trying to access, and this is my current application state”. It has no knowledge of the logic that will be applied to this data or cares for it. Objects placed into an EnforcementContext are understood as ”Security Components”. These components are basically Annotated POJOs that the framework can understand and process against the Rule Engine.
+More about the ”Security Component” specification is discussed later.
+
+The framework provides an extensive set of core ”Security Components”. The core Component Set is extensive and tries to cover the concepts covered by the industry standard xacml specification.
+More custom Components can also be created based on the ”Security Component” specification.
+
+An incoming request is intercepted before invoking a protected resource, an EnforcementContext consisting of runtime state of the system is populated,
+and and Enforcement Request is issued to the framework
+
+The framework then processes this Request through its Rule Engine and stored Policies to come up with a yes or no decision
+
+If access is granted, the request moves forward, if not, appropriate action is taken by the application
+
+
+Provisioning
+
+CompositionContext – The CompositionContext allows the Developer to specify the Policy Structure for the Policy using ”Security Components”,
+just like the EnforcementContext.
+
+This Policy Structure is then handed over to a PolicyComposer by the framework which then auto generates the system policy (an xacml policy)
+including all the conditional logic that must be used within the Policy Rules. As a Developer trying to provision a policy your
+main concern is to populate the state of the ”Security Component” based on your Security Requirements.
+Rule Generation including conditional logic expressions is automatically handled by the PolicyComposer component of the framework
+
+The Developer is never exposed to any low-level xacml/xml mess. In fact, we picked xacml which is an industry spec, and a supported
+JBoss Security component. This can be completely replaced with a custom Rule Engine with proprietary Policy Language,
+and the Application would never be affected.
+
+Once the Policy is provisioned it is then managed by the framework and used during incoming Enforcement Requests.
+
+All provisioning is dynamic as in, when the Policy Repository is updated, the changes go into effect immediately without requiring any server/application restart
+
+
+Development Process
+
+The original goal of the Authorization Framework was to eliminate all authorization related logic from the core application and/or infrastructure code.
+The idea was to make Authorization a purely cross cutting concern for applications.
+
+With this goal in mind, development using the Authorization Framework fell into three stages
+
+* Core Application/Infrastructure Development: This is where the developers develop their applications without any concern of embedding any security checking
+logic inside their implementation. Basically, think of it as developing an application that does not have any security functionality
+
+* Enforcement Layer: This is the cross cutting layer of the application that introduces authorization functionality to an otherwise authorization agnostic
+application. This layer makes the "Enforcement Phase" possible.
+
+* Provisioning Layer: This is the provisioning aspect of authorization. This layer provides policy management capabilities associated with the functional
+requirements of the application being developed.
+
+As a user of the Authorization Framework, the developer is concerned with the Enforcement Layer and Provisioning Layer development
+
+
+
+Enforcement Layer Development Steps
+
+* Depending upon the architecture of your application, identify the interception points and interceptor type when Enforcement Calls can be plugged in.
+For instance, if you are trying to protect the application at the Http Layer, you can used a Servlet Filter based Enforcement Layer
+In case of a POJO Service layer, you could possibly use an AOP based approach
+
+* Based on the "facts" and "rules" used inside the Policy Structure decide what "facts" about your application will be used to populate the Enforcement
+Request. This is what I would loosely qualify as the contract between the Enforcement Phase and the Provisioning Phase, and is driven by the authorization
+requirements of the application
+
+* Select the Authorization "components" that will be used to represent these facts. You can pick from the set of core components that come packaged out of
+the box with the framework itself. If the set of core components are not enough for your requirements, then you can develop custom components
+that adhere to the "Authorization Component Spec".
+
+* Populate the EnforcementContext with Authorization Components for Access Control checks
+
+
+Provisioning Layer Development Steps
+
+* Depending upon the authorization requirements of the application, select the "Authorization Components" to be used to provision the corresponding Policies
+
+* Populate the Composition Context with these components.
+
+* Policy Composer takes care of the rest related to generating the appropriate Policy. It generates all the "Targets", "Rules", and "Conditional Expressions"
+to be associated with the Policy
+
+
+Some Development Observations
+
+* As a Developer, in both authorization phases, when dealing with "Authorization Components", you are more concerned with populating the "state" of the
+components which is represented as "facts" inside the Rule Engine
+
+* You are not concerned as much about low level details of Policy Composition and Policy Structure. That is taken care of by the Policy Composer
+
+* The "Authorization Components" in a way enforce the "contract" between the Enforcement and Provisioning phases. The same components are involved to ensure
+appropriate "facts" and "rules" are represented within the Policy and then while doing security checks
+
+Simple Enforcement Phase Example
+
+Simple Provisioning Example
\ No newline at end of file
Modified: modules/authorization/trunk/documentation/reference-guide/en/master.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/en/master.xml 2009-08-24 02:03:05 UTC (rev 13784)
+++ modules/authorization/trunk/documentation/reference-guide/en/master.xml 2009-08-24 13:56:27 UTC (rev 13785)
@@ -16,7 +16,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/introduction.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/concepts.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/architecture.xml" />
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/api.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/framework.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/profiles.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/spi.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/examples.xml" />
Deleted: modules/authorization/trunk/documentation/reference-guide/en/modules/api.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/en/modules/api.xml 2009-08-24 02:03:05 UTC (rev 13784)
+++ modules/authorization/trunk/documentation/reference-guide/en/modules/api.xml 2009-08-24 13:56:27 UTC (rev 13785)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="api">
- <chapterinfo>
- <author>
- <firstname>Sohil</firstname>
- <surname>Shah</surname>
- <email>sshah(a)redhat.com</email>
- </author>
- </chapterinfo>
- <title>Developer API</title>
- <sect1>
- <title>Developer API</title>
- <para>
- </para>
- </sect1>
-</chapter>
Copied: modules/authorization/trunk/documentation/reference-guide/en/modules/framework.xml (from rev 13731, modules/authorization/trunk/documentation/reference-guide/en/modules/api.xml)
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/en/modules/framework.xml (rev 0)
+++ modules/authorization/trunk/documentation/reference-guide/en/modules/framework.xml 2009-08-24 13:56:27 UTC (rev 13785)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="framework">
+ <chapterinfo>
+ <author>
+ <firstname>Sohil</firstname>
+ <surname>Shah</surname>
+ <email>sshah(a)redhat.com</email>
+ </author>
+ </chapterinfo>
+ <title>Framework</title>
+ <sect1>
+ <title>Developer API</title>
+ <para>
+ The <emphasis>Authorization Framework</emphasis> consists of a <emphasis role="bold">component-oriented Developer API</emphasis>.
+ The API is used to integrate an Authorization layer for your application.
+ This allows your Application components to be free from any embedded Security Logic.
+ The Framework itself provides a number of useful <emphasis>reusable</emphasis> components.
+ These components can be used by application developers to create custom Authorization layers, and/or by infrastructure developers
+ to develop Profiles for their respective tier.
+ The components adhere to what we call the "Authorization Component" spec, to be covered in more detail in the next chapter.
+ </para>
+ </sect1>
+ <sect1>
+ <title>Rule based Framework</title>
+ <para>
+ The Authorization Framework relies on a Rule based approach for enforcing access control. A Rule Engine matches the incoming enforcement request
+ against the various policies stored in the Policy Store. A matching policy is found based on "facts" presented within the request.
+ Once a Policy match is found, all the Rules associated with this Policy are evaluated to reach a "Permit" or "Deny" state.
+ </para>
+ <sect2>
+ <title>Policy</title>
+ <para>
+ A Policy forms the central concept of this framework. A Policy is composed of the following components:
+ <itemizedlist>
+ <listitem><emphasis role="bold">One</emphasis> Target :
+ A policy-level <emphasis>Target</emphasis> component consists of <emphasis role="bold">"facts"</emphasis> to be matched
+ appropriately with the <emphasis role="bold">"facts"</emphasis> included with the incoming enforcement request.
+ This <emphasis role="bold">"fact-matching"</emphasis> selects a policy instance for evaluation inside the Rule Engine.
+ </listitem>
+ <listitem><emphasis role="bold">One or More</emphasis> Rules : Each <emphasis>Rule</emphasis> inside a policy is evaluated
+ against the <emphasis role="bold">"facts"</emphasis> presented by the incoming enforcement request.
+ A <emphasis>Rule</emphasis> execution results in a <emphasis role="bold">"Permit"</emphasis>
+ or <emphasis role="bold">"Deny"</emphasis> state. A <emphasis>Rule</emphasis> itself is composed of a <emphasis>Target</emphasis> and a <emphasis>Conditional Expression</emphasis>.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">One</emphasis> rule-level Target - A <emphasis>Rule</emphasis> is selected for execution if the
+ <emphasis role="bold">"facts"</emphasis> represented within its Target component match the <emphasis role="bold">"facts"</emphasis>
+ within the incoming request.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">One (optional)</emphasis> Conditional Expression - If a <emphasis>Rule</emphasis> contains an optional
+ <emphasis>Conditional Expression</emphasis>, it is evaluated for a boolean result against the <emphasis role="bold">"facts"</emphasis>
+ within the incoming request.
+ If the result is <emphasis role="bold">"true"</emphasis>, then the appropriate <emphasis>Effect</emphasis>
+ <emphasis role="bold">"Permit"</emphasis> or <emphasis role="bold">"Deny"</emphasis> becomes the state of this Rule evaluation.
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ A simple Policy that <emphasis>Permit</emphasis> or <emphasis>Denies</emphasis> a particular <emphasis>Identity</emphasis>
+ from making a <emphasis role="bold">GET</emphasis> HTTP Request on <emphasis>/intranet/index.html</emphasis> resource
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os" RuleCombiningAlgId="rule-combining-alg:nopermit-means-denied" Version="2.0" PolicyId="testGetURLTargetWithParameters">
+ <!-- Policy-Level Target Component -->
+ <Target>
+ <Resources>
+ <Resource>
+ <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/intranet/index.html</AttributeValue>
+ <ResourceAttributeDesignator MustBePresent="true" DataType="http://www.w3.org/2001/XMLSchema#string" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"/>
+ </ResourceMatch>
+ </Resource>
+ </Resources>
+ </Target>
+ <Rule Effect="Permit" RuleId="8b167dd5-78c5-4c5a-b744-db376927211d">
+ <!-- Rule-Level Target Component -->
+ <Rule Effect="Permit" RuleId="b72cd78d-b76c-4efb-8e6b-5daa1d417567">
+ <Target>
+ <Actions>
+ <Action>
+ <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">get</AttributeValue>
+ <ActionAttributeDesignator MustBePresent="true" DataType="http://www.w3.org/2001/XMLSchema#string" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"/>
+ </ActionMatch>
+ </Action>
+ </Actions>
+ </Target>
+ <!-- An optional Conditional Expression. This particular expression points to a Drools expression -->
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:jboss-drools:rule">
+ <VariableReference VariableId="roles://allowRule/856e41d7-9f4b-4c03-bc1a-c58d0a683786"/>
+ </Apply>
+ </Condition>
+ </Rule>
+</Policy>
+ ]]>
+ </programlisting>
+ </para>
+ <para>Note: This is just to show what a Policy looks like. A Developer using this framework will never have to deal with this low-level XACML-based xml representation.
+ The Policies are composed, generated, and managed automatically by the framework itself.
+ </para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Authorization Phases</title>
+ <para>
+ A typical Authorization system operates in two phases
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">Enforcement</emphasis>: This is where access control is enforced during application request execution.
+ </listitem>
+ <listitem>
+ <emphasis role="bold">Provisioning</emphasis>: This is where security policies are administered in the system.
+ This is done via tools like GUI based tools, a command line tool, xml based configuration tool etc.
+ </listitem>
+ </itemizedlist>
+ </para>
+ <sect2>
+ <title>Enforcement Phase</title>
+ <para>
+ Enforcement is the cross cutting concern of the application and injected into the application request life cycle as a system service.
+ Enforcement Interceptors intercept incoming application requests for access control evaluation.
+ The term Interceptor needs clarification. The term Interceptor is used in a logical sense, and not in low level technical sense.
+ What that means that interceptor does not mean it has to be an AOP interceptor only.
+ What component performs the interception is at the discretion of the Application Developer/System Integrator.
+ Some examples of interceptors could be:
+ <itemizedlist>
+ <listitem>In the Http Layer it could be a Servlet Filter or a Tomcat Valve</listitem>
+ <listitem>In the Portal Layer it could actually be an AOP based Interceptor</listitem>
+ <listitem>In the Portlet Layer it could be a Portlet Filter</listitem>
+ <listitem>In the Seam Layer it could be a Phase Listener</listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ An <emphasis role="bold">EnforcementContext</emphasis> consists of runtime application state populated by the <emphasis>EnforcementInterceptor</emphasis>. These "facts" contained
+ inside the <emphasis>EnforcementContext</emphasis> are using during evaulation against security policies.
+ This state is arbitrary and depends upon what data is useful in coming up with an access control decision.
+ <emphasis>EnforcementContext</emphasis> answers the ”This is what I am trying to access, and this is my current application state”.
+ It has no knowledge of the logic that will be applied to this data or cares for it. Objects placed into an <emphasis>EnforcementContext</emphasis>
+ are understood as ”Authorization Components”. The "Authorization Component" spec will be covered in more details in the next chapter.
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
Property changes on: modules/authorization/trunk/documentation/reference-guide/en/modules/framework.xml
___________________________________________________________________
Name: svn:mergeinfo
+
14 years, 9 months
JBoss Portal SVN: r13784 - docs/enterprise/trunk/Read_Me/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-23 22:03:05 -0400 (Sun, 23 Aug 2009)
New Revision: 13784
Modified:
docs/enterprise/trunk/Read_Me/ja-JP/Release_Notes_GA.po
Log:
some changes done
Modified: docs/enterprise/trunk/Read_Me/ja-JP/Release_Notes_GA.po
===================================================================
--- docs/enterprise/trunk/Read_Me/ja-JP/Release_Notes_GA.po 2009-08-23 11:22:33 UTC (rev 13783)
+++ docs/enterprise/trunk/Read_Me/ja-JP/Release_Notes_GA.po 2009-08-24 02:03:05 UTC (rev 13784)
@@ -8,7 +8,7 @@
"Project-Id-Version: Release_Notes_GA\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:47+0000\n"
-"PO-Revision-Date: 2009-08-17 12:07+0900\n"
+"PO-Revision-Date: 2009-08-24 10:49+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -56,14 +56,14 @@
"straightforward path to implementation."
msgstr ""
"JBoss Enterprise Portal Platform はウェブベースの複合アプリケーションと "
-"ハイパフォーマンスのウェブ提供の配信を促進します。その俊敏で再利用可能なフレーム "
+"ハイパフォーマンスウェブ機能の配信を促進します。その俊敏で再利用可能なフレーム "
"ワークを通じて、お客様は自身のウェブインフラストラクチャのコストと複雑性を "
-"低減できます。オープンソース基準の使用はベンダー専従のリスクを軽減して、互換性を "
-"確保します。JBoss Enterprise Middleware の統合的コンポーネンツとして、広域に及ぶ "
+"低減できます。オープンソース基準の使用により、ベンダー専従のリスクを軽減して、互換性を "
+"確実にできます。JBoss Enterprise Middleware の統合的コンポーネンツとして、広域に及ぶ "
"活発な JBoss.org の開発者コミュニティがその継続的改革とエンタープライズ級の品質を "
-"育みます。そしてこれは 業界でNO.1 の J2EE 認定のアプリケーションプラットフォーム "
-"である JBoss Enterprise Application Platform 上でデプロイされており、パフォーマンス、 "
-"拡張性、及び信頼性と、実装への単純な工程を確保しています。"
+"育みます。更には 業界 NO.1 の J2EE 認定のアプリケーションプラットフォーム "
+"である JBoss Enterprise Application Platform 上でデプロイされていることから、パフォーマンス、 "
+"拡張性、及び信頼性と実装への単純な工程を確保しています。"
#. Tag: para
#: Release_Notes_GA.xml:20
@@ -105,10 +105,10 @@
"certified to work on many leading enterprise hardware and software products."
msgstr ""
"更には、JBoss Seam、Hibernate、Tomcat、及び JBoss Cache などのオープンソースの "
-"精鋭フレームワークを統合することにより、この Platform はオープンソースコミュニティの "
-"改革の利便性を活用します。そして JBoss Enterprise Application Platform は Red Hat に "
+"精鋭フレームワークを統合することにより、この Platform はオープンソースコミュニティ "
+"革新の利便性を活用します。そして JBoss Enterprise Application Platform は Red Hat に "
"より全面的にテストがなされてサポートされており、多くの先導的エンタープライズ用ハードウェアと "
-"ソフトウェア製品上で機能することの認定を受けています。"
+"ソフトウェア製品上で機能するように認定を受けています。"
#. Tag: para
#: Release_Notes_GA.xml:29
@@ -118,10 +118,9 @@
"Java EE 5.0 technologies immediately and with the confidence of knowing it "
"will remain forward-compatible with future versions of the JBoss Platform."
msgstr ""
-"このことの全ては、ユーザーが自身の新しいアプリケーションを開発して、すぐに "
-"Java EE 5.0 技術の利便性を利用することができて、更にそれが JBoss Platform の "
-"将来のバージョンとの上方互換性を維持することを知る確信を持つことができることを "
-"意味します。"
+"このことの全ては、ユーザーが Java EE 5.0 技術の利便性を利用して、すぐに自分の新しい "
+"アプリケーションを開発することができて、更にそれが JBoss Platform の将来の "
+"バージョンとの上方互換性を維持することを確信できることを意味します。"
#. Tag: title
#: Release_Notes_GA.xml:35
@@ -162,8 +161,8 @@
"components delivered by the Enterprise Application Platform 4.3.CP03."
msgstr ""
"このセクションでは、Enterprise Portal Platform 4.3 を構成するコンポーネンツの "
-"バージョンの詳細を示します。これらのコンポーネンツは Enterprise Application Platform 4.3.CP03 "
-"で配布されるコンポーネンツの最上部のリリースで見ることができます。"
+"バージョンの詳細を示します。これらのバージョンは Enterprise Application Platform 4.3.CP03 "
+"で配布されるコンポーネンツの追加として、リリースで見ることができます。"
#. Tag: para
#: Release_Notes_GA.xml:50
14 years, 9 months
JBoss Portal SVN: r13783 - in jbossexo/modules/wsrp/trunk: common/src/main/java/org/jboss/portal/wsrp and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-08-23 07:22:33 -0400 (Sun, 23 Aug 2009)
New Revision: 13783
Added:
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/ValueChangeListener.java
jbossexo/modules/wsrp/trunk/producer/src/main/webapp/WEB-INF/classes/
jbossexo/modules/wsrp/trunk/producer/src/main/webapp/WEB-INF/classes/wshandlers.xml
Removed:
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/registration/
Modified:
jbossexo/modules/wsrp/trunk/common/pom.xml
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/UserContextConverter.java
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java
jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/MarkupEndpoint.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/PortletManagementEndpoint.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/RegistrationEndpoint.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/ServiceDescriptionEndpoint.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
Log:
- Moved WSRPExtensionHandler to JAX-WS, lost ability to configure handler.
- Moved registration package from producer to common as it is also needed by GUI, removed dependency on producer classes.
- Removed common dependency on JAX-RPC.
- Added @HandlerChain annotations to endpoints.
Modified: jbossexo/modules/wsrp/trunk/common/pom.xml
===================================================================
--- jbossexo/modules/wsrp/trunk/common/pom.xml 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/common/pom.xml 2009-08-23 11:22:33 UTC (rev 13783)
@@ -60,6 +60,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.portal.registration</groupId>
+ <artifactId>registration-api</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
@@ -71,12 +76,6 @@
<version>${version.jbossxb}</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>javax.xml</groupId>
- <artifactId>jaxrpc-api</artifactId>
- <version>${version.jaxrpc}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/UserContextConverter.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/UserContextConverter.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/UserContextConverter.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -62,15 +62,15 @@
return new WSRPMappedUserContext(userContext, desiredLocales, preferredLocale);
}
- /*public static org.oasis.wsrp.v1.UserContext createWSRPUserContextFrom(UserContext userContext,
+ public static org.oasis.wsrp.v1.UserContext createWSRPUserContextFrom(UserContext userContext,
String userContextKey,
- String[] userCategories)
+ List<String> userCategories)
{
org.oasis.wsrp.v1.UserContext wsrpUserContext = WSRPTypeFactory.createUserContext(userContextKey);
wsrpUserContext.setProfile(createUserProfileFrom(userContext));
wsrpUserContext.getUserCategories().addAll(userCategories);
return wsrpUserContext;
- }*/
+ }
private static UserProfile createUserProfileFrom(UserContext userContext)
{
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/WSRPUtils.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -33,17 +33,20 @@
import org.jboss.portal.portlet.api.PortletURL;
import org.jboss.portal.portlet.api.RenderURL;
import org.jboss.portal.portlet.api.state.AccessMode;
+import org.jboss.portal.wsrp.registration.LocalizedString;
+import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
import org.oasis.wsrp.v1.InteractionParams;
import org.oasis.wsrp.v1.MarkupParams;
import org.oasis.wsrp.v1.NamedString;
+import org.oasis.wsrp.v1.PropertyDescription;
import org.oasis.wsrp.v1.StateChange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -238,16 +241,14 @@
return authType;
}
- public static String[] convertLocalesToRFC3066LanguageTagArray(List localesOrderedByPreference)
+ public static List<String> convertLocalesToRFC3066LanguageTags(List<Locale> localesOrderedByPreference)
{
ParameterValidation.throwIllegalArgExceptionIfNull(localesOrderedByPreference, SET_OF_LOCALES);
- String[] desiredLocales = new String[localesOrderedByPreference.size()];
- int i = 0;
- for (Iterator iterator = localesOrderedByPreference.iterator(); iterator.hasNext(); i++)
+ List<String> desiredLocales = new ArrayList<String>(localesOrderedByPreference.size());
+ for (Locale locale : localesOrderedByPreference)
{
- Locale locale = (Locale)iterator.next();
- desiredLocales[i] = toString(locale);
+ desiredLocales.add(toString(locale));
}
return desiredLocales;
}
@@ -265,6 +266,16 @@
return context;
}
+ public static PortletContext convertToPortalPortletContext(String portletHandle, byte[] state)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletContext");
+
+ PortletContext context;
+ context = PortletContext.createPortletContext(portletHandle, state);
+
+ return context;
+ }
+
/**
* @param portletContext
* @return Since 2.6
@@ -380,4 +391,56 @@
}
return null;
}
+
+ /**
+ * @param propertyDescription
+ * @return
+ * @since 2.6
+ */
+ public static RegistrationPropertyDescription convertToRegistrationPropertyDescription(PropertyDescription propertyDescription)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "PropertyDescription");
+ RegistrationPropertyDescription desc = new RegistrationPropertyDescription(propertyDescription.getName(),
+ propertyDescription.getType());
+ desc.setLabel(getLocalizedStringOrNull(propertyDescription.getLabel()));
+ desc.setHint(getLocalizedStringOrNull(propertyDescription.getHint()));
+
+ return desc;
+ }
+
+ private static LocalizedString getLocalizedStringOrNull(org.oasis.wsrp.v1.LocalizedString wsrpLocalizedString)
+ {
+ if (wsrpLocalizedString == null)
+ {
+ return null;
+ }
+ else
+ {
+ return convertToLocalizedString(wsrpLocalizedString);
+ }
+ }
+
+ /**
+ * @param wsrpLocalizedString
+ * @return
+ * @since 2.6
+ */
+ public static LocalizedString convertToLocalizedString(org.oasis.wsrp.v1.LocalizedString wsrpLocalizedString)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(wsrpLocalizedString, "WSRP LocalizedString");
+ String lang = wsrpLocalizedString.getLang();
+ Locale locale;
+ if (lang == null)
+ {
+ locale = Locale.getDefault();
+ }
+ else
+ {
+ locale = getLocale(lang);
+ }
+
+ LocalizedString localizedString = new LocalizedString(wsrpLocalizedString.getValue(), locale);
+ localizedString.setResourceName(wsrpLocalizedString.getResourceName());
+ return localizedString;
+ }
}
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -28,58 +28,52 @@
import org.w3c.dom.NodeList;
import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.GenericHandler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.util.Set;
/**
- * JAX-RPC Handler that strips the SOAP Message of any WSRP extensions.
+ * JAX-WS Handler that strips the SOAP Message of any WSRP extensions.
*
* @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 12277 $
* @since 2.4 (Apr 26, 2006)
*/
-public class WSRPExtensionHandler extends GenericHandler
+public class WSRPExtensionHandler implements SOAPHandler<SOAPMessageContext>
{
private static Logger log = LoggerFactory.getLogger(WSRPExtensionHandler.class);
private boolean debug = false;
- private boolean removeExtensions = false;
+ private boolean removeExtensions = true;
private static final String EXTENSIONS = "extensions";
- public void init(HandlerInfo info)
+ public boolean handleMessage(SOAPMessageContext messageContext)
{
- // this parameter configured in 'webservices.xml' or 'application-client.xml'
- String debugStr = (String)info.getHandlerConfig().get("debug");
- debug = "true".equalsIgnoreCase(debugStr);
- String rem = (String)info.getHandlerConfig().get("removeExtensions");
- removeExtensions = "true".equalsIgnoreCase(rem);
+ removeExtensions(messageContext);
+ return true;
}
- public QName[] getHeaders()
+ public boolean handleFault(SOAPMessageContext messageContext)
{
- return null;
+ return true;
}
- public boolean handleResponse(MessageContext messageContext)
+ public void close(MessageContext messageContext)
{
- removeExtensions(messageContext);
- return super.handleResponse(messageContext);
+ // nothing to do
}
- public boolean handleRequest(MessageContext messageContext)
+ public Set<QName> getHeaders()
{
- removeExtensions(messageContext);
- return super.handleRequest(messageContext);
+ return null;
}
- private void removeExtensions(MessageContext msgContext)
+ private void removeExtensions(SOAPMessageContext msgContext)
{
- SOAPMessageContext soapMessageContext = (SOAPMessageContext)msgContext;
- SOAPMessage soapMessage = soapMessageContext.getMessage();
+ SOAPMessage soapMessage = msgContext.getMessage();
try
{
if (debug)
Copied: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration (from rev 13778, jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/registration)
Modified: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2009-08-19 08:41:08 UTC (rev 13778)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.registration.PropertyDescription;
-import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import javax.xml.namespace.QName;
import java.net.URI;
@@ -50,7 +49,7 @@
private String[] usages;
private QName[] aliases;
- private transient ProducerRegistrationRequirements parent;
+ private transient ValueChangeListener valueChangeListener;
public RegistrationPropertyDescription(QName name, QName type)
{
@@ -103,7 +102,7 @@
System.arraycopy(other.usages, 0, usages, 0, other.usages.length);
}
- parent = other.parent;
+// valueChangeListener = other.valueChangeListener;
}
@@ -171,10 +170,9 @@
{
QName oldName = this.name;
this.name = name;
- if (parent != null)
+ if (valueChangeListener != null)
{
- parent.notifyRegistrationPropertyChangeListeners();
- parent.propertyHasBeenRenamed(this, oldName);
+ valueChangeListener.valueHasChanged(this, oldName, name, true);
}
}
}
@@ -290,6 +288,7 @@
{
if (!Arrays.equals(this.usages, usages))
{
+ notifyParentOfChangeIfNeeded(this.usages, usages);
if (usages != null)
{
this.usages = new String[usages.length];
@@ -299,7 +298,6 @@
{
this.usages = null;
}
- notifyParentOfChangeIfNeeded();
}
}
@@ -312,6 +310,7 @@
{
if (!Arrays.equals(this.aliases, aliases))
{
+ notifyParentOfChangeIfNeeded(this.aliases, aliases);
if (aliases != null)
{
this.aliases = new QName[aliases.length];
@@ -321,20 +320,19 @@
{
this.aliases = null;
}
- notifyParentOfChangeIfNeeded();
}
}
- public void setParent(ProducerRegistrationRequirements requirements)
+ public void setValueChangeListener(ValueChangeListener listener)
{
- this.parent = requirements;
+ this.valueChangeListener = listener;
}
- private void notifyParentOfChangeIfNeeded()
+ private void notifyParentOfChangeIfNeeded(Object oldValue, Object newValue)
{
- if (parent != null)
+ if (valueChangeListener != null)
{
- parent.notifyRegistrationPropertyChangeListeners();
+ valueChangeListener.valueHasChanged(this, oldValue, newValue, false);
}
}
@@ -342,8 +340,8 @@
{
if (valueWillBeUpdated(oldValue, newValue))
{
+ notifyParentOfChangeIfNeeded(oldValue, newValue);
oldValue = newValue;
- notifyParentOfChangeIfNeeded();
}
return oldValue;
Added: jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/ValueChangeListener.java
===================================================================
--- jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/ValueChangeListener.java (rev 0)
+++ jbossexo/modules/wsrp/trunk/common/src/main/java/org/jboss/portal/wsrp/registration/ValueChangeListener.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.portal.wsrp.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface ValueChangeListener
+{
+ void valueHasChanged(RegistrationPropertyDescription originating, Object oldValue, Object newValue, boolean isName);
+}
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/MarkupEndpoint.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/MarkupEndpoint.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/MarkupEndpoint.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -56,6 +56,7 @@
import org.oasis.wsrp.v1.UserContext;
import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
import java.util.List;
@@ -74,6 +75,7 @@
wsdlLocation = "/WEB-INF/wsdl/wsrp_services.wsdl",
endpointInterface = "org.oasis.wsrp.v1.WSRPV1MarkupPortType"
)
+@HandlerChain(file = "wshandlers.xml")
public class MarkupEndpoint extends WSRPBaseEndpoint implements WSRPV1MarkupPortType
{
public void performBlockingInteraction(
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/PortletManagementEndpoint.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/PortletManagementEndpoint.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/PortletManagementEndpoint.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -52,6 +52,7 @@
import org.oasis.wsrp.v1.UserContext;
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
import java.util.List;
@@ -69,6 +70,7 @@
wsdlLocation = "/WEB-INF/wsdl/wsrp_services.wsdl",
endpointInterface = "org.oasis.wsrp.v1.WSRPV1PortletManagementPortType"
)
+@HandlerChain(file = "wshandlers.xml")
public class PortletManagementEndpoint extends WSRPBaseEndpoint implements WSRPV1PortletManagementPortType
{
public void getPortletPropertyDescription(
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/RegistrationEndpoint.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/RegistrationEndpoint.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/RegistrationEndpoint.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -34,6 +34,7 @@
import org.oasis.wsrp.v1.RegistrationState;
import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
import java.util.List;
@@ -51,6 +52,7 @@
wsdlLocation = "/WEB-INF/wsdl/wsrp_services.wsdl",
endpointInterface = "org.oasis.wsrp.v1.WSRPV1RegistrationPortType"
)
+@HandlerChain(file = "wshandlers.xml")
public class RegistrationEndpoint extends WSRPBaseEndpoint implements WSRPV1RegistrationPortType
{
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/ServiceDescriptionEndpoint.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/ServiceDescriptionEndpoint.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/endpoints/ServiceDescriptionEndpoint.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -36,6 +36,7 @@
import org.oasis.wsrp.v1.ServiceDescription;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
import java.util.List;
@@ -53,6 +54,7 @@
wsdlLocation = "/WEB-INF/wsdl/wsrp_services.wsdl",
endpointInterface = "org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType"
)
+@HandlerChain(file = "wshandlers.xml")
public class ServiceDescriptionEndpoint extends WSRPBaseEndpoint implements WSRPV1ServiceDescriptionPortType
{
public void getServiceDescription(
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -27,6 +27,7 @@
import org.jboss.portal.registration.RegistrationPolicyChangeListener;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+import org.jboss.portal.wsrp.registration.ValueChangeListener;
import javax.xml.namespace.QName;
import java.util.Map;
@@ -37,7 +38,7 @@
* @version $Revision:5865 $
* @since 2.6
*/
-public interface ProducerRegistrationRequirements
+public interface ProducerRegistrationRequirements extends ValueChangeListener
{
String DEFAULT_POLICY_CLASS_NAME = "org.jboss.portal.registration.policies.DefaultRegistrationPolicy";
String DEFAULT_VALIDATOR_CLASS_NAME = "org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator";
Modified: jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2009-08-22 05:08:00 UTC (rev 13782)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/java/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2009-08-23 11:22:33 UTC (rev 13783)
@@ -113,7 +113,7 @@
ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property name");
registrationProperties.put(name, propertyDescription);
- propertyDescription.setParent(this);
+ propertyDescription.setValueChangeListener(this);
notifyRegistrationPropertyChangeListeners();
}
@@ -177,6 +177,19 @@
}
/*
+ * == ValueChangeListener implementation
+ */
+
+ public void valueHasChanged(RegistrationPropertyDescription originatingProperty, Object oldValue, Object newValue, boolean isName)
+ {
+ notifyRegistrationPropertyChangeListeners();
+ if (isName && oldValue instanceof QName)
+ {
+ propertyHasBeenRenamed(originatingProperty, (QName)oldValue);
+ }
+ }
+
+ /*
* == RegistrationPropertyChangeListeners handling ==
*/
Added: jbossexo/modules/wsrp/trunk/producer/src/main/webapp/WEB-INF/classes/wshandlers.xml
===================================================================
--- jbossexo/modules/wsrp/trunk/producer/src/main/webapp/WEB-INF/classes/wshandlers.xml (rev 0)
+++ jbossexo/modules/wsrp/trunk/producer/src/main/webapp/WEB-INF/classes/wshandlers.xml 2009-08-23 11:22:33 UTC (rev 13783)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<javaee:handler-chains xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ 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/javaee_web_services_metadata_handler_2_...">
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>WSRP Extension Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.portal.wsrp.handler.WSRPExtensionHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+</javaee:handler-chains>
14 years, 9 months
JBoss Portal SVN: r13782 - docs/enterprise/trunk/User_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-22 01:08:00 -0400 (Sat, 22 Aug 2009)
New Revision: 13782
Modified:
docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
Log:
UserGuide all done
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-21 09:18:08 UTC (rev 13781)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-22 05:08:00 UTC (rev 13782)
@@ -8,7 +8,7 @@
"Project-Id-Version: Dynamicity\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-21 18:17+0900\n"
+"PO-Revision-Date: 2009-08-22 14:02+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -547,6 +547,16 @@
"section is for. Then, you need to figure out where on the page should this "
"content be displayed, hence the <literal>Page Layout</literal> section."
msgstr ""
+"特別な関心を寄せるものは、多分、<literal>Page Layout</literal> リンクでしょう。 "
+"これが、ページのどの部分で、どのウィンドウ内で、どの portlet インスタンスが表示 "
+"されるかを設定するために入る場所です。この画面とその作業の仕方を見てみましょう: "
+"<mediaobject> <imageobject> <imagedata fileref="
+"\"images/management/default_page_layout.png\" format=\"PNG\" scalefit=\"1\"/"
+"> </imageobject> </mediaobject> この画面は、2つの部分で構成されており、ページ上の "
+"コンテンツ表示の為の自然なプロセスに従って左から右に流れています。先ず最初にどのコンテンツを "
+"表示したいのかを決定する必要があります。そのために <literal>Content Definition</literal> "
+"セクションがあります。それから、ページ上のどの位置にこのコンテンツが表示されるべきかを "
+"判断する必要があります。この為には <literal>Page Layout</literal> セクションがあります。"
#. Tag: para
#: Dynamicity.xml:346
@@ -571,6 +581,23 @@
"in the region by selecting it in the list and using the button to the right "
"of the list, or even destroy it if desired."
msgstr ""
+"既存の <literal>CMSWindow</literal> の下の中央部分に <literal>NewsPortletInstance</literal> "
+"と言う名前の portlet インスタンスのコンテンツを表示する <literal>test</literal> と言う名前のウィンドウを "
+"追加しましょう。最初に、<literal>Window name</literal> フィールドに新しいウィンドウ名を記入する "
+"必要があります。そしてドロップダウンメニューから <literal>portlet</literal> コンテンツタイプを "
+"選択します: <mediaobject> <imageobject> <imagedata fileref=\"images/"
+"management/layout_content.png\" format=\"PNG\"/> </imageobject> </"
+"mediaobject> これが達成されると、インスタンスリスト内でその名前をクリックして "
+"その portlet インスタンスを選択できます:<mediaobject> <imageobject> "
+"<imagedata fileref=\"images/management/layout_instance.png\" format=\"PNG\"/"
+"> </imageobject> </mediaobject> これにより、その portlet インスタンスに関する "
+"情報が一部表示されることを確認して下さい。最後に、そのエリアのウィンドウリストの "
+"左側にある <literal>Add</literal> ボタンをクリックすることで、ページの中央部分に "
+"我々のウィンドウを追加できます: <mediaobject> <imageobject> "
+"<imagedata fileref=\"images/management/layout_region.png\" format=\"PNG\"/> "
+"</imageobject> </mediaobject> リスト内でそのウィンドウを選択してリストの右にある "
+"ボタンを使用すると、それを上下に動かすことが出来て、必要なら抹消することもできることに "
+"注意して下さい。"
#. Tag: para
#: Dynamicity.xml:381
@@ -592,6 +619,20 @@
"layout_google3.png\" format=\"PNG\"/> </imageobject> </mediaobject> You can "
"now add the new window to the desired region."
msgstr ""
+"このプロセスを繰り返すと、異なるタイプのコンテンツを追加することが "
+"できます。ここで、Google widget ゲームを使用したウィンドウを追加して "
+"見ましょう。まず、このウィンドウに名前を付けます(ここでは \"google\" とします)。 "
+"そしてコンテンツタイプドロップダウンメニューから <literal>widget/google</literal> を "
+"選択します: <mediaobject> <imageobject> <imagedata fileref="
+"\"images/management/layout_google1.png\" format=\"PNG\"/> </imageobject> </"
+"mediaobject> インスタンスリストが、Google widget のリストで入れ替わっている "
+"状態を確認して下さい。我々が使用する widget は <literal>Fun & "
+"Games</literal> カテゴリ内に位置しているため、そのカテゴリドロップダウンメニューから "
+"それを選択します:<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"layout_google2.png\" format=\"PNG\" scalefit=\"1\"/> </imageobject> </"
+"mediaobject> <literal>Search Gadgets</literal> を押すと、その widget リストがリフレッシュ "
+"されます。我々が求める widget は <literal>Bejeweled</literal> です: <mediaobject> <imageobject> <imagedata fileref=\"images/management/layout_google3.png\" format=\"PNG\"/> </imageobject> </mediaobject> "
+"これで、この新しいウィンドウを好きなエリアに追加することができます。"
#. Tag: para
#: Dynamicity.xml:413
@@ -608,6 +649,16 @@
"layout_cms2.png\" format=\"PNG\"/> </imageobject> </mediaobject> You can now "
"add the window to the desired region."
msgstr ""
+"このプロセスを繰り返しましょう。今度は CMS のコンテンツを使用します。 "
+"新しい名前を入力します(ここでは、 \"cms\" を使用)。そしてコンテンツタイプ "
+"ドロップダウンメニューから <literal>cms</literal> を選択します: <mediaobject> <imageobject> <imagedata "
+"fileref=\"images/management/layout_cms1.png\" format=\"PNG\"/> </"
+"imageobject> </mediaobject> 再度、インスタンスリストは、利用可能なコンテンツ root を "
+"表示しているディレクトリリストで入れ替わっています。<literal>default</literal> をクリックして、 "
+"<literal>project.html</literal> を選択します: "
+"<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"layout_cms2.png\" format=\"PNG\"/> </imageobject> </mediaobject> これで "
+"このウィンドウを好みのエリアに追加することができます。"
#. Tag: para
#: Dynamicity.xml:435
@@ -624,6 +675,15 @@
"layout_final.png\" format=\"PNG\"/> </imageobject> </mediaobject> If all "
"went well, logging out of the Admin portal, you should see:"
msgstr ""
+"我々は、異なるコンテンツタイプを使用して3つの新規ウィンドウをデフォルトページに "
+"追加してきました。portlet (例では、RSS フィードのコンテンツを表示)のコンテンツを "
+"表示しているウィンドウを追加しました。もう1つは Google widget を表示するものでした。 "
+"3つめは CMS 発行のコンテンツでした。そして我々は、既存の <literal>CMSWindow</literal> を "
+"削除して、中央にある <literal>test</literal> の下に <literal>cms</literal> ウィンドウを "
+"追加する決定をしました。そして、Google widget を表示しているウィンドウは既存のコンテンツの "
+"下で左のエリアに追加されました: <mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"layout_final.png\" format=\"PNG\"/> </imageobject> </mediaobject> すべてがうまく出来た場合は、 "
+"Admin portal からログアウトすると、以下のものが見えるはずです:"
#. Tag: para
#: Dynamicity.xml:460
@@ -658,6 +718,12 @@
"page layout screen. Thus, for the <literal>google</literal> window that we "
"created in the previous section:"
msgstr ""
+"Window オペレーションは、portal オブジェクト階級内の他のレベルにある同じ "
+"オペレーションに似ています。portal ページ情報画面のウィンドウリスト内で "
+"ウィンドウ名がクリックされた時に表示される唯一の情報はそのコンテンツに "
+"関する情報です。これは、ページレイアウト画面で表示されるものに似ています。 "
+"以前のセクションで作成した <literal>google</literal> ウィンドウ用には "
+"以下のようになります:"
#. Tag: title
#: Dynamicity.xml:495
@@ -724,6 +790,21 @@
"Portal </ulink> chapter of the Reference Guide for more information on this "
"topic."
msgstr ""
+"Portlet 定義は異なるプロバイダ毎に利用可能にできます。ドロップダウン "
+"メニューからプロバイダを選択して、<literal>View portlets</literal> をクリックすることで、 "
+"閲覧したいプロバイダを選択することができます。デフォルトでは、2つのプロバイダが "
+"利用可能です: <itemizedlist> <listitem> <para><emphasis role=\"bold\">local</"
+"emphasis>: これは Portal の portlet コンテナです。正常にデプロイされた "
+"portlet はいずれもこのプロバイダ用の利用可能 portlet 定義のリスト内に出ます。 "
+"</para> </listitem> <listitem> <para><emphasis role=\"bold\">self</"
+"emphasis>: こちらは、 Portal のデフォルトの WSRP コンシューマであり、Portal 自身の "
+"WSRP プロデューサによって発行された portlets を消費するように設定されています。これは、 "
+"Portal の WSRP 機能のクイックテストを許可すること以外には、大した意味を持ちません。 "
+"</para> </listitem> </itemizedlist> このリストにはもっと多くのプロバイダを追加する "
+"ことができます。アクティブで正しく設定された WSRP コンシューマはドロップダウンメニュー "
+"にも出てきます。このトピックの詳細情報についてはリファレンスガイドの <ulink url=\"http://docs.jboss.com/jbportal/v2.6/reference-guide/en/html/"
+"wsrp.html#consumer_configuration\">Consuming remote WSRP portlets in JBoss "
+"Portal </ulink> の章をご覧下さい。"
#. Tag: para
#: Dynamicity.xml:554
14 years, 9 months
JBoss Portal SVN: r13781 - docs/enterprise/trunk/User_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-21 05:18:08 -0400 (Fri, 21 Aug 2009)
New Revision: 13781
Modified:
docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
Log:
7 left now
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-21 08:57:37 UTC (rev 13780)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-21 09:18:08 UTC (rev 13781)
@@ -8,7 +8,7 @@
"Project-Id-Version: Dynamicity\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-21 17:56+0900\n"
+"PO-Revision-Date: 2009-08-21 18:17+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -635,6 +635,11 @@
"CMS are available in <xref linkend=\"Portal_User_Guide-Administration_-"
"_Content_Management_System-Introduction\"/>."
msgstr ""
+"より詳しい情報はリファレンスガイドの <ulink url=\"http://docs.jboss.com/jbportal/v2.6/"
+"reference-guide/en/html/contentintegration.html\">Content Integration </"
+"ulink> でご覧になれます。CMS での content root のセットアップ方法についての詳細は "
+"<xref linkend=\"Portal_User_Guide-Administration_-"
+"_Content_Management_System-Introduction\"/> でご覧になれます。"
#. Tag: title
#: Dynamicity.xml:474
@@ -670,6 +675,10 @@
"to certain roles), destroy an instance or override the portlet definition "
"preferences for a specific instance if there is any overridable preference."
msgstr ""
+"<literal>Portlet Instances</literal> タブは管理者に、実行中の portal 内で作成された "
+"インスタンスのリストを提示します。このページでは、ユーザーは(一定のロールにのみアクセスを許可するため) "
+"その portlet 用のセキュリティ制約を修正すること、1つのインスタンスを破壊すること、又は上書きの "
+"個人設定がある場合は、特定のインスタンス用の portlet 定義の個人設定を上書きすることができます。 "
#. Tag: title
#: Dynamicity.xml:513
@@ -769,4 +778,9 @@
"the portlet, create a window for it and add that window to the specified "
"region on the page defined by the user."
msgstr ""
+"Wizard モードは、portlet インスタンスに後押しされたページ上に新規のウィンドウを "
+"作成するための迅速で簡単な方法です。ユーザーは単に使用する portlet 定義、及びその "
+"ページ上でインスタンスが存在すべき場所を定義するだけです。Wizard は自動的に "
+"その portlet の新規インスタンスを作成し、その為の新規ウィンドウを作成し、そして "
+"そのウィンドウを、ページ上のユーザー定義の特定の場所に追加します。"
14 years, 9 months
JBoss Portal SVN: r13780 - docs/enterprise/trunk/User_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-21 04:57:37 -0400 (Fri, 21 Aug 2009)
New Revision: 13780
Modified:
docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
Log:
10 left in Dynamicity
Modified: docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-20 09:30:05 UTC (rev 13779)
+++ docs/enterprise/trunk/User_Guide/ja-JP/Dynamicity.po 2009-08-21 08:57:37 UTC (rev 13780)
@@ -1,29 +1,32 @@
+# translation of Dynamicity.po to Japanese
# Language ja-JP translations for User_Guide package.
+#
# Automatically generated, 2009.
-#
+# Kiyoto Hashida <khashida(a)redhat.com>, 2009.
msgid ""
msgstr ""
-"Project-Id-Version: User_Guide VERSION\n"
+"Project-Id-Version: Dynamicity\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-14 00:58+0000\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2009-08-21 17:56+0900\n"
+"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
+"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Dynamicity.xml:6
#, no-c-format
msgid "Administration - Portal Object Management (Dynamicity)"
-msgstr ""
+msgstr "管理:Portal オブジェクトマネージメント (Dynamicity)"
#. Tag: title
#: Dynamicity.xml:9
#, no-c-format
msgid "Introduction"
-msgstr ""
+msgstr "はじめに"
#. Tag: para
#: Dynamicity.xml:13
@@ -35,6 +38,10 @@
"In the scope of dynamicity, portal objects are defined and can be altered as "
"follows:"
msgstr ""
+"Dynamicity の概念は、すべての portal オブジェクトがランタイム時に動的に修正可能であり、 "
+"大量の xml ファイルとの奮闘やその変更を反映するためのサーバーの再起動の必要性を "
+"抹消してしまう事実を示します。Dynamicity の有効範囲では、portal オブジェクトが定義 "
+"されて以下のように変更することができます:"
#. Tag: para
#: Dynamicity.xml:21
@@ -43,6 +50,8 @@
"Portal Instances: Multiple Portal instances can be launched at any time, "
"secured, and skinned."
msgstr ""
+"Portal インスタンス: 複数の Portal インスタンスがいつでも開始できて、 "
+"保護と皮膜が付きます。"
#. Tag: para
#: Dynamicity.xml:22
@@ -51,6 +60,8 @@
"Pages: Multiple pages, composed of windows, can securely coexist inside a "
"portal instance. Each could have its own theme applied, if desired."
msgstr ""
+"ページ: ウィンドウで構成された複数のページが portal インスタンス内で安全に共存できます。 "
+"それぞれのページは、必要であれば、それ自身のテーマを持つことができます。"
#. Tag: para
#: Dynamicity.xml:24
@@ -59,6 +70,8 @@
"Portlets: Can be hot-deployed and will instantly register with the portal, "
"appearing in the management portlet."
msgstr ""
+"Portlets: ホットデプロイが可能であり、すぐに portal に登録するため "
+"マネージメント portlet に出現します。"
#. Tag: para
#: Dynamicity.xml:26
@@ -67,6 +80,8 @@
"Portlet Instances: Instances can be created/destroyed. Instance preference "
"variables can be modified at runtime, assigned to windows and secured."
msgstr ""
+"Portlet インスタンス: インスタンスは作成と破壊が出来ます。インスタンスの個人設定 "
+"変数はランタイム時に変更可能で、ウィンドウに割り当てられて保護されます。"
#. Tag: para
#: Dynamicity.xml:28
@@ -75,6 +90,8 @@
"Windows: Windows can be secured, created/destroyed, and assigned to specific "
"pages."
msgstr ""
+"ウィンドウ: ウィンドウは保護、作成、及び破壊が可能で、特定のページに割り当て "
+"られます。"
#. Tag: para
#: Dynamicity.xml:29
@@ -84,6 +101,9 @@
"appear in the management portlet, allowing for dynamic customization of any "
"of the above components."
msgstr ""
+"テーマ/レイアウト: ホットデプロイが可能で、portal に登録します。これらは "
+"マネージメント portlet に現れて、上記のコンポーネンツのいずれでも動的 "
+"カスタマイズを可能にします。"
#. Tag: para
#: Dynamicity.xml:35
@@ -93,12 +113,15 @@
"(admin/admin) and navigating to the Admin portal (see <xref linkend="
"\"Portal_User_Guide-JBoss_Portal_Basics-Admin_Portal\"/>)."
msgstr ""
+"マネージメント Portlet の表示は、admin(admin/admin)としてログインして "
+"Admin portal へ移動して達成します。(<xref linkend="
+"\"Portal_User_Guide-JBoss_Portal_Basics-Admin_Portal\"/> 参照)。"
#. Tag: title
#: Dynamicity.xml:50
#, no-c-format
msgid "Management Portlet"
-msgstr ""
+msgstr "マネージメント Portlet"
#. Tag: para
#: Dynamicity.xml:54
@@ -108,6 +131,9 @@
"correspond to the different sections that can be managed; and the main area "
"under it, which displays the current information for the selected tab."
msgstr ""
+"マネージメント portlet は、2 部構成のインターフェイスを提供します: 異なるセクションに "
+"相当する管理可能な上部のタブと、選択したタブの現在の情報を示す主要エリアがその下に "
+"あります。"
#. Tag: para
#: Dynamicity.xml:59
@@ -117,6 +143,9 @@
"emphasis> will be used to mean Portal, Page, Portlet, or Window "
"indifferently."
msgstr ""
+"この章の残りの部分では、用語 <emphasis role=\"bold\">object(オブジェクト)</"
+"emphasis> は Portal、Page、Portlet、Window などを無差別に意味する用語として "
+"使用されます。"
#. Tag: para
#: Dynamicity.xml:71
@@ -136,18 +165,29 @@
"listitem> </itemizedlist> We will look at each of these tabs and their "
"functionality in the following sections."
msgstr ""
+"タブは以下のようになります: <itemizedlist> <listitem> <para><emphasis role=\"bold\">Portal "
+"Objects</emphasis> は portal オブジェクト(portal インスタンス、ページ、ウィンドウ、及びそれぞれの "
+"設定情報) の管理に属するオペレーションを収集します。これがインターフェイスの最も複雑な部分です。 "
+"</para> </listitem> <listitem><para><emphasis role=\"bold\">Portlet Instances</"
+"emphasis> は、設定済みの全ての Portlet インスタンスにアクセスを与えます。"
+"</para> </listitem> <listitem><para><emphasis role=\"bold\">Portlet "
+"Definitions</emphasis> は、現在利用可能な portlet プロバイダに、及び各プロバイダが発行する Portlets に "
+"アクセスを与えます。</para> </listitem> <listitem> <para><emphasis role=\"bold\">Dashboards</emphasis> "
+"は、管理者が Dashboards の動作方法を設定できるようにします。</para> </"
+"listitem> </itemizedlist> これらのタブの1つひとつとその機能について以下のセクションで "
+"説明していきます。"
#. Tag: title
#: Dynamicity.xml:98
#, no-c-format
msgid "Managing Portal Objects"
-msgstr ""
+msgstr "Portal Objects の管理"
#. Tag: title
#: Dynamicity.xml:104
#, no-c-format
msgid "Portals Operations"
-msgstr ""
+msgstr "Portals オペレーション"
#. Tag: para
#: Dynamicity.xml:113
@@ -164,6 +204,14 @@
"emphasis> tab, the context is the list of portals as shown in the picture "
"above."
msgstr ""
+"<emphasis role=\"bold\">Portal Objects</emphasis> は、この Portal サーバーに "
+"定義してある利用可能な portal インスタンスの一覧を示すページへ管理者を導きます。 "
+"重要な点がいくつかあります。まず、ナビゲーション指標、すなわち \"breadcrumbs\" は "
+"タブ群の真下に位置しています。これが portal objects の階級の中で現在の画面が存在する "
+"位置についてのコンテキストを提供します。画面のいくつかは階級の数種のレベルで見られます。 "
+"迷ってしまった場合は、 \"breadcrumbs\" を参照してコンテキストを求めます。初めて "
+"<emphasis role=\"bold\">Portal Objects</emphasis> タブをクリックする時は、上記の "
+"画像で示してあるように、コンテキストは portals の一覧となります。"
#. Tag: para
#: Dynamicity.xml:123
@@ -178,6 +226,13 @@
"errorhandling.html\">Error handling chapter</ulink> of the Reference Guide "
"for more information on this point."
msgstr ""
+"サーバー全域の portal のプロパティにアクセスする為のリンクは breadcrumbs の "
+"真下に位置しています。これにより、管理者はサーバー全域のプロパティをセットして "
+"エラーが処理されるべき手段を設定できるようになります。<mediaobject> <imageobject> "
+"<imagedata fileref=\"images/management/portals_properties.png\" format=\"PNG"
+"\" scalefit=\"1\"/> </imageobject> </mediaobject> この点についての詳細情報には、 "
+"リファレンスガイドの <ulink url=\"http://docs.jboss.com/jbportal/v2.6/reference-guide/en/html/"
+"errorhandling.html\">Error handling chapter(エラー処理の章)</ulink> を参照して下さい。"
#. Tag: para
#: Dynamicity.xml:140
@@ -190,6 +245,10 @@
"instances list will be refreshed to display the newly created portal "
"instance."
msgstr ""
+"管理者が新規の portal インスタンスを作成できるようにする書式は <literal>Properties</literal> "
+"リンクの下に位置しています。新規 portal の名前 "
+"(これはもちろん既存のものとは異なる必要があります)を記入して、<literal>Create portal</literal> を "
+"クリックすると、portal インスタンスのリストが更新されて新規作成の portal インスタンスを表示します。"
#. Tag: para
#: Dynamicity.xml:147
@@ -211,6 +270,19 @@
"will be refreshed and the selected portal status will be refreshed, its "
"action now showing its <literal>Default</literal> status."
msgstr ""
+"このレベルの最後のインスタンスは全ての利用可能な portal インスタンス、及び "
+"それらで実行できる可能性のあるアクションをリストした表です。portal 名をクリック "
+"すると、該当する portal インスタンス用の情報を示す画面が現れます。そこから利用 "
+"可能な portal オブジェクトの階級が下に向かいます。アクション名を1つクリックすると、 "
+"関連した portal インスタンス上の特定のアクションを実行します。これらのアクションは "
+"これから見ていくように、各個別の portal 画面で利用可能です。特記すべき例外は <literal>Make "
+"Default/Default</literal> アクションで、これは特定の portal 用ではなく portal 群全域の "
+"アクションであるため、このレベルで表示される利点があることからこのリスト内でのみ利用 "
+"できます。このアクションにより、ユーザーは Portal が初めてアクセスされる時にどの portal インスタンスが "
+"表示されるかを指定できるようになります。<literal>Make Default</literal> をクリックすると "
+"関係付けされた portal がデフォルトでユーザーに表示されます。portal リストは更新され、そして "
+"選択された portal ステータスが更新されます。この時点ではアクションはその <literal>Default</literal> "
+"ステータスを表示しています。"
#. Tag: para
#: Dynamicity.xml:162
@@ -221,12 +293,15 @@
"default portal, one of its pages, show how to configure content on a page "
"and, finally, look at specific window information."
msgstr ""
+"次のセクションでは階級を段階的に降下して行くことにより、マネージメント portlet の機能を提示して "
+"デフォルトの portal とそのページの1つを見ていき、ページの内容の設定の方法を示して、 "
+"最後に特定のウィンドウの情報を見ていきます。"
#. Tag: title
#: Dynamicity.xml:170
#, no-c-format
msgid "Looking at portal instance information"
-msgstr ""
+msgstr "portal instance 情報を見る"
#. Tag: para
#: Dynamicity.xml:172
@@ -242,6 +317,13 @@
"currently are. In this case, we are looking at the <literal>default</"
"literal> portal."
msgstr ""
+"トップレベルの <literal>Portal Objects</literal> ページにある利用可能な portal インスタンス "
+"のリストの <literal>default</literal> portal をクリックすると、以下に示してあるように "
+"\"default\" と言う名前の portal インスタンスの情報を表示するページへと移動します。<mediaobject> "
+"<imageobject> <imagedata fileref=\"images/management/default_portal.png\" "
+"format=\"PNG\" scalefit=\"1\"/> </imageobject> </mediaobject> 画面の上部にある "
+"breadcrumbs は、この階級内でユーザーの現在の位置を示していることに注意して下さい。 "
+"現在の例では、<literal>default</literal> portal を見ていることになります。"
#. Tag: para
#: Dynamicity.xml:187
@@ -255,6 +337,12 @@
"instances list on the top level page, <literal>Make Default/Default</"
"literal> excepted."
msgstr ""
+"この portal インスタンスに影響する他の情報やオペレーションへのリンクは "
+"breadcrumbs の下に位置しています。名前が暗示するように、管理者が現在の "
+"portal インスタンスを破壊できるようにする <literal>Destroy</literal> オペレーション "
+"は除外して、それぞれを後で説明していきます。<literal>Make Default/Default</"
+"literal> 以外は、これらのリンクはトップレベルページの portal インスタンスリスト内で "
+"利用できるリンクのミラーになっています。"
#. Tag: para
#: Dynamicity.xml:196
@@ -265,6 +353,9 @@
"<literal>Create page</literal> and the new page will appear in the pages "
"list, ready to be configured."
msgstr ""
+"portal 全域オペレーションリンクの下のページ作成書式を使用して新規のページを "
+"作成することができます。新規ページの名前を入力して、<literal>Create page</literal> を "
+"クリックすると、新規ページがページリスト内に出現して設定可能になります。"
#. Tag: para
#: Dynamicity.xml:202
@@ -282,6 +373,15 @@
"appears in this list: this is where you specify which page should be the "
"default one when users first access the portal instance."
msgstr ""
+"最後として、この portal インスタンス用に利用可能なページのリストを表示している "
+"表はこの画面の底辺に位置しています。最初のカラムはページ名を示しており、これを "
+"クリックすると階級を下降して行き、この特定のページ特有の情報を表示します。2つめの "
+"カラムは、関連したページ上のアクションリンクのリストを提供します。これらのリンクは "
+"個別のページ画面でも出現して、portal アクションリンクが portal インスタンスリストに "
+"出現したのと同様に、個別の portal ページでも出現します。繰り返しになりますが、 "
+"<literal>Make Default/Default</literal> アクションは、その対応する portal として動作して "
+"このリストのみに出現します。ここが、ユーザーが初めて portal インスタンスにアクセスした時に "
+"どのページがデフォルトであるかを指定する場所です。"
#. Tag: para
#: Dynamicity.xml:214
@@ -297,6 +397,14 @@
"reference-guide/en/html/security.html\">Security </ulink> chapter of the "
"Reference Guide for more information about how to secure portal objects."
msgstr ""
+"さて、デフォルト portal の <literal>Security</literal> 情報画面を見てみましょう。 "
+"この画面は、portal ページの <literal>Security</literal> アクションリンクをクリック "
+"するとアクセスできます。ここでは、管理者はこの portal インスタンス用オブジェクトの "
+"セキュリティに関するデフォルトポリシーを設定できます。<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"default_portal_security.png\" format=\"PNG\"/> </imageobject> </mediaobject> "
+"portal オブジェクトのセキュリティの設定に関する詳細情報には、リファレンスガイドの "
+"<ulink url=\"http://docs.jboss.com/jbportal/v2.6/"
+"reference-guide/en/html/security.html\">Security </ulink> の章をご覧下さい。"
#. Tag: para
#: Dynamicity.xml:233
@@ -306,6 +414,9 @@
"configured properties for this portal instance and allows you to modify "
"them, as well as configure the error handling strategy:"
msgstr ""
+"<literal>Properties</literal> アクションリンクは、この portal インスタンスの "
+"現在設定されているプロパティを表示します。そしてユーザーがそれらの修正と、 "
+"更にはエラー処理の戦略設定をできるようにします:"
#. Tag: para
#: Dynamicity.xml:244
@@ -320,6 +431,13 @@
"ulink> chapter of the Reference Guide for more information about themes and "
"layouts."
msgstr ""
+"<literal>Theme</literal> アクションリンクは、管理者がこの portal インスタンス用のテーマ、 "
+"レイアウト、及び描写セットを設定できる画面を表示します。<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"default_portal_theme.png\" format=\"PNG\" scalefit=\"1\"/> </imageobject> </"
+"mediaobject> テーマとレイアウトに関する詳細情報についてはリファレンスガイドの "
+"<ulink url=\"http://docs.jboss.com/jbportal/"
+"v2.6/reference-guide/en/html/themeandlayouts.html\">Layouts and Themes</"
+"ulink> の章を参照して下さい。"
#. Tag: para
#: Dynamicity.xml:263
@@ -333,6 +451,11 @@
"of the logged-in user. This is used by the default tab navigation of the "
"default layouts."
msgstr ""
+"<literal>Display Name</literal> アクションリンクは、管理者が異なる言語用に "
+"異なる名前を設定できる画面を表示します。<mediaobject> <imageobject> <imagedata fileref=\"images/management/"
+"display_names.png\" format=\"PNG\"/> </imageobject> </mediaobject> 異なる名前は、ログインした "
+"ユーザーの好みのロケール用のページ表示名として使用されます。これはデフォルトレイアウトのデフォルト "
+"タブナビゲーションで使用されます。"
#. Tag: para
#: Dynamicity.xml:277
@@ -342,12 +465,15 @@
"hierarchy again and look at a page, more precisely the <literal>default</"
"literal> page, by clicking its name in the pages list."
msgstr ""
+"これで portal レベルの情報を見終りましたので、再度階級を下降してページリスト内の "
+"名前をクリックすることにより、ページ、精確には <literal>default</"
+"literal> ページを見てみましょう。"
#. Tag: title
#: Dynamicity.xml:284
#, no-c-format
msgid "Looking at a page configuration"
-msgstr ""
+msgstr "ページ設定を見る"
#. Tag: para
#: Dynamicity.xml:293
@@ -361,6 +487,11 @@
"Once again, you can configure the page's security, theme and properties. You "
"can also destroy it if so desired."
msgstr ""
+"この画面のレイアウトはもう見慣れていることでしょう。ページの情報は、portal インスタンスの "
+"情報に良く似ています。ユーザーがページを実際に見ていることを示す breadcrumbs に注意して "
+"下さい。これもページ上部のアクションリンクで見ることができて、portal インスタンス画面の "
+"ページリスト内の各ページ用に利用可能な物のミラーとなっています。ここでも、ページのセキュリティ、 "
+"テーマ、及びプロパティを設定できます。また必要であれば破壊することも出来ます。"
#. Tag: para
#: Dynamicity.xml:304
@@ -372,6 +503,11 @@
"while the second one provides a list of action links for that specific "
"window. Clicking on a window name will display information about that window."
msgstr ""
+"portal オブジェクト階級の他の画面と同様に、1つのページ設定画面はそのページの "
+"全てのウィンドウのリストも提供します。このリストには、2つのカラムがあります: "
+"1つめのカラムはウィンドウの名前を含んでおり、2つめのカラムはその特定ウィンドウの "
+"アクションリンクのリストを提供します。ウィンドウ名をクリックすると、そのウィンドウの "
+"情報が表示されます。"
#. Tag: para
#: Dynamicity.xml:311
@@ -383,12 +519,17 @@
"operations work similarly to the same operations at the portal instance "
"level."
msgstr ""
+"portal インスタンスが数種のページを収納できるのと同様に、1つのページは "
+"数種のサブページを含むことができます。そのため、1つのページはサブページの "
+"作成と、ユーザーが初めてそのページに移動した時にどのサブページを "
+"表示するかをセットする手段を定義します。これらのオペレーションは、portal "
+"インスタンスレベルの同じオペレーションと同様に機能します。"
#. Tag: para
#: Dynamicity.xml:317
#, no-c-format
msgid "You can also rename the page if desired:"
-msgstr ""
+msgstr "必要であればページは改名もできます:"
#. Tag: para
#: Dynamicity.xml:328
@@ -499,7 +640,7 @@
#: Dynamicity.xml:474
#, no-c-format
msgid "Looking at windows of a given page"
-msgstr ""
+msgstr "任意ページのウィンドウを見る"
#. Tag: para
#: Dynamicity.xml:476
@@ -517,7 +658,7 @@
#: Dynamicity.xml:495
#, no-c-format
msgid "Managing Portlet Instances"
-msgstr ""
+msgstr "Portlet インスタンスの管理"
#. Tag: para
#: Dynamicity.xml:497
@@ -534,7 +675,7 @@
#: Dynamicity.xml:513
#, no-c-format
msgid "Managing Portlet Definitions"
-msgstr ""
+msgstr "Portlet 定義の管理"
#. Tag: para
#: Dynamicity.xml:515
@@ -546,6 +687,11 @@
"remote producer) or if it is remotable (i.e., if it is exposed to WSRP "
"consumers by Portal's producer)."
msgstr ""
+"<literal>Portlet Definitions</literal> タブは管理者に "
+"名前と、説明と、portlet がリモートかどうか(リモートプロデューサから "
+"WSRP 経由でアクセス)、あるいは、リモート可能かどうか(Portal のプロデューサによって "
+"WSRP コンシューマに露呈されているかどうか)を表示する表として書式化された portlet 定義の "
+"リストを提示します。"
#. Tag: para
#: Dynamicity.xml:522
@@ -581,12 +727,18 @@
"literal> action (when available) is used to edit preferences at the portlet "
"definition level as explained in the JSR-168 specification."
msgstr ""
+"リスト内の portlet 名をクリックすると、その portlet の定義、タイトル、説明、サポートされる "
+"言語、及びキーワードが表示されます。<mediaobject> "
+"<imageobject> <imagedata fileref=\"images/management/portlet_details.png\" "
+"format=\"PNG\"/> </imageobject> </mediaobject> <literal>Preferences</"
+"literal> アクションは(利用できる時)、 JSR-168 仕様で説明してあるように、その "
+"portlet 定義のレベルで個人設定を編集するために使用されます。"
#. Tag: title
#: Dynamicity.xml:571
#, no-c-format
msgid "Managing Dashboards"
-msgstr ""
+msgstr "Dashboards の管理"
#. Tag: para
#: Dynamicity.xml:573
@@ -596,12 +748,15 @@
"parameters for all user dashboards. It also allows the user to configure the "
"error pages and theme properties as for the other portal objects."
msgstr ""
+"<literal>Dashboards</literal> タブの使用により、管理者は全てのユーザーの dashboard 用の "
+"パラメータを設定できるようになります。それはまた、ユーザーが、他の portal オブジェクトに "
+"関するエラーページとテーマのプロパティを設定できるようにします。"
#. Tag: title
#: Dynamicity.xml:580
#, no-c-format
msgid "Wizard mode"
-msgstr ""
+msgstr "Wizard モード"
#. Tag: para
#: Dynamicity.xml:583
@@ -614,3 +769,4 @@
"the portlet, create a window for it and add that window to the specified "
"region on the page defined by the user."
msgstr ""
+
Modified: docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-20 09:30:05 UTC (rev 13779)
+++ docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-21 08:57:37 UTC (rev 13780)
@@ -8,7 +8,7 @@
"Project-Id-Version: JBoss_Portal_Basics\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-20 18:29+0900\n"
+"PO-Revision-Date: 2009-08-21 14:33+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -673,7 +673,7 @@
"更には、ログインしたユーザーは、<mediaobject> "
"<imageobject> <imagedata fileref=\"images/intro/ico_edit.gif\" format=\"GIF"
"\"/> </imageobject> </mediaobject> をクリックしてから Portlet の Edit Mode を "
-"使用することで RSS フィードソース内の個人設定を変更することができます。その様式が "
+"使用することで RSS フィードソース内の個人設定を変更することができます。その書式が "
"提出された後は、そのプロパティがユーザーの個人設定に保存されますので、ユーザーは "
"ログインした時には常に、同じニュースソースを見ることができます。"
@@ -736,7 +736,7 @@
"更には、ログインしたユーザーは <mediaobject> <imageobject> <imagedata fileref=\"images/intro/"
"ico_edit.gif\" format=\"GIF\"/> </imageobject> </mediaobject> をクリックしてから、 "
"Portlet の <emphasis role=\"bold\">Edit Mode</emphasis> を使用することでユーザーの地域 "
-"設定を変更することができます。有効な米国の郵便番号はどれもここで入力できます。その様式が "
+"設定を変更することができます。有効な米国の郵便番号はどれもここで入力できます。その書式が "
"提出された後は、そのプロパティがユーザーの個人設定に保存されるため、ユーザーはログインした時は "
"いつでもその同じ地域の気候情報を見ることができます。"
@@ -882,7 +882,7 @@
"\">Theme and Layout</emphasis> form."
msgstr ""
"自分の dashboard 用にテーマ(theme)とレイアウト(layout)を選択するには、 "
-"<emphasis role=\"bold\">Theme and Layout</emphasis> 様式から利用可能な "
+"<emphasis role=\"bold\">Theme and Layout</emphasis> 書式から利用可能な "
"ものを選択して、「select」をクリックします。"
#. Tag: para
14 years, 9 months
JBoss Portal SVN: r13779 - docs/enterprise/trunk/User_Guide/ja-JP.
by portal-commits@lists.jboss.org
Author: khashida(a)redhat.com
Date: 2009-08-20 05:30:05 -0400 (Thu, 20 Aug 2009)
New Revision: 13779
Modified:
docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
Log:
Basics done
Modified: docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po
===================================================================
--- docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-19 08:41:08 UTC (rev 13778)
+++ docs/enterprise/trunk/User_Guide/ja-JP/JBoss_Portal_Basics.po 2009-08-20 09:30:05 UTC (rev 13779)
@@ -8,7 +8,7 @@
"Project-Id-Version: JBoss_Portal_Basics\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-08-14 00:58+0000\n"
-"PO-Revision-Date: 2009-08-19 17:40+0900\n"
+"PO-Revision-Date: 2009-08-20 18:29+0900\n"
"Last-Translator: Kiyoto Hashida <khashida(a)redhat.com>\n"
"Language-Team: Japanese <jp(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -590,6 +590,12 @@
"displayed outside of the portal pages, but text/html are displayed inside "
"the CMSPortlet Window."
msgstr ""
+"Content は portal を介してパスマッパーを使用して表示されます。例えば、<emphasis>/default/foo/bar.zip</"
+"emphasis> に存在する zip ファイルを表示したい場合は、URL <emphasis>http://localhost:8080/content/"
+"default/foo/bar.zip</emphasis> を記入します。コンテンツへのパスが <emphasis role=\"bold\">/content</emphasis> を "
+"先頭に配置している方法に注意して下さい。この例では、バイナリコンテンツの取り込みを説明していますが、同様なことが "
+"テキスト/html ファイルにも言えます。但し、バイナリファイルは portal ページの外部で表示されて、 "
+"テキスト/html ファイルは CMSPortlet ウィンドウの内部で表示されることを忘れないで下さい。"
#. Tag: para
#: JBoss_Portal_Basics.xml:453
@@ -602,6 +608,12 @@
"file. If a Spanish version is not found, it will then try and retrieve the "
"default language version set for the CMSPortlet (set to English, by default)."
msgstr ""
+"<emphasis role=\"bold\">Serving Logic:</emphasis> CMS Portlet は現在、ユーザーの "
+"ロケールの設定を基にしてコンテンツにサービスします。例えば、ユーザーのロケールが "
+"そのブラウザでスペイン語にセットしてあり、要求が URL: default/index.html である場合は、 "
+"CMSPortlet は最初にそのファイルのスペイン語バージョンを取り込む試みをするでしょう。 "
+"スペイン語バージョンが見付からない場合は、CMSPortlet はそれ自身用にセットしてある "
+"デフォルトの言語のバージョン(例:デフォルトで英語)を取り込み試みをするでしょう。"
#. Tag: para
#: JBoss_Portal_Basics.xml:461
@@ -610,6 +622,8 @@
"Administrators should read <xref linkend=\"Portal_User_Guide-Test-"
"Administration_CMS_Portlet\"/> for managing the data in the CMS."
msgstr ""
+"管理者は、CMS 内のデータ管理には <xref linkend=\"Portal_User_Guide-Test-"
+"Administration_CMS_Portlet\"/> を読む必要があります。"
#. Tag: title
#: JBoss_Portal_Basics.xml:469
@@ -625,6 +639,9 @@
"feeds. An open internet connection on the server-side is therefore required "
"for them to operate."
msgstr ""
+"News Page には、一般的なインターネットフィードからニュースを表示する "
+"2つの portlets が含まれています。それらの運営にはサーバー側のオープンインターネット接続が "
+"必要になります。"
#. Tag: title
#: JBoss_Portal_Basics.xml:484
@@ -639,6 +656,8 @@
"The News Portlet retrieves an RSS news feed from a URL and displays it as "
"HTML to the user."
msgstr ""
+"News Portlet は URL から RSS ニュースフィードを取り込んで、それを HTML として "
+"ユーザーに表示します。"
#. Tag: para
#: JBoss_Portal_Basics.xml:496
@@ -651,6 +670,12 @@
"will be saved in the user's preference, so the user will always see the same "
"news source when logged in."
msgstr ""
+"更には、ログインしたユーザーは、<mediaobject> "
+"<imageobject> <imagedata fileref=\"images/intro/ico_edit.gif\" format=\"GIF"
+"\"/> </imageobject> </mediaobject> をクリックしてから Portlet の Edit Mode を "
+"使用することで RSS フィードソース内の個人設定を変更することができます。その様式が "
+"提出された後は、そのプロパティがユーザーの個人設定に保存されますので、ユーザーは "
+"ログインした時には常に、同じニュースソースを見ることができます。"
#. Tag: para
#: JBoss_Portal_Basics.xml:513
@@ -675,6 +700,10 @@
"contains a portlet that displays the weather forecast for a specific "
"location."
msgstr ""
+"サンプルでは、Enterprise Portal Platform でデプロイできる基本的な weather portlet を "
+"見ることができるでしょう。そのウェブアーカイブを自分の EPP 設定の <literal>deploy</literal> "
+"ディレクトリにコピーすることにより、それが weather portlet を持つ新しいページを自動的に "
+"作成します。このページには、特定の地域の天気予報を表示する portlet が含まれています。"
#. Tag: title
#: JBoss_Portal_Basics.xml:533
@@ -704,6 +733,12 @@
"will be saved in the user's preference, so the user will always see the same "
"weather data for their location when logged in."
msgstr ""
+"更には、ログインしたユーザーは <mediaobject> <imageobject> <imagedata fileref=\"images/intro/"
+"ico_edit.gif\" format=\"GIF\"/> </imageobject> </mediaobject> をクリックしてから、 "
+"Portlet の <emphasis role=\"bold\">Edit Mode</emphasis> を使用することでユーザーの地域 "
+"設定を変更することができます。有効な米国の郵便番号はどれもここで入力できます。その様式が "
+"提出された後は、そのプロパティがユーザーの個人設定に保存されるため、ユーザーはログインした時は "
+"いつでもその同じ地域の気候情報を見ることができます。"
#. Tag: para
#: JBoss_Portal_Basics.xml:566
@@ -712,6 +747,8 @@
"If you are not located in the United States you will need to configure the "
"Weather portlet to display the information for your area."
msgstr ""
+"ユーザーが米国内に居ない場合は、ユーザーの地域の情報を表示するように "
+"Weather portlet を設定する必要があります。"
#. Tag: para
#: JBoss_Portal_Basics.xml:571
@@ -760,12 +797,17 @@
"\"middle\"/> </imageobject> </mediaobject> Click on <emphasis role=\"bold"
"\">submit</emphasis>"
msgstr ""
+"この番号(例の場合 <emphasis>FRXX0059</emphasis>)を weather portlet 編集形式 : "
+"<mediaobject> <imageobject> <imagedata fileref="
+"\"images/intro/weather_config4.png\" format=\"PNG\" align=\"center\" valign="
+"\"middle\"/> </imageobject> </mediaobject> に貼り付けます。そして <emphasis role=\"bold"
+"\">submit(提出)</emphasis> をクリックします。"
#. Tag: title
#: JBoss_Portal_Basics.xml:640
#, no-c-format
msgid "Personal Dashboard"
-msgstr "個人用 Dashboard"
+msgstr "個人用 Dashboard(ダッシュボード)"
#. Tag: para
#: JBoss_Portal_Basics.xml:642
@@ -783,6 +825,15 @@
"portlet windows to any location, if the administrator allows this "
"functionality. Changes made in this fashion will also be persisted."
msgstr ""
+"ログインした後は、portal の全てのユーザー/管理者 は、portal ページの右上にある "
+"<emphasis role=\"bold\">Dashboard</emphasis> リンクをクリックすることで、 "
+"個人用 dashboard にアクセスできるようになります。リンクが変化している様子に "
+"注意して下さい。<mediaobject> <imageobject> <imagedata fileref=\"images/intro/dashboard.png"
+"\" format=\"PNG\" scalefit=\"1\"/> </imageobject> </mediaobject> 個人用 dashboard の使用により "
+"ユーザーはその portal ページを好みでカスタマイズすることができます。全ての変更は永続化しますので、 "
+"次回にユーザーがその dashboard にログインすると変更した状態を見ることができます。dashboard の "
+"ページ内の移動に於いては管理者が機能を許可する限りは、ユーザーは portlet ウィンドウをどんな場所にも "
+"ドラッグアンドドロップすることができます。この方法での変更も永続化します。"
#. Tag: para
#: JBoss_Portal_Basics.xml:657
@@ -794,6 +845,11 @@
"will clone the page and add it to your personal dashboard as a page with the "
"same name."
msgstr ""
+"また、共有のページの内容もユーザーの dashboard にコピーできますので、それも "
+"好みでカスタマイズできます。ページ右上の <emphasis role=\"bold"
+"\">Copy to my dashboard</emphasis> リンクをクリックします。これが "
+"そのページをクローンして、それを同じ名前のページとしてユーザーの "
+"個人用 dashboard に追加します。"
#. Tag: title
#: JBoss_Portal_Basics.xml:671
@@ -808,6 +864,8 @@
"You can configure your dashboard by using the top-right menu item labeled "
"<emphasis role=\"bold\">'Configure dashboard'</emphasis>:"
msgstr ""
+"個人用の dashboard を設定するには、以下のように <emphasis role=\"bold\">'Configure dashboard'</emphasis> "
+"と言うラベルの付いた右上のメニュー項目を使用します:"
#. Tag: title
#: JBoss_Portal_Basics.xml:685
@@ -823,6 +881,9 @@
"available ones and then clicking on select in the <emphasis role=\"bold"
"\">Theme and Layout</emphasis> form."
msgstr ""
+"自分の dashboard 用にテーマ(theme)とレイアウト(layout)を選択するには、 "
+"<emphasis role=\"bold\">Theme and Layout</emphasis> 様式から利用可能な "
+"ものを選択して、「select」をクリックします。"
#. Tag: para
#: JBoss_Portal_Basics.xml:691
@@ -836,6 +897,13 @@
"note> Upon creating a new page, the screen will refresh and allow a user to "
"customize the new page."
msgstr ""
+"また、自分の dashboard に追加できる新しいページを作成するには、画面の "
+"左上にある <emphasis role=\"bold\">Create New Page</emphasis> 内に "
+"新しいページの名前を入力することで始まります。<note> <itemizedlist> "
+"<listitem> <para> ページ名は固有のものでなければなりません。 </para> </listitem> <listitem> "
+"<para> ページ名は空白であってはいけません。</para> </listitem> </itemizedlist> </"
+"note> 新しいページを作成した後は、画面が入れ替わってユーザーがその新ページをカスタマイズ "
+"できるようになります。"
#. Tag: para
#: JBoss_Portal_Basics.xml:711
@@ -847,12 +915,15 @@
"the bottom of the screen. Users are not able to delete the default dashboard "
"page."
msgstr ""
+"dashboard ページの削除はいつでも可能です。まず、画面の上部にあるポップアップメニューを使用 "
+"して削除したいページを選択し、それから画面底辺の <emphasis role=\"bold\">Delete this page</emphasis> "
+"ボタンをクリックします。ユーザーはデフォルトの dashboard ページは削除することができません。"
#. Tag: para
#: JBoss_Portal_Basics.xml:721
#, no-c-format
msgid "Deleted pages are NOT recoverable. This change is permanent!"
-msgstr "削除したページは復元できません。この変更は不変になります。"
+msgstr "削除したページは復元できません。この変更は永久確定になります。"
#. Tag: title
#: JBoss_Portal_Basics.xml:730
@@ -870,6 +941,10 @@
"how to use it here as it is similar to the page layout functionality of the "
"Admin portal, which we will look at in"
msgstr ""
+"ユーザーは特定のニーズに合うように dashboard ページ上の portlet を追加、削除、及び "
+"順序変更をすることができます。ページのポップアップセレクタを使用して変更したい "
+"ページを選択して、それから portlet management form を選択します。これは 次で説明する "
+"Admin portal の ページレイアウト機能に良く似ているため、ここではその使用法は言及しません。"
#. Tag: title
#: JBoss_Portal_Basics.xml:748
@@ -886,6 +961,10 @@
"in as an administrator, or have proper privileges to see this portal. Follow "
"the links for in-depth reviews of these functions:"
msgstr ""
+"Admin Portal の目的は、管理者が portal の全ての側面を管理できるようにすることです。 "
+"この Portal を見るには、管理者としてログイン <emphasis role=\"bold\">しなければなりません。</emphasis> "
+"あるいは、適切な権限を持っている必要があります。これらの機能の詳細説明に関しては "
+"以下のリンクをご覧下さい:"
#. Tag: para
#: JBoss_Portal_Basics.xml:758
@@ -906,6 +985,8 @@
"Portal Objects (themes, layouts, portal instances, pages, windows, security, "
"and deployed portlets) (See:"
msgstr ""
+"Portal Objects (テーマ、レイアウト、portal インスタンス、ページ、ウィンドウ、セキュリティ、及び "
+"デプロイした portlets)(以下を参照):"
#. Tag: para
#: JBoss_Portal_Basics.xml:765
@@ -915,4 +996,6 @@
"guide/en/html/wsrp.html\">WSRP chapter</ulink> in the Reference Guide for "
"more information)"
msgstr ""
+"WSRP (詳細はリファレンスガイドにある <ulink url=\"http://docs.jboss.com/jbportal/v2.6/reference-"
+"guide/en/html/wsrp.html\">WSRP の章</ulink> を参照して下さい)"
14 years, 9 months