CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-sun-xml-ws--jaxws-rt

Jakarta XML Web Services (JAX-WS) runtime implementation providing comprehensive SOAP web service capabilities

Pending
Overview
Eval results
Files

policy-framework.mddocs/

Policy Framework

WS-Policy implementation providing declarative configuration of web service capabilities, policy attachment, assertion processing, and policy-driven feature configuration. The framework enables standards-based policy negotiation and enforcement.

Capabilities

Core Policy Representation

Central policy abstractions providing normalized policy representation and assertion management.

/**
 * Normalized policy representation containing assertion alternatives
 */
package com.sun.xml.ws.policy;
public final class Policy implements Iterable<AssertionSet> {
    /** Create policy from source model */
    public static Policy createPolicy(PolicySourceModel model) throws PolicyException;
    
    /** Create empty policy */
    public static Policy createEmptyPolicy();
    
    /** Create policy from existing policy */
    public static Policy createPolicy(Policy... policies) throws PolicyException;
    
    /** Check if policy is empty */
    public boolean isEmpty();
    
    /** Check if policy contains assertions */
    public boolean contains(String assertionNamespace);
    
    /** Get iterator over assertion sets (alternatives) */
    public Iterator<AssertionSet> iterator();
    
    /** Normalize policy for client or server side */
    public Policy normalize(boolean isClient) throws PolicyException;
    
    /** Merge with another policy */
    public Policy merge(Policy policy) throws PolicyException;
    
    /** Intersect with another policy */
    public Policy intersect(Policy policy) throws PolicyException;
    
    /** Get policy ID */
    public String getId();
    
    /** Get policy name */
    public String getName();
}

/**
 * Collection of policy assertions representing one policy alternative
 */
public final class AssertionSet implements Iterable<PolicyAssertion> {
    /** Create assertion set from assertions */
    public static AssertionSet createAssertionSet(Collection<PolicyAssertion> assertions);
    
    /** Check if assertion set is empty */
    public boolean isEmpty();
    
    /** Get iterator over assertions */
    public Iterator<PolicyAssertion> iterator();
    
    /** Get assertions by type */
    public Collection<PolicyAssertion> get(QName assertionType);
    
    /** Check if contains assertion type */
    public boolean contains(QName assertionType);
}

Policy Assertions

Base classes and implementations for policy assertions with support for simple and complex assertions.

/**
 * Base class for all policy assertions
 */
public abstract class PolicyAssertion {
    /** Get assertion name (QName) */
    public abstract QName getName();
    
    /** Get assertion data including attributes */
    public final AssertionData getData();
    
    /** Check if assertion is optional */
    public final boolean isOptional();
    
    /** Check if assertion is private (ignorable) */
    public final boolean isPrivate();
    
    /** Get nested policy (for complex assertions) */
    public final Policy getNestedPolicy();
    
    /** Get nested assertions */
    public final Iterator<PolicyAssertion> getNestedAssertionsIterator();
    
    /** Check if assertion has nested policy */
    public final boolean hasNestedPolicy();
    
    /** Check if assertion has nested assertions */
    public final boolean hasNestedAssertions();
}

/**
 * Simple policy assertion with no nested content
 */
public abstract class SimpleAssertion extends PolicyAssertion {
    /** Constructor with assertion data */
    protected SimpleAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters);
    
    /** Get assertion value */
    public final String getValue();
    
    /** Check if assertion has value */
    public final boolean hasValue();
}

/**
 * Complex policy assertion with nested policy content
 */
public abstract class ComplexAssertion extends PolicyAssertion {
    /** Constructor with assertion data and nested policy */
    protected ComplexAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters, 
                             Policy nestedPolicy);
    
    /** Get nested policy */
    public final Policy getNestedPolicy();
}

Policy Storage and Retrieval

Policy map providing organized storage and retrieval of policies by scope and subject.

/**
 * Storage and retrieval system for policies organized by scope
 */
public final class PolicyMap {
    /** Get effective policy for service endpoint */
    public Policy getServiceEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Get effective policy for endpoint */
    public Policy getEndpointEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Get effective policy for operation */
    public Policy getOperationEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Get effective policy for input message */
    public Policy getInputMessageEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Get effective policy for output message */
    public Policy getOutputMessageEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Get effective policy for fault message */
    public Policy getFaultMessageEffectivePolicy(PolicyMapKey key) throws PolicyException;
    
    /** Check if policy map is empty */
    public boolean isEmpty();
    
    /** Get all service subjects */
    public Collection<PolicyMapKey> getAllServiceScopeKeys();
    
