src/share/jaxws_classes/com/sun/xml/internal/ws/api/config/management/policy/ManagedClientAssertion.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.xml.internal.ws.api.config.management.policy;
    28 import com.sun.istack.internal.logging.Logger;
    29 import com.sun.xml.internal.ws.api.client.WSPortInfo;
    30 import com.sun.xml.internal.ws.policy.PolicyAssertion;
    31 import com.sun.xml.internal.ws.policy.PolicyMap;
    32 import com.sun.xml.internal.ws.policy.PolicyConstants;
    33 import com.sun.xml.internal.ws.policy.sourcemodel.AssertionData;
    34 import com.sun.xml.internal.ws.policy.spi.AssertionCreationException;
    35 import com.sun.xml.internal.ws.resources.ManagementMessages;
    37 import java.util.Collection;
    38 import javax.xml.namespace.QName;
    39 import javax.xml.ws.WebServiceException;
    41 /**
    42  * The client-side ManagedClient policy assertion.
    43  *
    44  * @author Fabian Ritzmann
    45  */
    46 public class ManagedClientAssertion extends ManagementAssertion {
    48     public static final QName MANAGED_CLIENT_QNAME =
    49             new QName(PolicyConstants.SUN_MANAGEMENT_NAMESPACE, "ManagedClient");
    51     private static final Logger LOGGER = Logger.getLogger(ManagedClientAssertion.class);
    53     /**
    54      * Return ManagedClient assertion if there is one associated with the client.
    55      *
    56      * @param portInfo The client PortInfo.
    57      * @return The policy assertion if found. Null otherwise.
    58      * @throws WebServiceException If computing the effective policy of the port failed.
    59      */
    60     public static ManagedClientAssertion getAssertion(WSPortInfo portInfo) throws WebServiceException {
    61         if (portInfo == null)
    62                 return null;
    64         LOGGER.entering(portInfo);
    65         // getPolicyMap is deprecated because it is only supposed to be used by Metro code
    66         // and not by other clients.
    67         @SuppressWarnings("deprecation")
    68         final PolicyMap policyMap = portInfo.getPolicyMap();
    69         final ManagedClientAssertion assertion = ManagementAssertion.getAssertion(MANAGED_CLIENT_QNAME,
    70                 policyMap, portInfo.getServiceName(), portInfo.getPortName(), ManagedClientAssertion.class);
    71         LOGGER.exiting(assertion);
    72         return assertion;
    73     }
    75     public ManagedClientAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters)
    76             throws AssertionCreationException {
    77         super(MANAGED_CLIENT_QNAME, data, assertionParameters);
    78     }
    80     /**
    81      * Clients cannot be managed.
    82      *
    83      * @return False.
    84      */
    85     public boolean isManagementEnabled() {
    86         final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    87         if (management != null) {
    88             if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
    89                 LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
    90             }
    91         }
    92         return false;
    93     }
    95 }

mercurial