Author: chris.laprun(a)jboss.com
Date: 2010-06-07 11:25:49 -0400 (Mon, 07 Jun 2010)
New Revision: 3238
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.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/WSRP1TypeFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.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/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/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
Log:
- Mostly synchronization commit:
+ Started fleshing out V2V1Converter
+ Added better way to create exceptions: should replace old way in new code.
+ Added test cases.
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -25,6 +25,8 @@
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;
@@ -40,10 +42,13 @@
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;
@@ -86,6 +91,8 @@
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
{
@@ -140,6 +147,36 @@
}
}
+ 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);
+ }
+ }
+
private WSRPExceptionFactory()
{
}
@@ -172,6 +209,24 @@
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);
+ }
+
+ public static <E extends Exception> E createWSException(Class<E>
exceptionClass, String message, Throwable cause)
+ {
+ ExceptionFactory2<E> exceptionFactory =
(ExceptionFactory2<E>)exceptionClassToFactory.get(exceptionClass);
+
+ if (exceptionFactory == null)
+ {
+ throw new IllegalArgumentException("Unknown exception class: " +
exceptionClass);
+ }
+
+ return exceptionFactory.newInstance(message, cause);
+ }
+
+
private abstract static class ExceptionFactory<E extends Exception, F extends
Fault>
{
private final Constructor<E> exceptionConstructor;
@@ -200,4 +255,43 @@
}
}
}
+
+ private static class ExceptionFactory2<E extends Exception>
+ {
+ private final Constructor<E> exceptionConstructor;
+ private final Fault fault;
+ private static final String FAULT = "Fault";
+
+ public ExceptionFactory2(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);
+ }
+ }
+
+ 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;
+ }
+ }
+ }
}
\ No newline at end of file
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -27,11 +27,15 @@
import com.google.common.collect.Lists;
import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.oasis.wsrp.v1.V1ClientData;
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.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
@@ -40,8 +44,11 @@
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v2.ClientData;
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.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -55,8 +62,14 @@
*/
public class V2V1Converter
{
- private static final V1ToV2ExtensionFunction V1_TO_V2_EXTENSION_FUNCTION = new
V1ToV2ExtensionFunction();
+ 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 V2ToV1PortletDescription V2_TO_V1_PORTLETDESCRIPTION = new
V2ToV1PortletDescription();
+ public static final V2ToV1LocalizedString V2_TO_V1_LOCALIZEDSTRING = new
V2ToV1LocalizedString();
+ public static final V2ToV1ItemDescription V2_TO_V1_ITEMDESCRIPTION = new
V2ToV1ItemDescription();
+
public static V1PortletDescription toV1PortletDescription(PortletDescription
portletDescription)
{
throw new NotYetImplemented();
@@ -81,10 +94,11 @@
markupParams.getValidNewModes().addAll(v1MarkupParams.getValidNewModes());
markupParams.getValidNewWindowStates().addAll(v1MarkupParams.getValidNewWindowStates());
- markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(),
V1_TO_V2_EXTENSION_FUNCTION));
+ markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(),
V1_TO_V2_EXTENSION));
return markupParams;
}
+
private static ClientData toV2ClientData(V1ClientData clientData)
{
throw new NotYetImplemented();
@@ -120,8 +134,50 @@
throw new NotYetImplemented();
}
- private static class V1ToV2ExtensionFunction implements Function<V1Extension,
Extension>
+ public static V1RegistrationContext toV1RegistrationContext(RegistrationContext
registrationContext)
{
+ if (registrationContext != null)
+ {
+ V1RegistrationContext result =
WSRP1TypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
+ result.setRegistrationState(registrationContext.getRegistrationState());
+
result.getExtensions().addAll(Lists.transform(registrationContext.getExtensions(),
V2_TO_V1_EXTENSION));
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static <E extends Exception> E toV2Exception(Class<E>
v2ExceptionClass, Exception v1Exception)
+ {
+ if
(!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception class is not a WSRP
2 exception: " + v2ExceptionClass);
+ }
+
+ Class<? extends Exception> v1ExceptionClass = v1Exception.getClass();
+ String v1Name = v1ExceptionClass.getSimpleName();
+ int v1Index = v1Name.indexOf("V1");
+ if (v1Index != 0 &&
!"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception is not a WSRP 1
exception: " + v1Exception);
+ }
+
+ String v2Name = v2ExceptionClass.getSimpleName();
+ // V2 class name should match V1 class name minus "V1"
+ if (!v2Name.equals(v1Name.substring(2)))
+ {
+ throw new IllegalArgumentException("Exception names do not match.
Requested: " + v2Name
+ + ", was given: " + v1Name);
+ }
+
+ return WSRPExceptionFactory.createWSException(v2ExceptionClass,
v1Exception.getMessage(), v1Exception.getCause());
+ }
+
+
+ private static class V1ToV2Extension implements Function<V1Extension,
Extension>
+ {
public Extension apply(V1Extension from)
{
if (from == null)
@@ -136,4 +192,81 @@
}
}
}
+
+ private static class V2ToV1Extension implements Function<Extension,
V1Extension>
+ {
+ public V1Extension apply(Extension from)
+ {
+ if (from == null)
+ {
+ return null;
+ }
+ else
+ {
+ V1Extension extension = new V1Extension();
+ extension.setAny(from.getAny());
+ return extension;
+ }
+ }
+ }
+
+ public static class V2ToV1PortletDescription implements
Function<PortletDescription, V1PortletDescription>
+ {
+
+ public V1PortletDescription apply(PortletDescription from)
+ {
+ V1PortletDescription result =
WSRP1TypeFactory.createPortletDescription(from.getPortletHandle(),
+ Lists.transform(from.getMarkupTypes(), V2_TO_V1_MARKUPTYPE));
+ result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
+ result.setDisplayName(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDisplayName()));
+ result.getExtensions().addAll(Lists.transform(from.getExtensions(),
V2_TO_V1_EXTENSION));
+ result.getKeywords().addAll(Lists.transform(from.getKeywords(),
V2_TO_V1_LOCALIZEDSTRING));
+ result.getUserCategories().addAll(from.getUserCategories());
+ result.getUserProfileItems().addAll(from.getUserProfileItems());
+ result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
+ result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
+ result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
+ result.setHasUserSpecificState(from.isHasUserSpecificState());
+ result.setOnlySecure(from.isOnlySecure());
+ result.setUserContextStoredInSession(from.isUserContextStoredInSession());
+ result.setUsesMethodGet(from.isUsesMethodGet());
+ result.setShortTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getShortTitle()));
+ result.setTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getTitle()));
+
+ result.setGroupID(from.getGroupID());
+ return null;
+ }
+ }
+
+ public static class V2ToV1ItemDescription implements Function<ItemDescription,
V1ItemDescription>
+ {
+
+ public V1ItemDescription apply(ItemDescription from)
+ {
+ V1ItemDescription result = new V1ItemDescription();
+ result.setItemName(from.getItemName());
+ result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
+ result.getExtensions().addAll(Lists.transform(from.getExtensions(),
V2_TO_V1_EXTENSION));
+ return result;
+ }
+ }
+
+ public static class V2ToV1MarkupType implements Function<MarkupType,
V1MarkupType>
+ {
+
+ public V1MarkupType apply(MarkupType from)
+ {
+ return WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(),
from.getWindowStates(), from.getLocales());
+ }
+ }
+
+ public static class V2ToV1LocalizedString implements Function<LocalizedString,
V1LocalizedString>
+ {
+
+ public V1LocalizedString apply(LocalizedString from)
+ {
+ return WSRP1TypeFactory.createLocalizedString(from.getLang(),
from.getResourceName(), from.getValue());
+
+ }
+ }
}
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -328,6 +328,21 @@
return portletDescription;
}
+ public static V1PortletDescription createPortletDescription(String portletHandle,
List<V1MarkupType> markupTypes)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle,
"portlet handle", null);
+ ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes,
"MarkupType");
+ if (markupTypes.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a PortletDescription with
an empty list of MarkupTypes!");
+ }
+
+ V1PortletDescription portletDescription = new V1PortletDescription();
+ portletDescription.setPortletHandle(portletHandle);
+ portletDescription.getMarkupTypes().addAll(markupTypes);
+ return portletDescription;
+ }
+
private static void checkPortletHandle(String portletHandle)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle,
"portlet handle", "PortletDescription");
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
===================================================================
---
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java
(rev 0)
+++
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPExceptionFactoryTestCase.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -0,0 +1,55 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.wsrp;
+
+import junit.framework.TestCase;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPExceptionFactoryTestCase extends TestCase
+{
+ public void testCreateWSException() throws Exception
+ {
+ Throwable throwable = new Throwable();
+ OperationFailed operationFailed =
WSRPExceptionFactory.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);
+ fail("Should have failed because specified exception is not a WSRP
one");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+}
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
===================================================================
---
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
(rev 0)
+++
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -0,0 +1,91 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.wsrp.spec.v1;
+
+import junit.framework.TestCase;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.OperationFailed;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class V2V1ConverterTestCase extends TestCase
+{
+ public void testToV2Exception() throws Exception
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new
V1OperationFailedFault(), throwable);
+ OperationFailed operationFailed =
V2V1Converter.toV2Exception(OperationFailed.class, v1OF);
+ assertNotNull(operationFailed);
+ assertEquals("foo", operationFailed.getMessage());
+ assertEquals(throwable, operationFailed.getCause());
+ }
+
+ public void testToV2ExceptionMismatch()
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new
V1OperationFailedFault(), throwable);
+
+ try
+ {
+ V2V1Converter.toV2Exception(InvalidSession.class, v1OF);
+ fail("Should have failed as requested v2 exception doesn't match
specified v1");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testToV2ExceptionWrongRequestedException()
+ {
+ Throwable throwable = new Throwable();
+ V1OperationFailed v1OF = new V1OperationFailed("foo", new
V1OperationFailedFault(), throwable);
+
+ try
+ {
+ V2V1Converter.toV2Exception(IllegalArgumentException.class, v1OF);
+ fail("Should have failed as requested exception is not a WSRP 2 exception
class");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testToV2ExceptionWrongV1Exception()
+ {
+ try
+ {
+ V2V1Converter.toV2Exception(OperationFailed.class, new
IllegalArgumentException());
+ fail("Should have failed as specified exception is not a WSRP 1
exception");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -22,8 +22,17 @@
package org.gatein.wsrp.services.v1;
-import org.gatein.common.NotYetImplemented;
import org.gatein.wsrp.services.ServiceDescriptionService;
+import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.oasis.wsrp.v1.V1CookieProtocol;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.EventDescription;
@@ -68,7 +77,33 @@
Holder<Boolean> mayReturnRegistrationState,
Holder<List<Extension>> extensions)
throws InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
ResourceSuspended
{
- throw new NotYetImplemented();
+ V1RegistrationContext v1RegistrationContext =
V2V1Converter.toV1RegistrationContext(registrationContext);
+ Holder<List<V1PortletDescription>> v1OfferedPortlets = new
Holder<List<V1PortletDescription>>();
+ Holder<List<V1ItemDescription>> v1UserCategories = new
Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1ProfileITems = new
Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1WindowStates = new
Holder<List<V1ItemDescription>>();
+ Holder<List<V1ItemDescription>> v1Modes = new
Holder<List<V1ItemDescription>>();
+ Holder<V1CookieProtocol> v1Cookie = new Holder<V1CookieProtocol>();
+ Holder<V1ModelDescription> v1RegistrationProperties = new
Holder<V1ModelDescription>();
+ Holder<V1ResourceList> v1Resources = new Holder<V1ResourceList>();
+ Holder<List<V1Extension>> v1Extensions = new
Holder<List<V1Extension>>();
+ try
+ {
+ service.getServiceDescription(v1RegistrationContext, desiredLocales,
requiresRegistration, v1OfferedPortlets,
+ v1UserCategories,
+ v1ProfileITems,
+ v1WindowStates,
+ v1Modes,
+ v1Cookie, v1RegistrationProperties, locales, v1Resources, v1Extensions);
+ }
+ catch (V1InvalidRegistration v1InvalidRegistration)
+ {
+ throw V2V1Converter.toV2Exception(InvalidRegistration.class,
v1InvalidRegistration);
+ }
+ catch (V1OperationFailed v1OperationFailed)
+ {
+ throw V2V1Converter.toV2Exception(OperationFailed.class, v1OperationFailed);
+ }
/*service.getServiceDescription(registrationContext, desiredLocales,
portletHandles, userContext,
requiresRegistration, offeredPortlets, userCategoryDescriptions,
extensionDescriptions,
customWindowStateDescriptions, customModeDescriptions, requiresInitCookie,
registrationPropertyDescription,
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -37,13 +37,11 @@
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.InvalidRegistrationFault;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.Lifetime;
import org.oasis.wsrp.v2.MissingParameters;
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.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -385,8 +383,7 @@
return;
}
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- value + " is not a valid value for " + PROP_NAME, null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value +
" is not a valid value for " + PROP_NAME, null);
}
@Override
@@ -398,7 +395,7 @@
if
(!RegistrationBehavior.REGISTRATION_HANDLE.equals(registrationContext.getRegistrationHandle()))
{
- WSRPExceptionFactory.<InvalidRegistration,
InvalidRegistrationFault>throwWSException(WSRPExceptionFactory.INVALID_REGISTRATION,
"Invalid registration", null);
+ WSRPExceptionFactory.throwWSException(InvalidRegistration.class,
"Invalid registration", null);
}
WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", null);
@@ -411,7 +408,7 @@
return;
}
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, value
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, value
+ " is not a valid value for " + PROP_NAME, null);
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -56,13 +56,13 @@
import org.gatein.wsrp.test.support.TestPortletInvocationContext;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InvalidHandle;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1ModelDescription;
import org.oasis.wsrp.v1.V1OperationFailed;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.servlet.http.HttpSession;
import javax.xml.ws.Holder;
@@ -165,7 +165,7 @@
ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
}
- public void testInitCookiePerUser() throws PortletInvokerException, InvalidHandle
+ public void testInitCookiePerUser() throws PortletInvokerException, V1InvalidHandle
{
String handle = PerUserInitCookieMarkupBehavior.PER_USER_INIT_COOKIE_HANDLE;
InitCookieMarkupBehavior behavior =
(InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
@@ -179,7 +179,7 @@
ExtendedAssert.assertEquals(1, behavior.getInitCookieCallCount());
}
- public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandle,
V1InvalidRegistration, V1OperationFailed
+ public void testInitCookiePerGroup() throws PortletInvokerException, V1InvalidHandle,
V1InvalidRegistration, V1OperationFailed
{
BehaviorRegistry registry = producer.getBehaviorRegistry();
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -23,9 +23,9 @@
package org.gatein.wsrp.test.protocol.v1;
-import org.gatein.wsrp.WSRPExceptionFactory;
-import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
+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;
@@ -59,13 +59,13 @@
behaviors.clear();
}
- public MarkupBehavior getMarkupBehaviorFor(String handle) throws InvalidHandle
+ public MarkupBehavior getMarkupBehaviorFor(String handle) throws V1InvalidHandle
{
if (behaviors.containsKey(handle))
{
return behaviors.get(handle);
}
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
"There is no registered MarkupBehavior for handle '" + handle +
"'", null);
}
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -32,7 +32,6 @@
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1InvalidCookie;
import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
import org.oasis.wsrp.v1.V1InvalidRegistration;
import org.oasis.wsrp.v1.V1InvalidSession;
import org.oasis.wsrp.v1.V1InvalidUserCategory;
@@ -64,7 +63,6 @@
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -117,14 +115,7 @@
private MarkupBehavior getMarkupBehaviorFor(String portletHandle) throws
V1InvalidHandle
{
- try
- {
- return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
- }
- catch (InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
"Invalid handle", null);
- }
+ return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
}
private ServiceDescriptionBehavior getServiceDescriptionBehavior()
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -47,7 +47,6 @@
import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1UserContext;
-import org.oasis.wsrp.v2.InvalidHandle;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -103,16 +102,7 @@
}
// get the POP description...
- MarkupBehavior markupBehaviorFor;
- try
- {
- markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
- }
- catch (InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
- "Invalid handle '" + handle + "'",
invalidHandle);
- }
+ MarkupBehavior markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
V1PortletDescription description =
markupBehaviorFor.getPortletDescriptionFor(handle);
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -25,7 +25,6 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import java.util.HashMap;
import java.util.Map;
@@ -65,8 +64,7 @@
{
return behaviors.get(handle);
}
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "There is no registered MarkupBehavior for handle '" + handle +
"'", null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -58,7 +58,6 @@
import org.oasis.wsrp.v2.ModelTypes;
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.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -192,7 +191,7 @@
// should only be called if we required cookies to be initialized
if (requiresInitCookie == null || CookieProtocol.NONE.equals(requiresInitCookie))
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't have called initCookie", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't have called initCookie", null);
}
try
@@ -201,7 +200,7 @@
}
catch (InvalidHandle invalidHandle)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Invalid handle", invalidHandle);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -41,7 +41,6 @@
import org.oasis.wsrp.v2.ImportedPortlet;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.Lifetime;
@@ -49,7 +48,6 @@
import org.oasis.wsrp.v2.ModelDescription;
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.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -128,8 +126,7 @@
if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Can only clone portlet with handle '" +
BasicMarkupBehavior.PORTLET_HANDLE + "'", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Can only
clone portlet with handle '" + BasicMarkupBehavior.PORTLET_HANDLE +
"'", null);
}
portletHandle.value = CLONED_HANDLE;
@@ -205,8 +202,7 @@
if (!(CLONED_HANDLE).equals(handle))
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Cannot modify portlet '" + handle + "'", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Cannot
modify portlet '" + handle + "'", null);
}
portletHandle.value = handle;
@@ -236,8 +232,7 @@
}
else
{
- WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Unknown handle '" + handle + "'", null);
+ WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Unknown handle
'" + handle + "'", null);
}
incrementCallCount();
@@ -251,8 +246,7 @@
WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet
handle", "PortletContext");
if (handle.length() == 0)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Portlet handle is empty", null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -29,7 +29,6 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.MissingParameters;
@@ -73,8 +72,7 @@
}
else
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Invalid portlet handle: " + portletContext.getPortletHandle(),
null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -32,11 +32,9 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.InvalidCookie;
-import org.oasis.wsrp.v2.InvalidCookieFault;
import org.oasis.wsrp.v2.InvalidRegistration;
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.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -75,7 +73,7 @@
}
// shouldn't happen
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be happen", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Shouldn't be happen", null);
}
protected String getMarkupString(String handle) throws InvalidCookie, OperationFailed
@@ -84,14 +82,14 @@
{
case 0:
// simulate change of configuration between calls: upon receiving this, the
consumer should invoke initCookie
- throw WSRPExceptionFactory.<InvalidCookie,
InvalidCookieFault>throwWSException(WSRPExceptionFactory.INVALID_COOKIE, "Simulate
invalid cookie", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidCookie.class,
"Simulate invalid cookie", null);
case 1:
return handle;
default:
// shouldn't be called more than twice
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be called more than twice", null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -30,7 +30,6 @@
import org.oasis.wsrp.v2.InvalidRegistration;
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.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -67,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.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be called", null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -30,7 +30,6 @@
import org.oasis.wsrp.v2.InvalidRegistration;
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.RegistrationContext;
import org.oasis.wsrp.v2.ResourceSuspended;
@@ -64,9 +63,7 @@
if (initCookieCallCount > 3)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.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 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!"));
}
return extensions;
}
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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -46,18 +46,14 @@
import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
import org.oasis.wsrp.v2.PortletStateChangeRequired;
-import org.oasis.wsrp.v2.PortletStateChangeRequiredFault;
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.UnsupportedLocale;
import org.oasis.wsrp.v2.UnsupportedMimeType;
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 javax.portlet.PortletModeException;
import javax.portlet.WindowStateException;
@@ -96,8 +92,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not render portlet '" + handle + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not render portlet '" + handle + "'", e);
}
checkForError(response);
@@ -123,13 +118,11 @@
}
catch (PortletStateChangeRequiredException e)
{
- throw WSRPExceptionFactory.<PortletStateChangeRequired,
PortletStateChangeRequiredFault>throwWSException(WSRPExceptionFactory.PORTLET_STATE_CHANGE_REQUIRED,
- e.getLocalizedMessage(), e);
+ throw WSRPExceptionFactory.throwWSException(PortletStateChangeRequired.class,
e.getLocalizedMessage(), e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not perform action on portlet '" + handle +
"'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not perform action on portlet '" + handle + "'", e);
}
checkForError(response);
@@ -159,7 +152,7 @@
static void throwOperationFaultOnSessionOperation() throws OperationFailed
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"JBoss Portal's Producer" +
+ throw WSRPExceptionFactory.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);
}
@@ -173,25 +166,21 @@
Throwable cause = errorResult.getCause();
if (cause instanceof PortletModeException)
{
- throw WSRPExceptionFactory.<UnsupportedMode,
UnsupportedModeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MODE,
- "Unsupported mode: " + ((PortletModeException)cause).getMode(),
null);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode: " + ((PortletModeException)cause).getMode(), null);
}
if (cause instanceof WindowStateException)
{
- throw WSRPExceptionFactory.<UnsupportedWindowState,
UnsupportedWindowStateFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_WINDOW_STATE,
- "Unsupported window state: " +
((WindowStateException)cause).getState(), null);
+ throw WSRPExceptionFactory.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.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- errorResult.getMessage(), cause);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
errorResult.getMessage(), cause);
}
else if (!(response instanceof HTTPRedirectionResponse || response instanceof
FragmentResponse || response instanceof UpdateNavigationalStateResponse))
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Unsupported result type: " + response.getClass().getName(),
null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/PortletManagementHandler.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -24,7 +24,6 @@
package org.gatein.wsrp.producer;
import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.pc.api.InvalidPortletIdException;
@@ -53,14 +52,11 @@
import org.oasis.wsrp.v2.GetPortletProperties;
import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.InconsistentParameters;
-import org.oasis.wsrp.v2.InconsistentParametersFault;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.PortletDescriptionResponse;
@@ -71,7 +67,6 @@
import org.oasis.wsrp.v2.ResetProperty;
import org.oasis.wsrp.v2.SetPortletProperties;
import org.oasis.wsrp.v2.UserContext;
-import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.Collections;
@@ -184,18 +179,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Failed to create clone for portlet '" +
portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed to
create clone for portlet '" + portletContext.getPortletHandle(), e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.<InconsistentParameters,
InconsistentParametersFault>throwWSException(WSRPExceptionFactory.INCONSISTENT_PARAMETERS,
- "Failed to create clone for portlet '" +
portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to create clone for portlet '" + portletContext.getPortletHandle(),
e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to create clone for portlet '" +
portletContext.getPortletHandle(), e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed
to create clone for portlet '" + portletContext.getPortletHandle(), e);
}
finally
{
@@ -228,7 +220,7 @@
if (failuresNumber > 0)
{
// for each reason of failure, record the associated portlet handles,
expecting one portlet handle per message
- Multimap<String,String> reasonToHandles =
HashMultimap.create(failuresNumber, 1);
+ Multimap<String, String> reasonToHandles =
HashMultimap.create(failuresNumber, 1);
for (DestroyCloneFailure failure : failuresList)
{
reasonToHandles.put(failure.getMessage(), failure.getPortletId());
@@ -250,8 +242,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to destroy clones", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Failed
to destroy clones", e);
}
finally
{
@@ -323,18 +314,15 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Failed to set properties for portlet '" +
portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Failed
to set properties for portlet '" + portletContext.getPortletHandle() +
"'", e);
}
catch (InvalidPortletIdException e)
{
- throw WSRPExceptionFactory.<InconsistentParameters,
InconsistentParametersFault>throwWSException(WSRPExceptionFactory.INCONSISTENT_PARAMETERS,
- "Failed to set properties for portlet '" +
portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(InconsistentParameters.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to set properties for portlet '" +
portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Failed to set properties for portlet '" + portletContext.getPortletHandle()
+ "'", e);
}
finally
{
@@ -411,8 +399,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Could not retrieve properties for portlet '" + portletContext
+ "'", e);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Could not
retrieve properties for portlet '" + portletContext + "'", e);
}
finally
{
@@ -440,8 +427,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Could not retrieve portlet '" +
portletContext.getPortletHandle() + "'", e);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RegistrationHandler.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -38,11 +38,9 @@
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.InvalidRegistrationFault;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.ModifyRegistration;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
@@ -96,8 +94,7 @@
{
String msg = "Could not register consumer named '" +
consumerName + "'";
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
RegistrationContext registrationContext =
WSRPTypeFactory.createRegistrationContext(registration.getRegistrationHandle());
@@ -105,8 +102,7 @@
return registrationContext;
}
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Registration shouldn't be attempted if registration is not
required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Registration shouldn't be attempted if registration is not required",
null);
}
private void updateRegistrationInformation(Registration registration, RegistrationData
registrationData)
@@ -173,15 +169,13 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
return new ReturnAny();
}
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Deregistration shouldn't be attempted if registration is not
required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Deregistration shouldn't be attempted if registration is not required",
null);
}
public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration)
throws MissingParameters,
@@ -231,8 +225,7 @@
catch (RegistrationException e)
{
log.debug(msg, e);
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- msg, e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, msg, e);
}
@@ -240,8 +233,7 @@
return null;
}
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Modifying a registration shouldn't be attempted if registration is not
required", null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Modifying
a registration shouldn't be attempted if registration is not required", null);
}
/**
@@ -340,13 +332,12 @@
private void throwOperationFailedFault(String message, RegistrationException e) throws
OperationFailed
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, message,
e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, message, e);
}
boolean throwInvalidRegistrationFault(String message) throws InvalidRegistration
{
- throw WSRPExceptionFactory.<InvalidRegistration,
InvalidRegistrationFault>throwWSException(WSRPExceptionFactory.INVALID_REGISTRATION,
- "Invalid registration: " + message, null);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -51,18 +51,14 @@
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.SessionParams;
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 java.security.Principal;
import java.util.Collections;
@@ -123,8 +119,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not retrieve portlet '" + portletContext +
"'", e);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class, "Could
not retrieve portlet '" + portletContext + "'", e);
}
// get portlet description for the desired portlet...
@@ -132,8 +127,7 @@
portletDescription = producer.getPortletDescription(portlet, desiredLocales);
if (Boolean.TRUE.equals(portletDescription.isUsesMethodGet()))
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
- "Portlets using GET method in forms are not currently supported.",
null);
+ throw WSRPExceptionFactory.throwWSException(OperationFailed.class,
"Portlets using GET method in forms are not currently supported.", null);
}
List<MarkupType> markupTypes = portletDescription.getMarkupTypes();
@@ -247,8 +241,7 @@
// no MIME type was found: error!
if (markupType == null)
{
- throw WSRPExceptionFactory.<UnsupportedMimeType,
UnsupportedMimeTypeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- "None of the specified MIME types are supported by portlet '" +
portlet.getContext().getId() + "'", null);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMimeType.class,
"None of the specified MIME types are supported by portlet '" +
portlet.getContext().getId() + "'", null);
}
// use user-desired locales
@@ -298,8 +291,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedMode,
UnsupportedModeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MODE,
- "Unsupported mode '" + params.getMode() + "'",
e);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedMode.class,
"Unsupported mode '" + params.getMode() + "'", e);
}
// get the window state
@@ -310,8 +302,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedWindowState,
UnsupportedWindowStateFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_WINDOW_STATE,
- "Unsupported window state '" + params.getMode() +
"'", e);
+ throw WSRPExceptionFactory.throwWSException(UnsupportedWindowState.class,
"Unsupported window state '" + params.getMode() + "'", e);
}
// get the character set
@@ -484,8 +475,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRPExceptionFactory.<UnsupportedMimeType,
UnsupportedMimeTypeFault>throwWSException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- e.getLocalizedMessage(), e);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -45,7 +45,6 @@
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.OperationFailed;
-import org.oasis.wsrp.v2.OperationFailedFault;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -158,7 +157,7 @@
}
catch (PortletInvokerException e)
{
- throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Could not retrieve portlet '" + portletContext + "'", e);
+ throw WSRPExceptionFactory.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-07
11:21:25 UTC (rev 3237)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-06-07
15:25:49 UTC (rev 3238)
@@ -52,7 +52,6 @@
import org.oasis.wsrp.v2.InitCookie;
import org.oasis.wsrp.v2.InvalidCookie;
import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidSession;
import org.oasis.wsrp.v2.InvalidUserCategory;
@@ -373,8 +372,7 @@
}
catch (NoSuchPortletException e)
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Couldn't find portlet with handle '" +
portletContext.getId() + "'", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class,
"Couldn't find portlet with handle '" + portletContext.getId() +
"'", null);
}
finally
{
@@ -383,8 +381,7 @@
if (!isRemotable(portlet))
{
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "Portlet '" + portletContext.getId() + "' is not
remotely available.", null);
+ throw WSRPExceptionFactory.throwWSException(InvalidHandle.class, "Portlet
'" + portletContext.getId() + "' is not remotely available.",
null);
}
return portlet;