Author: chris.laprun(a)jboss.com
Date: 2008-07-10 07:41:33 -0400 (Thu, 10 Jul 2008)
New Revision: 11402
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
Log:
- Generification.
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2008-07-10
11:27:02 UTC (rev 11401)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2008-07-10
11:41:33 UTC (rev 11402)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.Tools;
@@ -89,7 +91,7 @@
}
void prepareInvocation() throws InvalidRegistrationFault, OperationFailedFault,
InvalidHandleFault,
- UnsupportedMimeTypeFault, UnsupportedWindowStateFault, UnsupportedModeFault
+ UnsupportedMimeTypeFault, UnsupportedWindowStateFault, UnsupportedModeFault
{
Registration registration =
producer.getRegistrationOrFailIfInvalid(getRegistrationContext());
@@ -117,7 +119,7 @@
catch (PortletInvokerException e)
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not retrieve portlet '" + portletContext +
"'", e);
+ "Could not retrieve portlet '" + portletContext +
"'", e);
}
// get portlet description for the desired portlet...
@@ -126,7 +128,7 @@
if (Boolean.TRUE.equals(portletDescription.getUsesMethodGet()))
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED,
- "Portlets using GET method in forms are not currently supported.",
null);
+ "Portlets using GET method in forms are not currently
supported.", null);
}
MarkupType[] markupTypes = portletDescription.getMarkupTypes();
@@ -181,7 +183,7 @@
* @return a MarkupRequest containing the most appropriate information to base markup
generation for this request
*/
private MarkupRequest createMarkupRequestFrom(MarkupType[] markupTypes, MarkupParams
params, Portlet portlet)
- throws UnsupportedMimeTypeFault, UnsupportedModeFault, UnsupportedWindowStateFault
+ throws UnsupportedMimeTypeFault, UnsupportedModeFault,
UnsupportedWindowStateFault
{
String[] desiredMIMETypes = params.getMimeTypes();
MarkupType markupType = null;
@@ -190,11 +192,11 @@
for (int i = 0; markupType == null && i < desiredMIMETypes.length; i++)
{
String desiredMIMEType = desiredMIMETypes[i];
- for (int j = 0; j < markupTypes.length; j++)
+ for (MarkupType mt : markupTypes)
{
- if (desiredMIMEType.equalsIgnoreCase(markupTypes[j].getMimeType()))
+ if (desiredMIMEType.equalsIgnoreCase(mt.getMimeType()))
{
- markupType = markupTypes[j];
+ markupType = mt;
break;
}
}
@@ -204,7 +206,7 @@
if (markupType == null)
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- "None of the specified MIME types are supported by portlet '" +
portlet.getContext().getId() + "'", null);
+ "None of the specified MIME types are supported by portlet
'" + portlet.getContext().getId() + "'", null);
}
// get the mode
@@ -216,7 +218,7 @@
catch (IllegalArgumentException e)
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.UNSUPPORTED_MODE,
- "Unsupported mode '" + params.getMode() + "'",
e);
+ "Unsupported mode '" + params.getMode() +
"'", e);
}
// get the window state
@@ -228,7 +230,7 @@
catch (IllegalArgumentException e)
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.UNSUPPORTED_WINDOW_STATE,
- "Unsupported window state '" + params.getMode() +
"'", e);
+ "Unsupported window state '" + params.getMode() +
"'", e);
}
// get the character set
@@ -271,13 +273,13 @@
{
if (preferredValues != null && possibleValues != null)
{
- List possibleList = Arrays.asList(possibleValues);
+ List<String> possibleList = Arrays.asList(possibleValues);
- for (int i = 0; i < preferredValues.length; i++)
+ for (String preferredValue : preferredValues)
{
- if (possibleList.contains(preferredValues[i]))
+ if (possibleList.contains(preferredValue))
{
- return preferredValues[i];
+ return preferredValue;
}
}
}
@@ -362,10 +364,9 @@
String[] validNewWindowStates = params.getValidNewWindowStates();
if (validNewWindowStates != null)
{
- Set states = new HashSet(validNewWindowStates.length);
- for (int i = 0; i < validNewWindowStates.length; i++)
+ Set<WindowState> states = new
HashSet<WindowState>(validNewWindowStates.length);
+ for (String state : validNewWindowStates)
{
- String state = validNewWindowStates[i];
states.add(WSRPUtils.getJSR168WindowStateFromWSRPName(state));
}
return states;
@@ -378,10 +379,9 @@
String[] validNewModes = params.getValidNewModes();
if (validNewModes != null)
{
- Set modes = new HashSet(validNewModes.length);
- for (int i = 0; i < validNewModes.length; i++)
+ Set<Mode> modes = new HashSet<Mode>(validNewModes.length);
+ for (String mode : validNewModes)
{
- String mode = validNewModes[i];
modes.add(WSRPUtils.getJSR168PortletModeFromWSRPName(mode));
}
return modes;
@@ -406,7 +406,7 @@
catch (MimeTypeParseException e)
{
throw
WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
- e.getLocalizedMessage(), e);
+ e.getLocalizedMessage(), e);
}
return markupInfo;
}