Author: chris.laprun(a)jboss.com
Date: 2010-06-15 02:55:01 -0400 (Tue, 15 Jun 2010)
New Revision: 3336
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:
- Minor clean-up.
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
06:24:46 UTC (rev 3335)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15
06:55:01 UTC (rev 3336)
@@ -31,7 +31,6 @@
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;
@@ -83,7 +82,6 @@
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;
@@ -878,7 +876,7 @@
return null;
}
}
-
+
public static GetMarkup toV2GetMarkup(V1GetMarkup getMarkup)
{
if (getMarkup != null)
@@ -887,10 +885,10 @@
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
@@ -914,7 +912,7 @@
return null;
}
}
-
+
public static ClonePortlet toV2ClonePortlet(V1ClonePortlet clonePortlet)
{
if (clonePortlet != null)
@@ -931,7 +929,7 @@
return null;
}
}
-
+
public static PerformBlockingInteraction
toV2PerformBlockingInteraction(V1PerformBlockingInteraction performBlockingInteraction)
{
if (performBlockingInteraction != null)
@@ -940,12 +938,12 @@
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
@@ -953,13 +951,13 @@
return null;
}
}
-
+
public static DestroyPortlets toV2DestroyPortlets(V1DestroyPortlets destroyPortlets)
{
if (destroyPortlets != null)
{
RegistrationContext registrationContext =
toV2RegistrationContext(destroyPortlets.getRegistrationContext());
- DestroyPortlets result =
WSRPTypeFactory.createDestroyPortlets(registrationContext,
destroyPortlets.getPortletHandles());
+ DestroyPortlets result =
WSRPTypeFactory.createDestroyPortlets(registrationContext,
destroyPortlets.getPortletHandles());
return result;
}
else
@@ -967,7 +965,7 @@
return null;
}
}
-
+
public static SetPortletProperties toV2SetPortletProperties(V1SetPortletProperties
setPortletProperties)
{
if (setPortletProperties != null)
@@ -975,8 +973,8 @@
RegistrationContext registrationContext =
toV2RegistrationContext(setPortletProperties.getRegistrationContext());
PortletContext portletContext =
toV2PortletContext(setPortletProperties.getPortletContext());
PropertyList propertyList =
toV2PropertyList(setPortletProperties.getPropertyList());
- SetPortletProperties result =
WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext,
propertyList);
-
+ SetPortletProperties result =
WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext,
propertyList);
+
result.setUserContext(toV2UserContext(setPortletProperties.getUserContext()));
return result;
@@ -986,7 +984,7 @@
return null;
}
}
-
+
public static GetPortletProperties toV2GetPortletProperties(V1GetPortletProperties
getPortletProperties)
{
if (getPortletProperties != null)
@@ -1003,14 +1001,14 @@
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
@@ -1018,7 +1016,7 @@
return null;
}
}
-
+
public static InitCookie toV2InitCookie(V1InitCookie initCookie)
{
if (initCookie != null)
@@ -1033,7 +1031,7 @@
return null;
}
}
-
+
public static GetPortletPropertyDescription
toV2GetPortletPropertyDescription(V1GetPortletPropertyDescription
getPortletPropertyDescription)
{
if (getPortletPropertyDescription != null)
@@ -1042,7 +1040,7 @@
PortletContext portletContext =
toV2PortletContext(getPortletPropertyDescription.getPortletContext());
UserContext userContext =
toV2UserContext(getPortletPropertyDescription.getUserContext());
GetPortletPropertyDescription result =
WSRPTypeFactory.createGetPortletPropertyDescription(registrationContext, portletContext,
userContext, getPortletPropertyDescription.getDesiredLocales());
-
+
return result;
}
else
@@ -1050,7 +1048,7 @@
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
06:24:46 UTC (rev 3335)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15
06:55:01 UTC (rev 3336)
@@ -26,7 +26,6 @@
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;
@@ -37,8 +36,6 @@
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;
@@ -86,7 +83,6 @@
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;
@@ -914,7 +910,7 @@
return null;
}
}
-
+
public static V1MarkupResponse toV1MarkupResponse(MarkupResponse markupResponse)
{
if (markupResponse != null)
@@ -935,19 +931,19 @@
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
@@ -962,13 +958,13 @@
{
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
@@ -976,22 +972,22 @@
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
@@ -999,12 +995,12 @@
return null;
}
}
-
+
public static V1DestroyPortletsResponse
toV1DestroyPortlesResponse(DestroyPortletsResponse destroyPortletResponse)
{
if (destroyPortletResponse != null)
{
-
+
List<V1DestroyFailed> destroyedFailed =
WSRPUtils.transform(destroyPortletResponse.getFailedPortlets(), FAILEDPORTLET);
V1DestroyPortletsResponse result =
WSRP1TypeFactory.createDestroyPortletsResponse(destroyedFailed);
@@ -1013,7 +1009,7 @@
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -1021,7 +1017,7 @@
return null;
}
}
-
+
public static V1PortletPropertyDescriptionResponse
toV1PortletPropertyDescriptionResponse(PortletPropertyDescriptionResponse
portletPropertyDescriptionResponse)
{
if (portletPropertyDescriptionResponse != null)
@@ -1030,13 +1026,13 @@
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
@@ -1044,7 +1040,7 @@
return null;
}
}
-
+
private static class V2ToV1Extension implements Function<Extension,
V1Extension>
{
public V1Extension apply(Extension from)
@@ -1336,7 +1332,7 @@
}
}
}
-
+
private static class V2ToV1FailedPortlets implements Function<FailedPortlets,
V1DestroyFailed>
{
public V1ResetProperty apply(ResetProperty from)
@@ -1360,5 +1356,5 @@
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
06:24:46 UTC (rev 3335)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15
06:55:01 UTC (rev 3336)
@@ -23,26 +23,20 @@
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;
@@ -211,8 +205,8 @@
{
try
{
- ReturnAny returnAny =
producer.deregister(V1ToV2Converter.toV2RegistrationContext(deregister));
- return V2ToV1Converter.toV1ReturnAny(returnAny);
+ ReturnAny returnAny =
producer.deregister(V1ToV2Converter.toV2RegistrationContext(deregister));
+ return V2ToV1Converter.toV1ReturnAny(returnAny);
}
catch (InvalidRegistration invalidRegistration)
{
@@ -228,8 +222,8 @@
{
try
{
- RegistrationState registrationState =
producer.modifyRegistration(V1ToV2Converter.toV2ModifyRegistration(modifyRegistration));
- return V2ToV1Converter.toV1RegistrationState(registrationState);
+ RegistrationState registrationState =
producer.modifyRegistration(V1ToV2Converter.toV2ModifyRegistration(modifyRegistration));
+ return V2ToV1Converter.toV1RegistrationState(registrationState);
}
catch (MissingParameters missingParameters)
{
@@ -243,7 +237,7 @@
{
throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
invalidRegistration);
}
-
+
}
public V1PortletDescriptionResponse getPortletDescription(V1GetPortletDescription
getPortletDescription) throws V1AccessDenied, V1InvalidHandle, V1InvalidUserCategory,
V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration, V1OperationFailed
@@ -255,8 +249,8 @@
{
try
{
- MarkupResponse markupResponse =
producer.getMarkup(V1ToV2Converter.toV2GetMarkup(getMarkup));
- return V2ToV1Converter.toV1MarkupResponse(markupResponse);
+ MarkupResponse markupResponse =
producer.getMarkup(V1ToV2Converter.toV2GetMarkup(getMarkup));
+ return V2ToV1Converter.toV1MarkupResponse(markupResponse);
}
catch (UnsupportedMimeType unsupportedMimeType)
{
@@ -316,8 +310,8 @@
{
try
{
- PortletContext portletContext =
producer.clonePortlet(V1ToV2Converter.toV2ClonePortlet(clonePortlet));
- return V2ToV1Converter.toV1PortletContext(portletContext);
+ PortletContext portletContext =
producer.clonePortlet(V1ToV2Converter.toV2ClonePortlet(clonePortlet));
+ return V2ToV1Converter.toV1PortletContext(portletContext);
}
catch (AccessDenied accessDenied)
{
@@ -563,8 +557,8 @@
{
try
{
- PortletPropertyDescriptionResponse portletPropertyDescriptionResponse =
producer.getPortletPropertyDescription(V1ToV2Converter.toV2GetPortletPropertyDescription(getPortletPropertyDescription));
- return
V2ToV1Converter.toV1PortletPropertyDescriptionResponse(portletPropertyDescriptionResponse);
+ PortletPropertyDescriptionResponse portletPropertyDescriptionResponse =
producer.getPortletPropertyDescription(V1ToV2Converter.toV2GetPortletPropertyDescription(getPortletPropertyDescription));
+ return
V2ToV1Converter.toV1PortletPropertyDescriptionResponse(portletPropertyDescriptionResponse);
}
catch (MissingParameters missingParameters)
{