Author: chris.laprun(a)jboss.com
Date: 2010-06-08 11:43:55 -0400 (Tue, 08 Jun 2010)
New Revision: 3252
Added:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1ExceptionFactory.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
Log:
- Refactored WSRPExceptionFactory hierarchy. Would still need some work to prevent v1
factory from creating v2 exceptions but need to move on right now.
- Started implementing v1 ServiceDescriptionEndpoint to delegate to v2 producer. Still
lots of blanks to fill... :/
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,45 +23,12 @@
package org.gatein.wsrp;
-import org.oasis.wsrp.v2.AccessDenied;
-import org.oasis.wsrp.v2.AccessDeniedFault;
-import org.oasis.wsrp.v2.ExportByValueNotSupported;
-import org.oasis.wsrp.v2.ExportNoLongerValid;
-import org.oasis.wsrp.v2.Fault;
-import org.oasis.wsrp.v2.InconsistentParameters;
-import org.oasis.wsrp.v2.InconsistentParametersFault;
-import org.oasis.wsrp.v2.InvalidCookie;
-import org.oasis.wsrp.v2.InvalidCookieFault;
-import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
-import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.InvalidRegistrationFault;
-import org.oasis.wsrp.v2.InvalidSession;
-import org.oasis.wsrp.v2.InvalidSessionFault;
-import org.oasis.wsrp.v2.InvalidUserCategory;
-import org.oasis.wsrp.v2.InvalidUserCategoryFault;
-import org.oasis.wsrp.v2.MissingParameters;
-import org.oasis.wsrp.v2.MissingParametersFault;
-import org.oasis.wsrp.v2.ModifyRegistrationRequired;
-import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
-import org.oasis.wsrp.v2.OperationNotSupported;
-import org.oasis.wsrp.v2.PortletStateChangeRequired;
-import org.oasis.wsrp.v2.PortletStateChangeRequiredFault;
-import org.oasis.wsrp.v2.ResourceSuspended;
-import org.oasis.wsrp.v2.UnsupportedLocale;
-import org.oasis.wsrp.v2.UnsupportedLocaleFault;
-import org.oasis.wsrp.v2.UnsupportedMimeType;
-import org.oasis.wsrp.v2.UnsupportedMimeTypeFault;
-import org.oasis.wsrp.v2.UnsupportedMode;
-import org.oasis.wsrp.v2.UnsupportedModeFault;
-import org.oasis.wsrp.v2.UnsupportedWindowState;
-import org.oasis.wsrp.v2.UnsupportedWindowStateFault;
+import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
-import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
import java.util.Map;
@@ -70,145 +37,26 @@
* @version $Revision: 9360 $
* @since 2.6
*/
-public class WSRPExceptionFactory
+public abstract class WSRPExceptionFactory
{
- private static final Logger log =
LoggerFactory.getLogger(WSRPExceptionFactory.class);
+ protected static final Logger log =
LoggerFactory.getLogger(WSRPExceptionFactory.class);
- public static final String ACCESS_DENIED = "AccessDenied";
- public static final String INCONSISTENT_PARAMETERS =
"InconsistentParameters";
- public static final String INVALID_REGISTRATION = "InvalidRegistration";
- public static final String INVALID_COOKIE = "InvalidCookie";
- public static final String INVALID_HANDLE = "InvalidHandle";
- public static final String INVALID_SESSION = "InvalidSession";
- public static final String INVALID_USER_CATEGORY = "InvalidUserCategory";
- public static final String MISSING_PARAMETERS = "MissingParameters";
- public static final String OPERATION_FAILED = "OperationFailed";
- public static final String PORTLET_STATE_CHANGE_REQUIRED =
"PortletStateChangeRequired";
- public static final String UNSUPPORTED_LOCALE = "UnsupportedLocale";
- public static final String UNSUPPORTED_MIME_TYPE = "UnsupportedMimeType";
- public static final String UNSUPPORTED_MODE = "UnsupportedMode";
- public static final String UNSUPPORTED_WINDOW_STATE =
"UnsupportedWindowState";
+ protected static final Map<Class<? extends Exception>, ExceptionFactory<?
extends Exception>> exceptionClassToFactory =
+ new HashMap<Class<? extends Exception>, ExceptionFactory<? extends
Exception>>(33);
- private static final Map<String, ExceptionFactory<? extends Exception, ? extends
Fault>> errorCodeToExceptions =
- new HashMap<String, ExceptionFactory<? extends Exception, ? extends
Fault>>(17);
- private static final Map<Class<? extends Exception>, ExceptionFactory2<?
extends Exception>> exceptionClassToFactory =
- new HashMap<Class<? extends Exception>, ExceptionFactory2<? extends
Exception>>(19);
-
static
{
- try
- {
- errorCodeToExceptions.put(ACCESS_DENIED, new ExceptionFactory<AccessDenied,
AccessDeniedFault>()
- {
- });
- errorCodeToExceptions.put(INCONSISTENT_PARAMETERS, new
ExceptionFactory<InconsistentParameters, InconsistentParametersFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_COOKIE, new ExceptionFactory<InvalidCookie,
InvalidCookieFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_HANDLE, new ExceptionFactory<InvalidHandle,
InvalidHandleFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_REGISTRATION, new
ExceptionFactory<InvalidRegistration, InvalidRegistrationFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_SESSION, new
ExceptionFactory<InvalidSession, InvalidSessionFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_USER_CATEGORY, new
ExceptionFactory<InvalidUserCategory, InvalidUserCategoryFault>()
- {
- });
- errorCodeToExceptions.put(MISSING_PARAMETERS, new
ExceptionFactory<MissingParameters, MissingParametersFault>()
- {
- });
- errorCodeToExceptions.put(OPERATION_FAILED, new
ExceptionFactory<OperationFailed, OperationFailedFault>()
- {
- });
- errorCodeToExceptions.put(PORTLET_STATE_CHANGE_REQUIRED, new
ExceptionFactory<PortletStateChangeRequired, PortletStateChangeRequiredFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_LOCALE, new
ExceptionFactory<UnsupportedLocale, UnsupportedLocaleFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_MIME_TYPE, new
ExceptionFactory<UnsupportedMimeType, UnsupportedMimeTypeFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_MODE, new
ExceptionFactory<UnsupportedMode, UnsupportedModeFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_WINDOW_STATE, new
ExceptionFactory<UnsupportedWindowState, UnsupportedWindowStateFault>()
- {
- });
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error initializing WSRPExceptionFactory",
e);
- }
+ // initialize exception factories
+ WSRP1ExceptionFactory.getInstance().loadExceptionFactories();
+ WSRP2ExceptionFactory.getInstance().loadExceptionFactories();
}
- static
- {
- try
- {
- exceptionClassToFactory.put(AccessDenied.class, new
ExceptionFactory2<AccessDenied>(AccessDenied.class));
- exceptionClassToFactory.put(ExportByValueNotSupported.class, new
ExceptionFactory2<ExportByValueNotSupported>(ExportByValueNotSupported.class));
- exceptionClassToFactory.put(ExportNoLongerValid.class, new
ExceptionFactory2<ExportNoLongerValid>(ExportNoLongerValid.class));
- exceptionClassToFactory.put(InconsistentParameters.class, new
ExceptionFactory2<InconsistentParameters>(InconsistentParameters.class));
- exceptionClassToFactory.put(InvalidCookie.class, new
ExceptionFactory2<InvalidCookie>(InvalidCookie.class));
- exceptionClassToFactory.put(InvalidHandle.class, new
ExceptionFactory2<InvalidHandle>(InvalidHandle.class));
- exceptionClassToFactory.put(InvalidRegistration.class, new
ExceptionFactory2<InvalidRegistration>(InvalidRegistration.class));
- exceptionClassToFactory.put(InvalidSession.class, new
ExceptionFactory2<InvalidSession>(InvalidSession.class));
- exceptionClassToFactory.put(InvalidUserCategory.class, new
ExceptionFactory2<InvalidUserCategory>(InvalidUserCategory.class));
- exceptionClassToFactory.put(MissingParameters.class, new
ExceptionFactory2<MissingParameters>(MissingParameters.class));
- exceptionClassToFactory.put(ModifyRegistrationRequired.class, new
ExceptionFactory2<ModifyRegistrationRequired>(ModifyRegistrationRequired.class));
- exceptionClassToFactory.put(OperationFailed.class, new
ExceptionFactory2<OperationFailed>(OperationFailed.class));
- exceptionClassToFactory.put(OperationNotSupported.class, new
ExceptionFactory2<OperationNotSupported>(OperationNotSupported.class));
- exceptionClassToFactory.put(PortletStateChangeRequired.class, new
ExceptionFactory2<PortletStateChangeRequired>(PortletStateChangeRequired.class));
- exceptionClassToFactory.put(ResourceSuspended.class, new
ExceptionFactory2<ResourceSuspended>(ResourceSuspended.class));
- exceptionClassToFactory.put(UnsupportedLocale.class, new
ExceptionFactory2<UnsupportedLocale>(UnsupportedLocale.class));
- exceptionClassToFactory.put(UnsupportedMimeType.class, new
ExceptionFactory2<UnsupportedMimeType>(UnsupportedMimeType.class));
- exceptionClassToFactory.put(UnsupportedMode.class, new
ExceptionFactory2<UnsupportedMode>(UnsupportedMode.class));
- exceptionClassToFactory.put(UnsupportedWindowState.class, new
ExceptionFactory2<UnsupportedWindowState>(UnsupportedWindowState.class));
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't initialize
WSRPExceptionFactory", e);
- }
- }
+ protected abstract void loadExceptionFactories();
- private WSRPExceptionFactory()
+ protected WSRPExceptionFactory()
{
}
- public static void throwMissingParametersIfValueIsMissing(Object valueToCheck, String
valueName, String context)
- throws MissingParameters
- {
- if (valueToCheck == null)
- {
- throw new MissingParameters("Missing required " + valueName + (context
!= null ? " in " + context : ""), new MissingParametersFault());
- }
- }
-
- public static void throwOperationFailedIfValueIsMissing(Object valueToCheck, String
valueName) throws OperationFailed
- {
- if (valueToCheck == null)
- {
- throw new OperationFailed("Missing required " + valueName, new
OperationFailedFault());
- }
- }
-
- public static <E extends Exception, F extends Fault> E throwWSException(String
errorCode, String message, Throwable cause) throws E
- {
- ExceptionFactory<E, F> exceptionFactory = (ExceptionFactory<E,
F>)errorCodeToExceptions.get(errorCode);
- if (exceptionFactory == null)
- {
- throw new IllegalArgumentException("Unknown error code: " +
errorCode);
- }
-
- throw exceptionFactory.newInstance(message, cause);
- }
-
public static <E extends Exception> E throwWSException(Class<E>
exceptionClass, String message, Throwable cause) throws E
{
throw createWSException(exceptionClass, message, cause);
@@ -216,7 +64,7 @@
public static <E extends Exception> E createWSException(Class<E>
exceptionClass, String message, Throwable cause)
{
- ExceptionFactory2<E> exceptionFactory =
(ExceptionFactory2<E>)exceptionClassToFactory.get(exceptionClass);
+ ExceptionFactory<E> exceptionFactory =
(ExceptionFactory<E>)exceptionClassToFactory.get(exceptionClass);
if (exceptionFactory == null)
{
@@ -226,60 +74,22 @@
return exceptionFactory.newInstance(message, cause);
}
-
- private abstract static class ExceptionFactory<E extends Exception, F extends
Fault>
+ protected abstract static class ExceptionFactory<E extends Exception>
{
private final Constructor<E> exceptionConstructor;
- private final Fault fault;
-
- public ExceptionFactory() throws NoSuchMethodException, IllegalAccessException,
InstantiationException
- {
- ParameterizedType pt = (ParameterizedType)getClass().getGenericSuperclass();
- Class<E> exceptionClass = (Class<E>)pt.getActualTypeArguments()[0];
- Class<F> faultClass = (Class<F>)pt.getActualTypeArguments()[1];
- exceptionConstructor = exceptionClass.getConstructor(String.class, faultClass,
Throwable.class);
- fault = faultClass.newInstance();
- }
-
- public E newInstance(String message, Throwable cause)
- {
- try
- {
- return exceptionConstructor.newInstance(message, fault, cause);
- }
- catch (Exception e)
- {
- log.debug("Couldn't instantiate Exception associated with " +
fault.getClass().getSimpleName()
- + ", message: " + message + ", cause: " + cause);
- return null;
- }
- }
- }
-
- private static class ExceptionFactory2<E extends Exception>
- {
- private final Constructor<E> exceptionConstructor;
- private final Fault fault;
+ protected Object fault;
private static final String FAULT = "Fault";
- public ExceptionFactory2(Class<E> exceptionClass) throws
NoSuchMethodException, IllegalAccessException, InstantiationException,
ClassNotFoundException
+ public ExceptionFactory(Class<E> exceptionClass) throws
NoSuchMethodException, IllegalAccessException, InstantiationException,
ClassNotFoundException
{
String faultClassName = exceptionClass.getName() + FAULT;
Class<?> clazz =
Thread.currentThread().getContextClassLoader().loadClass(faultClassName);
- if (Fault.class.isAssignableFrom(clazz))
- {
- Class<? extends Fault> faultClass = (Class<Fault>)clazz;
- exceptionConstructor = exceptionClass.getConstructor(String.class,
faultClass, Throwable.class);
- fault = faultClass.newInstance();
- }
- else
- {
- throw new IllegalArgumentException("Couldn't create a Fault class
based on specified exception class: "
- + exceptionClass);
- }
+ exceptionConstructor = exceptionClass.getConstructor(String.class,
initFaultAndGetClass(clazz), Throwable.class);
}
+ protected abstract Class initFaultAndGetClass(Class clazz) throws
IllegalAccessException, InstantiationException;
+
public E newInstance(String message, Throwable cause)
{
try
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -30,28 +30,34 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v1.V1ClientData;
+import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
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.V1MarkupType;
+import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1ServiceDescription;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v2.ClientData;
+import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.Extension;
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.MarkupType;
+import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.UserContext;
@@ -62,9 +68,9 @@
*/
public class V2V1Converter
{
- private static final V1ToV2Extension V1_TO_V2_EXTENSION = new V1ToV2Extension();
- private static final V2ToV1Extension V2_TO_V1_EXTENSION = new V2ToV1Extension();
- private static final V2ToV1MarkupType V2_TO_V1_MARKUPTYPE = new V2ToV1MarkupType();
+ public static final V1ToV2Extension V1_TO_V2_EXTENSION = new V1ToV2Extension();
+ public static final V2ToV1Extension V2_TO_V1_EXTENSION = new V2ToV1Extension();
+ public static final V2ToV1MarkupType V2_TO_V1_MARKUPTYPE = new V2ToV1MarkupType();
public static final V2ToV1PortletDescription V2_TO_V1_PORTLETDESCRIPTION = new
V2ToV1PortletDescription();
public static final V2ToV1LocalizedString V2_TO_V1_LOCALIZEDSTRING = new
V2ToV1LocalizedString();
@@ -175,7 +181,47 @@
return WSRPExceptionFactory.createWSException(v2ExceptionClass,
v1Exception.getMessage(), v1Exception.getCause());
}
+ public static <E extends Exception> E toV1Exception(Class<E>
v1ExceptionClass, Exception v2Exception)
+ {
+ if
(!"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception class is not a WSRP
1 exception: " + v1ExceptionClass);
+ }
+ Class<? extends Exception> v2ExceptionClass = v2Exception.getClass();
+ String v1Name = v2ExceptionClass.getSimpleName();
+ if
(!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception is not a WSRP 2
exception: " + v2Exception);
+ }
+
+ String v2Name = v2ExceptionClass.getSimpleName();
+ // V1 class name should match V2 class name plus "V1"
+ if (!v2Name.equals(v1Name.substring(2)))
+ {
+ throw new IllegalArgumentException("Exception names do not match.
Requested: " + v1Name
+ + ", was given: " + v2Name);
+ }
+
+ return WSRP1ExceptionFactory.createWSException(v1ExceptionClass,
v2Exception.getMessage(), v2Exception.getCause());
+ }
+
+ public static V1CookieProtocol toV1CookieProtocol(CookieProtocol requiresInitCookie)
+ {
+ return V1CookieProtocol.fromValue(requiresInitCookie.value());
+ }
+
+ public static V1ModelDescription toV1ModelDescription(ModelDescription
modelDescription)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public static V1ResourceList toV1ResourceList(ResourceList resourceList)
+ {
+ throw new NotYetImplemented();
+ }
+
+
private 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/WSRP1ExceptionFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1ExceptionFactory.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1ExceptionFactory.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,179 +23,96 @@
package org.gatein.wsrp.spec.v1;
+import org.gatein.wsrp.WSRPExceptionFactory;
import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1AccessDeniedFault;
import org.oasis.wsrp.v1.V1Fault;
import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InconsistentParametersFault;
import org.oasis.wsrp.v1.V1InvalidCookie;
-import org.oasis.wsrp.v1.V1InvalidCookieFault;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidRegistrationFault;
import org.oasis.wsrp.v1.V1InvalidSession;
-import org.oasis.wsrp.v1.V1InvalidSessionFault;
import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1InvalidUserCategoryFault;
import org.oasis.wsrp.v1.V1MissingParameters;
import org.oasis.wsrp.v1.V1MissingParametersFault;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
-import org.oasis.wsrp.v1.V1PortletStateChangeRequiredFault;
import org.oasis.wsrp.v1.V1UnsupportedLocale;
-import org.oasis.wsrp.v1.V1UnsupportedLocaleFault;
import org.oasis.wsrp.v1.V1UnsupportedMimeType;
-import org.oasis.wsrp.v1.V1UnsupportedMimeTypeFault;
import org.oasis.wsrp.v1.V1UnsupportedMode;
-import org.oasis.wsrp.v1.V1UnsupportedModeFault;
import org.oasis.wsrp.v1.V1UnsupportedWindowState;
-import org.oasis.wsrp.v1.V1UnsupportedWindowStateFault;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.ParameterizedType;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
*/
-public class WSRP1ExceptionFactory
+public class WSRP1ExceptionFactory extends WSRPExceptionFactory
{
- private static final Logger log =
LoggerFactory.getLogger(WSRP1ExceptionFactory.class);
-
- public static final String ACCESS_DENIED = "AccessDenied";
- public static final String INCONSISTENT_PARAMETERS =
"InconsistentParameters";
- public static final String INVALID_REGISTRATION = "InvalidRegistration";
- public static final String INVALID_COOKIE = "InvalidCookie";
- public static final String INVALID_HANDLE = "InvalidHandle";
- public static final String INVALID_SESSION = "InvalidSession";
- public static final String INVALID_USER_CATEGORY = "InvalidUserCategory";
- public static final String MISSING_PARAMETERS = "MissingParameters";
- public static final String OPERATION_FAILED = "OperationFailed";
- public static final String PORTLET_STATE_CHANGE_REQUIRED =
"PortletStateChangeRequired";
- public static final String UNSUPPORTED_LOCALE = "UnsupportedLocale";
- public static final String UNSUPPORTED_MIME_TYPE = "UnsupportedMimeType";
- public static final String UNSUPPORTED_MODE = "UnsupportedMode";
- public static final String UNSUPPORTED_WINDOW_STATE =
"UnsupportedWindowState";
-
- private static final Map<String, ExceptionFactory<? extends Exception, ? extends
V1Fault>> errorCodeToExceptions =
- new HashMap<String, ExceptionFactory<? extends Exception, ? extends
V1Fault>>(17);
-
- static
+ protected void loadExceptionFactories()
{
try
{
- errorCodeToExceptions.put(ACCESS_DENIED, new ExceptionFactory<V1AccessDenied,
V1AccessDeniedFault>()
- {
- });
- errorCodeToExceptions.put(INCONSISTENT_PARAMETERS, new
ExceptionFactory<V1InconsistentParameters, V1InconsistentParametersFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_COOKIE, new
ExceptionFactory<V1InvalidCookie, V1InvalidCookieFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_HANDLE, new
ExceptionFactory<V1InvalidHandle, V1InvalidHandleFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_REGISTRATION, new
ExceptionFactory<V1InvalidRegistration, V1InvalidRegistrationFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_SESSION, new
ExceptionFactory<V1InvalidSession, V1InvalidSessionFault>()
- {
- });
- errorCodeToExceptions.put(INVALID_USER_CATEGORY, new
ExceptionFactory<V1InvalidUserCategory, V1InvalidUserCategoryFault>()
- {
- });
- errorCodeToExceptions.put(MISSING_PARAMETERS, new
ExceptionFactory<V1MissingParameters, V1MissingParametersFault>()
- {
- });
- errorCodeToExceptions.put(OPERATION_FAILED, new
ExceptionFactory<V1OperationFailed, V1OperationFailedFault>()
- {
- });
- errorCodeToExceptions.put(PORTLET_STATE_CHANGE_REQUIRED, new
ExceptionFactory<V1PortletStateChangeRequired, V1PortletStateChangeRequiredFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_LOCALE, new
ExceptionFactory<V1UnsupportedLocale, V1UnsupportedLocaleFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_MIME_TYPE, new
ExceptionFactory<V1UnsupportedMimeType, V1UnsupportedMimeTypeFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_MODE, new
ExceptionFactory<V1UnsupportedMode, V1UnsupportedModeFault>()
- {
- });
- errorCodeToExceptions.put(UNSUPPORTED_WINDOW_STATE, new
ExceptionFactory<V1UnsupportedWindowState, V1UnsupportedWindowStateFault>()
- {
- });
+ exceptionClassToFactory.put(V1AccessDenied.class, new
V1ExceptionFactory<V1AccessDenied>(V1AccessDenied.class));
+ exceptionClassToFactory.put(V1InconsistentParameters.class, new
V1ExceptionFactory<V1InconsistentParameters>(V1InconsistentParameters.class));
+ exceptionClassToFactory.put(V1InvalidCookie.class, new
V1ExceptionFactory<V1InvalidCookie>(V1InvalidCookie.class));
+ exceptionClassToFactory.put(V1InvalidHandle.class, new
V1ExceptionFactory<V1InvalidHandle>(V1InvalidHandle.class));
+ exceptionClassToFactory.put(V1InvalidRegistration.class, new
V1ExceptionFactory<V1InvalidRegistration>(V1InvalidRegistration.class));
+ exceptionClassToFactory.put(V1InvalidSession.class, new
V1ExceptionFactory<V1InvalidSession>(V1InvalidSession.class));
+ exceptionClassToFactory.put(V1InvalidUserCategory.class, new
V1ExceptionFactory<V1InvalidUserCategory>(V1InvalidUserCategory.class));
+ exceptionClassToFactory.put(V1MissingParameters.class, new
V1ExceptionFactory<V1MissingParameters>(V1MissingParameters.class));
+ exceptionClassToFactory.put(V1OperationFailed.class, new
V1ExceptionFactory<V1OperationFailed>(V1OperationFailed.class));
+ exceptionClassToFactory.put(V1PortletStateChangeRequired.class, new
V1ExceptionFactory<V1PortletStateChangeRequired>(V1PortletStateChangeRequired.class));
+ exceptionClassToFactory.put(V1UnsupportedLocale.class, new
V1ExceptionFactory<V1UnsupportedLocale>(V1UnsupportedLocale.class));
+ exceptionClassToFactory.put(V1UnsupportedMimeType.class, new
V1ExceptionFactory<V1UnsupportedMimeType>(V1UnsupportedMimeType.class));
+ exceptionClassToFactory.put(V1UnsupportedMode.class, new
V1ExceptionFactory<V1UnsupportedMode>(V1UnsupportedMode.class));
+ exceptionClassToFactory.put(V1UnsupportedWindowState.class, new
V1ExceptionFactory<V1UnsupportedWindowState>(V1UnsupportedWindowState.class));
}
catch (Exception e)
{
- throw new RuntimeException("Error initializing WSRP1ExceptionFactory",
e);
+ throw new RuntimeException("Couldn't initialize
WSRPV1ExceptionFactory", e);
}
}
- private WSRP1ExceptionFactory()
+ private static final class InstanceHolder
{
+ public static final WSRP1ExceptionFactory factory = new WSRP1ExceptionFactory();
}
- public static void throwMissingParametersIfValueIsMissing(Object valueToCheck, String
valueName, String context)
- throws V1MissingParameters
+ public static WSRPExceptionFactory getInstance()
{
- if (valueToCheck == null)
- {
- throw new V1MissingParameters("Missing required " + valueName +
(context != null ? " in " + context : ""), new
V1MissingParametersFault());
- }
+ return InstanceHolder.factory;
}
- public static void throwOperationFailedIfValueIsMissing(Object valueToCheck, String
valueName) throws V1OperationFailed
+ private WSRP1ExceptionFactory()
{
- if (valueToCheck == null)
- {
- throw new V1OperationFailed("Missing required " + valueName, new
V1OperationFailedFault());
- }
}
- public static <E extends Exception, F extends V1Fault> E throwWSException(String
errorCode, String message, Throwable cause) throws E
+ public static void throwMissingParametersIfValueIsMissing(Object valueToCheck, String
valueName, String context) throws V1MissingParameters
{
- ExceptionFactory<E, F> exceptionFactory = (ExceptionFactory<E,
F>)errorCodeToExceptions.get(errorCode);
- if (exceptionFactory == null)
+ if (valueToCheck == null)
{
- throw new IllegalArgumentException("Unknown error code: " +
errorCode);
+ throw new V1MissingParameters("Missing required " + valueName +
(context != null ? " in " + context : ""), new
V1MissingParametersFault());
}
-
- throw exceptionFactory.newInstance(message, cause);
}
- private abstract static class ExceptionFactory<E extends Exception, F extends
V1Fault>
+ protected static class V1ExceptionFactory<E extends Exception> extends
ExceptionFactory
{
- private final Constructor<E> exceptionConstructor;
- private final V1Fault fault;
-
- public ExceptionFactory() throws NoSuchMethodException, IllegalAccessException,
InstantiationException
+ public V1ExceptionFactory(Class<E> exceptionClass) throws
NoSuchMethodException, IllegalAccessException, InstantiationException,
ClassNotFoundException
{
- ParameterizedType pt = (ParameterizedType)getClass().getGenericSuperclass();
- Class<E> exceptionClass = (Class<E>)pt.getActualTypeArguments()[0];
- Class<F> faultClass = (Class<F>)pt.getActualTypeArguments()[1];
- exceptionConstructor = exceptionClass.getConstructor(String.class, faultClass,
Throwable.class);
- fault = faultClass.newInstance();
+ super(exceptionClass);
}
- public E newInstance(String message, Throwable cause)
+ protected Class initFaultAndGetClass(Class clazz) throws IllegalAccessException,
InstantiationException
{
- try
+ if (V1Fault.class.isAssignableFrom(clazz))
{
- return exceptionConstructor.newInstance(message, fault, cause);
+ Class<? extends V1Fault> faultClass = (Class<V1Fault>)clazz;
+ fault = faultClass.newInstance();
+ return faultClass;
}
- catch (Exception e)
+ else
{
- log.debug("Couldn't instantiate Exception associated with " +
fault.getClass().getSimpleName()
- + ", message: " + message + ", cause: " + cause);
- return null;
+ throw new IllegalArgumentException("Couldn't create fault class
based on specified exception class from "
+ + clazz);
}
}
}
Added:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java
(rev 0)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2ExceptionFactory.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.spec.v2;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.ExportByValueNotSupported;
+import org.oasis.wsrp.v2.ExportNoLongerValid;
+import org.oasis.wsrp.v2.Fault;
+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.MissingParameters;
+import org.oasis.wsrp.v2.MissingParametersFault;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.ResourceSuspended;
+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>
+ * @version $Revision$
+ */
+public class WSRP2ExceptionFactory extends WSRPExceptionFactory
+{
+ protected void loadExceptionFactories()
+ {
+ // load exception factories
+ try
+ {
+ exceptionClassToFactory.put(AccessDenied.class, new
V2ExceptionFactory<AccessDenied>(AccessDenied.class));
+ exceptionClassToFactory.put(ExportByValueNotSupported.class, new
V2ExceptionFactory<ExportByValueNotSupported>(ExportByValueNotSupported.class));
+ exceptionClassToFactory.put(ExportNoLongerValid.class, new
V2ExceptionFactory<ExportNoLongerValid>(ExportNoLongerValid.class));
+ exceptionClassToFactory.put(InconsistentParameters.class, new
V2ExceptionFactory<InconsistentParameters>(InconsistentParameters.class));
+ exceptionClassToFactory.put(InvalidCookie.class, new
V2ExceptionFactory<InvalidCookie>(InvalidCookie.class));
+ exceptionClassToFactory.put(InvalidHandle.class, new
V2ExceptionFactory<InvalidHandle>(InvalidHandle.class));
+ exceptionClassToFactory.put(InvalidRegistration.class, new
V2ExceptionFactory<InvalidRegistration>(InvalidRegistration.class));
+ exceptionClassToFactory.put(InvalidSession.class, new
V2ExceptionFactory<InvalidSession>(InvalidSession.class));
+ exceptionClassToFactory.put(InvalidUserCategory.class, new
V2ExceptionFactory<InvalidUserCategory>(InvalidUserCategory.class));
+ exceptionClassToFactory.put(MissingParameters.class, new
V2ExceptionFactory<MissingParameters>(MissingParameters.class));
+ exceptionClassToFactory.put(ModifyRegistrationRequired.class, new
V2ExceptionFactory<ModifyRegistrationRequired>(ModifyRegistrationRequired.class));
+ exceptionClassToFactory.put(OperationFailed.class, new
V2ExceptionFactory<OperationFailed>(OperationFailed.class));
+ exceptionClassToFactory.put(OperationNotSupported.class, new
V2ExceptionFactory<OperationNotSupported>(OperationNotSupported.class));
+ exceptionClassToFactory.put(PortletStateChangeRequired.class, new
V2ExceptionFactory<PortletStateChangeRequired>(PortletStateChangeRequired.class));
+ exceptionClassToFactory.put(ResourceSuspended.class, new
V2ExceptionFactory<ResourceSuspended>(ResourceSuspended.class));
+ exceptionClassToFactory.put(UnsupportedLocale.class, new
V2ExceptionFactory<UnsupportedLocale>(UnsupportedLocale.class));
+ exceptionClassToFactory.put(UnsupportedMimeType.class, new
V2ExceptionFactory<UnsupportedMimeType>(UnsupportedMimeType.class));
+ exceptionClassToFactory.put(UnsupportedMode.class, new
V2ExceptionFactory<UnsupportedMode>(UnsupportedMode.class));
+ exceptionClassToFactory.put(UnsupportedWindowState.class, new
V2ExceptionFactory<UnsupportedWindowState>(UnsupportedWindowState.class));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't initialize
WSRPExceptionFactory", e);
+ }
+ }
+
+ private static final class InstanceHolder
+ {
+ public static final WSRP2ExceptionFactory factory = new WSRP2ExceptionFactory();
+ }
+
+ public static WSRPExceptionFactory getInstance()
+ {
+ return InstanceHolder.factory;
+ }
+
+ private WSRP2ExceptionFactory()
+ {
+ }
+
+ public static void throwMissingParametersIfValueIsMissing(Object valueToCheck, String
valueName, String context)
+ throws MissingParameters
+ {
+ if (valueToCheck == null)
+ {
+ throw new MissingParameters("Missing required " + valueName + (context
!= null ? " in " + context : ""), new MissingParametersFault());
+ }
+ }
+
+ public static void throwOperationFailedIfValueIsMissing(Object valueToCheck, String
valueName) throws OperationFailed
+ {
+ if (valueToCheck == null)
+ {
+ throw new OperationFailed("Missing required " + valueName, new
OperationFailedFault());
+ }
+ }
+
+ protected static class V2ExceptionFactory<E extends Exception> extends
ExceptionFactory
+ {
+ public V2ExceptionFactory(Class<E> exceptionClass) throws
NoSuchMethodException, IllegalAccessException, InstantiationException,
ClassNotFoundException
+ {
+ super(exceptionClass);
+ }
+
+ protected Class initFaultAndGetClass(Class clazz) throws IllegalAccessException,
InstantiationException
+ {
+ if (Fault.class.isAssignableFrom(clazz))
+ {
+ Class<? extends Fault> faultClass = (Class<Fault>)clazz;
+ fault = faultClass.newInstance();
+ return faultClass;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Couldn't create fault class
based on specified exception class from "
+ + clazz);
+ }
+ }
+ }
+}
Modified:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
===================================================================
---
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -1,28 +1,33 @@
/*
-* 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.gatein.wsrp;
import junit.framework.TestCase;
+import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.OperationFailedFault;
@@ -32,19 +37,53 @@
*/
public class WSRPExceptionFactoryTestCase extends TestCase
{
- public void testCreateWSException() throws Exception
+ public void testCreateWSExceptionV1() throws Exception
{
Throwable throwable = new Throwable();
- OperationFailed operationFailed =
WSRPExceptionFactory.createWSException(OperationFailed.class, "foo",
throwable);
+ V1OperationFailed operationFailed =
WSRP1ExceptionFactory.createWSException(V1OperationFailed.class, "foo",
throwable);
assertNotNull(operationFailed);
assertEquals("foo", operationFailed.getMessage());
assertNotNull(operationFailed.getFaultInfo());
+ assertEquals(V1OperationFailedFault.class,
operationFailed.getFaultInfo().getClass());
+ assertEquals(throwable, operationFailed.getCause());
+
+ try
+ {
+ WSRP1ExceptionFactory.createWSException(Exception.class, "foo",
null);
+ fail("Should have failed because specified exception is not a WSRP
one");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+/*
+// todo: ideally, we should be able to prevent WSRP1ExceptionFactory to create v2
exceptions... not sure how to do it right now
+ try
+ {
+ WSRP1ExceptionFactory.createWSException(OperationFailed.class, "foo",
null);
+ fail("Should have failed because specified exception is not a WSRP 1
exception");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+*/
+ }
+
+ public void testCreateWSExceptionV2() throws Exception
+ {
+ Throwable throwable = new Throwable();
+ OperationFailed operationFailed =
WSRP2ExceptionFactory.createWSException(OperationFailed.class, "foo",
throwable);
+ assertNotNull(operationFailed);
+ assertEquals("foo", operationFailed.getMessage());
+ assertNotNull(operationFailed.getFaultInfo());
assertEquals(OperationFailedFault.class,
operationFailed.getFaultInfo().getClass());
assertEquals(throwable, operationFailed.getCause());
try
{
- WSRPExceptionFactory.createWSException(Exception.class, "foo", null);
+ WSRP2ExceptionFactory.createWSException(Exception.class, "foo",
null);
fail("Should have failed because specified exception is not a WSRP
one");
}
catch (IllegalArgumentException e)
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorBackedServiceFactory;
import org.gatein.wsrp.test.protocol.v2.PortletManagementBehavior;
import org.gatein.wsrp.test.protocol.v2.RegistrationBehavior;
@@ -383,7 +383,7 @@
return;
}
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value +
" is not a valid value for " + PROP_NAME, null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, value +
" is not a valid value for " + PROP_NAME, null);
}
@Override
@@ -391,14 +391,14 @@
{
incrementCallCount();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", null);
+
WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", null);
if
(!RegistrationBehavior.REGISTRATION_HANDLE.equals(registrationContext.getRegistrationHandle()))
{
- WSRPExceptionFactory.throwWSException(InvalidRegistration.class,
"Invalid registration", null);
+ WSRP2ExceptionFactory.throwWSException(InvalidRegistration.class,
"Invalid registration", null);
}
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", null);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", null);
Property prop =
checkRegistrationData(registrationData.getRegistrationProperties());
@@ -408,17 +408,17 @@
return;
}
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, value
+ " is not a valid value for " + PROP_NAME, null);
}
private Property checkRegistrationData(List<Property> registrationProperties)
throws OperationFailed
{
-
WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(registrationProperties,
"RegistrationData");
+
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(registrationProperties,
"RegistrationData");
Property prop = registrationProperties.get(0);
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(prop,
"Registration property");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(prop,
"Registration property");
return prop;
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -25,7 +25,6 @@
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import java.util.HashMap;
import java.util.Map;
@@ -65,8 +64,7 @@
{
return behaviors.get(handle);
}
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "There is no registered MarkupBehavior for handle '" + handle +
"'", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1InvalidHandle.class, "There is
no registered MarkupBehavior for handle '" + handle + "'", null);
}
public void registerMarkupBehavior(MarkupBehavior behavior)
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -41,7 +41,6 @@
import org.oasis.wsrp.v1.V1MissingParameters;
import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
@@ -161,7 +160,7 @@
// should only be called if we required cookies to be initialized
if (requiresInitCookie == null ||
V1CookieProtocol.NONE.equals(requiresInitCookie))
{
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't have called initCookie", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Shouldn't have called initCookie", null);
}
try
@@ -170,7 +169,7 @@
}
catch (V1InvalidHandle invalidHandle)
{
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Invalid handle", invalidHandle);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Invalid handle", invalidHandle);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -33,12 +33,10 @@
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InconsistentParameters;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1InvalidUserCategory;
import org.oasis.wsrp.v1.V1MissingParameters;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1Property;
@@ -80,8 +78,7 @@
if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
{
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Can only clone portlet with handle '" +
BasicMarkupBehavior.PORTLET_HANDLE + "'", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Cannot modify portlet '" + handle + "'", null);
}
portletHandle.value = CLONED_HANDLE;
@@ -139,8 +136,7 @@
}
else
{
- WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Unknown handle '" + handle + "'", null);
+ WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class, "Cannot
modify portlet '" + handle + "'", null);
}
incrementCallCount();
@@ -154,8 +150,7 @@
if (!(CLONED_HANDLE).equals(handle))
{
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
- "Cannot modify portlet '" + handle + "'", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Cannot modify portlet '" + handle + "'", null);
}
portletHandle.value = handle;
@@ -168,8 +163,7 @@
WSRP1ExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet
handle", "PortletContext");
if (handle.length() == 0)
{
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Portlet handle is empty", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1InvalidHandle.class,
"Portlet handle is empty", null);
}
return handle;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -29,7 +29,6 @@
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InconsistentParameters;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1InvalidUserCategory;
import org.oasis.wsrp.v1.V1MissingParameters;
@@ -70,8 +69,7 @@
}
else
{
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Invalid portlet handle: " + portletContext.getPortletHandle(),
null);
+ throw WSRP1ExceptionFactory.throwWSException(V1InvalidHandle.class,
"Invalid portlet handle: " + portletContext.getPortletHandle(), null);
}
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -32,10 +32,8 @@
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
import org.oasis.wsrp.v1.V1InvalidCookie;
-import org.oasis.wsrp.v1.V1InvalidCookieFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1RegistrationContext;
import javax.jws.WebParam;
@@ -71,7 +69,7 @@
}
// shouldn't happen
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't happen", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Shouldn't happen", null);
}
protected String getMarkupString(String handle) throws V1InvalidCookie,
V1OperationFailed
@@ -80,14 +78,14 @@
{
case 0:
// simulate change of configuration between calls: upon receiving this, the
consumer should invoke initCookie
- throw WSRP1ExceptionFactory.<V1InvalidCookie,
V1InvalidCookieFault>throwWSException(WSRP1ExceptionFactory.INVALID_COOKIE,
"Simulate invalid cookie", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1InvalidCookie.class,
"Simulate invalid cookie", null);
case 1:
return handle;
default:
// shouldn't be called more than twice
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't be called more than twice", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Shouldn't be called more than twice", null);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -29,7 +29,6 @@
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1RegistrationContext;
import javax.jws.WebParam;
@@ -63,6 +62,6 @@
public List<V1Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext)
throws V1InvalidRegistration, V1AccessDenied, V1OperationFailed
{
super.initCookie(registrationContext);
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't be called", null);
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Shouldn't be called", null);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -29,7 +29,6 @@
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
import org.oasis.wsrp.v1.V1RegistrationContext;
import javax.jws.WebParam;
@@ -60,9 +59,7 @@
if (initCookieCallCount > 3)
{
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
- "Service description only defines 3 groups so initCookie should only be
called 3 times!",
- new IllegalStateException("Service description only defines 3 groups so
initCookie should only be called 3 times!"));
+ throw WSRP1ExceptionFactory.throwWSException(V1OperationFailed.class,
"Service description only defines 3 groups so initCookie should only be called 3
times!", new IllegalStateException("Service description only defines 3 groups so
initCookie should only be called 3 times!"));
}
return extensions;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,7 +23,7 @@
package org.gatein.wsrp.test.protocol.v2;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.InvalidHandle;
import java.util.HashMap;
@@ -64,7 +64,7 @@
{
return behaviors.get(handle);
}
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "There is no
registered MarkupBehavior for handle '" + handle + "'", null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "There is no
registered MarkupBehavior for handle '" + handle + "'", null);
}
public void registerMarkupBehavior(MarkupBehavior behavior)
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -24,7 +24,7 @@
package org.gatein.wsrp.test.protocol.v2;
import org.gatein.common.NotYetImplemented;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.CopiedPortlet;
@@ -191,7 +191,7 @@
// should only be called if we required cookies to be initialized
if (requiresInitCookie == null || CookieProtocol.NONE.equals(requiresInitCookie))
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't have called initCookie", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't have called initCookie", null);
}
try
@@ -200,7 +200,7 @@
}
catch (InvalidHandle invalidHandle)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Invalid
handle", invalidHandle);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Invalid handle", invalidHandle);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -24,8 +24,8 @@
package org.gatein.wsrp.test.protocol.v2.behaviors;
import org.gatein.common.NotYetImplemented;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
import org.gatein.wsrp.test.protocol.v2.PortletManagementBehavior;
@@ -126,7 +126,7 @@
if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Can only
clone portlet with handle '" + BasicMarkupBehavior.PORTLET_HANDLE +
"'", null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Can only
clone portlet with handle '" + BasicMarkupBehavior.PORTLET_HANDLE +
"'", null);
}
portletHandle.value = CLONED_HANDLE;
@@ -136,10 +136,10 @@
public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InconsistentParameters, InvalidRegistration, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
super.destroyPortlets(registrationContext, portletHandles, userContext,
failedPortlets, extensions);
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "destroyPortlets");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "destroyPortlets");
if (portletHandles.isEmpty())
{
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "DestroyPortlets");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "DestroyPortlets");
}
for (String handle : portletHandles)
@@ -202,7 +202,7 @@
if (!(CLONED_HANDLE).equals(handle))
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Cannot
modify portlet '" + handle + "'", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Cannot
modify portlet '" + handle + "'", null);
}
portletHandle.value = handle;
@@ -232,7 +232,7 @@
}
else
{
- WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Unknown handle
'" + handle + "'", null);
+ WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Unknown handle
'" + handle + "'", null);
}
incrementCallCount();
@@ -241,12 +241,12 @@
private String getHandleFrom(PortletContext portletContext, String context) throws
MissingParameters, InvalidHandle
{
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"portlet context", context);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"portlet context", context);
String handle = portletContext.getPortletHandle();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet
handle", "PortletContext");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet
handle", "PortletContext");
if (handle.length() == 0)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Portlet
handle is empty", null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Portlet
handle is empty", null);
}
return handle;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,7 +23,7 @@
package org.gatein.wsrp.test.protocol.v2.behaviors;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.Extension;
@@ -72,7 +72,7 @@
}
else
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Invalid
portlet handle: " + portletContext.getPortletHandle(), null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Invalid
portlet handle: " + portletContext.getPortletHandle(), null);
}
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -25,7 +25,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
import org.oasis.wsrp.v2.AccessDenied;
@@ -73,7 +73,7 @@
}
// shouldn't happen
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be happen", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be happen", null);
}
protected String getMarkupString(String handle) throws InvalidCookie, OperationFailed
@@ -82,14 +82,14 @@
{
case 0:
// simulate change of configuration between calls: upon receiving this, the
consumer should invoke initCookie
- throw WSRPExceptionFactory.throwWSException(InvalidCookie.class,
"Simulate invalid cookie", null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidCookie.class,
"Simulate invalid cookie", null);
case 1:
return handle;
default:
// shouldn't be called more than twice
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be called more than twice", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be called more than twice", null);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,7 +23,7 @@
package org.gatein.wsrp.test.protocol.v2.behaviors;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.Extension;
@@ -66,6 +66,6 @@
public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
{
super.initCookie(registrationContext, userContext);
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be called", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be called", null);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,7 +23,7 @@
package org.gatein.wsrp.test.protocol.v2.behaviors;
-import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.Extension;
@@ -63,7 +63,7 @@
if (initCookieCallCount > 3)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Service
description only defines 3 groups so initCookie should only be called 3 times!", new
IllegalStateException("Service description only defines 3 groups so initCookie should
only be called 3 times!"));
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Service description only defines 3 groups so initCookie should only be called 3
times!", new IllegalStateException("Service description only defines 3 groups so
initCookie should only be called 3 times!"));
}
return extensions;
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,7 +23,6 @@
package org.gatein.wsrp.producer;
-import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.invocation.ActionInvocation;
import org.gatein.pc.api.invocation.PortletInvocation;
@@ -31,9 +30,9 @@
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.api.state.AccessMode;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
@@ -51,8 +50,6 @@
import org.oasis.wsrp.v2.UnsupportedWindowState;
import org.oasis.wsrp.v2.UpdateResponse;
-import java.util.Map;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 13121 $
@@ -106,7 +103,7 @@
AccessMode getAccessMode() throws MissingParameters
{
StateChange stateChange = interactionParams.getPortletStateChange();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(stateChange,
"portletStateChange", "InteractionParams");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(stateChange,
"portletStateChange", "InteractionParams");
return WSRPUtils.getAccessModeFromStateChange(stateChange);
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -30,8 +30,8 @@
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.portlet.state.producer.PortletStateChangeRequiredException;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.GetMarkup;
@@ -78,7 +78,7 @@
public MarkupResponse getMarkup(GetMarkup getMarkup) throws UnsupportedWindowState,
InvalidCookie, InvalidSession, AccessDenied, InconsistentParameters, InvalidHandle,
UnsupportedLocale, UnsupportedMode, OperationFailed, MissingParameters,
InvalidUserCategory, InvalidRegistration, UnsupportedMimeType
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(getMarkup, GET_MARKUP);
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(getMarkup, GET_MARKUP);
RequestProcessor requestProcessor = new RenderRequestProcessor(producer,
getMarkup);
@@ -92,7 +92,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not render portlet '" + handle + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could
not render portlet '" + handle + "'", e);
}
checkForError(response);
@@ -102,9 +102,9 @@
public BlockingInteractionResponse
performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction) throws
InvalidSession, UnsupportedMode, UnsupportedMimeType, OperationFailed,
UnsupportedWindowState, UnsupportedLocale, AccessDenied, PortletStateChangeRequired,
InvalidRegistration, MissingParameters, InvalidUserCategory, InconsistentParameters,
InvalidHandle, InvalidCookie
{
-
WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(performBlockingInteraction,
PBI);
+
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(performBlockingInteraction,
PBI);
final InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(interactionParams,
"InteractionParams", PBI);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(interactionParams,
"InteractionParams", PBI);
RequestProcessor requestProcessor = new ActionRequestProcessor(producer,
performBlockingInteraction, interactionParams);
@@ -118,11 +118,11 @@
}
catch (PortletStateChangeRequiredException e)
{
- throw WSRPExceptionFactory.throwWSException(PortletStateChangeRequired.class,
e.getLocalizedMessage(), e);
+ throw WSRP2ExceptionFactory.throwWSException(PortletStateChangeRequired.class,
e.getLocalizedMessage(), e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not perform action on portlet '" + handle + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could
not perform action on portlet '" + handle + "'", e);
}
checkForError(response);
@@ -139,7 +139,7 @@
public ReturnAny initCookie(InitCookie initCookie) throws AccessDenied,
OperationFailed, InvalidRegistration
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(initCookie,
"InitCookie");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(initCookie,
"InitCookie");
producer.getRegistrationOrFailIfInvalid(initCookie.getRegistrationContext());
// Force HTTP session creation... this is required for BEA Weblogic version <
9.2.
@@ -152,7 +152,7 @@
static void throwOperationFaultOnSessionOperation() throws OperationFailed
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "JBoss
Portal's Producer" +
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "JBoss
Portal's Producer" +
" manages sessions completely on the server side, passing or trying to
release sessionIDs is therefore an error.",
null);
}
@@ -166,21 +166,21 @@
Throwable cause = errorResult.getCause();
if (cause instanceof PortletModeException)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode: " + ((PortletModeException)cause).getMode(), null);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode: " + ((PortletModeException)cause).getMode(), null);
}
if (cause instanceof WindowStateException)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedWindowState.class,
"Unsupported window state: " + ((WindowStateException)cause).getState(), null);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedWindowState.class,
"Unsupported window state: " + ((WindowStateException)cause).getState(), null);
}
// todo: deal with other exceptions
// we're not sure what happened so throw an OperationFailedFault
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
errorResult.getMessage(), cause);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
errorResult.getMessage(), cause);
}
else if (!(response instanceof HTTPRedirectionResponse || response instanceof
FragmentResponse || response instanceof UpdateNavigationalStateResponse))
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Unsupported result type: " + response.getClass().getName(), null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Unsupported result type: " + response.getClass().getName(), null);
}
}
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -40,9 +40,9 @@
import org.gatein.registration.Registration;
import org.gatein.registration.RegistrationLocal;
import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.ClonePortlet;
import org.oasis.wsrp.v2.DestroyPortlets;
@@ -96,11 +96,11 @@
throws AccessDenied, InvalidHandle, InvalidUserCategory, InconsistentParameters,
MissingParameters, InvalidRegistration, OperationFailed
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletDescription,
GET_PORTLET_DESCRIPTION);
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletDescription,
GET_PORTLET_DESCRIPTION);
Registration registration =
producer.getRegistrationOrFailIfInvalid(getPortletDescription.getRegistrationContext());
PortletContext portletContext = getPortletDescription.getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_DESCRIPTION);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_DESCRIPTION);
UserContext userContext = getPortletDescription.getUserContext();
checkUserAuthorization(userContext);
@@ -114,10 +114,10 @@
throws MissingParameters, InconsistentParameters, InvalidUserCategory,
InvalidRegistration, AccessDenied,
InvalidHandle, OperationFailed
{
-
WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletPropertyDescription,
GET_PORTLET_PROPERTY_DESCRIPTION);
+
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletPropertyDescription,
GET_PORTLET_PROPERTY_DESCRIPTION);
PortletContext portletContext = getPortletPropertyDescription.getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_PROPERTY_DESCRIPTION);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_PROPERTY_DESCRIPTION);
Registration registration =
producer.getRegistrationOrFailIfInvalid(getPortletPropertyDescription.getRegistrationContext());
@@ -160,10 +160,10 @@
public PortletContext clonePortlet(ClonePortlet clonePortlet) throws
InvalidUserCategory, AccessDenied, OperationFailed,
InvalidHandle, InvalidRegistration, InconsistentParameters, MissingParameters
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(clonePortlet,
"ClonePortlet");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(clonePortlet,
"ClonePortlet");
PortletContext portletContext = clonePortlet.getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"PortletContext", "ClonePortlet");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"PortletContext", "ClonePortlet");
Registration registration =
producer.getRegistrationOrFailIfInvalid(clonePortlet.getRegistrationContext());
@@ -179,15 +179,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed to
create clone for portlet '" + portletContext.getPortletHandle(), e);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Failed
to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to create clone for portlet '" + portletContext.getPortletHandle(),
e);
+ throw WSRP2ExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to create clone for portlet '" + portletContext.getPortletHandle(),
e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed
to create clone for portlet '" + portletContext.getPortletHandle(), e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Failed
to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
finally
{
@@ -198,10 +198,10 @@
public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws
InconsistentParameters,
MissingParameters, InvalidRegistration, OperationFailed
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(destroyPortlets,
"DestroyPortlets");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(destroyPortlets,
"DestroyPortlets");
List<String> handles = destroyPortlets.getPortletHandles();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(handles, "portlet
handles to be destroyed", "DestroyPortlets");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(handles, "portlet
handles to be destroyed", "DestroyPortlets");
Registration registration =
producer.getRegistrationOrFailIfInvalid(destroyPortlets.getRegistrationContext());
@@ -242,7 +242,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed
to destroy clones", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Failed
to destroy clones", e);
}
finally
{
@@ -253,13 +253,13 @@
public PortletContext setPortletProperties(SetPortletProperties setPortletProperties)
throws OperationFailed,
InvalidHandle, MissingParameters, InconsistentParameters, InvalidUserCategory,
AccessDenied, InvalidRegistration
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(setPortletProperties,
"SetPortletProperties");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(setPortletProperties,
"SetPortletProperties");
PortletContext portletContext = setPortletProperties.getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"PortletContext", "SetPortletProperties");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"PortletContext", "SetPortletProperties");
PropertyList propertyList = setPortletProperties.getPropertyList();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(propertyList,
"PropertyList", "SetPortletProperties");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(propertyList,
"PropertyList", "SetPortletProperties");
Registration registration =
producer.getRegistrationOrFailIfInvalid(setPortletProperties.getRegistrationContext());
@@ -314,15 +314,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed
to set properties for portlet '" + portletContext.getPortletHandle() +
"'", e);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
}
finally
{
@@ -336,10 +336,10 @@
public PropertyList getPortletProperties(GetPortletProperties getPortletProperties)
throws InvalidHandle,
MissingParameters, InvalidRegistration, AccessDenied, OperationFailed,
InconsistentParameters, InvalidUserCategory
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletProperties,
GET_PORTLET_PROPERTIES);
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(getPortletProperties,
GET_PORTLET_PROPERTIES);
PortletContext portletContext = getPortletProperties.getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_PROPERTIES);
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
PORTLET_CONTEXT, GET_PORTLET_PROPERTIES);
Registration registration =
producer.getRegistrationOrFailIfInvalid(getPortletProperties.getRegistrationContext());
@@ -399,7 +399,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Could not
retrieve properties for portlet '" + portletContext + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Could
not retrieve properties for portlet '" + portletContext + "'", e);
}
finally
{
@@ -427,7 +427,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Could not
retrieve portlet '" + portletContext.getPortletHandle() + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Could
not retrieve portlet '" + portletContext.getPortletHandle() + "'",
e);
}
finally
{
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -33,10 +33,10 @@
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationStatus;
import org.gatein.registration.RegistrationUtils;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.ModifyRegistration;
@@ -72,12 +72,12 @@
ProducerRegistrationRequirements registrationRequirements =
producer.getProducerRegistrationRequirements();
if (registrationRequirements.isRegistrationRequired())
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(registrationData,
"RegistrationData");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(registrationData,
"RegistrationData");
String consumerName = registrationData.getConsumerName();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName,
"consumer name", "RegistrationData");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName,
"consumer name", "RegistrationData");
String consumerAgent = registrationData.getConsumerAgent();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent,
"consumer agent", "RegistrationData");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent,
"consumer agent", "RegistrationData");
Registration registration;
try
@@ -94,7 +94,7 @@
{
String msg = "Could not register consumer named '" +
consumerName + "'";
log.debug(msg, e);
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
RegistrationContext registrationContext =
WSRPTypeFactory.createRegistrationContext(registration.getRegistrationHandle());
@@ -102,7 +102,7 @@
return registrationContext;
}
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Registration shouldn't be attempted if registration is not required",
null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Registration shouldn't be attempted if registration is not required",
null);
}
private void updateRegistrationInformation(Registration registration, RegistrationData
registrationData)
@@ -146,7 +146,7 @@
{
if (producer.getProducerRegistrationRequirements().isRegistrationRequired())
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(deregister,
"RegistrationContext");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(deregister,
"RegistrationContext");
String registrationHandle = deregister.getRegistrationHandle();
if (ParameterValidation.isNullOrEmpty(registrationHandle))
@@ -169,13 +169,13 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
return new ReturnAny();
}
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Deregistration shouldn't be attempted if registration is not required",
null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Deregistration shouldn't be attempted if registration is not required",
null);
}
public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration)
throws MissingParameters,
@@ -183,10 +183,10 @@
{
if (producer.getProducerRegistrationRequirements().isRegistrationRequired())
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(modifyRegistration,
"ModifyRegistration");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(modifyRegistration,
"ModifyRegistration");
RegistrationContext registrationContext =
modifyRegistration.getRegistrationContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", "ModifyRegistration");
+
WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", "ModifyRegistration");
String registrationHandle = registrationContext.getRegistrationHandle();
if (ParameterValidation.isNullOrEmpty(registrationHandle))
{
@@ -194,13 +194,13 @@
}
RegistrationData registrationData = modifyRegistration.getRegistrationData();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", "ModifyRegistration");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", "ModifyRegistration");
String consumerName = registrationData.getConsumerName();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName,
"consumer name", "RegistrationData");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName,
"consumer name", "RegistrationData");
String consumerAgent = registrationData.getConsumerAgent();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent,
"consumer agent", "RegistrationData");
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent,
"consumer agent", "RegistrationData");
log.debug("Attempting to modify registration with handle '" +
registrationHandle + "'");
String msg = "Could not modify registration with handle '" +
registrationHandle + "'";
@@ -225,7 +225,7 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
@@ -233,7 +233,7 @@
return null;
}
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Modifying
a registration shouldn't be attempted if registration is not required", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Modifying
a registration shouldn't be attempted if registration is not required", null);
}
/**
@@ -332,12 +332,12 @@
private void throwOperationFailedFault(String message, RegistrationException e) throws
OperationFailed
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, message, e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, message, e);
}
boolean throwInvalidRegistrationFault(String message) throws InvalidRegistration
{
- throw WSRPExceptionFactory.throwWSException(InvalidRegistration.class,
"Invalid registration: " + message, null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidRegistration.class,
"Invalid registration: " + message, null);
}
private Map<QName, Object> createRegistrationProperties(RegistrationData
registrationData)
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -41,8 +41,8 @@
import org.gatein.registration.Registration;
import org.gatein.wsrp.UserContextConverter;
import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupParams;
@@ -98,17 +98,17 @@
// get session information and deal with it
final RuntimeContext runtimeContext = getRuntimeContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(runtimeContext,
"RuntimeContext", getContextName());
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(runtimeContext,
"RuntimeContext", getContextName());
checkForSessionIDs(runtimeContext);
// get markup parameters
final MarkupParams params = getMarkupParams();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(params,
"MarkupParams", getContextName());
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(params,
"MarkupParams", getContextName());
// get portlet handle
PortletContext wsrpPC = getPortletContext();
- WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpPC,
"PortletContext", getContextName());
+ WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpPC,
"PortletContext", getContextName());
org.gatein.pc.api.PortletContext portletContext =
WSRPUtils.convertToPortalPortletContext(wsrpPC);
// retrieve the portlet
@@ -119,7 +119,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not retrieve portlet '" + portletContext + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could
not retrieve portlet '" + portletContext + "'", e);
}
// get portlet description for the desired portlet...
@@ -127,7 +127,7 @@
portletDescription = producer.getPortletDescription(portlet, desiredLocales);
if (Boolean.TRUE.equals(portletDescription.isUsesMethodGet()))
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Portlets using GET method in forms are not currently supported.", null);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class,
"Portlets using GET method in forms are not currently supported.", null);
}
List<MarkupType> markupTypes = portletDescription.getMarkupTypes();
@@ -241,7 +241,7 @@
// no MIME type was found: error!
if (markupType == null)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedMimeType.class,
"None of the specified MIME types are supported by portlet '" +
portlet.getContext().getId() + "'", null);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedMimeType.class,
"None of the specified MIME types are supported by portlet '" +
portlet.getContext().getId() + "'", null);
}
// use user-desired locales
@@ -291,7 +291,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode '" + params.getMode() + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode '" + params.getMode() + "'", e);
}
// get the window state
@@ -302,7 +302,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedWindowState.class,
"Unsupported window state '" + params.getMode() + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedWindowState.class,
"Unsupported window state '" + params.getMode() + "'", e);
}
// get the character set
@@ -360,7 +360,7 @@
{
if (wsrpUserContext != null)
{
-
WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpUserContext.getUserContextKey(),
"User Context Key", "UserContext");
+
WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpUserContext.getUserContextKey(),
"User Context Key", "UserContext");
}
}
@@ -475,7 +475,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.throwWSException(UnsupportedMimeType.class,
e.getLocalizedMessage(), e);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedMimeType.class,
e.getLocalizedMessage(), e);
}
return markupInfo;
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -33,11 +33,11 @@
import org.gatein.pc.api.info.PortletInfo;
import org.gatein.pc.api.info.WindowStateInfo;
import org.gatein.registration.Registration;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.GetServiceDescription;
import org.oasis.wsrp.v2.InvalidHandle;
@@ -79,7 +79,7 @@
public ServiceDescription getServiceDescription(GetServiceDescription gs)
throws InvalidRegistration, OperationFailed
{
- WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(gs,
"GetServiceDescription");
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(gs,
"GetServiceDescription");
RegistrationContext registrationContext = gs.getRegistrationContext();
@@ -157,7 +157,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not retrieve portlet '" + portletContext + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could
not retrieve portlet '" + portletContext + "'", e);
}
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -32,11 +32,11 @@
import org.gatein.registration.RegistrationLocal;
import org.gatein.registration.RegistrationManager;
import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.producer.config.ProducerConfiguration;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.v2.WSRP2Producer;
+import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.ClonePortlet;
@@ -372,7 +372,7 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class,
"Couldn't find portlet with handle '" + portletContext.getId() +
"'", null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class,
"Couldn't find portlet with handle '" + portletContext.getId() +
"'", null);
}
finally
{
@@ -381,7 +381,7 @@
if (!isRemotable(portlet))
{
- throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Portlet
'" + portletContext.getId() + "' is not remotely available.",
null);
+ throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Portlet
'" + portletContext.getId() + "' is not remotely available.",
null);
}
return portlet;
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-08
11:36:22 UTC (rev 3251)
+++
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-08
15:43:55 UTC (rev 3252)
@@ -23,11 +23,11 @@
package org.gatein.wsrp.endpoints.v1;
-import org.gatein.common.NotYetImplemented;
+import com.google.common.collect.Lists;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
+import org.gatein.wsrp.spec.v1.V2V1Converter;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1GetServiceDescription;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1ModelDescription;
@@ -35,9 +35,10 @@
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v1.V1ServiceDescription;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
import org.oasis.wsrp.v2.GetServiceDescription;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.ServiceDescription;
import javax.jws.HandlerChain;
@@ -76,24 +77,34 @@
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions
) throws V1InvalidRegistration, V1OperationFailed
{
- /*GetServiceDescription getServiceDescription = new GetServiceDescription();
- getServiceDescription.setRegistrationContext(registrationContext);
+ GetServiceDescription getServiceDescription = new GetServiceDescription();
+
getServiceDescription.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
getServiceDescription.getDesiredLocales().addAll(desiredLocales);
- ServiceDescription description =
producer.getServiceDescription(getServiceDescription);
+ ServiceDescription description = null;
+ try
+ {
+ description = producer.getServiceDescription(getServiceDescription);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
requiresRegistration.value = description.isRequiresRegistration();
- offeredPortlets.value = description.getOfferedPortlets();
- userCategoryDescriptions.value = description.getUserCategoryDescriptions();
- customUserProfileItemDescriptions.value =
description.getCustomUserProfileItemDescriptions();
- customWindowStateDescriptions.value =
description.getCustomWindowStateDescriptions();
- customModeDescriptions.value = description.getCustomModeDescriptions();
- requiresInitCookie.value = description.getRequiresInitCookie();
- registrationPropertyDescription.value =
description.getRegistrationPropertyDescription();
+ offeredPortlets.value = Lists.transform(description.getOfferedPortlets(),
V2V1Converter.V2_TO_V1_PORTLETDESCRIPTION);
+ userCategoryDescriptions.value =
Lists.transform(description.getUserCategoryDescriptions(),
V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+// customUserProfileItemDescriptions.value =
description.getCustomUserProfileItemDescriptions();
+ customWindowStateDescriptions.value =
Lists.transform(description.getCustomWindowStateDescriptions(),
V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+ customModeDescriptions.value =
Lists.transform(description.getCustomModeDescriptions(),
V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+ requiresInitCookie.value =
V2V1Converter.toV1CookieProtocol(description.getRequiresInitCookie());
+ registrationPropertyDescription.value =
V2V1Converter.toV1ModelDescription(description.getRegistrationPropertyDescription());
locales.value = description.getLocales();
- resourceList.value = description.getResourceList();
- extensions.value = description.getExtensions();*/
-
- throw new NotYetImplemented();
+ resourceList.value =
V2V1Converter.toV1ResourceList(description.getResourceList());
+ extensions.value = Lists.transform(description.getExtensions(),
V2V1Converter.V2_TO_V1_EXTENSION);
}
}