Author: mwringe
Date: 2010-06-15 02:07:47 -0400 (Tue, 15 Jun 2010)
New Revision: 3334
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
Log:
Update WSRP1Producer to implement empty methods and add corresponding methods to the
Converter classes.
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15
02:09:01 UTC (rev 3333)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15
06:07:47 UTC (rev 3334)
@@ -31,14 +31,21 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1CacheControl;
import org.oasis.wsrp.v1.V1ClientData;
+import org.oasis.wsrp.v1.V1ClonePortlet;
import org.oasis.wsrp.v1.V1Contact;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1DestroyFailed;
+import org.oasis.wsrp.v1.V1DestroyPortlets;
import org.oasis.wsrp.v1.V1EmployerInfo;
import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetPortletProperties;
+import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InitCookie;
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1LocalizedString;
@@ -47,8 +54,10 @@
import org.oasis.wsrp.v1.V1MarkupType;
import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1ModelTypes;
+import org.oasis.wsrp.v1.V1ModifyRegistration;
import org.oasis.wsrp.v1.V1NamedString;
import org.oasis.wsrp.v1.V1Online;
+import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
import org.oasis.wsrp.v1.V1PersonName;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
@@ -58,12 +67,14 @@
import org.oasis.wsrp.v1.V1PropertyList;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1ReleaseSessions;
import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1Resource;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1ResourceValue;
import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1SetPortletProperties;
import org.oasis.wsrp.v1.V1StateChange;
import org.oasis.wsrp.v1.V1Telecom;
import org.oasis.wsrp.v1.V1TelephoneNum;
@@ -72,14 +83,21 @@
import org.oasis.wsrp.v1.V1UploadContext;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v1.V1UserProfile;
+import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
+import org.oasis.wsrp.v2.ClonePortlet;
import org.oasis.wsrp.v2.Contact;
import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.DestroyPortlets;
import org.oasis.wsrp.v2.EmployerInfo;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.GetPortletProperties;
+import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.GetServiceDescription;
+import org.oasis.wsrp.v2.InitCookie;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.ItemDescription;
import org.oasis.wsrp.v2.LocalizedString;
@@ -88,8 +106,10 @@
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.ModifyRegistration;
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.Online;
+import org.oasis.wsrp.v2.PerformBlockingInteraction;
import org.oasis.wsrp.v2.PersonName;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -99,6 +119,7 @@
import org.oasis.wsrp.v2.PropertyList;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
+import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ResetProperty;
import org.oasis.wsrp.v2.Resource;
import org.oasis.wsrp.v2.ResourceList;
@@ -106,6 +127,7 @@
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.SessionContext;
import org.oasis.wsrp.v2.SessionParams;
+import org.oasis.wsrp.v2.SetPortletProperties;
import org.oasis.wsrp.v2.StateChange;
import org.oasis.wsrp.v2.Telecom;
import org.oasis.wsrp.v2.TelephoneNum;
@@ -856,7 +878,179 @@
return null;
}
}
+
+ public static GetMarkup toV2GetMarkup(V1GetMarkup getMarkup)
+ {
+ if (getMarkup != null)
+ {
+ PortletContext portletContext =
toV2PortletContext(getMarkup.getPortletContext());
+ RuntimeContext runtimeContext =
toV2RuntimeContext(getMarkup.getRuntimeContext());
+ MarkupParams markupParams = toV2MarkupParams(getMarkup.getMarkupParams());
+ GetMarkup result = WSRPTypeFactory.createMarkupRequest(portletContext,
runtimeContext, markupParams);
+
+
result.setRegistrationContext(toV2RegistrationContext(getMarkup.getRegistrationContext()));
+ result.setUserContext(toV2UserContext(getMarkup.getUserContext()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ public static ModifyRegistration toV2ModifyRegistration(V1ModifyRegistration
modifyRegistration)
+ {
+ if (modifyRegistration != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(modifyRegistration.getRegistrationContext());
+ RegistrationData registrationData =
toV2RegistrationData(modifyRegistration.getRegistrationData());
+ ModifyRegistration result =
WSRPTypeFactory.createModifyRegistration(registrationContext, registrationData);
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ClonePortlet toV2ClonePortlet(V1ClonePortlet clonePortlet)
+ {
+ if (clonePortlet != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(clonePortlet.getRegistrationContext());
+ PortletContext portletContext =
toV2PortletContext(clonePortlet.getPortletContext());
+ UserContext userContext = toV2UserContext(clonePortlet.getUserContext());
+ ClonePortlet result = WSRPTypeFactory.createClonePortlet(registrationContext,
portletContext, userContext);
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static PerformBlockingInteraction
toV2PerformBlockingInteraction(V1PerformBlockingInteraction performBlockingInteraction)
+ {
+ if (performBlockingInteraction != null)
+ {
+ InteractionParams interactionParams =
toV2InteractionParams(performBlockingInteraction.getInteractionParams());
+ MarkupParams markupParams =
toV2MarkupParams(performBlockingInteraction.getMarkupParams());
+ PortletContext portletContext =
toV2PortletContext(performBlockingInteraction.getPortletContext());
+ RuntimeContext runtimeContext =
toV2RuntimeContext(performBlockingInteraction.getRuntimeContext());
+
+ PerformBlockingInteraction result =
WSRPTypeFactory.createPerformBlockingInteraction(portletContext, runtimeContext,
markupParams, interactionParams);
+
+
result.setRegistrationContext(toV2RegistrationContext(performBlockingInteraction.getRegistrationContext()));
+
result.setUserContext(toV2UserContext(performBlockingInteraction.getUserContext()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static DestroyPortlets toV2DestroyPortlets(V1DestroyPortlets destroyPortlets)
+ {
+ if (destroyPortlets != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(destroyPortlets.getRegistrationContext());
+ DestroyPortlets result =
WSRPTypeFactory.createDestroyPortlets(registrationContext,
destroyPortlets.getPortletHandles());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static SetPortletProperties toV2SetPortletProperties(V1SetPortletProperties
setPortletProperties)
+ {
+ if (setPortletProperties != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(setPortletProperties.getRegistrationContext());
+ PortletContext portletContext =
toV2PortletContext(setPortletProperties.getPortletContext());
+ PropertyList propertyList =
toV2PropertyList(setPortletProperties.getPropertyList());
+ SetPortletProperties result =
WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext,
propertyList);
+
+ result.setUserContext(toV2UserContext(setPortletProperties.getUserContext()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static GetPortletProperties toV2GetPortletProperties(V1GetPortletProperties
getPortletProperties)
+ {
+ if (getPortletProperties != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(getPortletProperties.getRegistrationContext());
+ PortletContext portletContext =
toV2PortletContext(getPortletProperties.getPortletContext());
+ UserContext userContext =
toV2UserContext(getPortletProperties.getUserContext());
+ GetPortletProperties result =
WSRPTypeFactory.createGetPortletProperties(registrationContext, portletContext,
userContext, getPortletProperties.getNames());
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ReleaseSessions toV2ReleaseSessions(V1ReleaseSessions releaseSessions)
+ {
+ if (releaseSessions != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(releaseSessions.getRegistrationContext());
+ ReleaseSessions result =
WSRPTypeFactory.createReleaseSessions(registrationContext,
releaseSessions.getSessionIDs());
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static InitCookie toV2InitCookie(V1InitCookie initCookie)
+ {
+ if (initCookie != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(initCookie.getRegistrationContext());
+ InitCookie result = WSRPTypeFactory.createInitCookie(registrationContext);
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static GetPortletPropertyDescription
toV2GetPortletPropertyDescription(V1GetPortletPropertyDescription
getPortletPropertyDescription)
+ {
+ if (getPortletPropertyDescription != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(getPortletPropertyDescription.getRegistrationContext());
+ PortletContext portletContext =
toV2PortletContext(getPortletPropertyDescription.getPortletContext());
+ UserContext userContext =
toV2UserContext(getPortletPropertyDescription.getUserContext());
+ GetPortletPropertyDescription result =
WSRPTypeFactory.createGetPortletPropertyDescription(registrationContext, portletContext,
userContext, getPortletPropertyDescription.getDesiredLocales());
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
public static class V1ToV2Extension implements Function<V1Extension, Extension>
{
public Extension apply(V1Extension from)
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15
02:09:01 UTC (rev 3333)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15
06:07:47 UTC (rev 3334)
@@ -26,19 +26,25 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.gatein.common.util.ParameterValidation;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1CacheControl;
import org.oasis.wsrp.v1.V1ClientData;
import org.oasis.wsrp.v1.V1Contact;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1DestroyFailed;
+import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
import org.oasis.wsrp.v1.V1EmployerInfo;
import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1Fault;
+import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1LocalizedString;
import org.oasis.wsrp.v1.V1MarkupContext;
import org.oasis.wsrp.v1.V1MarkupParams;
+import org.oasis.wsrp.v1.V1MarkupResponse;
import org.oasis.wsrp.v1.V1MarkupType;
import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1ModelTypes;
@@ -47,16 +53,19 @@
import org.oasis.wsrp.v1.V1PersonName;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v1.V1Postal;
import org.oasis.wsrp.v1.V1Property;
import org.oasis.wsrp.v1.V1PropertyDescription;
import org.oasis.wsrp.v1.V1PropertyList;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1RegistrationState;
import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1Resource;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1ResourceValue;
+import org.oasis.wsrp.v1.V1ReturnAny;
import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1ServiceDescription;
import org.oasis.wsrp.v1.V1SessionContext;
@@ -68,18 +77,22 @@
import org.oasis.wsrp.v1.V1UploadContext;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v1.V1UserProfile;
+import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.Contact;
import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.DestroyPortletsResponse;
import org.oasis.wsrp.v2.EmployerInfo;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.ItemDescription;
import org.oasis.wsrp.v2.LocalizedString;
import org.oasis.wsrp.v2.MarkupContext;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModelTypes;
@@ -88,16 +101,19 @@
import org.oasis.wsrp.v2.PersonName;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.Postal;
import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.PropertyDescription;
import org.oasis.wsrp.v2.PropertyList;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
+import org.oasis.wsrp.v2.RegistrationState;
import org.oasis.wsrp.v2.ResetProperty;
import org.oasis.wsrp.v2.Resource;
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.ResourceValue;
+import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.SessionContext;
@@ -134,6 +150,7 @@
public static final V2ToV1UploadContext UPLOADCONTEXT = new V2ToV1UploadContext();
public static final V2ToV1Property PROPERTY = new V2ToV1Property();
public static final V2ToV1ResetProperty RESETPROPERTY = new V2ToV1ResetProperty();
+ public static final V2ToV1FailedPortlets FAILEDPORTLET = new V2ToV1FailedPortlets();
public static V1PortletContext toV1PortletContext(PortletContext portletContext)
@@ -509,7 +526,6 @@
}
v1MarkupContext.setCacheControl(toV1CacheControl(markupContext.getCacheControl()));
v1MarkupContext.setLocale(markupContext.getLocale());
- v1MarkupContext.setMimeType(markupContext.getMimeType());
v1MarkupContext.setPreferredTitle(markupContext.getPreferredTitle());
v1MarkupContext.setRequiresUrlRewriting(markupContext.isRequiresRewriting());
v1MarkupContext.setUseCachedMarkup(markupContext.isUseCachedItem());
@@ -898,7 +914,137 @@
return null;
}
}
+
+ public static V1MarkupResponse toV1MarkupResponse(MarkupResponse markupResponse)
+ {
+ if (markupResponse != null)
+ {
+ V1MarkupResponse result =
WSRP1TypeFactory.createMarkupResponse(toV1MarkupContext(markupResponse.getMarkupContext()));
+
result.setSessionContext(toV1SessionContext(markupResponse.getSessionContext()));
+ List<V1Extension> extensions =
WSRPUtils.transform(markupResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1ReturnAny toV1ReturnAny(ReturnAny returnAny)
+ {
+ if (returnAny != null)
+ {
+ V1ReturnAny result = new V1ReturnAny();
+
+ List<V1Extension> extensions =
WSRPUtils.transform(returnAny.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1RegistrationState toV1RegistrationState(RegistrationState
registrationState)
+ {
+ if (registrationState != null)
+ {
+ V1RegistrationState result = new V1RegistrationState();
+ result.setRegistrationState(registrationState.getRegistrationState());
+
+ List<V1Extension> extensions =
WSRPUtils.transform(registrationState.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1BlockingInteractionResponse
toV1BlockingInteractionResponse(BlockingInteractionResponse blockingInteractionResponse)
+ {
+ if (blockingInteractionResponse != null)
+ {
+ V1UpdateResponse updateResponse =
toV1UpdateResponse(blockingInteractionResponse.getUpdateResponse());
+ V1BlockingInteractionResponse result =
WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
+
+ result.setRedirectURL(blockingInteractionResponse.getRedirectURL());
+
+ List<V1Extension> extensions =
WSRPUtils.transform(blockingInteractionResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1DestroyPortletsResponse
toV1DestroyPortlesResponse(DestroyPortletsResponse destroyPortletResponse)
+ {
+ if (destroyPortletResponse != null)
+ {
+
+ List<V1DestroyFailed> destroyedFailed =
WSRPUtils.transform(destroyPortletResponse.getFailedPortlets(), FAILEDPORTLET);
+ V1DestroyPortletsResponse result =
WSRP1TypeFactory.createDestroyPortletsResponse(destroyedFailed);
+
+ List<V1Extension> extensions =
WSRPUtils.transform(destroyPortletResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1PortletPropertyDescriptionResponse
toV1PortletPropertyDescriptionResponse(PortletPropertyDescriptionResponse
portletPropertyDescriptionResponse)
+ {
+ if (portletPropertyDescriptionResponse != null)
+ {
+ //todo use WSRP1TypeFactory instead
+ V1PortletPropertyDescriptionResponse result = new
V1PortletPropertyDescriptionResponse();
+
result.setModelDescription(toV1ModelDescription(portletPropertyDescriptionResponse.getModelDescription()));
+
result.setResourceList(toV1ResourceList(portletPropertyDescriptionResponse.getResourceList()));
+
+ List<V1Extension> extensions =
WSRPUtils.transform(portletPropertyDescriptionResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private static class V2ToV1Extension implements Function<Extension,
V1Extension>
{
public V1Extension apply(Extension from)
@@ -1190,4 +1336,29 @@
}
}
}
+
+ private static class V2ToV1FailedPortlets implements Function<FailedPortlets,
V1DestroyFailed>
+ {
+ public V1ResetProperty apply(ResetProperty from)
+ {
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createResetProperty(from.getName().toString());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public V1DestroyFailed apply(FailedPortlets from)
+ {
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createDestroyFailed(from.getPortletHandles().get(0),
from.getReason().toString());
+ }
+ return null;
+ }
+ }
+
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15
02:09:01 UTC (rev 3333)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15
06:07:47 UTC (rev 3334)
@@ -23,20 +23,26 @@
package org.gatein.wsrp.producer.v1;
+import java.security.AccessControlException;
+import java.util.List;
+
import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.registration.RegistrationManager;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.ProducerHolder;
import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.v2.WSRP2Producer;
import org.gatein.wsrp.spec.v1.V1ToV2Converter;
import org.gatein.wsrp.spec.v1.V2ToV1Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter.V2ToV1NamedString;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1ClonePortlet;
import org.oasis.wsrp.v1.V1DestroyPortlets;
import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
+import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
import org.oasis.wsrp.v1.V1GetPortletDescription;
import org.oasis.wsrp.v1.V1GetPortletProperties;
@@ -70,9 +76,30 @@
import org.oasis.wsrp.v1.V1UnsupportedMimeType;
import org.oasis.wsrp.v1.V1UnsupportedMode;
import org.oasis.wsrp.v1.V1UnsupportedWindowState;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.BlockingInteractionResponse;
+import org.oasis.wsrp.v2.DestroyPortletsResponse;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.PropertyList;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.RegistrationState;
+import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.ServiceDescription;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -98,7 +125,7 @@
{
}
- private final WSRP2Producer producer = ProducerHolder.getProducer();
+ private final WSRP2Producer producer = ProducerHolder.getProducer(true);
public RegistrationManager getRegistrationManager()
{
@@ -165,17 +192,58 @@
public V1RegistrationContext register(V1RegistrationData register) throws
V1MissingParameters, V1OperationFailed
{
- throw new NotYetImplemented();
+ try
+ {
+ RegistrationContext registrationContext =
producer.register(V1ToV2Converter.toV2RegistrationData(register));
+ return V2ToV1Converter.toV1RegistrationContext(registrationContext);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
}
public V1ReturnAny deregister(V1RegistrationContext deregister) throws
V1OperationFailed, V1InvalidRegistration
{
- throw new NotYetImplemented();
+ try
+ {
+ ReturnAny returnAny =
producer.deregister(V1ToV2Converter.toV2RegistrationContext(deregister));
+ return V2ToV1Converter.toV1ReturnAny(returnAny);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
}
public V1RegistrationState modifyRegistration(V1ModifyRegistration modifyRegistration)
throws V1MissingParameters, V1OperationFailed, V1InvalidRegistration
{
- throw new NotYetImplemented();
+ try
+ {
+ RegistrationState registrationState =
producer.modifyRegistration(V1ToV2Converter.toV2ModifyRegistration(modifyRegistration));
+ return V2ToV1Converter.toV1RegistrationState(registrationState);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
invalidRegistration);
+ }
+
}
public V1PortletDescriptionResponse getPortletDescription(V1GetPortletDescription
getPortletDescription) throws V1AccessDenied, V1InvalidHandle, V1InvalidUserCategory,
V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration, V1OperationFailed
@@ -185,46 +253,346 @@
public V1MarkupResponse getMarkup(V1GetMarkup getMarkup) throws
V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession, V1AccessDenied,
V1InconsistentParameters, V1InvalidHandle, V1UnsupportedLocale, V1UnsupportedMode,
V1OperationFailed, V1MissingParameters, V1InvalidUserCategory, V1InvalidRegistration,
V1UnsupportedMimeType
{
- throw new NotYetImplemented();
+ try
+ {
+ MarkupResponse markupResponse =
producer.getMarkup(V1ToV2Converter.toV2GetMarkup(getMarkup));
+ return V2ToV1Converter.toV1MarkupResponse(markupResponse);
+ }
+ catch (UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMimeType.class,
unsupportedMimeType);
+ }
+ catch (UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedWindowState.class,
unsupportedWindowState);
+ }
+ catch (InvalidCookie invalidCookie)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ }
+ catch (InvalidSession invalidSession)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (UnsupportedLocale unsupportedLocale)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedLocale.class,
unsupportedLocale);
+ }
+ catch (UnsupportedMode unsupportedMode)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
}
public V1PortletContext clonePortlet(V1ClonePortlet clonePortlet) throws
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed, V1InvalidHandle,
V1InvalidRegistration, V1InconsistentParameters, V1MissingParameters
{
- throw new NotYetImplemented();
+ try
+ {
+ PortletContext portletContext =
producer.clonePortlet(V1ToV2Converter.toV2ClonePortlet(clonePortlet));
+ return V2ToV1Converter.toV1PortletContext(portletContext);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
}
public V1BlockingInteractionResponse
performBlockingInteraction(V1PerformBlockingInteraction performBlockingInteraction) throws
V1InvalidSession, V1UnsupportedMode, V1UnsupportedMimeType, V1OperationFailed,
V1UnsupportedWindowState, V1UnsupportedLocale, V1AccessDenied,
V1PortletStateChangeRequired, V1InvalidRegistration, V1MissingParameters,
V1InvalidUserCategory, V1InconsistentParameters, V1InvalidHandle, V1InvalidCookie
{
- throw new NotYetImplemented();
+ try
+ {
+ BlockingInteractionResponse blockingInteractionResponse =
producer.performBlockingInteraction(V1ToV2Converter.toV2PerformBlockingInteraction(performBlockingInteraction));
+ return
V2ToV1Converter.toV1BlockingInteractionResponse(blockingInteractionResponse);
+ }
+ catch (InvalidSession invalidSession)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ }
+ catch (UnsupportedMode unsupportedMode)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ }
+ catch (UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMimeType.class,
unsupportedMimeType);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedWindowState.class,
unsupportedWindowState);
+ }
+ catch (UnsupportedLocale unsupportedLocale)
+ {
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedLocale.class,
unsupportedLocale);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (PortletStateChangeRequired portletStateChangeRequired)
+ {
+ throw V2ToV1Converter.toV1Exception(V1PortletStateChangeRequired.class,
portletStateChangeRequired);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (InvalidCookie invalidCookie)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ }
}
public V1DestroyPortletsResponse destroyPortlets(V1DestroyPortlets destroyPortlets)
throws V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration,
V1OperationFailed
{
- throw new NotYetImplemented();
+ try
+ {
+ DestroyPortletsResponse destroyportletResponse =
producer.destroyPortlets(V1ToV2Converter.toV2DestroyPortlets(destroyPortlets));
+ return V2ToV1Converter.toV1DestroyPortlesResponse(destroyportletResponse);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
}
public V1PortletContext setPortletProperties(V1SetPortletProperties
setPortletProperties) throws V1OperationFailed, V1InvalidHandle, V1MissingParameters,
V1InconsistentParameters, V1InvalidUserCategory, V1AccessDenied, V1InvalidRegistration
{
- throw new NotYetImplemented();
+ try
+ {
+ PortletContext portletContext =
producer.setPortletProperties(V1ToV2Converter.toV2SetPortletProperties(setPortletProperties));
+ return V2ToV1Converter.toV1PortletContext(portletContext);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
}
public V1ReturnAny releaseSessions(V1ReleaseSessions releaseSessions) throws
V1InvalidRegistration, V1OperationFailed, V1MissingParameters, V1AccessDenied
{
- throw new NotYetImplemented();
+ try
+ {
+ ReturnAny returnAny =
producer.releaseSessions(V1ToV2Converter.toV2ReleaseSessions(releaseSessions));
+ return V2ToV1Converter.toV1ReturnAny(returnAny);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
}
public V1PropertyList getPortletProperties(V1GetPortletProperties
getPortletProperties) throws V1InvalidHandle, V1MissingParameters, V1InvalidRegistration,
V1AccessDenied, V1OperationFailed, V1InconsistentParameters, V1InvalidUserCategory
{
- throw new NotYetImplemented();
+ try
+ {
+ PropertyList propertyList =
producer.getPortletProperties(V1ToV2Converter.toV2GetPortletProperties(getPortletProperties));
+ return V2ToV1Converter.toV1PropertyList(propertyList);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
}
public V1ReturnAny initCookie(V1InitCookie initCookie) throws V1AccessDenied,
V1OperationFailed, V1InvalidRegistration
{
- throw new NotYetImplemented();
+ try
+ {
+ ReturnAny returnAny =
producer.initCookie(V1ToV2Converter.toV2InitCookie(initCookie));
+ return V2ToV1Converter.toV1ReturnAny(returnAny);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
}
public V1PortletPropertyDescriptionResponse
getPortletPropertyDescription(V1GetPortletPropertyDescription
getPortletPropertyDescription) throws V1MissingParameters, V1InconsistentParameters,
V1InvalidUserCategory, V1InvalidRegistration, V1AccessDenied, V1InvalidHandle,
V1OperationFailed
{
- throw new NotYetImplemented();
+ try
+ {
+ PortletPropertyDescriptionResponse portletPropertyDescriptionResponse =
producer.getPortletPropertyDescription(V1ToV2Converter.toV2GetPortletPropertyDescription(getPortletPropertyDescription));
+ return
V2ToV1Converter.toV1PortletPropertyDescriptionResponse(portletPropertyDescriptionResponse);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
}
}