Author: chris.laprun(a)jboss.com
Date: 2009-10-07 20:15:12 -0400 (Wed, 07 Oct 2009)
New Revision: 314
Added:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java
Removed:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractJNDIServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractSOAPServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/CachingServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupServiceWrapper.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PortletManagementServiceWrapper.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RegistrationServiceWrapper.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RemoteSOAPInvokerServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceDescriptionServiceWrapper.java
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLWSRPConsumerFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceWrapper.java
components/wsrp/trunk/consumer/src/main/resources/conf/wsrp-consumers-config.xml
Log:
- Replaced old ServiceFactory hierarchy with new SOAPServiceFactory class as old classes
were not adapted to JAX-WS.
- Removed code that was forcing access to the service factory too early (isAvailable in
particular). This allows to use
WSDL for self producer instead of specifying endpoint URLs (which cannot seem to be
possible with JAX-WS). Will
probably lead to removal of methods to get and set individual endpoint URLs.
- Started to encapsulate ServiceFactory better so that it doesn't leak out of
EndpointConfigurationInfo.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -25,8 +25,7 @@
import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.InvokerUnavailableException;
-import org.gatein.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
-import org.gatein.wsrp.services.RemoteSOAPInvokerServiceFactory;
+import org.gatein.wsrp.services.SOAPServiceFactory;
import org.gatein.wsrp.services.ServiceFactory;
import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
@@ -57,14 +56,9 @@
// transient variables
/** Access to the WS */
- private ServiceFactory serviceFactory;
+ private transient SOAPServiceFactory 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";
@@ -79,24 +73,13 @@
private boolean usingWSDL = true;
private boolean isModifiedWSDL;
- // todo: public for tests
- public EndpointConfigurationInfo()
- {
- }
-
public EndpointConfigurationInfo(ProducerInfo producerInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo,
"ProducerInfo");
producerInfo.setEndpointConfigurationInfo(this);
+ serviceFactory = new SOAPServiceFactory();
}
- public EndpointConfigurationInfo(ProducerInfo producerInfo, ServiceFactory
serviceFactory)
- {
- this(producerInfo);
- setServiceFactory(serviceFactory);
- }
-
-
public Long getKey()
{
return key;
@@ -119,9 +102,9 @@
public String getWsdlDefinitionURL()
{
- if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+ if (serviceFactory != null)
{
- persistentWsdlDefinitionURL =
((RemoteSOAPInvokerServiceFactory)serviceFactory).getWsdlDefinitionURL();
+ persistentWsdlDefinitionURL = (serviceFactory).getWsdlDefinitionURL();
}
return persistentWsdlDefinitionURL;
@@ -211,14 +194,7 @@
{
usingWSDL = true;
- if (serviceFactory != null)
- {
- if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
- {
- serviceFactory = new RemoteSOAPInvokerServiceFactory();
- }
- internalSetWsdlURL();
- }
+ internalSetWsdlURL();
}
else
{
@@ -237,11 +213,7 @@
{
if (usesWSDL())
{
- if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
- {
- isModifiedWSDL = true;
- }
-
+ isModifiedWSDL = true;
usingWSDL = false;
}
@@ -256,16 +228,17 @@
{
if (serviceFactory == null)
{
+ serviceFactory = new SOAPServiceFactory();
if (usesWSDL())
{
- serviceFactory = new RemoteSOAPInvokerServiceFactory();
+// serviceFactory = new RemoteSOAPInvokerServiceFactory();
internalSetWsdlURL();
}
else
{
if (!UNSET.equals(persistentServiceDescriptionURL) &&
!UNSET.equals(persistentMarkupURL))
{
- serviceFactory = new PerEndpointSOAPInvokerServiceFactory();
+// serviceFactory = new PerEndpointSOAPInvokerServiceFactory();
serviceFactory.setServiceDescriptionURL(persistentServiceDescriptionURL);
serviceFactory.setMarkupURL(persistentMarkupURL);
serviceFactory.setPortletManagementURL(persistentPortletManagementURL);
@@ -310,7 +283,7 @@
{
try
{
-
((RemoteSOAPInvokerServiceFactory)serviceFactory).setWsdlDefinitionURL(persistentWsdlDefinitionURL);
+ serviceFactory.setWsdlDefinitionURL(persistentWsdlDefinitionURL);
// update the URLs based on WSDL information
persistentMarkupURL = serviceFactory.getMarkupURL();
@@ -340,52 +313,29 @@
}
}
- // todo: public for tests
- public ServiceFactory getServiceFactory()
+ private ServiceFactory getServiceFactory()
{
initServiceFactoryIfNeeded();
startServiceFactoryIfNeeded();
return serviceFactory;
}
- // todo: public for tests
- public void setServiceFactory(ServiceFactory serviceFactory)
+ WSRPV1ServiceDescriptionPortType getServiceDescriptionService() throws
InvokerUnavailableException
{
- 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
+ WSRPV1MarkupPortType getMarkupService() throws InvokerUnavailableException
{
return getService(WSRPV1MarkupPortType.class);
}
- // todo: public for tests
- public WSRPV1PortletManagementPortType getPortletManagementService() throws
InvokerUnavailableException
+ WSRPV1PortletManagementPortType getPortletManagementService() throws
InvokerUnavailableException
{
return getService(WSRPV1PortletManagementPortType.class);
}
- // todo: public for tests
- public WSRPV1RegistrationPortType getRegistrationService() throws
InvokerUnavailableException
+ WSRPV1RegistrationPortType getRegistrationService() throws
InvokerUnavailableException
{
return getService(WSRPV1RegistrationPortType.class);
}
@@ -429,14 +379,7 @@
public boolean isAvailable()
{
- try
- {
- return getServiceFactory().isAvailable();
- }
- catch (Exception e)
- {
- return false;
- }
+ return serviceFactory.isAvailable();
}
public boolean isRefreshNeeded()
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -225,7 +225,7 @@
*/
public boolean isActive()
{
- return persistentActive && persistentEndpointInfo.isAvailable();
+ return persistentActive/* && persistentEndpointInfo.isAvailable()*/;
}
/**
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -49,7 +49,6 @@
import org.gatein.wsrp.api.SessionEvent;
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
-import org.gatein.wsrp.services.ServiceFactory;
import org.gatein.wsrp.servlet.UserAccess;
import org.oasis.wsrp.v1.DestroyFailed;
import org.oasis.wsrp.v1.Extension;
@@ -485,7 +484,7 @@
public void activate() throws Exception
{
internalStart();
- producerInfo.setActiveAndSave(getEndpointConfigurationInfo().isAvailable());
+ producerInfo.setActiveAndSave(true);
}
private void internalStart() throws Exception
@@ -561,16 +560,6 @@
// Web services access
**********************************************************************************************
- /**
- * Needed to wire Consumer tests.
- *
- * @param serviceFactory
- */
- public void setServiceFactory(ServiceFactory serviceFactory)
- {
- getEndpointConfigurationInfo().setServiceFactory(serviceFactory);
- }
-
private EndpointConfigurationInfo getEndpointConfigurationInfo()
{
return producerInfo.getEndpointConfigurationInfo();
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLWSRPConsumerFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLWSRPConsumerFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLWSRPConsumerFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -334,20 +334,11 @@
System.out.println("adding consumer " + info.getId() + " to
deployment - localName: " + localName);
}
- String message;
String id = consumer.getProducerId();
- if (consumer.getProducerInfo().getEndpointConfigurationInfo().isAvailable())
- {
- message = "Added consumer for producer '" + id + "' from
xml configuration.";
- consumers.put(id, consumer);
- }
- else
- {
- message = "There was a problem initializing the WSRP interface for producer
'"
- + id + "'. The consumer will NOT be available.";
- info.setActive(false);
- }
+ consumers.put(id, consumer);
+ log.info("Added consumer for producer '" + id + "' from xml
configuration.");
+
// update the producer info once the whole information is known
try
{
@@ -358,9 +349,6 @@
// if we couldn't update the info, remove it from the list of service to be
activated
consumers.remove(id);
log.info("Couldn't update the ProducerInfo for Consumer '" +
info.getId() + "'", e);
- return;
}
-
- log.info(message);
}
}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractJNDIServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractJNDIServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractJNDIServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,206 +0,0 @@
-/*
- * 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.gatein.wsrp.services;
-
-import org.gatein.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;
- }
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractSOAPServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractSOAPServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/AbstractSOAPServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,92 +0,0 @@
-/*
- * 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.gatein.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;
- }
- }
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/CachingServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/CachingServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/CachingServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,195 +0,0 @@
-/*
- * 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.gatein.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();
- }
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupServiceWrapper.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupServiceWrapper.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupServiceWrapper.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,88 +0,0 @@
-/*
- * 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.gatein.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
- }
- }*/
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PerEndpointSOAPInvokerServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,162 +0,0 @@
-/*
- * 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.gatein.wsrp.services;
-
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.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);
- }
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PortletManagementServiceWrapper.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PortletManagementServiceWrapper.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/PortletManagementServiceWrapper.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,114 +0,0 @@
-/*
- * 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.gatein.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
- }
- }*/
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RegistrationServiceWrapper.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RegistrationServiceWrapper.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RegistrationServiceWrapper.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,111 +0,0 @@
-/*
- * 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.gatein.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.
- }*/
-}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,111 +0,0 @@
-/*
- * 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.gatein.wsrp.services;
-
-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.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * @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 final static QName SERVICE = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPService");
- private final static QName WSRPServiceDescriptionService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl",
"WSRPServiceDescriptionService");
- private final static QName WSRPBaseService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPBaseService");
- private final static QName WSRPPortletManagementService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl",
"WSRPPortletManagementService");
- private final static QName WSRPRegistrationService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPRegistrationService");
-
- 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
- {
- URL wsdlURL = new URL(wsdlDefinitionURL);
- Service service = Service.create(wsdlURL, SERVICE);
-
- WSRPV1MarkupPortType markupPortType = service.getPort(WSRPBaseService,
WSRPV1MarkupPortType.class);
- markupURL =
(String)((BindingProvider)markupPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-
- WSRPV1ServiceDescriptionPortType sdPort =
service.getPort(WSRPServiceDescriptionService, WSRPV1ServiceDescriptionPortType.class);
- serviceDescriptionURL =
(String)((BindingProvider)sdPort).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-
- WSRPV1PortletManagementPortType managementPortType =
service.getPort(WSRPPortletManagementService, WSRPV1PortletManagementPortType.class);
- portletManagementURL =
(String)((BindingProvider)managementPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-
- WSRPV1RegistrationPortType registrationPortType =
service.getPort(WSRPRegistrationService, WSRPV1RegistrationPortType.class);
- registrationURL =
(String)((BindingProvider)registrationPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
- }
-}
Added:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -0,0 +1,276 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.wsrp.services;
+
+import org.gatein.common.util.ParameterValidation;
+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.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class SOAPServiceFactory implements ManageableServiceFactory
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private String wsdlDefinitionURL;
+
+ private final static QName SERVICE = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPService");
+ private final static QName WSRPServiceDescriptionService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl",
"WSRPServiceDescriptionService");
+ private final static QName WSRPBaseService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPBaseService");
+ private final static QName WSRPPortletManagementService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl",
"WSRPPortletManagementService");
+ private final static QName WSRPRegistrationService = new
QName("urn:oasis:names:tc:wsrp:v1:wsdl", "WSRPRegistrationService");
+
+ private Map<Class, Object> services = new ConcurrentHashMap<Class,
Object>();
+ private String markupURL;
+ private String serviceDescriptionURL;
+ private String portletManagementURL;
+ private String registrationURL;
+ private boolean failed;
+ private boolean available;
+
+ public <T> T getService(Class<T> clazz) throws Exception
+ {
+ log.debug("Getting service for class " + clazz);
+
+ // if we need a refresh, reload information from WSDL
+ if (!isAvailable() && !isFailed())
+ {
+ start();
+ }
+
+ Object service = services.get(clazz);
+
+ //
+ String portAddress = null;
+ boolean isMandatoryInterface = false;
+ if (WSRPV1ServiceDescriptionPortType.class.isAssignableFrom(clazz))
+ {
+ portAddress = serviceDescriptionURL;
+ isMandatoryInterface = true;
+ }
+ else if (WSRPV1MarkupPortType.class.isAssignableFrom(clazz))
+ {
+ portAddress = markupURL;
+ isMandatoryInterface = true;
+ }
+ else if (WSRPV1RegistrationPortType.class.isAssignableFrom(clazz))
+ {
+ portAddress = registrationURL;
+ }
+ else if (WSRPV1PortletManagementPortType.class.isAssignableFrom(clazz))
+ {
+ portAddress = portletManagementURL;
+ }
+
+ // 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)
+ {
+ if (portAddress != null)
+ {
+ log.debug("Setting the end point to: " + portAddress);
+
((BindingProvider)service).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
portAddress);
+
+ T result = ServiceWrapper.getServiceWrapper(clazz, service, this);
+
+ // if we managed to retrieve a service, we're probably available
+ setFailed(false);
+ setAvailable(true);
+
+ return result;
+ }
+ else
+ {
+ if (isMandatoryInterface)
+ {
+ setFailed(true);
+ throw new IllegalStateException("Mandatory interface URLs were not
properly initialized: no proper service URL for "
+ + clazz.getName());
+ }
+ else
+ {
+ throw new IllegalStateException("No URL was provided for optional
interface " + clazz.getName());
+ }
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public boolean isAvailable()
+ {
+ return available;
+ }
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+
+ public String getServiceDescriptionURL()
+ {
+ return serviceDescriptionURL;
+ }
+
+ public String getMarkupURL()
+ {
+ return markupURL;
+ }
+
+ public String getRegistrationURL()
+ {
+ return registrationURL;
+ }
+
+ public String getPortletManagementURL()
+ {
+ return portletManagementURL;
+ }
+
+ 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 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 void setRegistrationURL(String registrationURL)
+ {
+ this.registrationURL = registrationURL;
+ setFailed(false); // reset failed status to false since we can't assert it
anymore
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ this.portletManagementURL = portletManagementURL;
+ setFailed(false); // reset failed status to false since we can't assert it
anymore
+ }
+
+
+ public void stop()
+ {
+ // todo: implement as needed
+ }
+
+ public void setFailed(boolean failed)
+ {
+ this.failed = failed;
+ }
+
+ public void setAvailable(boolean available)
+ {
+ this.available = available;
+ }
+
+ 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");
+ }
+
+ // only modify WSDL URL if it's different from the previous one as this will
trigger re-import of data from remote host
+ if (!wsdlDefinitionURL.equals(this.wsdlDefinitionURL))
+ {
+ this.wsdlDefinitionURL = wsdlDefinitionURL;
+
+ // we need a refresh so mark as not available but not failed
+ setAvailable(false);
+ setFailed(false);
+ }
+ }
+
+ public void start() throws Exception
+ {
+ try
+ {
+ URL wsdlURL = new URL(wsdlDefinitionURL);
+
+ Service service = Service.create(wsdlURL, SERVICE);
+
+// WSRPV1MarkupPortType markupPortType = service.getPort(WSRPBaseService,
WSRPV1MarkupPortType.class);
+ WSRPV1MarkupPortType markupPortType =
service.getPort(WSRPV1MarkupPortType.class);
+ services.put(WSRPV1MarkupPortType.class, markupPortType);
+ markupURL =
(String)((BindingProvider)markupPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+
+// WSRPV1ServiceDescriptionPortType sdPort =
service.getPort(WSRPServiceDescriptionService, WSRPV1ServiceDescriptionPortType.class);
+ WSRPV1ServiceDescriptionPortType sdPort =
service.getPort(WSRPV1ServiceDescriptionPortType.class);
+ services.put(WSRPV1ServiceDescriptionPortType.class, sdPort);
+ serviceDescriptionURL =
(String)((BindingProvider)sdPort).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+
+// WSRPV1PortletManagementPortType managementPortType =
service.getPort(WSRPPortletManagementService, WSRPV1PortletManagementPortType.class);
+ WSRPV1PortletManagementPortType managementPortType =
service.getPort(WSRPV1PortletManagementPortType.class);
+ services.put(WSRPV1PortletManagementPortType.class, managementPortType);
+ portletManagementURL =
(String)((BindingProvider)managementPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+
+// WSRPV1RegistrationPortType registrationPortType =
service.getPort(WSRPRegistrationService, WSRPV1RegistrationPortType.class);
+ WSRPV1RegistrationPortType registrationPortType =
service.getPort(WSRPV1RegistrationPortType.class);
+ services.put(WSRPV1RegistrationPortType.class, registrationPortType);
+ registrationURL =
(String)((BindingProvider)registrationPortType).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+
+ setFailed(false);
+ setAvailable(true);
+ }
+ catch (MalformedURLException e)
+ {
+ setFailed(true);
+ throw new IllegalArgumentException(wsdlDefinitionURL + " is not 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;
+ }
+ }
+}
Deleted:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceDescriptionServiceWrapper.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceDescriptionServiceWrapper.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceDescriptionServiceWrapper.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -1,50 +0,0 @@
-/*
- * 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.gatein.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
- }
- }*/
-}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -66,7 +66,7 @@
void setPortletManagementURL(String portletManagementURL);
- void start();
+ void start() throws Exception;
void stop();
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceWrapper.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceWrapper.java 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceWrapper.java 2009-10-08
00:15:12 UTC (rev 314)
@@ -36,7 +36,7 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-class ServiceWrapper<T>
+public class ServiceWrapper<T>
{
protected T service;
protected ManageableServiceFactory parentFactory;
@@ -86,30 +86,6 @@
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);
Modified:
components/wsrp/trunk/consumer/src/main/resources/conf/wsrp-consumers-config.xml
===================================================================
---
components/wsrp/trunk/consumer/src/main/resources/conf/wsrp-consumers-config.xml 2009-10-08
00:07:46 UTC (rev 313)
+++
components/wsrp/trunk/consumer/src/main/resources/conf/wsrp-consumers-config.xml 2009-10-08
00:15:12 UTC (rev 314)
@@ -27,17 +27,17 @@
xsi:schemaLocation="urn:jboss:portal:wsrp:consumer:v2_7
http://www.jboss.org/portal/xsd/jboss-wsrp-consumer_2_7.xsd">
<deployment>
<wsrp-producer id="self" expiration-cache="300">
+
<endpoint-wsdl-url>http://127.0.0.1:8080/wsrp-producer/MarkupService?wsdl</endpoint-wsdl-url>
<!--
we need to use the individual endpoint configuration because the configuration
via wsdl forces an
immediate attempt to access the web service description which is not available
yet at this point of deployment
-->
- <endpoint-config>
-
<service-description-url>http://localhost:8080/portal-wsrp/ServiceDescriptionService
- </service-description-url>
+ <!--<endpoint-config>
+
<service-description-url>http://localhost:8080/portal-wsrp/ServiceDescriptionService</service-description-url>
<markup-url>http://localhost:8080/portal-wsrp/MarkupService</markup-url>
<registration-url>http://localhost:8080/portal-wsrp/RegistrationService</registration-url>
<portlet-management-url>http://localhost:8080/portal-wsrp/PortletManagementService</portlet-management-url>
- </endpoint-config>
+ </endpoint-config>-->
<registration-data/>
</wsrp-producer>
</deployment>
@@ -69,7 +69,7 @@
<endpoint-wsdl-url>http://wsrp.bea.com:7001/producer/producer?WSDL</endpoint-wsdl-url>
<registration-data>
<property>
- <name>registration/consumerRole</name>
+ <name>{urn:bea:wlp:prop:reg:registration}consumerRole</name>
<lang>en</lang>
<value>insider</value>
</property>