    /** Get all endpoint subjects */
    public Collection<PolicyMapKey> getAllEndpointScopeKeys();
    
    /** Get all operation subjects */
    public Collection<PolicyMapKey> getAllOperationScopeKeys();
}

/**
 * Key for accessing policies in policy map
 */
public final class PolicyMapKey {
    /** Create service scope key */
    public static PolicyMapKey createServiceScopeKey(QName service);
    
    /** Create endpoint scope key */
    public static PolicyMapKey createEndpointScopeKey(QName service, QName port);
    
    /** Create operation scope key */
    public static PolicyMapKey createOperationScopeKey(QName service, QName port, QName operation);
    
    /** Create input message scope key */
    public static PolicyMapKey createInputMessageScopeKey(QName service, QName port, QName operation);
    
    /** Create output message scope key */
    public static PolicyMapKey createOutputMessageScopeKey(QName service, QName port, QName operation);
    
    /** Create fault message scope key */
    public static PolicyMapKey createFaultMessageScopeKey(QName service, QName port, QName operation, QName fault);
    
    /** Get service name */
    public QName getServiceName();
    
    /** Get port name */
    public QName getPortName();
    
    /** Get operation name */
    public QName getOperationName();
}

Policy Source Model

Source model representation for policy documents before normalization.

/**
 * Source representation of policy document
 */
package com.sun.xml.ws.policy.sourcemodel;
public final class PolicySourceModel {
    /** Create policy source model */
    public static PolicySourceModel createPolicySourceModel(QName policyName, String policyId);
    
    /** Get root model node */
    public ModelNode getRootNode();
    
    /** Get namespace to prefix mappings */
    public Map<String, String> getNamespaceToPrefixMapping();
    
    /** Expand policy model */
    public PolicySourceModel expand() throws PolicyException;
    
    /** Check if model contains assertion */
    public boolean containsAssertion(QName assertionName);
}

/**
 * Model node in policy source tree
 */
public final class ModelNode implements Iterable<ModelNode> {
    /** Get node type */
    public NodeType getType();
    
    /** Get node data */
    public AssertionData getNodeData();
    
    /** Get parent node */
    public ModelNode getParentNode();
    
    /** Get child nodes */
    public Iterator<ModelNode> getChildNodesIterator();
    
    /** Add child node */
    public ModelNode addChild(NodeType nodeType, AssertionData nodeData);
    
    /** Check if node has children */
    public boolean hasChildren();
}

/**
 * Policy model generator for creating source models
 */
public final class PolicyModelGenerator {
    /** Generate policy model from policy */
    public PolicySourceModel translate(Policy policy) throws PolicyException;
    
    /** Generate policy model with custom translator */
    public PolicySourceModel translate(Policy policy, PolicyModelTranslator translator) throws PolicyException;
}

Policy Subject and Attachment

Policy subject identification and attachment mechanisms.

/**
 * Policy attachment subject
 */
package com.sun.xml.ws.policy.subject;
public final class PolicySubject {
    /** Create policy subject */
    public static PolicySubject createPolicySubject(Object subject, Policy policy);
    
    /** Get subject object */
    public Object getSubject();
    
    /** Get attached policy */
    public Policy getPolicy();
    
    /** Attach policy to subject */
    public void attach(Policy policy);
}

/**
 * WSDL binding subject for policy attachment
 */
public final class WsdlBindingSubject {
    /** Create binding subject */
    public static WsdlBindingSubject createBindingSubject(QName bindingName);
    
    /** Create binding operation subject */
    public static WsdlBindingSubject createBindingOperationSubject(QName bindingName, QName operationName);
    
    /** Create binding message subject */
    public static WsdlBindingSubject createBindingMessageSubject(QName bindingName, QName operationName, 
                                                               QName messageName, WsdlMessageType messageType);
    
    /** Get binding name */
    public QName getName();
    
    /** Get message type */
    public WsdlMessageType getMessageType();
    
    /** Check if subject is binding level */
    public boolean isBindingSubject();
    
    /** Check if subject is operation level */
    public boolean isBindingOperationSubject();
    
    /** Check if subject is message level */
    public boolean isBindingMessageSubject();
}

Service Provider Interfaces

Extension points for custom policy assertion creators and validators.

/**
 * SPI for creating custom policy assertions
 */
package com.sun.xml.ws.policy.spi;
public interface PolicyAssertionCreator {
    /** Get supported domain namespace URIs */
    String[] getSupportedDomainNamespaceURIs();
    
    /** Create assertion from assertion data */
    PolicyAssertion createAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters, 
                                  Policy nestedPolicy) throws AssertionCreationException;
}

