com.sun.xml.internal.ws.resources.ManagementMessages Java Examples

The following examples show how to use com.sun.xml.internal.ws.resources.ManagementMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManagementAssertion.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #2
Source File: ManagementAssertion.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #3
Source File: ManagementAssertion.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #4
Source File: ManagementAssertion.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #5
Source File: ManagementAssertion.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #6
Source File: ManagementAssertion.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #7
Source File: ManagementAssertion.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #8
Source File: ManagementAssertion.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
Example #9
Source File: ManagedServiceAssertion.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}
 
Example #10
Source File: ManagedServiceAssertion.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion.
 *
 * @return A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion. May be empty.
 */
public Collection<ImplementationRecord> getCommunicationServerImplementations() {
    final Collection<ImplementationRecord> result = new LinkedList<ImplementationRecord>();
    final Iterator<PolicyAssertion> parameters = getParametersIterator();
    while (parameters.hasNext()) {
        final PolicyAssertion parameter = parameters.next();
        if (COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME.equals(parameter.getName())) {
            final Iterator<PolicyAssertion> implementations = parameter.getParametersIterator();
            if (!implementations.hasNext()) {
                throw LOGGER.logSevereException(new WebServiceException(
                        ManagementMessages.WSM_1005_EXPECTED_COMMUNICATION_CHILD()));
            }
            while (implementations.hasNext()) {
                final PolicyAssertion implementation = implementations.next();
                if (COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME.equals(implementation.getName())) {
                    result.add(getImplementation(implementation));
                }
                else {
                    throw LOGGER.logSevereException(new WebServiceException(
                            ManagementMessages.WSM_1004_EXPECTED_XML_TAG(
                            COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, implementation.getName())));
                }
            }
        }
    }
    return result;
}
 
Example #11
Source File: ManagedServiceAssertion.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion.
 *
 * @return A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion. May be empty.
 */
public Collection<ImplementationRecord> getCommunicationServerImplementations() {
    final Collection<ImplementationRecord> result = new LinkedList<ImplementationRecord>();
    final Iterator<PolicyAssertion> parameters = getParametersIterator();
    while (parameters.hasNext()) {
        final PolicyAssertion parameter = parameters.next();
        if (COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME.equals(parameter.getName())) {
            final Iterator<PolicyAssertion> implementations = parameter.getParametersIterator();
            if (!implementations.hasNext()) {
                throw LOGGER.logSevereException(new WebServiceException(
                        ManagementMessages.WSM_1005_EXPECTED_COMMUNICATION_CHILD()));
            }
            while (implementations.hasNext()) {
                final PolicyAssertion implementation = implementations.next();
                if (COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME.equals(implementation.getName())) {
                    result.add(getImplementation(implementation));
                }
                else {
                    throw LOGGER.logSevereException(new WebServiceException(
                            ManagementMessages.WSM_1004_EXPECTED_XML_TAG(
                            COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, implementation.getName())));
                }
            }
        }
    }
    return result;
}
 
Example #12
Source File: ManagementAssertion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #13
Source File: ManagedClientAssertion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Clients cannot be managed.
 *
 * @return False.
 */
public boolean isManagementEnabled() {
    final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    if (management != null) {
        if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
            LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
        }
    }
    return false;
}
 
Example #14
Source File: ManagedServiceAssertion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}
 
Example #15
Source File: ManagedServiceAssertion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion.
 *
 * @return A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion. May be empty.
 */
public Collection<ImplementationRecord> getCommunicationServerImplementations() {
    final Collection<ImplementationRecord> result = new LinkedList<ImplementationRecord>();
    final Iterator<PolicyAssertion> parameters = getParametersIterator();
    while (parameters.hasNext()) {
        final PolicyAssertion parameter = parameters.next();
        if (COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME.equals(parameter.getName())) {
            final Iterator<PolicyAssertion> implementations = parameter.getParametersIterator();
            if (!implementations.hasNext()) {
                throw LOGGER.logSevereException(new WebServiceException(
                        ManagementMessages.WSM_1005_EXPECTED_COMMUNICATION_CHILD()));
            }
            while (implementations.hasNext()) {
                final PolicyAssertion implementation = implementations.next();
                if (COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME.equals(implementation.getName())) {
                    result.add(getImplementation(implementation));
                }
                else {
                    throw LOGGER.logSevereException(new WebServiceException(
                            ManagementMessages.WSM_1004_EXPECTED_XML_TAG(
                            COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, implementation.getName())));
                }
            }
        }
    }
    return result;
}
 
Example #16
Source File: ManagementAssertion.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #17
Source File: ManagedClientAssertion.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Clients cannot be managed.
 *
 * @return False.
 */
public boolean isManagementEnabled() {
    final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    if (management != null) {
        if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
            LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
        }
    }
    return false;
}
 
Example #18
Source File: ManagedServiceAssertion.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}
 
Example #19
Source File: ManagedServiceAssertion.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion.
 *
 * @return A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion. May be empty.
 */
