gatein SVN: r3255 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-08 21:59:32 -0400 (Tue, 08 Jun 2010)
New Revision: 3255
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
Log:
GTNPORTAL-1273 Portal composer has 'Page properties' button label while the system is in 'edit layout' mode
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2010-06-08 16:56:47 UTC (rev 3254)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2010-06-09 01:59:32 UTC (rev 3255)
@@ -300,7 +300,8 @@
uiComposer.setCollapse(false);
uiComposer.setShowControl(true);
uiComposer.setComponentConfig(UIPortalComposer.class, null);
-
+ uiComposer.setId("UIPortalComposer");
+
UIPortal uiPortal = Util.getUIPortal();
uiWorkingWS.setBackupUIPortal(uiPortal);
14 years, 6 months
gatein SVN: r3254 - in components/wsrp/trunk: wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1 and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-08 12:56:47 -0400 (Tue, 08 Jun 2010)
New Revision: 3254
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
Log:
- Replaced direct usage of Lists.transform by V2V1Converter.transform so that:
1. the implementation can be changed if needed
2. we can deal with the case where the given list is null properly
- Calls to addAll on WSRP objects list properties must be guarded by a null check as addAll will fail when passed a null value.
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 16:07:08 UTC (rev 3253)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-08 16:56:47 UTC (rev 3254)
@@ -38,8 +38,10 @@
import org.oasis.wsrp.v1.V1MarkupParams;
import org.oasis.wsrp.v1.V1MarkupType;
import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1ModelTypes;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PropertyDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1RuntimeContext;
@@ -54,14 +56,18 @@
import org.oasis.wsrp.v2.MarkupParams;
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PropertyDescription;
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;
+import java.util.List;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -69,13 +75,27 @@
public class V2V1Converter
{
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();
public static final V2ToV1ItemDescription V2_TO_V1_ITEMDESCRIPTION = new V2ToV1ItemDescription();
+ public static final V2ToV1PropertyDescription V2_TO_V1_PROPERTY_DESCRIPTION = new V2ToV1PropertyDescription();
+ public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
+ {
+ if (fromList == null)
+ {
+ return null;
+ }
+ else
+ {
+ return Lists.transform(fromList, function);
+ }
+ }
+
+
public static V1PortletDescription toV1PortletDescription(PortletDescription portletDescription)
{
throw new NotYetImplemented();
@@ -98,11 +118,27 @@
new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
markupParams.setValidateTag(v1MarkupParams.getValidateTag());
- markupParams.getMarkupCharacterSets().addAll(v1MarkupParams.getMarkupCharacterSets());
- markupParams.getValidNewModes().addAll(v1MarkupParams.getValidNewModes());
- markupParams.getValidNewWindowStates().addAll(v1MarkupParams.getValidNewWindowStates());
+ List<String> charSets = v1MarkupParams.getMarkupCharacterSets();
+ if (charSets != null)
+ {
+ markupParams.getMarkupCharacterSets().addAll(charSets);
+ }
+ List<String> validNewModes = v1MarkupParams.getValidNewModes();
+ if (validNewModes != null)
+ {
+ markupParams.getValidNewModes().addAll(validNewModes);
+ }
+ List<String> validNewWindowStates = v1MarkupParams.getValidNewWindowStates();
+ if (validNewWindowStates != null)
+ {
+ markupParams.getValidNewWindowStates().addAll(validNewWindowStates);
+ }
- markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION));
+ List<Extension> extensions = V2V1Converter.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION);
+ if (extensions != null)
+ {
+ markupParams.getExtensions().addAll(extensions);
+ }
return markupParams;
}
else
@@ -153,7 +189,11 @@
{
V1RegistrationContext result = WSRP1TypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
result.setRegistrationState(registrationContext.getRegistrationState());
- result.getExtensions().addAll(Lists.transform(registrationContext.getExtensions(), V2_TO_V1_EXTENSION));
+ List<V1Extension> extensions = V2V1Converter.transform(registrationContext.getExtensions(), V2_TO_V1_EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
return result;
}
else
@@ -215,11 +255,38 @@
public static V1CookieProtocol toV1CookieProtocol(CookieProtocol requiresInitCookie)
{
- return V1CookieProtocol.fromValue(requiresInitCookie.value());
+ if (requiresInitCookie != null)
+ {
+ return V1CookieProtocol.fromValue(requiresInitCookie.value());
+ }
+ else
+ {
+ return null;
+ }
}
public static V1ModelDescription toV1ModelDescription(ModelDescription modelDescription)
{
+ if (modelDescription != null)
+ {
+ V1ModelDescription result = WSRP1TypeFactory.createModelDescription(V2V1Converter.transform(modelDescription.getPropertyDescriptions(), V2_TO_V1_PROPERTY_DESCRIPTION));
+ List<V1Extension> extensions = V2V1Converter.transform(modelDescription.getExtensions(), V2_TO_V1_EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ result.setModelTypes(toV1ModelTypes(modelDescription.getModelTypes()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1ModelTypes toV1ModelTypes(ModelTypes modelTypes)
+ {
throw new NotYetImplemented();
}
@@ -228,6 +295,10 @@
throw new NotYetImplemented();
}
+ public static V1LocalizedString toV1LocalizedString(LocalizedString localizedString)
+ {
+ return V2_TO_V1_LOCALIZEDSTRING.apply(localizedString);
+ }
private static class V1ToV2Extension implements Function<V1Extension, Extension>
{
@@ -263,7 +334,7 @@
}
}
- public static class V2ToV1PortletDescription implements Function<PortletDescription, V1PortletDescription>
+ private static class V2ToV1PortletDescription implements Function<PortletDescription, V1PortletDescription>
{
public V1PortletDescription apply(PortletDescription from)
@@ -271,13 +342,29 @@
if (from != null)
{
V1PortletDescription result = WSRP1TypeFactory.createPortletDescription(from.getPortletHandle(),
- Lists.transform(from.getMarkupTypes(), V2_TO_V1_MARKUPTYPE));
+ V2V1Converter.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());
+ List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ List<V1LocalizedString> keywords = V2V1Converter.transform(from.getKeywords(), V2_TO_V1_LOCALIZEDSTRING);
+ if (keywords != null)
+ {
+ result.getKeywords().addAll(keywords);
+ }
+ List<String> userCategories = from.getUserCategories();
+ if (userCategories != null)
+ {
+ result.getUserCategories().addAll(userCategories);
+ }
+ List<String> userProfileItems = from.getUserProfileItems();
+ if (userProfileItems != null)
+ {
+ result.getUserProfileItems().addAll(userProfileItems);
+ }
result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
@@ -298,7 +385,7 @@
}
}
- public static class V2ToV1ItemDescription implements Function<ItemDescription, V1ItemDescription>
+ private static class V2ToV1ItemDescription implements Function<ItemDescription, V1ItemDescription>
{
public V1ItemDescription apply(ItemDescription from)
@@ -308,7 +395,11 @@
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));
+ List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
return result;
}
else
@@ -318,7 +409,7 @@
}
}
- public static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
+ private static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
{
public V1MarkupType apply(MarkupType from)
@@ -334,7 +425,7 @@
}
}
- public static class V2ToV1LocalizedString implements Function<LocalizedString, V1LocalizedString>
+ private static class V2ToV1LocalizedString implements Function<LocalizedString, V1LocalizedString>
{
public V1LocalizedString apply(LocalizedString from)
@@ -350,4 +441,22 @@
}
}
+
+ private static class V2ToV1PropertyDescription implements Function<PropertyDescription, V1PropertyDescription>
+ {
+
+ public V1PropertyDescription apply(PropertyDescription from)
+ {
+ if (from != null)
+ {
+ V1PropertyDescription result = WSRP1TypeFactory.createPropertyDescription(from.getName().toString(), from.getType());
+ result.setHint(toV1LocalizedString(from.getHint()));
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
}
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 16:07:08 UTC (rev 3253)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-08 16:56:47 UTC (rev 3254)
@@ -23,7 +23,6 @@
package org.gatein.wsrp.endpoints.v1;
-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;
@@ -96,15 +95,15 @@
}
requiresRegistration.value = description.isRequiresRegistration();
- offeredPortlets.value = Lists.transform(description.getOfferedPortlets(), V2V1Converter.V2_TO_V1_PORTLETDESCRIPTION);
- userCategoryDescriptions.value = Lists.transform(description.getUserCategoryDescriptions(), V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+ offeredPortlets.value = V2V1Converter.transform(description.getOfferedPortlets(), V2V1Converter.V2_TO_V1_PORTLETDESCRIPTION);
+ userCategoryDescriptions.value = V2V1Converter.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);
+ customWindowStateDescriptions.value = V2V1Converter.transform(description.getCustomWindowStateDescriptions(), V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+ customModeDescriptions.value = V2V1Converter.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 = V2V1Converter.toV1ResourceList(description.getResourceList());
- extensions.value = Lists.transform(description.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ extensions.value = V2V1Converter.transform(description.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
}
}
14 years, 6 months
gatein SVN: r3253 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-08 12:07:08 -0400 (Tue, 08 Jun 2010)
New Revision: 3253
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
Log:
- If an input is null, so should the converted value.
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 15:43:55 UTC (rev 3252)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-08 16:07:08 UTC (rev 3253)
@@ -88,20 +88,27 @@
public static MarkupParams toV2MarkupParams(V1MarkupParams v1MarkupParams)
{
- MarkupParams markupParams = WSRPTypeFactory.createMarkupParams(v1MarkupParams.isSecureClientCommunication(),
- v1MarkupParams.getLocales(), v1MarkupParams.getMimeTypes(), v1MarkupParams.getMode(),
- v1MarkupParams.getWindowState());
- markupParams.setClientData(toV2ClientData(v1MarkupParams.getClientData()));
- markupParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(
- new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
- markupParams.setValidateTag(v1MarkupParams.getValidateTag());
+ if (v1MarkupParams != null)
+ {
+ MarkupParams markupParams = WSRPTypeFactory.createMarkupParams(v1MarkupParams.isSecureClientCommunication(),
+ v1MarkupParams.getLocales(), v1MarkupParams.getMimeTypes(), v1MarkupParams.getMode(),
+ v1MarkupParams.getWindowState());
+ markupParams.setClientData(toV2ClientData(v1MarkupParams.getClientData()));
+ markupParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(
+ new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
+ markupParams.setValidateTag(v1MarkupParams.getValidateTag());
- markupParams.getMarkupCharacterSets().addAll(v1MarkupParams.getMarkupCharacterSets());
- markupParams.getValidNewModes().addAll(v1MarkupParams.getValidNewModes());
- markupParams.getValidNewWindowStates().addAll(v1MarkupParams.getValidNewWindowStates());
+ markupParams.getMarkupCharacterSets().addAll(v1MarkupParams.getMarkupCharacterSets());
+ markupParams.getValidNewModes().addAll(v1MarkupParams.getValidNewModes());
+ markupParams.getValidNewWindowStates().addAll(v1MarkupParams.getValidNewWindowStates());
- markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION));
- return markupParams;
+ markupParams.getExtensions().addAll(Lists.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION));
+ return markupParams;
+ }
+ else
+ {
+ return null;
+ }
}
@@ -226,16 +233,16 @@
{
public Extension apply(V1Extension from)
{
- if (from == null)
+ if (from != null)
{
- return null;
- }
- else
- {
Extension extension = new Extension();
extension.setAny(from.getAny());
return extension;
}
+ else
+ {
+ return null;
+ }
}
}
@@ -243,16 +250,16 @@
{
public V1Extension apply(Extension from)
{
- if (from == null)
+ if (from != null)
{
- return null;
- }
- else
- {
V1Extension extension = new V1Extension();
extension.setAny(from.getAny());
return extension;
}
+ else
+ {
+ return null;
+ }
}
}
@@ -261,26 +268,33 @@
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()));
+ if (from != null)
+ {
+ 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;
+ result.setGroupID(from.getGroupID());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
}
}
@@ -289,11 +303,18 @@
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;
+ if (from != null)
+ {
+ 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;
+ }
+ else
+ {
+ return null;
+ }
}
}
@@ -302,7 +323,14 @@
public V1MarkupType apply(MarkupType from)
{
- return WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ }
+ else
+ {
+ return null;
+ }
}
}
@@ -311,7 +339,14 @@
public V1LocalizedString apply(LocalizedString from)
{
- return WSRP1TypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
+ }
+ else
+ {
+ return null;
+ }
}
}
14 years, 6 months
gatein SVN: r3252 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp/spec/v1 and 9 other directories.
by do-not-reply@jboss.org
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);
}
}
14 years, 6 months
gatein SVN: r3251 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component.
by do-not-reply@jboss.org
Author: thanh_tung_do
Date: 2010-06-08 07:36:22 -0400 (Tue, 08 Jun 2010)
New Revision: 3251
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java
Log:
GTNPORTAL-1217: set value "" for membership's description if membership's description is null
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java 2010-06-08 10:45:09 UTC (rev 3250)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java 2010-06-08 11:36:22 UTC (rev 3251)
@@ -90,6 +90,10 @@
OrganizationService service = uiMembership.getApplicationComponent(OrganizationService.class);
MembershipType mt = service.getMembershipTypeHandler().findMembershipType(name);
+ if(mt.getDescription()==null)
+ {
+ mt.setDescription("");
+ }
UIMembershipManagement uiMembershipManager = uiMembership.getParent();
UIMembershipTypeForm uiForm = uiMembershipManager.getChild(UIMembershipTypeForm.class);
uiForm.setMembershipType(mt);
14 years, 6 months
gatein SVN: r3250 - portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application.
by do-not-reply@jboss.org
Author: thanh_tung_do
Date: 2010-06-08 06:45:09 -0400 (Tue, 08 Jun 2010)
New Revision: 3250
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
Log:
GTNPORTAL-1152: set gadget's default icon
Modified: portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2010-06-08 10:36:01 UTC (rev 3249)
+++ portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2010-06-08 10:45:09 UTC (rev 3250)
@@ -43,7 +43,7 @@
<div class="UIVTab VTabStyle3" id="<%=application.getId();%>" onmousedown="eXo.portal.PortalDragDrop.init.call(this, event);">
<div class="VTabContentBG">
<div class="OverflowContainer">
- <img src="$srcBG" onError="src='$srcBGError'" alt=""/>
+ <img src="<%=(srcBG!=null && srcBG.length()>0)?srcBG:srcBGError%>" onError="src='$srcBGError'" alt=""/>
<div class="ContentInfo" title="<%= application.getDisplayName() %>" style="cursor:move;">
<div class="LabelTab">$applicationLabel</div>
<div class="LableText"><%= application.getDescription() %></div>
14 years, 6 months
gatein SVN: r3249 - portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-06-08 06:36:01 -0400 (Tue, 08 Jun 2010)
New Revision: 3249
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
Log:
GTNPORTAL-1267 Remove ToolbarColumn from Layout at runtime
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-06-08 10:21:22 UTC (rev 3248)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-06-08 10:36:01 UTC (rev 3249)
@@ -64,14 +64,6 @@
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
"</container>",
"ThreeColumnContainerLayout")) ;
- column.addSelectItemOption(new SelectItemOption("threeToolbarColumns",
- "<container template=\"system:/groovy/portal/webui/container/UIToolbarContainer.gtmpl\">" +
- " <factory-id>TableColumnContainer</factory-id>" +
- " <container id=\"StarToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
- " <container id=\"UserToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
- " <container id=\"AdminToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
- "</container>",
- "ThreeColumnContainerLayout")) ;
templates.add(column);
SelectItemCategory autofitColumn = new SelectItemCategory("autofitColumn") ;
14 years, 6 months
gatein SVN: r3248 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-06-08 06:21:22 -0400 (Tue, 08 Jun 2010)
New Revision: 3248
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java
Log:
GTNPORTAL-1290 Allow to add user into group in case after comma has space
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java 2010-06-08 09:55:45 UTC (rev 3247)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java 2010-06-08 10:21:22 UTC (rev 3248)
@@ -77,7 +77,7 @@
public UIGroupMembershipForm() throws Exception
{
addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME, null).addValidator(MandatoryValidator.class)
- .addValidator(ExpressionValidator.class, "^\\p{L}[\\p{L}\\d._\\-,]+$",
+ .addValidator(ExpressionValidator.class, "^\\p{L}[\\p{L}\\d._\\-\\s*,\\s*]+$",
"UIGroupMembershipForm.msg.Invalid-char"));
addUIFormInput(new UIFormSelectBox("membership", "membership", listOption).setSize(1));
UIPopupWindow searchUserPopup = addChild(UIPopupWindow.class, "SearchUser", "SearchUser");
@@ -191,7 +191,7 @@
OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
MembershipHandler memberShipHandler = service.getMembershipHandler();
UIApplication uiApp = event.getRequestContext().getUIApplication();
- List<String> userNames = Arrays.asList(uiForm.getUserName().split(","));
+ List<String> userNames = Arrays.asList(uiForm.getUserName().trim().split("\\s*,\\s*"));
Group group = userInGroup.getSelectedGroup();
MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(uiForm.getMembership());
if (group == null)
14 years, 6 months
gatein SVN: r3247 - in portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages: three-columns and 7 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-06-08 05:55:45 -0400 (Tue, 08 Jun 2010)
New Revision: 3247
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/one-row-two-columns/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-columns/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows-two-columns/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-tabs/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns-one-row/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-rows/page.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-tabs/page.xml
Log:
GTNPORTAL-1170 Set access permission for UIContainer when create pages have page layout which contains some UIContainers
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/one-row-two-columns/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/one-row-two-columns/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/one-row-two-columns/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -25,9 +25,16 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
<container template='system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl'>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <access-permissions>Everyone</access-permissions>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-columns/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-columns/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-columns/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -26,8 +26,15 @@
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
<container template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
+ <access-permissions>Everyone</access-permissions>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -25,7 +25,13 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows-two-columns/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows-two-columns/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-rows-two-columns/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -26,10 +26,21 @@
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
<container template='system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl'>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <access-permissions>Everyone</access-permissions>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-tabs/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-tabs/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/three-tabs/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -27,11 +27,19 @@
<name></name>
<title></title>
<container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
<container template="system:/groovy/portal/webui/container/UITabContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
<factory-id>TabContainer</factory-id>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
</container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -26,7 +26,12 @@
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
<container template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
+ <access-permissions>Everyone</access-permissions>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns-one-row/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns-one-row/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-columns-one-row/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -26,8 +26,15 @@
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
<container template='system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl'>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <access-permissions>Everyone</access-permissions>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
</container>
- <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'></container>
+ <container template='system:/groovy/portal/webui/container/UIContainer.gtmpl'>
+ <access-permissions>Everyone</access-permissions>
+ </container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-rows/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-rows/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-rows/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -25,6 +25,10 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<name></name>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
- <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl"></container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
+ <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
+ </container>
</page>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-tabs/page.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-tabs/page.xml 2010-06-08 09:53:11 UTC (rev 3246)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/template/pages/two-tabs/page.xml 2010-06-08 09:55:45 UTC (rev 3247)
@@ -27,11 +27,15 @@
<name></name>
<title></title>
<container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
<container template="system:/groovy/portal/webui/container/UITabContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
<factory-id>TabContainer</factory-id>
<container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
</container>
<container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
+ <access-permissions>Everyone</access-permissions>
</container>
</container>
</container>
14 years, 6 months
gatein SVN: r3246 - portal/trunk/web/portal/src/main/webapp/templates/groovy/webui/component.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-08 05:53:11 -0400 (Tue, 08 Jun 2010)
New Revision: 3246
Modified:
portal/trunk/web/portal/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
Log:
GTNPORTAL-1274 Login links in default page must be contextual and depend on the displayed portal
Modified: portal/trunk/web/portal/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2010-06-08 09:38:50 UTC (rev 3245)
+++ portal/trunk/web/portal/src/main/webapp/templates/groovy/webui/component/UIHomePagePortlet.gtmpl 2010-06-08 09:53:11 UTC (rev 3246)
@@ -1,3 +1,8 @@
+<%
+ //TODO: nguyenanhkien2a(a)gmail.com
+ String initialURI = _ctx.getRequestContext().getParentAppRequestContext().getRequestContextPath() + "/private/" + _ctx.getRequestContext().getParentAppRequestContext().getPortalOwner();
+%>
+
<div class="UIHomePagePortlet" id="$uicomponent.id">
<div class="TRContainer">
<div class="PortletDecoration">
@@ -28,7 +33,7 @@
<div class="AccountsContainerDeco">
<div class="AccountBlock AdministratorUser">
<div class="AccountInfos">
- <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=root&password=gtn"><%=_ctx.appRes("UIHomePagePortlet.Label.Administrator")%></a></div>
+ <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=root&password=gtn&initialURI=<%=initialURI%>"><%=_ctx.appRes("UIHomePagePortlet.Label.Administrator")%></a></div>
<div class="Username">
<div class="Lable"><%=_ctx.appRes("UIHomePagePortlet.Label.Username")%></div><span>root</span>
<div class="ClearBoth"><span></span></div>
@@ -42,7 +47,7 @@
<div class="SeparatorLine"><span></span></div>
<div class="AccountBlock ManagerUser">
<div class="AccountInfos">
- <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=john&password=gtn"><%=_ctx.appRes("UIHomePagePortlet.Label.Manager")%></a></div>
+ <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=john&password=gtn&initialURI=<%=initialURI%>"><%=_ctx.appRes("UIHomePagePortlet.Label.Manager")%></a></div>
<div class="Username">
<div class="Lable"><%=_ctx.appRes("UIHomePagePortlet.Label.Username")%></div><span>john</span>
<div class="ClearBoth"><span></span></div>
@@ -56,7 +61,7 @@
<div class="SeparatorLine"><span></span></div>
<div class="AccountBlock NormalUser">
<div class="AccountInfos">
- <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=mary&password=gtn"><%=_ctx.appRes("UIHomePagePortlet.Label.User")%></a></div>
+ <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=mary&password=gtn&initialURI=<%=initialURI%>"><%=_ctx.appRes("UIHomePagePortlet.Label.User")%></a></div>
<div class="Username">
<div class="Lable"><%=_ctx.appRes("UIHomePagePortlet.Label.Username")%></div><span>mary</span>
<div class="ClearBoth"><span></span></div>
@@ -70,7 +75,7 @@
<div class="SeparatorLine"><span></span></div>
<div class="AccountBlock DemoUser" style="margin-right: 0px;">
<div class="AccountInfos">
- <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=demo&password=gtn"><%=_ctx.appRes("UIHomePagePortlet.Label.Demo")%></a></div>
+ <div class="AccountTitle"><a href="${_ctx.getPortalContextPath()}/login?username=demo&password=gtn&initialURI=<%=initialURI%>"><%=_ctx.appRes("UIHomePagePortlet.Label.Demo")%></a></div>
<div class="Username">
<div class="Lable"><%=_ctx.appRes("UIHomePagePortlet.Label.Username")%></div><span>demo</span>
<div class="ClearBoth"><span></span></div>
14 years, 6 months