You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by cz...@apache.org on 2005/08/11 15:00:01 UTC
cvs commit: ws-wsrp4j/portlets/proxyportlet/src/org/apache/wsrp4j/consumer/portlet/impl ResourceProxy.java
cziegeler 2005/08/11 06:00:01
Modified: src/org/apache/wsrp4j/util Modes.java
AuthenticationInfoHelper.java ParameterChecker.java
PropertyListHelper.java WindowStates.java
portlets/proxyportlet/src/org/apache/wsrp4j/consumer/portlet/impl
ResourceProxy.java
Log:
Code cleanup
Revision Changes Path
1.7 +13 -14 ws-wsrp4j/src/org/apache/wsrp4j/util/Modes.java
Index: Modes.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/util/Modes.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Modes.java 10 Aug 2005 15:10:23 -0000 1.6
+++ Modes.java 11 Aug 2005 13:00:01 -0000 1.7
@@ -22,26 +22,26 @@
*/
public class Modes implements java.io.Serializable
{
- private java.lang.String _value_;
+ private String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
- protected Modes(java.lang.String value)
+ protected Modes(String value)
{
_value_ = value;
_table_.put(_value_, this);
}
// define the modes we can currently handle
- public static final java.lang.String _view = "wsrp:view";
- public static final java.lang.String _edit = "wsrp:edit";
- public static final java.lang.String _help = "wsrp:help";
- public static final java.lang.String _preview = "wsrp:preview";
+ public static final String _view = "wsrp:view";
+ public static final String _edit = "wsrp:edit";
+ public static final String _help = "wsrp:help";
+ public static final String _preview = "wsrp:preview";
public static final Modes view = new Modes(_view);
public static final Modes edit = new Modes(_edit);
public static final Modes help = new Modes(_help);
public static final Modes preview = new Modes(_preview);
- public java.lang.String getValue()
+ public String getValue()
{
return _value_;
}
@@ -52,7 +52,7 @@
* @param value <code>String</string> representation of the WSRP mode
* @return The WSRP <code>Mode</code> represented by the passed string
*/
- public static Modes fromValue(java.lang.String value)
+ public static Modes fromValue(String value)
{
return (Modes)_table_.get(value);
}
@@ -63,12 +63,12 @@
* @param value <code>String</string> representation of the WSRP mode
* @return The WSRP <code>Mode</code> represented by the passed string
*/
- public static Modes fromString(java.lang.String value)
+ public static Modes fromString(String value)
{
return fromValue(value);
}
- public boolean equals(java.lang.Object obj)
+ public boolean equals(Object obj)
{
return (obj == this);
}
@@ -78,12 +78,12 @@
return toString().hashCode();
}
- public java.lang.String toString()
+ public String toString()
{
return _value_;
}
- public java.lang.Object readResolve() throws java.io.ObjectStreamException
+ public Object readResolve()
{
return fromValue(_value_);
}
@@ -121,7 +121,6 @@
*
* @param portletMode The <code>javax.portlet.PortletMode</code> which should be resolved as
* as portlet mode defined in wsrp.
- * @return
**/
public static Modes getWsrpModeFromJsrPortletMode(PortletMode portletMode)
{
1.6 +1 -2 ws-wsrp4j/src/org/apache/wsrp4j/util/AuthenticationInfoHelper.java
Index: AuthenticationInfoHelper.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/util/AuthenticationInfoHelper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AuthenticationInfoHelper.java 10 Aug 2005 15:10:23 -0000 1.5
+++ AuthenticationInfoHelper.java 11 Aug 2005 13:00:01 -0000 1.6
@@ -80,7 +80,6 @@
* passed info could not be matched the same string is returned.
*
* @param wsrpInfo
- * @return
**/
public static String getPortletFromWsrp(String wsrpInfo)
{
1.11 +80 -232 ws-wsrp4j/src/org/apache/wsrp4j/util/ParameterChecker.java
Index: ParameterChecker.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/util/ParameterChecker.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ParameterChecker.java 11 Aug 2005 12:18:31 -0000 1.10
+++ ParameterChecker.java 11 Aug 2005 13:00:01 -0000 1.11
@@ -192,21 +192,13 @@
if (isCheckEnabled())
{
// check PerformBlockingInteraction request object pointer
- if (request instanceof PerformBlockingInteraction)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
- check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
- check(request.getInteractionParams(), Constants.NILLABLE_FALSE);
-
- } else
- {
- throwMissingParametersFault("Input object is not from type PerformBlockingInteraction or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
+ check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
+ check(request.getInteractionParams(), Constants.NILLABLE_FALSE);
}
}
@@ -226,16 +218,7 @@
if (isCheckEnabled())
{
// check InitCookie request object pointer
- if (request instanceof InitCookie)
- {
-
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not from type InitCookie or is null");
- }
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
}
}
@@ -257,16 +240,9 @@
if (isCheckEnabled())
{
// check GetPortletDescription request object pointer
- if (request instanceof GetPortletDescription)
- {
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
- throwMissingParametersFault("Input object is not from type GetPortletDescription or is null");
- }
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
}
}
@@ -288,19 +264,10 @@
if (isCheckEnabled())
{
// check ClonePortlet request object pointer
- if (request instanceof ClonePortlet)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not a ClonePortlet or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
}
}
@@ -321,18 +288,9 @@
if (isCheckEnabled())
{
// check DestroyPortlet request object pointer
- if (request instanceof DestroyPortlets)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletHandles(), Constants.NILLABLE_FALSE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not a DestroyPortlets or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletHandles(), Constants.NILLABLE_FALSE);
}
}
@@ -355,20 +313,11 @@
if (isCheckEnabled())
{
// check SetPortletProperties request object pointer
- if (request instanceof SetPortletProperties)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
- check(request.getPropertyList(), Constants.NILLABLE_FALSE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not a SetPortletProperties or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
+ check(request.getPropertyList(), Constants.NILLABLE_FALSE);
}
}
@@ -384,26 +333,18 @@
*
* @throws MissingParametersFault
*
- * @see GetPortletPorperties
+ * @see GetPortletProperties
*/
public void check(GetPortletProperties request) throws MissingParametersFault
{
if (isCheckEnabled())
{
// check GetPortletProperties request object pointer
- if (request instanceof GetPortletProperties)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
- check(request.getNames(), Constants.NILLABLE_TRUE);
-
- } else
- {
- throwMissingParametersFault("Input object is not a GetPortletProperties or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
+ check(request.getNames(), Constants.NILLABLE_TRUE);
}
}
@@ -425,19 +366,10 @@
if (isCheckEnabled())
{
// check GetPortletPropertyDescription request object pointer
- if (request instanceof GetPortletPropertyDescription)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getPortletContext(), Constants.NILLABLE_FALSE);
- check(request.getUserContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not a GetPortletPropertyDescription or is null");
- }
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getPortletContext(), Constants.NILLABLE_FALSE);
+ check(request.getUserContext(), Constants.NILLABLE_TRUE);
}
}
@@ -451,27 +383,18 @@
*
* @throws MissingParametersFault
*
- * @see ReleaseSession
+ * @see ReleaseSessions
*/
public void check(ReleaseSessions request) throws MissingParametersFault
{
if (isCheckEnabled())
{
// check ReleaseSession request object pointer
- if (request instanceof ReleaseSessions)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- // check sessionhandles array
- check(request.getSessionIDs(), Constants.NILLABLE_FALSE);
-
- } else
- {
-
- throwMissingParametersFault("Input object is not a ReleaseSession or is null");
- }
+ // check sessionhandles array
+ check(request.getSessionIDs(), Constants.NILLABLE_FALSE);
}
}
@@ -495,31 +418,24 @@
if (isCheckEnabled()) {
if (response != null) {
// check ServiceDescription object pointer
- if (response instanceof ServiceDescription) {
-
- if (response.getOfferedPortlets() != null) {
-
- PortletDescription[] portletDesc = response.getOfferedPortlets();
+ if (response.getOfferedPortlets() != null) {
- for (int i = 0; i < portletDesc.length; i++) {
+ PortletDescription[] portletDesc = response.getOfferedPortlets();
- check(portletDesc[i]);
- }
+ for (int i = 0; i < portletDesc.length; i++) {
- } else if (response.getRequiresInitCookie() != null) {
+ check(portletDesc[i]);
+ }
- check(response.getRequiresInitCookie(), true);
+ } else if (response.getRequiresInitCookie() != null) {
- } else if (response.getResourceList() != null) {
+ check(response.getRequiresInitCookie(), true);
- check(response.getResourceList(), true);
+ } else if (response.getResourceList() != null) {
- }
- } else {
+ check(response.getResourceList(), true);
- throwMissingParametersFault("No valid service description.");
}
-
} else {
throwMissingParametersFault("No valid service description response found.");
@@ -546,30 +462,22 @@
if (isCheckEnabled())
{
// check BlockingInteractionResponse object pointer
- if (response instanceof BlockingInteractionResponse)
+ if (response.getUpdateResponse() != null && response.getRedirectURL() == null)
{
- if (response.getUpdateResponse() != null && response.getRedirectURL() == null)
- {
-
- check(response.getUpdateResponse());
+ check(response.getUpdateResponse());
- } else if (response.getRedirectURL() != null && response.getUpdateResponse() == null)
- {
+ } else if (response.getRedirectURL() != null && response.getUpdateResponse() == null)
+ {
- // everything is fine
+ // everything is fine
- } else
- {
-
- throwMissingParametersFault(
- "No valid blocking interaction response. UpdateResponse"
- + "and redirect url are mutually exclusive");
- }
} else
{
- throwMissingParametersFault("No valid blocking interaction response found.");
+ throwMissingParametersFault(
+ "No valid blocking interaction response. UpdateResponse"
+ + "and redirect url are mutually exclusive");
}
}
}
@@ -592,20 +500,11 @@
{
// check UpdateResponse object pointer
- if (response instanceof UpdateResponse)
- {
-
- check(response.getSessionContext(), Constants.NILLABLE_TRUE);
- check(response.getPortletContext(), Constants.NILLABLE_TRUE);
- check(response.getMarkupContext(), Constants.NILLABLE_TRUE);
-
- // TODO: check for valid window states and portlet modes
-
- } else
- {
+ check(response.getSessionContext(), Constants.NILLABLE_TRUE);
+ check(response.getPortletContext(), Constants.NILLABLE_TRUE);
+ check(response.getMarkupContext(), Constants.NILLABLE_TRUE);
- throwMissingParametersFault("No valid update response found.");
- }
+ // TODO: check for valid window states and portlet modes
}
/**
@@ -625,17 +524,8 @@
if (isCheckEnabled())
{
// check MarkupResponse object pointer
- if (response instanceof MarkupResponse)
- {
-
- check(response.getMarkupContext(), Constants.NILLABLE_FALSE);
- check(response.getSessionContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid markup response found.");
- }
+ check(response.getMarkupContext(), Constants.NILLABLE_FALSE);
+ check(response.getSessionContext(), Constants.NILLABLE_TRUE);
}
}
@@ -656,17 +546,8 @@
if (isCheckEnabled())
{
// check MarkupResponse object pointer
- if (response instanceof PortletDescriptionResponse)
- {
-
- check(response.getPortletDescription());
- check(response.getResourceList(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid PortletDescriptionResponse response found.");
- }
+ check(response.getPortletDescription());
+ check(response.getResourceList(), Constants.NILLABLE_TRUE);
}
}
@@ -686,18 +567,9 @@
if (isCheckEnabled())
{
// check MarkupResponse object pointer
- if (response instanceof PortletPropertyDescriptionResponse)
- {
-
- // TODO: check ModelDescription
-
- check(response.getResourceList(), Constants.NILLABLE_TRUE);
+ // TODO: check ModelDescription
- } else
- {
-
- throwMissingParametersFault("No valid PortletPropertyDescriptionResponse response found.");
- }
+ check(response.getResourceList(), Constants.NILLABLE_TRUE);
}
}
@@ -717,16 +589,7 @@
if (isCheckEnabled())
{
// check MarkupResponse object pointer
- if (response instanceof DestroyPortletsResponse)
- {
-
- check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid PortletDescriptionResponse response found.");
- }
+ check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
}
}
@@ -751,23 +614,14 @@
if (isCheckEnabled())
{
// check PortletDescription object pointer
- if (element instanceof PortletDescription)
+ if (element.getPortletHandle() == null)
{
+ throwMissingParametersFault("A portlet handle has to be set in the portlet description.");
+ }
- if (element.getPortletHandle() == null)
- {
- throwMissingParametersFault("A portlet handle has to be set in the portlet description.");
- }
-
- if (element.getMarkupTypes() == null)
- {
- throwMissingParametersFault("Markup types have to be defined in the portlet description.");
- }
-
- } else
+ if (element.getMarkupTypes() == null)
{
-
- throwMissingParametersFault("No valid portlet description found.");
+ throwMissingParametersFault("Markup types have to be defined in the portlet description.");
}
}
}
@@ -788,20 +642,14 @@
if (isCheckEnabled())
{
// check PortletDescription object pointer
- if (element instanceof Templates)
+ if (element.getDefaultTemplate() == null)
{
- if (element.getDefaultTemplate() == null)
- {
- throwMissingParametersFault("DefaultTemplate has not been set!");
- }
+ throwMissingParametersFault("DefaultTemplate has not been set!");
+ }
- if (element.getSecureDefaultTemplate() == null)
- {
- throwMissingParametersFault("SecureDefaultTemplate Template has not been set!");
- }
- } else
+ if (element.getSecureDefaultTemplate() == null)
{
- throwMissingParametersFault("Consumer has to provide templates!");
+ throwMissingParametersFault("SecureDefaultTemplate Template has not been set!");
}
}
}
@@ -1248,7 +1096,7 @@
* Validates the ResourceList object for available resources.
*
* @param resourceList
- * @param nillable, true if null is allowed
+ * @param nillable true if null is allowed
*
* @throws MissingParametersFault
*/
@@ -1283,7 +1131,7 @@
* Validates the CookieProtocol object
*
* @param requiresInit
- * @param nillable, true if null is allowed
+ * @param nillable true if null is allowed
*
* @throws MissingParametersFault
*/
@@ -1375,7 +1223,7 @@
*
* @throws MissingParametersFault
*
- * @see MissingParameterFault
+ * @see MissingParametersFault
*/
private void throwMissingParametersFault(String msg) throws MissingParametersFault
{
1.6 +3 -7 ws-wsrp4j/src/org/apache/wsrp4j/util/PropertyListHelper.java
Index: PropertyListHelper.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/util/PropertyListHelper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PropertyListHelper.java 10 Aug 2005 15:10:23 -0000 1.5
+++ PropertyListHelper.java 11 Aug 2005 13:00:01 -0000 1.6
@@ -61,7 +61,7 @@
}
- };
+ }
public PropertyList makeSample()
{
@@ -168,10 +168,6 @@
sw.flush();
return sw.toString();
}
- private String quote(String ss)
- {
- return new String("\"" + ss + "\"");
- }
/**
* Method writePropertyDescriptionAsString.
@@ -289,7 +285,7 @@
}
return null;
}
- public Property updateProperty(Property prop, String xmlStringValue) throws InvalidXMLStringException
+ public Property updateProperty(Property prop, String xmlStringValue)
{
//String temp = new String("<" + name + ">" + xmlStringValue + "</" + name + ">");
1.8 +1 -2 ws-wsrp4j/src/org/apache/wsrp4j/util/WindowStates.java
Index: WindowStates.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/util/WindowStates.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WindowStates.java 10 Aug 2005 15:10:23 -0000 1.7
+++ WindowStates.java 11 Aug 2005 13:00:01 -0000 1.8
@@ -125,7 +125,6 @@
*
* @param portletState The <code>javax.portlet.WindowState</code> which should be resolved as
* as portlet window state defined in wsrp.
- * @return
**/
public static WindowStates getWsrpStateFromJsrPortletState(WindowState portletState)
{
1.5 +2 -2 ws-wsrp4j/portlets/proxyportlet/src/org/apache/wsrp4j/consumer/portlet/impl/ResourceProxy.java
Index: ResourceProxy.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/portlets/proxyportlet/src/org/apache/wsrp4j/consumer/portlet/impl/ResourceProxy.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ResourceProxy.java 10 Aug 2005 15:10:23 -0000 1.4
+++ ResourceProxy.java 11 Aug 2005 13:00:01 -0000 1.5
@@ -49,7 +49,7 @@
try
{
- URL url = new URL(URLDecoder.decode(targetURL));
+ URL url = new URL(URLDecoder.decode(targetURL, "utf-8"));
URLConnection conn = url.openConnection();
conn.connect();