Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 2583 invoked from network); 3 Feb 2009 09:19:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Feb 2009 09:19:26 -0000 Received: (qmail 9062 invoked by uid 500); 3 Feb 2009 09:19:26 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 8965 invoked by uid 500); 3 Feb 2009 09:19:26 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 8956 invoked by uid 500); 3 Feb 2009 09:19:26 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 8953 invoked by uid 99); 3 Feb 2009 09:19:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Feb 2009 01:19:26 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Feb 2009 09:19:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D7E49238898E; Tue, 3 Feb 2009 09:19:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r740254 - in /webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy: MTOMInHandler.java MTOMOutHandler.java MTOMPolicy.java Utils.java Date: Tue, 03 Feb 2009 09:19:04 -0000 To: axis2-cvs@ws.apache.org From: nandana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090203091904.D7E49238898E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nandana Date: Tue Feb 3 09:19:04 2009 New Revision: 740254 URL: http://svn.apache.org/viewvc?rev=740254&view=rev Log: AXIS2-4220 applying javadoc patches. Thanks Dobri. Modified: webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMInHandler.java webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMOutHandler.java webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMPolicy.java webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/Utils.java Modified: webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMInHandler.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMInHandler.java?rev=740254&r1=740253&r2=740254&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMInHandler.java (original) +++ webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMInHandler.java Tue Feb 3 09:19:04 2009 @@ -31,8 +31,20 @@ import org.apache.neethi.Assertion; import org.apache.neethi.Policy; +/** + * This class does a MTOM validation of the message. It checks if it should be MTOMised, or
+ * if the message is compliant with the MTOM policy set. + */ public class MTOMInHandler extends AbstractHandler { + /** + * Checks if the message should be MTOMised. If it is not but the policy states that it should be
+ * then an {@link AxisFault} is thrown. + * + * @param msgCtx the {@link MessageContext} + * + * @throws AxisFault if the message is not MTOMised, but the policy states so. + */ public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault { Policy policy = msgCtx.getEffectivePolicy(); if (policy == null) { @@ -44,7 +56,7 @@ if (assertion instanceof MTOMAssertion) { String contentType = (String) msgCtx.getProperty(Constants.Configuration.CONTENT_TYPE); if (!assertion.isOptional()) { - if (contentType == null || contentType.indexOf(MTOMConstants.MTOM_TYPE) == -1) {//!MTOMConstants.MTOM_TYPE.equals(contentType) + if (contentType == null || contentType.indexOf(MTOMConstants.MTOM_TYPE) == -1) { if (msgCtx.isServerSide()) { throw new AxisFault( "The SOAP REQUEST sent by the client IS NOT MTOMized!"); Modified: webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMOutHandler.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMOutHandler.java?rev=740254&r1=740253&r2=740254&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMOutHandler.java (original) +++ webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMOutHandler.java Tue Feb 3 09:19:04 2009 @@ -29,8 +29,20 @@ import org.apache.neethi.Assertion; import org.apache.neethi.Policy; +/** + * This out handler does a check of the effective policy set. Based on that the corresponding MTOM property
+ * value is set. + */ public class MTOMOutHandler extends AbstractHandler { + /** + * Checks the effective policy set and based on it the enableMTOM is set to the appropriate value.
+ * E.g. if the policy states that MTOM is optional then the enableMTOM is set to this value. + * + * @param msgCtx the {@link MessageContext} + * + * @throws AxisFault + */ public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault { Policy policy = msgCtx.getEffectivePolicy(); Modified: webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMPolicy.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMPolicy.java?rev=740254&r1=740253&r2=740254&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMPolicy.java (original) +++ webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/MTOMPolicy.java Tue Feb 3 09:19:04 2009 @@ -33,11 +33,12 @@ import org.apache.neethi.Assertion; import org.apache.neethi.Policy; +/** + * The module implementation class for the MTOM module. + * + */ public class MTOMPolicy implements Module { - /* - * setup for logging - */ private static final Log log = LogFactory.getLog(MTOMPolicy.class); public void applyPolicy(Policy policy, AxisDescription axisDescription) @@ -45,7 +46,7 @@ if (log.isDebugEnabled()) { log.debug("applyPolicy() called on MTOMPolicy module"); } - + } public boolean canSupportAssertion(Assertion assertion) { Modified: webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/Utils.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/Utils.java?rev=740254&r1=740253&r2=740254&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/Utils.java (original) +++ webservices/axis2/trunk/java/modules/mtompolicy-mar/src/org/apache/axis2/mtompolicy/Utils.java Tue Feb 3 09:19:04 2009 @@ -34,16 +34,32 @@ import org.apache.axis2.policy.model.MTOM10Assertion; import org.apache.axis2.policy.model.MTOMAssertion; import org.apache.axis2.util.PolicyUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; +/** + * This is a MTOM module utility class. It contains some useful methods used into the MTOM module. + */ public class Utils { + private static final Log log = LogFactory.getLog(Utils.class); + private static final String MTOM_ASSERTION_APPLIED = "MTOM_ASSERTION_APPLIED"; + /** + * Extracts the MTOM assertion object if it is exists into the policy based on a given {@link AxisDescription}. + * + * @param axisDescription the {@link AxisDescription} object that should be searched. + * @return {@link MTOMAssertion} the {@link MTOMAssertion} found. If it is not found "null" is returned. + */ public static MTOMAssertion getMTOMAssertion(AxisDescription axisDescription) { if (axisDescription == null) { + if (log.isDebugEnabled()) { + log.debug("AxisDescription passed as parameter has a \"null\" value."); + } return null; } @@ -70,6 +86,13 @@ } + /** + * Locates the {@link AxisService} object searching up in the hierarchy recursively
+ * the {@link AxisDescription} object passed. + * + * @param axisDescription the {@link AxisDescription} object that should be checked. + * @return the {@link AxisService} object found or "null". + */ public static AxisService locateAxisService(AxisDescription axisDescription) { if (axisDescription == null || axisDescription instanceof AxisService) { @@ -79,12 +102,21 @@ } } + /** + * Based on the parameter passed a {@link MTOM10Assertion} object is created by default.
+ * Then it is added to a {@link Policy} object and returned. + * + * @param param the {@link Parameter} object that contains the value of the "enableMTOM" parameter:
+ * "true" or "optional". + * @return The {@link Policy} object for the MTOM assertion. + */ public static Policy getMTOMPolicy(Parameter param) { if (param == null) { return null; } + // TODO We need to give the user the ability to specify if MTOM 1.0 or MTOM 1.1 should be used. MTOMAssertion mtom10; if (Constants.VALUE_TRUE.equals(param.getValue())) { @@ -103,6 +135,13 @@ } + /** + * Applies the MTOM policy to the binding level of the web service. + * + * @param axisService the {@link AxisService} to whom binding level the MTOM policy should be attached. + * @param policy the {@link Policy} object that contains the MTOM assertion. + * @throws AxisFault thrown if the parameter is locked on a parent level - thus it could not be added. + */ public static void applyPolicyToSOAPBindings(AxisService axisService, Policy policy) throws AxisFault { @@ -115,8 +154,7 @@ for (Object obj : axisService.getEndpoints().values()) { AxisEndpoint endpoint = (AxisEndpoint) obj; - AxisBinding binding = endpoint.getBinding(); - + AxisBinding binding = endpoint.getBinding(); if (Java2WSDLConstants.TRANSPORT_URI.equals(binding.getType()) || WSDL2Constants.URI_WSDL2_SOAP.equals(binding.getType())) { binding.getPolicySubject().attachPolicy(policy);