gatein SVN: r4964 - components/sso/branches.
by do-not-reply@jboss.org
Author: sohil.shah(a)jboss.com
Date: 2010-11-06 12:11:39 -0400 (Sat, 06 Nov 2010)
New Revision: 4964
Added:
components/sso/branches/sso-wci/
Log:
sso-wci branch
Copied: components/sso/branches/sso-wci (from rev 4963, components/sso/trunk)
14 years, 2 months
gatein SVN: r4963 - components/sso/branches.
by do-not-reply@jboss.org
Author: sohil.shah(a)jboss.com
Date: 2010-11-06 12:10:54 -0400 (Sat, 06 Nov 2010)
New Revision: 4963
Removed:
components/sso/branches/sso-wci/
Log:
cleanup
14 years, 2 months
gatein SVN: r4962 - components/sso/branches/sso-wci.
by do-not-reply@jboss.org
Author: sohil.shah(a)jboss.com
Date: 2010-11-06 12:08:19 -0400 (Sat, 06 Nov 2010)
New Revision: 4962
Added:
components/sso/branches/sso-wci/trunk/
Log:
sso-wci branch
Copied: components/sso/branches/sso-wci/trunk (from rev 4961, components/sso/trunk)
14 years, 2 months
gatein SVN: r4961 - components/sso/branches.
by do-not-reply@jboss.org
Author: sohil.shah(a)jboss.com
Date: 2010-11-06 12:07:19 -0400 (Sat, 06 Nov 2010)
New Revision: 4961
Added:
components/sso/branches/sso-wci/
Log:
sso-wci branch
14 years, 2 months
gatein SVN: r4960 - in components/wsrp/trunk: consumer/src/main/java/org/gatein/wsrp/consumer/handlers and 4 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-05 13:52:29 -0400 (Fri, 05 Nov 2010)
New Revision: 4960
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ActionRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/EventRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProcessorFactory.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProducerHelper.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RenderRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ResourceRequestProcessor.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
Log:
- GTNWSRP-147: properly support ModifyRegistrationRequired exceptions
+ Make ProducerInfo know that modifying the registration is needed and make the consumer inactive.
+ Properly react to a ModifyRegistrationRequired exception when refreshing the ProducerInfo.
+ RegistrationHandler.isRegistrationValid now throws a ModifyRegistrationRequired exception instead of OperationFailed as was the case in WSRP 1.
+ Propagated exception up the call stacks...
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -51,6 +51,7 @@
import org.oasis.wsrp.v2.Lifetime;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
@@ -440,28 +441,7 @@
{
log.debug("OperationFailedFault occurred, might indicate a need to modify registration", operationFailedFault);
- // attempt to get unregistered service description
- serviceDescription = getServiceDescription(true);
- result.setServiceDescription(serviceDescription);
-
- // re-validate the registration information
- RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
- if (registrationResult.hasIssues())
- {
- // if the registration validation has issues, we need to modify our local information
- setModifyRegistrationRequired(true);
- setActiveAndSave(false);
- }
- else
- {
- // we might be in a situation where the producer changed the registration back to the initial state
- // which is, granted, pretty rare... attempt modifyRegistration
- log.debug("modifyRegistration was called after OperationFailedFault when a check of registration data didn't reveal any issue...");
- modifyRegistration(true);
- }
-
- result.setRegistrationResult(registrationResult);
- return result;
+ return handleModifyRegistrationNeeded(result);
}
else
{
@@ -486,6 +466,10 @@
return refreshInfo(false, serviceDescription, result);
}
+ catch (ModifyRegistrationRequired modifyRegistrationRequired)
+ {
+ return handleModifyRegistrationNeeded(result);
+ }
return refreshInfo(forceRefresh, serviceDescription, result);
}
@@ -493,6 +477,32 @@
return new RefreshResult(RefreshResult.Status.BYPASSED);
}
+ private RefreshResult handleModifyRegistrationNeeded(RefreshResult result) throws PortletInvokerException
+ {
+ ServiceDescription serviceDescription;// attempt to get unregistered service description
+ serviceDescription = getServiceDescription(true);
+ result.setServiceDescription(serviceDescription);
+
+ // re-validate the registration information
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
+ if (registrationResult.hasIssues())
+ {
+ // if the registration validation has issues, we need to modify our local information
+ setModifyRegistrationRequired(true);
+ setActiveAndSave(false);
+ }
+ else
+ {
+ // we might be in a situation where the producer changed the registration back to the initial state
+ // which is, granted, pretty rare... attempt modifyRegistration
+ log.debug("modifyRegistration was called after OperationFailedFault when a check of registration data didn't reveal any issue...");
+ modifyRegistration(true);
+ }
+
+ result.setRegistrationResult(registrationResult);
+ return result;
+ }
+
private RefreshResult refreshInfo(boolean forceRefresh, ServiceDescription serviceDescription, RefreshResult result)
throws PortletInvokerException
{
@@ -823,7 +833,7 @@
this.persistentExpirationCacheSeconds = expirationCacheSeconds;
}
- private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration
+ private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration, ModifyRegistrationRequired
{
//todo: might need to implement customization of default service description
ServiceDescription serviceDescription;
@@ -912,6 +922,10 @@
{
throw (OperationFailed)e; // rethrow to deal at higher level as meaning can vary depending on context
}
+ else if (e instanceof ModifyRegistrationRequired)
+ {
+ throw (ModifyRegistrationRequired)e;
+ }
return rethrowAsInvokerUnvailable(e);
}
@@ -931,6 +945,10 @@
{
return rethrowAsInvokerUnvailable(invalidRegistrationFault);
}
+ catch (ModifyRegistrationRequired modifyRegistrationRequired)
+ {
+ return rethrowAsInvokerUnvailable(modifyRegistrationRequired);
+ }
}
private ServiceDescription rethrowAsInvokerUnvailable(Exception e) throws InvokerUnavailableException
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -37,12 +37,14 @@
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
import org.oasis.wsrp.v2.InvalidCookie;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidSession;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
@@ -248,6 +250,17 @@
log.debug("Invalid registration");
consumer.handleInvalidRegistrationFault();
}
+ else if (error instanceof ModifyRegistrationRequired)
+ {
+ ProducerInfo producerInfo = consumer.getProducerInfo();
+
+ log.debug("Producer " + producerInfo.getId() + " indicated that modifyRegistration should be called.");
+
+ producerInfo.setModifyRegistrationRequired(true);
+ producerInfo.setActiveAndSave(false);
+
+ return new ErrorResponse(error);
+ }
else
{
// other errors cannot be dealt with: we have an error condition
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-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -499,7 +499,7 @@
return serviceDescriptionHandler.getPortletDescription(portlet, locales);
}
- public Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistration, OperationFailed
+ public Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistration, OperationFailed, ModifyRegistrationRequired
{
Registration registration = registrationHandler.getRegistrationFrom(registrationContext);
registrationHandler.isRegistrationValid(registration, true);
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -316,18 +316,18 @@
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(copyPortlets, "copyPortlets");
-
+
List<PortletContext> portletContexts = copyPortlets.getFromPortletContexts();
-
+
if (!ParameterValidation.existsAndIsNotEmpty(portletContexts))
{
throw WSRP2ExceptionFactory.createWSException(MissingParameters.class, "Missing required portletContext in CopyPortlets.", null);
}
-
+
Registration fromRegistration = producer.getRegistrationOrFailIfInvalid(copyPortlets.getFromRegistrationContext());
-
+
RegistrationContext toRegistationContext = copyPortlets.getToRegistrationContext();
-
+
//if toRegistrationCotnext is null, then we use the fromRegistrationContext (from spec).
//NOTE: this means we can't move between a PortletContext on a registered consumer to a non-registered consumer
// between two non-registered consumers will still be ok.
@@ -335,9 +335,9 @@
{
toRegistationContext = copyPortlets.getFromRegistrationContext();
}
-
+
Registration toRegistration = producer.getRegistrationOrFailIfInvalid(toRegistationContext);
-
+
UserContext fromUserContext = copyPortlets.getFromUserContext();
checkUserAuthorization(fromUserContext);
UserContext toUserContext = copyPortlets.getToUserContext();
@@ -346,29 +346,29 @@
try
{
RegistrationLocal.setRegistration(fromRegistration);
-
+
Map<String, FailedPortlets> failedPortletsMap = new HashMap<String, FailedPortlets>(portletContexts.size());
-
+
List<CopiedPortlet> copiedPortlets = new ArrayList<CopiedPortlet>(portletContexts.size());
-
+
for (PortletContext portletContext : portletContexts)
{
try
{
org.gatein.pc.api.PortletContext portalPC = WSRPUtils.convertToPortalPortletContext(portletContext);
-
+
//NOTE: There are two ways we can do a copy. We can export using one registration and import using another. This seems the most straight forward way to do this, just seems a little overkill.
// OR we can copy the portlet, then use the RegistrationManager and RegistrationPolicy to delete the PC from one registration and add it to another. But we don't actually
// create the copy under the toRegistration and we would need to add extra checks here to make sure the toRegistration has the proper permissions.
// Note sure why there is even a copy portlet operation since it can be replicated by an export and then an import operation.
-
+
org.gatein.pc.api.PortletContext exportedPortletContext = producer.getPortletInvoker().exportPortlet(PortletStateType.OPAQUE, portalPC);
//Change the registration to the new registration and try and do an import. This should force the new import to be under the new registration context
RegistrationLocal.setRegistration(toRegistration);
org.gatein.pc.api.PortletContext copiedPortletContext = producer.getPortletInvoker().importPortlet(PortletStateType.OPAQUE, exportedPortletContext);
-
+
PortletContext wsrpClonedPC = WSRPUtils.convertToWSRPPortletContext(copiedPortletContext);
-
+
CopiedPortlet copiedPortlet = WSRPTypeFactory.createCopiedPortlet(wsrpClonedPC, portletContext.getPortletHandle());
copiedPortlets.add(copiedPortlet);
}
@@ -663,7 +663,7 @@
{
exportContext = producer.getExportManager().createExportContext(exportByValueRequired, -1, -1, -1);
}
-
+
for (PortletContext portletContext : exportPortlets.getPortletContext())
{
try
@@ -740,7 +740,7 @@
byte[] exportContextBytes = producer.getExportManager().encodeExportContextData(exportContext);
Lifetime lifetime = null;
-
+
if (exportContext.getCurrentTime() > 0)
{
lifetime = new Lifetime();
@@ -748,7 +748,7 @@
lifetime.setTerminationTime(toXMLGregorianCalendar(exportContext.getTermintationTime()));
lifetime.setRefreshDuration(toDuration(exportContext.getRefreshDuration()));
}
-
+
return WSRPTypeFactory.createExportPortletsResponse(exportContextBytes, exportedPortlets, new ArrayList<FailedPortlets>(failedPortletsMap.values()), lifetime, resourceList);
}
catch (Exception e)
@@ -761,7 +761,7 @@
}
}
- public ImportPortletsResponse importPortlets(ImportPortlets importPortlets) throws OperationFailed, InvalidRegistration, MissingParameters
+ public ImportPortletsResponse importPortlets(ImportPortlets importPortlets) throws OperationFailed, InvalidRegistration, MissingParameters, ModifyRegistrationRequired
{
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(importPortlets, "ImportPortlets");
@@ -813,7 +813,7 @@
{
exportPortletData = producer.getExportManager().createExportPortletData(exportContext, -1, -1, -1, portletData);
}
-
+
String portletHandle = exportPortletData.getPortletHandle();
byte[] portletState = exportPortletData.getPortletState();
@@ -904,7 +904,7 @@
return WSRPTypeFactory.createReturnAny().getExtensions();
}
- public Lifetime setExportLifetime(SetExportLifetime setExportLifetime) throws OperationFailed, InvalidRegistration, OperationNotSupported
+ public Lifetime setExportLifetime(SetExportLifetime setExportLifetime) throws OperationFailed, InvalidRegistration, OperationNotSupported, ModifyRegistrationRequired
{
//this method is only valid if the producer can handle exporting by reference.
if (producer.getExportManager().getPersistenceManager() == null)
@@ -930,7 +930,7 @@
try
{
RegistrationLocal.setRegistration(registration);
-
+
ExportContext exportContext;
if (setExportLifetime != null)
{
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -263,7 +263,7 @@
* @return
* @since 2.6.2
*/
- public boolean isRegistrationValid(Registration reg, boolean throwExceptionIfInvalid) throws InvalidRegistration, OperationFailed
+ public boolean isRegistrationValid(Registration reg, boolean throwExceptionIfInvalid) throws InvalidRegistration, OperationFailed, ModifyRegistrationRequired
{
if (reg == null)
{
@@ -290,7 +290,7 @@
{
if (isPending)
{
- throwOperationFailedFault("Registration with handle '" + reg.getRegistrationHandle()
+ WSRP2ExceptionFactory.throwWSException(ModifyRegistrationRequired.class, "Registration with handle '" + reg.getRegistrationHandle()
+ "' is pending. Consumer needs to call modifyRegistration().", null);
}
else
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ActionRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ActionRequestProcessor.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ActionRequestProcessor.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -40,6 +40,7 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
import org.oasis.wsrp.v2.PortletContext;
@@ -62,7 +63,7 @@
ActionRequestProcessor(ProducerHelper producer, PerformBlockingInteraction performBlockingInteraction)
throws UnsupportedMimeType, UnsupportedWindowState, InvalidHandle, UnsupportedMode, MissingParameters,
- InvalidRegistration, OperationFailed
+ InvalidRegistration, OperationFailed, ModifyRegistrationRequired
{
super(producer);
this.performBlockingInteraction = performBlockingInteraction;
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/EventRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/EventRequestProcessor.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/EventRequestProcessor.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -43,6 +43,7 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PortletContext;
@@ -65,7 +66,7 @@
{
private HandleEvents handleEvents;
- public EventRequestProcessor(ProducerHelper producer, HandleEvents handleEvents) throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, UnsupportedWindowState, InvalidRegistration, OperationNotSupported
+ public EventRequestProcessor(ProducerHelper producer, HandleEvents handleEvents) throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, UnsupportedWindowState, InvalidRegistration, OperationNotSupported, ModifyRegistrationRequired
{
super(producer);
this.handleEvents = handleEvents;
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProcessorFactory.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProcessorFactory.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProcessorFactory.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -30,6 +30,7 @@
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.OperationNotSupported;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
@@ -45,7 +46,7 @@
{
public static RequestProcessor getProcessorFor(ProducerHelper producer, Object request)
throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType,
- UnsupportedWindowState, InvalidRegistration
+ UnsupportedWindowState, InvalidRegistration, ModifyRegistrationRequired
{
if (request instanceof GetMarkup)
{
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProducerHelper.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProducerHelper.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ProducerHelper.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -28,6 +28,7 @@
import org.gatein.registration.Registration;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -47,5 +48,5 @@
PortletDescription getPortletDescription(Portlet portlet, List<String> locales);
- Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistration, OperationFailed;
+ Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistration, OperationFailed, ModifyRegistrationRequired;
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RenderRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RenderRequestProcessor.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RenderRequestProcessor.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -36,6 +36,7 @@
import org.oasis.wsrp.v2.MarkupResponse;
import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -54,7 +55,7 @@
private final GetMarkup getMarkup;
public RenderRequestProcessor(ProducerHelper producer, GetMarkup getMarkup) throws UnsupportedMimeType,
- UnsupportedWindowState, InvalidHandle, UnsupportedMode, MissingParameters, InvalidRegistration, OperationFailed
+ UnsupportedWindowState, InvalidHandle, UnsupportedMode, MissingParameters, InvalidRegistration, OperationFailed, ModifyRegistrationRequired
{
super(producer);
this.getMarkup = getMarkup;
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -50,6 +50,7 @@
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
@@ -94,7 +95,7 @@
}
void prepareInvocation() throws InvalidRegistration, OperationFailed, InvalidHandle,
- UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode, MissingParameters
+ UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode, MissingParameters, ModifyRegistrationRequired
{
Registration registration = producer.getRegistrationOrFailIfInvalid(getRegistrationContext());
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ResourceRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ResourceRequestProcessor.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/ResourceRequestProcessor.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -35,6 +35,7 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -55,7 +56,7 @@
{
private final GetResource getResource;
- public ResourceRequestProcessor(ProducerHelper producer, GetResource getResource) throws InvalidRegistration, OperationFailed, MissingParameters, InvalidHandle, UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode
+ public ResourceRequestProcessor(ProducerHelper producer, GetResource getResource) throws InvalidRegistration, OperationFailed, MissingParameters, InvalidHandle, UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode, ModifyRegistrationRequired
{
super(producer);
this.getResource = getResource;
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2010-11-05 17:15:49 UTC (rev 4959)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2010-11-05 17:52:29 UTC (rev 4960)
@@ -40,6 +40,7 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -58,7 +59,7 @@
{
private static final String PORTLET_HANDLE = "portletHandle";
- public void testShouldUseProvidedNamespace() throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, UnsupportedWindowState, InvalidRegistration
+ public void testShouldUseProvidedNamespace() throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, UnsupportedWindowState, InvalidRegistration, ModifyRegistrationRequired
{
String namespace = "namespace";
ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(MockHttpSession.createMockSession()), MockHttpServletResponse.createMockResponse());
14 years, 2 months
gatein SVN: r4959 - in components/wsrp/trunk/producer/src: test/java/org/gatein/wsrp/producer/config and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-05 13:15:49 -0400 (Fri, 05 Nov 2010)
New Revision: 4959
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
Log:
- GTNWSRP-149: modifyNow wasn't properly called when setRegistrationProperties didn't add new registration properties so it wouldn't be called in the case of simply removing properties.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-11-05 16:24:35 UTC (rev 4958)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-11-05 17:15:49 UTC (rev 4959)
@@ -105,12 +105,8 @@
public void setRegistrationProperties(Map<QName, RegistrationPropertyDescription> regProps)
{
- if (registrationProperties.equals(regProps))
+ if (!registrationProperties.equals(regProps))
{
- return;
- }
- else
- {
registrationProperties.clear();
for (RegistrationPropertyDescription propertyDescription : regProps.values())
@@ -118,6 +114,8 @@
addRegistrationProperty(new RegistrationPropertyDescription(propertyDescription));
}
+ modifyNow();
+
notifyRegistrationPropertyChangeListeners();
}
}
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05 16:24:35 UTC (rev 4958)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05 17:15:49 UTC (rev 4959)
@@ -33,6 +33,7 @@
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -91,6 +92,28 @@
assertEquals(lastModified, requirements.getLastModified());
}
+ public void testSetRegistrationPropertiesPropertyRemoval()
+ {
+ ProducerRegistrationRequirements requirements = new ProducerRegistrationRequirementsImpl();
+ requirements.addEmptyRegistrationProperty("foo");
+
+ final Map<QName, RegistrationPropertyDescription> expected = Collections.emptyMap();
+
+ long lastModified = requirements.getLastModified();
+
+ requirements.addRegistrationPropertyChangeListener(new RegistrationPropertyChangeListener()
+ {
+ public void propertiesHaveChanged(Map<QName, ? extends PropertyDescription> newRegistrationProperties)
+ {
+ assertEquals(expected, newRegistrationProperties);
+ }
+ });
+
+ requirements.setRegistrationProperties(expected);
+
+ assertTrue(requirements.getLastModified() > lastModified);
+ }
+
public void testReloadSamePolicy()
{
ProducerRegistrationRequirements requirements = new ProducerRegistrationRequirementsImpl();
@@ -129,4 +152,24 @@
requirements.setRegistrationRequired(true);
}
+ public void testRemoveProperty()
+ {
+ ProducerRegistrationRequirements requirements = new ProducerRegistrationRequirementsImpl();
+ requirements.addEmptyRegistrationProperty("foo");
+
+ long lastModified = requirements.getLastModified();
+
+ requirements.removeRegistrationProperty("foo");
+
+ requirements.addRegistrationPropertyChangeListener(new RegistrationPropertyChangeListener()
+ {
+ public void propertiesHaveChanged(Map<QName, ? extends PropertyDescription> newRegistrationProperties)
+ {
+ assertTrue(newRegistrationProperties.isEmpty());
+ }
+ });
+
+ assertTrue(requirements.getLastModified() > lastModified);
+ }
+
}
14 years, 2 months
gatein SVN: r4958 - components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-05 12:24:35 -0400 (Fri, 05 Nov 2010)
New Revision: 4958
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
Log:
- Added check to see if the last modified date is properly updated when needed.
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05 16:06:17 UTC (rev 4957)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05 16:24:35 UTC (rev 4958)
@@ -52,6 +52,8 @@
RegistrationPropertyDescription newFoo = new RegistrationPropertyDescription("newFoo", WSRPConstants.XSD_STRING);
expected.put(newFoo.getName(), newFoo);
+ long lastModified = requirements.getLastModified();
+
requirements.addRegistrationPropertyChangeListener(new RegistrationPropertyChangeListener()
{
public void propertiesHaveChanged(Map<QName, ? extends PropertyDescription> newRegistrationProperties)
@@ -61,6 +63,8 @@
});
requirements.setRegistrationProperties(expected);
+
+ assertTrue(requirements.getLastModified() > lastModified);
}
public void testSetUnchangedRegistrationProperties()
@@ -72,6 +76,8 @@
RegistrationPropertyDescription newFoo = new RegistrationPropertyDescription("foo", WSRPConstants.XSD_STRING);
expected.put(newFoo.getName(), newFoo);
+ long lastModified = requirements.getLastModified();
+
requirements.addRegistrationPropertyChangeListener(new RegistrationPropertyChangeListener()
{
public void propertiesHaveChanged(Map<QName, ? extends PropertyDescription> newRegistrationProperties)
@@ -81,6 +87,8 @@
});
requirements.setRegistrationProperties(expected);
+
+ assertEquals(lastModified, requirements.getLastModified());
}
public void testReloadSamePolicy()
14 years, 2 months
gatein SVN: r4957 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-05 12:06:17 -0400 (Fri, 05 Nov 2010)
New Revision: 4957
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java
Log:
- GTNWSRP-148: Do not check key for equals since it's not present when comparing a persisted RegistrationPropertyDescription and a non-persisted one, resulting in improper behavior.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java 2010-11-05 15:17:57 UTC (rev 4956)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java 2010-11-05 16:06:17 UTC (rev 4957)
@@ -105,6 +105,7 @@
}
+ @Override
public boolean equals(Object o)
{
if (this == o)
@@ -118,23 +119,13 @@
RegistrationPropertyDescription that = (RegistrationPropertyDescription)o;
- if (key != null ? !key.equals(that.key) : that.key != null)
- {
- return false;
- }
- if (!name.equals(that.name))
- {
- return false;
- }
- return type.equals(that.type);
-
+ return name.equals(that.name) && type.equals(that.type);
}
+ @Override
public int hashCode()
{
- int result;
- result = (key != null ? key.hashCode() : 0);
- result = 31 * result + name.hashCode();
+ int result = name.hashCode();
result = 31 * result + type.hashCode();
return result;
}
14 years, 2 months
gatein SVN: r4956 - in components/wsrp/trunk/common/src: test/java/org/gatein/wsrp/other and 1 other directory.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-11-05 11:17:57 -0400 (Fri, 05 Nov 2010)
New Revision: 4956
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
Log:
GTNWSRP-97: We need to check if the resource ID is an encoded resource ID or an actual resource ID (actual will occur when a producer writes the url based on tokens). Update tests to include a check for this situation.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-11-05 12:32:07 UTC (rev 4955)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-11-05 15:17:57 UTC (rev 4956)
@@ -251,17 +251,24 @@
*/
public static Map<String, String> decodeResource(String resourceInfo)
{
- Map<String, String[]> resourceParameters = StateString.decodeOpaqueValue(resourceInfo);
-
Map<String, String> resource = new HashMap<String, String>();
+
+ if (resourceInfo != null && resourceInfo.startsWith(StateString.JBPNS_PREFIX))
+ {
+ Map<String, String[]> resourceParameters = StateString.decodeOpaqueValue(resourceInfo);
- for (Map.Entry<String, String[]> entry : resourceParameters.entrySet())
- {
- if (entry.getValue() != null && entry.getValue().length > 0)
+ for (Map.Entry<String, String[]> entry : resourceParameters.entrySet())
{
- resource.put(entry.getKey(), entry.getValue()[0]);
+ if (entry.getValue() != null && entry.getValue().length > 0)
+ {
+ resource.put(entry.getKey(), entry.getValue()[0]);
+ }
}
}
+ else //we are not dealing with an encoded resource ID but an actual resource ID
+ {
+ resource.put(WSRP2RewritingConstants.RESOURCE_ID, resourceInfo);
+ }
return resource;
}
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-11-05 12:32:07 UTC (rev 4955)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-11-05 15:17:57 UTC (rev 4956)
@@ -96,6 +96,19 @@
assertNull(resourceMap.get(WSRPRewritingConstants.RESOURCE_URL));
assertEquals("false", resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
}
+
+ public void testResourceIDToken()
+ {
+ //Test what happens in the case where the url is created via token wsrp rewriting on the producer side
+ //In this case the resource ID will not be an encoded resource map.
+
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource("resource_123");
+ String resourceID = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ assertEquals("resource_123", resourceID);
+
+ assertNull(resourceMap.get(WSRPRewritingConstants.RESOURCE_URL));
+ assertNull(resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
+ }
public void testResources()
{
14 years, 2 months
gatein SVN: r4955 - in components/wsrp/trunk/admin-gui/src/main/webapp: jsf/consumers/exports and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-05 08:32:07 -0400 (Fri, 05 Nov 2010)
New Revision: 4955
Added:
components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/export.gif
components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/import.gif
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/styles/style.css
Log:
- GTNWSRP-114: Added import and export icons.
Added: components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/export.gif
===================================================================
(Binary files differ)
Property changes on: components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/export.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/import.gif
===================================================================
(Binary files differ)
Property changes on: components/wsrp/trunk/admin-gui/src/main/webapp/img/jbp-icon-set/import.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml 2010-11-05 08:19:51 UTC (rev 4954)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml 2010-11-05 12:32:07 UTC (rev 4955)
@@ -60,7 +60,7 @@
#{i18n.exports_actions_delete}
</h:commandLink>
|
- <h:commandLink action="import" actionListener="#{consumer.selectExport}" styleClass="actionUse" id="use">
+ <h:commandLink action="import" actionListener="#{consumer.selectExport}" styleClass="actionImport" id="use">
#{i18n.exports_actions_use}
</h:commandLink>
</h:column>
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/styles/style.css
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/styles/style.css 2010-11-05 08:19:51 UTC (rev 4954)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/styles/style.css 2010-11-05 12:32:07 UTC (rev 4955)
@@ -200,6 +200,20 @@
white-space: nowrap;
}
+.wsrp-consumers-ui .actionImport {
+ padding: 5px 5px 5px 20px;
+ background: url(../img/jbp-icon-set/import.gif) no-repeat left;
+ line-height: 18px;
+ white-space: nowrap;
+}
+
+.wsrp-consumers-ui .actionExport {
+ padding: 5px 5px 5px 20px;
+ background: url(../img/jbp-icon-set/export.gif) no-repeat left;
+ line-height: 18px;
+ white-space: nowrap;
+}
+
.wsrp-consumers-ui td {
border: 0;
padding-bottom: 2px;
14 years, 2 months