public Collection<ImplementationRecord> getCommunicationServerImplementations() {
    final Collection<ImplementationRecord> result = new LinkedList<ImplementationRecord>();
    final Iterator<PolicyAssertion> parameters = getParametersIterator();
    while (parameters.hasNext()) {
        final PolicyAssertion parameter = parameters.next();
        if (COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME.equals(parameter.getName())) {
            final Iterator<PolicyAssertion> implementations = parameter.getParametersIterator();
            if (!implementations.hasNext()) {
                throw LOGGER.logSevereException(new WebServiceException(
                        ManagementMessages.WSM_1005_EXPECTED_COMMUNICATION_CHILD()));
            }
            while (implementations.hasNext()) {
                final PolicyAssertion implementation = implementations.next();
                if (COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME.equals(implementation.getName())) {
                    result.add(getImplementation(implementation));
                }
                else {
                    throw LOGGER.logSevereException(new WebServiceException(
                            ManagementMessages.WSM_1004_EXPECTED_XML_TAG(
                            COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, implementation.getName())));
                }
            }
        }
    }
    return result;
}
 
Example #20
Source File: ManagementAssertion.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #21
Source File: ManagedClientAssertion.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Clients cannot be managed.
 *
 * @return False.
 */
public boolean isManagementEnabled() {
    final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    if (management != null) {
        if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
            LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
        }
    }
    return false;
}
 
Example #22
Source File: ManagedServiceAssertion.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}
 
Example #23
Source File: ManagementAssertion.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #24
Source File: ManagementAssertion.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #25
Source File: ManagedClientAssertion.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Clients cannot be managed.
 *
 * @return False.
 */
public boolean isManagementEnabled() {
    final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    if (management != null) {
        if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
            LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
        }
    }
    return false;
}
 
Example #26
Source File: ManagedServiceAssertion.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}
 
Example #27
Source File: ManagedServiceAssertion.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion.
 *
 * @return A list of CommunicationServerImplementation elements that were set as
 * parameters of this assertion. May be empty.
 */
public Collection<ImplementationRecord> getCommunicationServerImplementations() {
    final Collection<ImplementationRecord> result = new LinkedList<ImplementationRecord>();
    final Iterator<PolicyAssertion> parameters = getParametersIterator();
    while (parameters.hasNext()) {
        final PolicyAssertion parameter = parameters.next();
        if (COMMUNICATION_SERVER_IMPLEMENTATIONS_PARAMETER_QNAME.equals(parameter.getName())) {
            final Iterator<PolicyAssertion> implementations = parameter.getParametersIterator();
            if (!implementations.hasNext()) {
                throw LOGGER.logSevereException(new WebServiceException(
                        ManagementMessages.WSM_1005_EXPECTED_COMMUNICATION_CHILD()));
            }
            while (implementations.hasNext()) {
                final PolicyAssertion implementation = implementations.next();
                if (COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME.equals(implementation.getName())) {
                    result.add(getImplementation(implementation));
                }
                else {
                    throw LOGGER.logSevereException(new WebServiceException(
                            ManagementMessages.WSM_1004_EXPECTED_XML_TAG(
                            COMMUNICATION_SERVER_IMPLEMENTATION_PARAMETER_QNAME, implementation.getName())));
                }
            }
        }
    }
    return result;
}
 
Example #28
Source File: ManagementAssertion.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new ManagementAssertion instance.
 *
 * @param name The fully qualified name of the server or client assertion. Must
 *   not be null.
 * @param data The assertion data. Must not be null.
 * @param assertionParameters Parameters of the assertion. May be null.
 * @throws AssertionCreationException Thrown if the creation of the assertion failed.
 */
protected ManagementAssertion(final QName name, AssertionData data, Collection<PolicyAssertion> assertionParameters)
        throws AssertionCreationException {
    super(data, assertionParameters);
    if (!name.equals(data.getName())) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1002_EXPECTED_MANAGEMENT_ASSERTION(name)));
    }
    if (isManagementEnabled() && !data.containsAttribute(ID_ATTRIBUTE_QNAME)) {
        throw LOGGER.logSevereException(new AssertionCreationException(data,
                ManagementMessages.WSM_1003_MANAGEMENT_ASSERTION_MISSING_ID(name)));
    }
}
 
Example #29
Source File: ManagedClientAssertion.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Clients cannot be managed.
 *
 * @return False.
 */
public boolean isManagementEnabled() {
    final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME);
    if (management != null) {
        if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) {
            LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED());
        }
    }
    return false;
}
 
Example #30
Source File: ManagedServiceAssertion.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the value of the endpointDisposeDelay attribute or the default value
 * otherwise.
 *
 * @param defaultDelay The default value that is returned if this attribute is
 *   not set
 * @return The value of the endpointDisposeDelay attribute or the default value
 *   otherwise.
 */
public long getEndpointDisposeDelay(final long defaultDelay) throws WebServiceException {
    long result = defaultDelay;
    final String delayText = getAttributeValue(ENDPOINT_DISPOSE_DELAY_ATTRIBUTE_QNAME);
    if (delayText != null) {
        try {
            result = Long.parseLong(delayText);
        } catch (NumberFormatException e) {
            throw LOGGER.logSevereException(new WebServiceException(
                    ManagementMessages.WSM_1008_EXPECTED_INTEGER_DISPOSE_DELAY_VALUE(delayText), e));
        }
    }
    return result;
}