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 ja...@apache.org on 2003/12/11 15:02:11 UTC
cvs commit: ws-wsrp4j/src/org/apache/wsrp4j/util ParameterChecker.java
jacob 2003/12/11 06:02:11
Modified: src/org/apache/wsrp4j/util ParameterChecker.java
Log:
check params only when trace level = TRACE_HIGH
Revision Changes Path
1.2 +518 -721 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParameterChecker.java 3 Sep 2003 20:29:32 -0000 1.1
+++ ParameterChecker.java 11 Dec 2003 14:02:11 -0000 1.2
@@ -1,62 +1,57 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "WSRP4J", and "Apache Software
- * Foundation" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
- * without prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
-
- */
-
-
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSRP4J", and "Apache Software
+ * Foundation" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
+ * without prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.wsrp4j.util;
import javax.xml.namespace.QName;
@@ -65,11 +60,7 @@
import oasis.names.tc.wsrp.v1.types.CookieProtocol;
import oasis.names.tc.wsrp.v1.types.DestroyFailed;
import oasis.names.tc.wsrp.v1.types.DestroyPortletsResponse;
-import oasis.names.tc.wsrp.v1.types.Handle;
-import oasis.names.tc.wsrp.v1.types.ID;
import oasis.names.tc.wsrp.v1.types.InteractionParams;
-import oasis.names.tc.wsrp.v1.types.InvalidHandleFault;
-import oasis.names.tc.wsrp.v1.types.Key;
import oasis.names.tc.wsrp.v1.types.MarkupContext;
import oasis.names.tc.wsrp.v1.types.MarkupParams;
import oasis.names.tc.wsrp.v1.types.MarkupResponse;
@@ -113,14 +104,12 @@
* required (R) parameters in the WSRP specification. Optional (O) parameters are ignored.
* If a parameter is specified as 'nillable' in the WSRP specification, the check is
* performed if the value is 'not null'. On null value, no checking is done.
- *
- * @author <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
*/
public class ParameterChecker
{
// for logging and exception support
- private Logger logger = LogManager.getLogManager().getLogger(this.getClass());
+ private Logger logger = LogManager.getLogManager().getLogger(ParameterChecker.class);
/**
* Default Constructor
@@ -129,6 +118,18 @@
{
}
+ /**
+ * @return true if we check
+ */
+ private boolean isCheckEnabled()
+ {
+ if (logger.isLogging(Logger.TRACE_HIGH))
+ {
+ return true;
+ }
+ return false;
+ }
+
/**
* --- THIS IS THE REQUEST SECTION OF THE PARAMETER-CHECKER ---
*/
@@ -147,22 +148,23 @@
*/
public void check(_getServiceDescription request) throws MissingParametersFault
{
-
- // check ClonePortlet request object pointer
- if (request instanceof _getServiceDescription)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
-
- } else
- {
- throwMissingParametersFault("Input object is not from type GetServiceDescription or is null");
- }
-
+ if (isCheckEnabled())
+ {
+ // check ClonePortlet request object pointer
+ if (request instanceof _getServiceDescription)
+ {
+
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+
+ } else
+ {
+ throwMissingParametersFault("Input object is not from type GetServiceDescription or is null");
+ }
+ }
}
- /**
+ /**
* Check the ModifyRegistration. The following attributes are mandatory:
*
* 1) RegistrationContext, only if available
@@ -176,20 +178,21 @@
*/
public void check(_modifyRegistration request) throws MissingParametersFault
{
-
- // check ClonePortlet request object pointer
- if (request instanceof _modifyRegistration)
- {
-
- // check for registration context
- check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
- check(request.getRegistrationData(), Constants.NILLABLE_FALSE);
-
- } else
- {
- throwMissingParametersFault("Input object is not from type ModifyRegistration or is null");
- }
-
+ if (isCheckEnabled())
+ {
+ // check ClonePortlet request object pointer
+ if (request instanceof _modifyRegistration)
+ {
+
+ // check for registration context
+ check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
+ check(request.getRegistrationData(), Constants.NILLABLE_FALSE);
+
+ } else
+ {
+ throwMissingParametersFault("Input object is not from type ModifyRegistration or is null");
+ }
+ }
}
/**
@@ -209,23 +212,24 @@
*/
public void check(_getMarkup request) throws MissingParametersFault
{
-
- // check ClonePortlet request object pointer
- if (request instanceof _getMarkup)
- {
-
- // 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);
-
- } else
- {
- throwMissingParametersFault("Input object is not from type GetMarkup or is null");
- }
-
+ if (isCheckEnabled())
+ {
+ // check ClonePortlet request object pointer
+ if (request instanceof _getMarkup)
+ {
+
+ // 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);
+
+ } else
+ {
+ throwMissingParametersFault("Input object is not from type GetMarkup or is null");
+ }
+ }
}
/**
@@ -246,24 +250,25 @@
*/
public void check(_performBlockingInteraction request) throws MissingParametersFault
{
-
- // 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");
- }
-
+ 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");
+ }
+ }
}
/**
@@ -279,19 +284,20 @@
*/
public void check(_initCookie request) throws MissingParametersFault
{
-
- // 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");
- }
-
+ 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");
+ }
+ }
}
/**
@@ -309,18 +315,20 @@
*/
public void check(_getPortletDescription request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -338,21 +346,23 @@
*/
public void check(_clonePortlet request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -369,20 +379,22 @@
*/
public void check(_destroyPortlets request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -401,22 +413,24 @@
*/
public void check(_setPortletProperties request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -435,22 +449,23 @@
*/
public void check(_getPortletProperties request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -468,21 +483,23 @@
*/
public void check(_getPortletPropertyDescription request) throws MissingParametersFault
{
-
- // 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");
- }
+ 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");
+ }
+ }
}
/**
@@ -499,22 +516,24 @@
*/
public void check(_releaseSessions request) throws MissingParametersFault
{
-
- // check ReleaseSession request object pointer
- if (request instanceof _releaseSessions)
- {
-
- // 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");
- }
+ if (isCheckEnabled())
+ {
+ // check ReleaseSession request object pointer
+ if (request instanceof _releaseSessions)
+ {
+
+ // 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");
+ }
+ }
}
/**
@@ -534,45 +553,47 @@
*/
public void check(ServiceDescription response) throws MissingParametersFault
{
+ if (isCheckEnabled())
+ {
+ // check ServiceDescription object pointer
+ if (response instanceof ServiceDescription)
+ {
- // check ServiceDescription object pointer
- if (response instanceof ServiceDescription)
- {
+ if (response != null)
+ {
- if (response != null)
- {
+ } else if (response.getOfferedPortlets() != null)
+ {
- } else if (response.getOfferedPortlets() != null)
- {
+ PortletDescription[] portletDesc = response.getOfferedPortlets();
- PortletDescription[] portletDesc = response.getOfferedPortlets();
+ for (int i = 0; i < portletDesc.length; i++)
+ {
- for (int i = 0; i < portletDesc.length; i++)
- {
+ check(portletDesc[i]);
+ }
- check(portletDesc[i]);
- }
+ } else if (response.getRequiresInitCookie() != null)
+ {
- } else if (response.getRequiresInitCookie() != null)
- {
+ check(response.getRequiresInitCookie(), true);
- check(response.getRequiresInitCookie(), true);
+ } else if (response.getResourceList() != null)
+ {
- } else if (response.getResourceList() != null)
- {
+ check(response.getResourceList(), true);
- check(response.getResourceList(), true);
+ } else
+ {
- } else
- {
+ throwMissingParametersFault("No valid service description.");
+ }
+ } else
+ {
- throwMissingParametersFault("No valid service description.");
- }
- } else
- {
-
- throwMissingParametersFault("No valid service description response found.");
- }
+ throwMissingParametersFault("No valid service description response found.");
+ }
+ }
}
/**
@@ -591,33 +612,35 @@
*/
public void check(BlockingInteractionResponse response) throws MissingParametersFault
{
-
- // check BlockingInteractionResponse object pointer
- if (response instanceof BlockingInteractionResponse)
- {
-
- if (response.getUpdateResponse() != null && response.getRedirectURL() == null)
- {
-
- check(response.getUpdateResponse());
-
- } else if (response.getRedirectURL() != null && response.getUpdateResponse() == null)
- {
-
- // 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.");
- }
+ if (isCheckEnabled())
+ {
+ // check BlockingInteractionResponse object pointer
+ if (response instanceof BlockingInteractionResponse)
+ {
+
+ if (response.getUpdateResponse() != null && response.getRedirectURL() == null)
+ {
+
+ check(response.getUpdateResponse());
+
+ } else if (response.getRedirectURL() != null && response.getUpdateResponse() == null)
+ {
+
+ // 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.");
+ }
+ }
}
/**
@@ -634,7 +657,7 @@
*
* @see UpdateResponse
*/
- public void check(UpdateResponse response) throws MissingParametersFault
+ private void check(UpdateResponse response) throws MissingParametersFault
{
// check UpdateResponse object pointer
@@ -645,13 +668,6 @@
check(response.getPortletContext(), Constants.NILLABLE_TRUE);
check(response.getMarkupContext(), Constants.NILLABLE_TRUE);
- // check navigational state
-/* if (response.getNavigationalState() == null)
- {
-
- throwMissingParametersFault("No valid update response found. No navigational state found");
- }
-*/
// TODO: check for valid window states and portlet modes
} else
@@ -675,19 +691,21 @@
*/
public void check(MarkupResponse response) throws MissingParametersFault
{
-
- // 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.");
- }
+ 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.");
+ }
+ }
}
/**
@@ -704,19 +722,21 @@
*/
public void check(PortletDescriptionResponse response) throws MissingParametersFault
{
-
- // check MarkupResponse object pointer
- if (response instanceof PortletDescriptionResponse)
- {
-
- check(response.getPortletDescription());
- check(response.getResourceList(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid PortletDescriptionResponse response found.");
- }
+ 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.");
+ }
+ }
}
/**
@@ -732,20 +752,22 @@
*/
public void check(PortletPropertyDescriptionResponse response) throws MissingParametersFault
{
-
- // check MarkupResponse object pointer
- if (response instanceof PortletPropertyDescriptionResponse)
- {
-
- // TODO: check ModelDescription
-
- check(response.getResourceList(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid PortletPropertyDescriptionResponse response found.");
- }
+ if (isCheckEnabled())
+ {
+ // check MarkupResponse object pointer
+ if (response instanceof PortletPropertyDescriptionResponse)
+ {
+
+ // TODO: check ModelDescription
+
+ check(response.getResourceList(), Constants.NILLABLE_TRUE);
+
+ } else
+ {
+
+ throwMissingParametersFault("No valid PortletPropertyDescriptionResponse response found.");
+ }
+ }
}
/**
@@ -761,18 +783,20 @@
*/
public void check(DestroyPortletsResponse response) throws MissingParametersFault
{
-
- // check MarkupResponse object pointer
- if (response instanceof DestroyPortletsResponse)
- {
-
- check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
-
- } else
- {
-
- throwMissingParametersFault("No valid PortletDescriptionResponse response found.");
- }
+ if (isCheckEnabled())
+ {
+ // check MarkupResponse object pointer
+ if (response instanceof DestroyPortletsResponse)
+ {
+
+ check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
+
+ } else
+ {
+
+ throwMissingParametersFault("No valid PortletDescriptionResponse response found.");
+ }
+ }
}
/**
@@ -793,26 +817,28 @@
*/
public void check(PortletDescription element) throws MissingParametersFault
{
-
- // check PortletDescription object pointer
- if (element instanceof PortletDescription)
- {
-
- if (element.getPortletHandle() == null)
- {
- throwMissingParametersFault("An 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
- {
-
- throwMissingParametersFault("No valid portlet description found.");
- }
+ 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.getMarkupTypes() == null)
+ {
+ throwMissingParametersFault("Markup types have to be defined in the portlet description.");
+ }
+
+ } else
+ {
+
+ throwMissingParametersFault("No valid portlet description found.");
+ }
+ }
}
/**
@@ -828,56 +854,25 @@
*/
public void check(Templates element) throws MissingParametersFault
{
-
- // check PortletDescription object pointer
- if (element instanceof Templates)
- {
-
- if (element.getBlockingActionTemplate() == null)
- {
- throwMissingParametersFault("BlockingActionTemplate has not been set!");
- }
-
- if (element.getDefaultTemplate() == null)
- {
- throwMissingParametersFault("DefaultTemplate has not been set!");
- }
-
- if (element.getRenderTemplate() == null)
- {
- throwMissingParametersFault("RenderTemplate has not been set!");
- }
-
- if (element.getResourceTemplate() == null)
- {
- throwMissingParametersFault("ResourceTemplate has not been set!");
- }
-
- if (element.getSecureBlockingActionTemplate() == null)
- {
- throwMissingParametersFault("SecureBlockingActionTemplate has not been set!");
- }
-
- if (element.getSecureDefaultTemplate() == null)
- {
- throwMissingParametersFault("SecureDefaultTemplate Template has not been set!");
- }
-
- if (element.getSecureRenderTemplate() == null)
- {
- throwMissingParametersFault("SecureRenderTemplate has not been set!");
- }
-
- if (element.getSecureResourceTemplate() == null)
- {
- throwMissingParametersFault("SecureResourceTemplate has not been set!");
- }
-
- } else
- {
-
- throwMissingParametersFault("Consumer has to provide templates!");
- }
+ if (isCheckEnabled())
+ {
+ // check PortletDescription object pointer
+ if (element instanceof Templates)
+ {
+ if (element.getDefaultTemplate() == null)
+ {
+ throwMissingParametersFault("DefaultTemplate has not been set!");
+ }
+
+ if (element.getSecureDefaultTemplate() == null)
+ {
+ throwMissingParametersFault("SecureDefaultTemplate Template has not been set!");
+ }
+ } else
+ {
+ throwMissingParametersFault("Consumer has to provide templates!");
+ }
+ }
}
/**
@@ -894,34 +889,25 @@
*
* @see SessionContext
*/
- public void check(SessionContext context, boolean nillable) throws MissingParametersFault
+ private void check(SessionContext context, boolean nillable) throws MissingParametersFault
{
-
if (context != null)
{
-
if (context.getSessionID() == null)
{
-
throwMissingParametersFault("No valid session context found. No session handle set.");
-
} else
{
-
// check, if the ID is valid, instance and length
-
//TODO: activate this, if ID is no longer as string declared!
//check(context.getSessionID());
}
-
if (context.getExpires() == 0)
{
throwMissingParametersFault("No valid session context found. No session expire set.");
}
-
} else
{
-
if (!nillable)
{
throwMissingParametersFault("No valid session context found.");
@@ -943,12 +929,10 @@
*
* @see MarkupContext
*/
- public void check(MarkupContext context, boolean nillable) throws MissingParametersFault
+ private void check(MarkupContext context, boolean nillable) throws MissingParametersFault
{
-
if (context != null)
{
-
boolean bMarkupBinary = false, bMarkupString = false;
if (context.getMarkupBinary() != null)
{
@@ -962,13 +946,11 @@
// XOR of markupBinary and markupString
if (bMarkupBinary ^ bMarkupString)
{
-
if (context.getMimeType() == null)
{
throwMissingParametersFault("MimeType not set in MarkupContext.");
} else
{
-
if (context.getLocale() == null)
{
throwMissingParametersFault("Locale not set in MarkupContext.");
@@ -977,10 +959,8 @@
}
} else
{
-
if (!nillable)
{
-
throwMissingParametersFault("No valid markup context found.");
}
}
@@ -1001,28 +981,26 @@
*/
public void check(PropertyList propertyList, boolean nillable) throws MissingParametersFault
{
-
- // check only, if object not null, otherwise ignore. Object is defined as nillable
- if (propertyList != null)
- {
-
- // property is mandatory
- if (propertyList.getProperties() == null)
- {
-
- throwMissingParametersFault("PropertyList[] in PropertyList is null");
- }
-
- } else
- {
-
- // check if nillable is allowed
- if (nillable == false)
- {
-
- throwMissingParametersFault("PropertyList object is null");
- }
- }
+ if (isCheckEnabled())
+ {
+ // check only, if object not null, otherwise ignore. Object is defined as nillable
+ if (propertyList != null)
+ {
+ // property is mandatory
+ if (propertyList.getProperties() == null)
+ {
+ throwMissingParametersFault("PropertyList[] in PropertyList is null");
+ }
+
+ } else
+ {
+ // check if nillable is allowed
+ if (nillable == false)
+ {
+ throwMissingParametersFault("PropertyList object is null");
+ }
+ }
+ }
}
/**
@@ -1041,34 +1019,31 @@
*/
public void check(RegistrationData registrationData, boolean nillable) throws MissingParametersFault
{
-
- // check only, if object not null, otherwise ignore. Object is defined as nillable
- if (registrationData != null)
- {
-
- // check the consumer name, is mandatory
- if (registrationData.getConsumerName() == null)
- {
-
- throwMissingParametersFault("ConsumerName in RegistrationData is null");
- }
- // check the consumer agent, is mandatory
- if (registrationData.getConsumerAgent() == null)
- {
-
- throwMissingParametersFault("ConsumerAgent in RegistrationData is null");
- }
-
- } else
- {
-
- // if registrationcontext is null, check if nillable is allowed
- if (nillable == false)
- {
-
- throwMissingParametersFault("RegistrationData object is null");
- }
- }
+ if (isCheckEnabled())
+ {
+ // check only, if object not null, otherwise ignore. Object is defined as nillable
+ if (registrationData != null)
+ {
+ // check the consumer name, is mandatory
+ if (registrationData.getConsumerName() == null)
+ {
+ throwMissingParametersFault("ConsumerName in RegistrationData is null");
+ }
+ // check the consumer agent, is mandatory
+ if (registrationData.getConsumerAgent() == null)
+ {
+ throwMissingParametersFault("ConsumerAgent in RegistrationData is null");
+ }
+
+ } else
+ {
+ // if registrationcontext is null, check if nillable is allowed
+ if (nillable == false)
+ {
+ throwMissingParametersFault("RegistrationData object is null");
+ }
+ }
+ }
}
/**
@@ -1088,27 +1063,21 @@
*
* @see String
*/
- public void check(String[] array, boolean nillable) throws MissingParametersFault
+ private void check(String[] array, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (array != null)
{
-
// check the array
if (array.length == 0)
{
-
throwMissingParametersFault("String[] array length is zero (0)");
}
-
} else
{
-
// if array is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("String array[] object is null");
}
}
@@ -1128,27 +1097,21 @@
*
* @see InteractionParams
*/
- public void check(InteractionParams interactionParams, boolean nillable) throws MissingParametersFault
+ private void check(InteractionParams interactionParams, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (interactionParams != null)
{
-
// check the portletHandle, is mandatory
if (interactionParams.getPortletStateChange() == null)
{
-
throwMissingParametersFault("PortletStateChange in InteractionParams is null");
}
-
} else
{
-
// if registrationcontext is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("InteractionParams object is null");
}
}
@@ -1171,28 +1134,25 @@
*/
public void check(RegistrationContext registrationContext, boolean nillable) throws MissingParametersFault
{
-
- // check only, if object not null, otherwise ignore. Object is defined as nillable
- if (registrationContext != null)
- {
-
- // check the registrationHandle, is mandatory
- if (registrationContext.getRegistrationHandle() == null)
- {
-
- throwMissingParametersFault("RegistrationHandle in RegistrationContext is null");
- }
-
- } else
- {
-
- // if registrationcontext is null, check if nillable is allowed
- if (nillable == false)
- {
-
- throwMissingParametersFault("RegistrationContext object is null");
- }
- }
+ if (isCheckEnabled())
+ {
+ // check only, if object not null, otherwise ignore. Object is defined as nillable
+ if (registrationContext != null)
+ {
+ // check the registrationHandle, is mandatory
+ if (registrationContext.getRegistrationHandle() == null)
+ {
+ throwMissingParametersFault("RegistrationHandle in RegistrationContext is null");
+ }
+ } else
+ {
+ // if registrationcontext is null, check if nillable is allowed
+ if (nillable == false)
+ {
+ throwMissingParametersFault("RegistrationContext object is null");
+ }
+ }
+ }
}
/**
@@ -1211,28 +1171,25 @@
*/
public void check(PortletContext portletContext, boolean nillable) throws MissingParametersFault
{
-
- // check only, if object not null, otherwise ignore. Object is defined as nillable
- if (portletContext != null)
- {
-
- // check the portletHandle, is mandatory
- if (portletContext.getPortletHandle() == null)
- {
-
- throwMissingParametersFault("PortletHandle in PortletContext is null");
- }
-
- } else
- {
-
- // if registrationcontext is null, check if nillable is allowed
- if (nillable == false)
- {
-
- throwMissingParametersFault("PortletContext object is null");
- }
- }
+ if (isCheckEnabled())
+ {
+ // check only, if object not null, otherwise ignore. Object is defined as nillable
+ if (portletContext != null)
+ {
+ // check the portletHandle, is mandatory
+ if (portletContext.getPortletHandle() == null)
+ {
+ throwMissingParametersFault("PortletHandle in PortletContext is null");
+ }
+ } else
+ {
+ // if registrationcontext is null, check if nillable is allowed
+ if (nillable == false)
+ {
+ throwMissingParametersFault("PortletContext object is null");
+ }
+ }
+ }
}
/**
@@ -1250,13 +1207,11 @@
*
* @see RuntimeContext
*/
- public void check(RuntimeContext runtimeContext, boolean nillable) throws MissingParametersFault
+ private void check(RuntimeContext runtimeContext, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (runtimeContext != null)
{
-
// check the userAuthentication, is mandatory
if (runtimeContext.getUserAuthentication() == null)
{
@@ -1266,18 +1221,14 @@
// check the portletHandle, is mandatory
if (runtimeContext.getPortletInstanceKey() != null)
{
-
//TODO: activate this, if the string is changed to key type
//check(runtimeContext.getPortletInstanceKey());
}
-
} else
{
-
// if registrationcontext is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("RuntimeContext object is null");
}
}
@@ -1293,19 +1244,15 @@
* false, if the DestroyFailed[] is not nillable
*
*/
- public void check(DestroyFailed[] destroyFailedArray, boolean nillable) throws MissingParametersFault
+ private void check(DestroyFailed[] destroyFailedArray, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (destroyFailedArray != null)
{
-
if (destroyFailedArray.length > 0)
{
-
for (int x = 0; x < destroyFailedArray.length; x++)
{
-
// mandatory
if (destroyFailedArray[x].getPortletHandle() == null)
{
@@ -1320,17 +1267,13 @@
}
} else
{
-
throwMissingParametersFault("DestroyFailedArray length is zero (0).");
}
-
} else
{
-
// if destroyFailedArray is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("DestroyFailed[] object is null");
}
}
@@ -1350,27 +1293,21 @@
*
* @see UserContext
*/
- public void check(UserContext userContext, boolean nillable) throws MissingParametersFault
+ private void check(UserContext userContext, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (userContext != null)
{
-
// check the UserContextKey, is mandatory
if (userContext.getUserContextKey() == null)
{
-
throwMissingParametersFault("UserContextKey in UserContext is null");
}
-
} else
{
-
// if registrationcontext is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("UserContext object is null");
}
}
@@ -1384,35 +1321,28 @@
*
* @throws MissingParametersFault
*/
- public void check(ResourceList resourceList, boolean nillable) throws MissingParametersFault
+ private void check(ResourceList resourceList, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null.
if (resourceList != null)
{
-
// check for Resources, it's mandatory
if (resourceList.getResources() == null)
{
-
throwMissingParametersFault("Resource[] is null");
} else
{
-
Resource[] resourceArray = resourceList.getResources();
if (resourceArray.length < 1)
{
-
throwMissingParametersFault("ResourceArray length is zero (0).");
}
}
} else
{
-
// if registrationcontext is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("ResourceList object is null");
}
}
@@ -1426,36 +1356,27 @@
*
* @throws MissingParametersFault
*/
- public void check(CookieProtocol requiresInit, boolean nillable) throws MissingParametersFault
+ private void check(CookieProtocol requiresInit, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null.
if (requiresInit != null)
{
-
if (requiresInit.toString().equals(CookieProtocol._none))
{
-
} else if (requiresInit.toString().equals(CookieProtocol._perGroup))
{
-
} else if (requiresInit.toString().equals(CookieProtocol._perUser))
{
-
} else
{
-
throwMissingParametersFault(
"Invalid value (" + requiresInit.toString() + ") of CookieProtocol object.");
}
-
} else
{
-
// if requiresInit is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("RequiresInitCookie object is null");
}
}
@@ -1480,150 +1401,43 @@
*
* @see MarkupParams
*/
- public void check(MarkupParams markupParams, boolean nillable) throws MissingParametersFault
+ private void check(MarkupParams markupParams, boolean nillable) throws MissingParametersFault
{
-
// check only, if object not null, otherwise ignore. Object is defined as nillable
if (markupParams != null)
{
-
// check ClientData, is mandatory
if (markupParams.getClientData() == null)
{
throwMissingParametersFault("ClientData in MarkupParams is null");
}
-
if (markupParams.getLocales() == null)
{
-
throwMissingParametersFault("Locales in MarkupParams is null");
}
-
if (markupParams.getMimeTypes() == null)
{
-
throwMissingParametersFault("MimeTypes in MarkupParams is null");
}
-
if (markupParams.getMode() == null)
{
-
throwMissingParametersFault("Mode in MarkupParams is null");
}
-
if (markupParams.getWindowState() == null)
{
-
throwMissingParametersFault("WindowState in MarkupParams is null");
}
-
} else
{
-
// if registrationcontext is null, check if nillable is allowed
if (nillable == false)
{
-
throwMissingParametersFault("MarkupParams object is null");
}
}
}
/**
- * Checks the Handle class against the instance and the length
- *
- * @param handle
- *
- * @throws InvalidHandleFault
- */
- public void check(Handle handle) throws InvalidHandleFault
- {
-
- if (handle instanceof Handle)
- {
-
- int handleLen = handle.getValue().length();
-
- if (handleLen < 1)
- {
-
- throwInvalidHandleFault("Handle too small");
- }
-
- if (handleLen > 255)
- {
-
- throwInvalidHandleFault("Handle too long");
- }
-
- } else
- {
-
- throwInvalidHandleFault("Argument is not instance of type Handle or is null");
- }
- }
-
- /**
- * Checks the ID class against the instance and the length
- *
- * @param id
- *
- * @throws InvalidHandleFault
- */
- public void check(ID id) throws InvalidHandleFault
- {
-
- if (id instanceof ID)
- {
- int idLen = id.getValue().length();
-
- if (idLen < 1)
- {
- throwInvalidHandleFault("ID too small");
- }
-
- if (idLen > 4196)
- {
- throwInvalidHandleFault("ID too long");
- }
-
- } else
- {
- throwInvalidHandleFault("Argument is not instance of type ID or is null");
- }
- }
-
- /**
- * Checks the Key class against the instance and the length
- *
- * @param key
- *
- * @throws InvalidHandleFault
- */
- public void check(Key key) throws InvalidHandleFault
- {
-
- if (key instanceof Key)
- {
- int keyLen = key.getValue().length();
-
- if (keyLen < 1)
- {
- throwInvalidHandleFault("Key too small");
- }
-
- if (keyLen > 4196)
- {
- throwInvalidHandleFault("Key too long");
- }
-
- } else
- {
- throwInvalidHandleFault("Argument is not instance of type Key or is null");
- }
- }
-
- /**
* Creates and throws a MissingParametersFault exception
*
* @param String error message
@@ -1636,23 +1450,6 @@
{
MissingParametersFault e = new MissingParametersFault();
e.setFaultCode(new QName("urn:oasis:names:tc:wsrp:v1:types", "Interface.MissingParameters"));
- e.setFaultString(msg);
- throw e;
- }
-
- /**
- * Creates and throws a InvalidHandleFault exception
- *
- * @param String error message
- *
- * @throws InvalidHandleFault
- *
- * @see InvalidHandleFault
- */
- private void throwInvalidHandleFault(String msg) throws InvalidHandleFault
- {
- InvalidHandleFault e = new InvalidHandleFault();
- e.setFaultCode(new QName("urn:oasis:names:tc:wsrp:v1:types", "Interface.InvalidHandle"));
e.setFaultString(msg);
throw e;
}