/**
 * SPI for validating policy assertions
 */
public interface PolicyAssertionValidator {
    /** Validate assertion */
    Fitness validateClientSide(PolicyAssertion assertion);
    
    /** Validate server side */
    Fitness validateServerSide(PolicyAssertion assertion);
    
    /** Get supported domain namespaces */
    String[] declareSupportedDomains();
}

/**
 * SPI for mapping namespace prefixes in policy documents
 */
public interface PrefixMapper {
    /** Get preferred prefix for namespace */
    String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix);
}

/**
 * SPI for policy logging integration
 */
public interface LoggingProvider {
    /** Get logger for policy subsystem */
    PolicyLogger getLogger(Class<?> componentClass);
}

JAX-WS Policy Integration

Integration between policy framework and JAX-WS runtime for feature configuration.

/**
 * SPI for configuring WebServiceFeatures from policy
 */
package com.sun.xml.ws.policy.jaxws.spi;
public interface PolicyFeatureConfigurator {
    /** Get supported assertion namespaces */
    Collection<QName> getSupportedAssertions();
    
    /** Configure features from policy map */
    Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException;
}

/**
 * SPI for configuring policy map from external sources
 */
public interface PolicyMapConfigurator {
    /** Update policy map with external policies */
    Collection<PolicySubject> update(PolicyMap policyMap, SEIModel model, WSBinding wsBinding) throws PolicyException;
}

Usage Examples:

import com.sun.xml.ws.policy.*;
import com.sun.xml.ws.policy.sourcemodel.*;
import com.sun.xml.ws.policy.spi.*;

// Create simple policy assertion
public class MyCustomAssertion extends SimpleAssertion {
    public static final QName ASSERTION_NAME = new QName("http://example.com/policy", "MyAssertion");
    
    public MyCustomAssertion(AssertionData data, Collection<PolicyAssertion> parameters) {
        super(data, parameters);
    }
    
    public QName getName() {
        return ASSERTION_NAME;
    }
}

// Custom assertion creator
public class MyAssertionCreator implements PolicyAssertionCreator {
    public String[] getSupportedDomainNamespaceURIs() {
        return new String[] { "http://example.com/policy" };
    }
    
    public PolicyAssertion createAssertion(AssertionData data, 
                                         Collection<PolicyAssertion> assertionParameters, 
                                         Policy nestedPolicy) throws AssertionCreationException {
        if (MyCustomAssertion.ASSERTION_NAME.equals(data.getName())) {
            return new MyCustomAssertion(data, assertionParameters);
        }
        return null;
    }
}

// Policy creation and processing
PolicySourceModel sourceModel = PolicySourceModel.createPolicySourceModel(
    new QName("http://example.com", "MyPolicy"), "policy1");

ModelNode rootNode = sourceModel.getRootNode();
ModelNode assertionNode = rootNode.addChild(NodeType.ASSERTION, 
    AssertionData.createAssertionData(MyCustomAssertion.ASSERTION_NAME));

// Create policy from source model
Policy policy = Policy.createPolicy(sourceModel);

// Policy map usage
PolicyMap policyMap = new PolicyMap();
PolicyMapKey endpointKey = PolicyMapKey.createEndpointScopeKey(
    new QName("http://example.com", "MyService"),
    new QName("http://example.com", "MyPort"));

Policy effectivePolicy = policyMap.getEndpointEffectivePolicy(endpointKey);

// Policy merging
Policy policy1 = Policy.createPolicy(sourceModel1);
Policy policy2 = Policy.createPolicy(sourceModel2);
Policy mergedPolicy = policy1.merge(policy2);

// Feature configuration from policy
public class MyFeatureConfigurator implements PolicyFeatureConfigurator {
    public Collection<QName> getSupportedAssertions() {
        return Arrays.asList(MyCustomAssertion.ASSERTION_NAME);
    }
    
    public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) 
            throws PolicyException {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        
        List<WebServiceFeature> features = new ArrayList<>();
        for (AssertionSet alternative : policy) {
            for (PolicyAssertion assertion : alternative) {
                if (MyCustomAssertion.ASSERTION_NAME.equals(assertion.getName())) {
                    features.add(new MyCustomFeature());
                }
            }
        }
        return features;
    }
}

Install with Tessl CLI

npx tessl i tessl/maven-com-sun-xml-ws--jaxws-rt

docs

addressing-support.md

client-services.md

databinding-system.md

developer-utilities.md

index.md

message-processing.md

policy-framework.md

server-endpoints.md

transport-integration.md

tile.json