com.sun.xml.internal.ws.api.policy.PolicyResolver Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.policy.PolicyResolver. 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: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #2
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #3
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #4
Source File: RuntimeWSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #5
Source File: RuntimeWSDLParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #6
Source File: RuntimeWSDLParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #7
Source File: RuntimeWSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #8
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private RuntimeWSDLParser(@NotNull String sourceLocation, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) {
    this.wsdlDoc = sourceLocation!=null ? new WSDLModelImpl(sourceLocation) : new WSDLModelImpl();
    this.resolver = resolver;
    this.policyResolver = policyResolver;
    this.extensions = new ArrayList<WSDLParserExtension>();
    this.context = new WSDLParserExtensionContextImpl(wsdlDoc, isClientSide, container, policyResolver);

    boolean isPolicyExtensionFound = false;
    for (WSDLParserExtension e : extensions) {
            if (e instanceof com.sun.xml.internal.ws.api.wsdl.parser.PolicyWSDLParserExtension)
                    isPolicyExtensionFound = true;
        register(e);
    }

    // register handlers for default extensions
    if (!isPolicyExtensionFound)
            register(new PolicyWSDLParserExtension());
    register(new MemberSubmissionAddressingWSDLParserExtension());
    register(new W3CAddressingWSDLParserExtension());
    register(new W3CAddressingMetadataWSDLParserExtension());

    this.extensionFacade =  new WSDLParserExtensionFacade(this.extensions.toArray(new WSDLParserExtension[0]));
}
 
Example #9
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 *
 * @param wsdlLoc
 *      Either this or <tt>wsdl</tt> parameter must be given.
 *      Null location means the system won't be able to resolve relative references in the WSDL,
 */
public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                  boolean isClientSide, Container container, Class serviceClass,
                                  @NotNull PolicyResolver policyResolver,
                                  boolean isUseStreamFromEntityResolverWrapper,
                                  WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;

    RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
    Parser parser;
    try{
        parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
        if(!hasWSDLDefinitions(parser.parser)){
            throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
                    WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
        }
    }catch(XMLStreamException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);

    }catch(IOException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);
    }
    wsdlParser.extensionFacade.start(wsdlParser.context);
    wsdlParser.parseWSDL(parser, false);
    wsdlParser.wsdlDoc.freeze();
    wsdlParser.extensionFacade.finished(wsdlParser.context);
    wsdlParser.extensionFacade.postFinished(wsdlParser.context);

    if(wsdlParser.wsdlDoc.getServices().isEmpty())
        throw new WebServiceException(ClientMessages.WSDL_CONTAINS_NO_SERVICE(wsdlLoc));

    return wsdlParser.wsdlDoc;
}
 
Example #10
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
Example #11
Source File: RuntimeWSDLParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #12
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #13
Source File: WSDLParserExtensionContextImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct {@link WSDLParserExtensionContextImpl} with information that whether its on client side
 * or server side.
 */
protected WSDLParserExtensionContextImpl(EditableWSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
    this.wsdlModel = model;
    this.isClientSide = isClientSide;
    this.container = container;
    this.policyResolver = policyResolver;
}
 
Example #14
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
Example #15
Source File: WSDLParserExtensionContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct {@link WSDLParserExtensionContextImpl} with information that whether its on client side
 * or server side.
 */
protected WSDLParserExtensionContextImpl(EditableWSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
    this.wsdlModel = model;
    this.isClientSide = isClientSide;
    this.container = container;
    this.policyResolver = policyResolver;
}
 
Example #16
Source File: PolicyWSDLGeneratorExtension.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
Example #17
Source File: PortInfo.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public PolicyMap createPolicyMap() {
   PolicyMap map;
   if(portModel != null) {
        map = portModel.getOwner().getParent().getPolicyMap();
   } else {
       map = PolicyResolverFactory.create().resolve(new PolicyResolver.ClientContext(null,owner.getContainer()));
   }
   //still map is null, create a empty map
   if(map == null)
       map = PolicyMap.createPolicyMap(null);
   return map;
}
 
Example #18
Source File: RuntimeWSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #19
Source File: PortInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PolicyMap createPolicyMap() {
   PolicyMap map;
   if(portModel != null) {
        map = portModel.getOwner().getParent().getPolicyMap();
   } else {
       map = PolicyResolverFactory.create().resolve(new PolicyResolver.ClientContext(null,owner.getContainer()));
   }
   //still map is null, create a empty map
   if(map == null)
       map = PolicyMap.createPolicyMap(null);
   return map;
}
 
Example #20
Source File: WSDLParserExtensionContextImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct {@link WSDLParserExtensionContextImpl} with information that whether its on client side
 * or server side.
 */
protected WSDLParserExtensionContextImpl(EditableWSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
    this.wsdlModel = model;
    this.isClientSide = isClientSide;
    this.container = container;
    this.policyResolver = policyResolver;
}
 
Example #21
Source File: PortInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PolicyMap createPolicyMap() {
   PolicyMap map;
   if(portModel != null) {
        map = portModel.getOwner().getParent().getPolicyMap();
   } else {
       map = PolicyResolverFactory.create().resolve(new PolicyResolver.ClientContext(null,owner.getContainer()));
   }
   //still map is null, create a empty map
   if(map == null)
       map = PolicyMap.createPolicyMap(null);
   return map;
}
 
Example #22
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 *
 * @param wsdlLoc
 *      Either this or <tt>wsdl</tt> parameter must be given.
 *      Null location means the system won't be able to resolve relative references in the WSDL,
 */
public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                  boolean isClientSide, Container container, Class serviceClass,
                                  @NotNull PolicyResolver policyResolver,
                                  boolean isUseStreamFromEntityResolverWrapper,
                                  WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;

    RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
    Parser parser;
    try{
        parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
        if(!hasWSDLDefinitions(parser.parser)){
            throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
                    WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
        }
    }catch(XMLStreamException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);

    }catch(IOException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);
    }
    wsdlParser.extensionFacade.start(wsdlParser.context);
    wsdlParser.parseWSDL(parser, false);
    wsdlParser.wsdlDoc.freeze();
    wsdlParser.extensionFacade.finished(wsdlParser.context);
    wsdlParser.extensionFacade.postFinished(wsdlParser.context);

    if(wsdlParser.wsdlDoc.getServices().isEmpty())
        throw new WebServiceException(ClientMessages.WSDL_CONTAINS_NO_SERVICE(wsdlLoc));

    return wsdlParser.wsdlDoc;
}
 
Example #23
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #24
Source File: PortInfo.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public PolicyMap createPolicyMap() {
   PolicyMap map;
   if(portModel != null) {
        map = portModel.getOwner().getParent().getPolicyMap();
   } else {
       map = PolicyResolverFactory.create().resolve(new PolicyResolver.ClientContext(null,owner.getContainer()));
   }
   //still map is null, create a empty map
   if(map == null)
       map = PolicyMap.createPolicyMap(null);
   return map;
}
 
Example #25
Source File: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #26
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
Example #27
Source File: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 *
 * @param wsdlLoc
 *      Either this or <tt>wsdl</tt> parameter must be given.
 *      Null location means the system won't be able to resolve relative references in the WSDL,
 */
public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                  boolean isClientSide, Container container, Class serviceClass,
                                  @NotNull PolicyResolver policyResolver,
                                  boolean isUseStreamFromEntityResolverWrapper,
                                  WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;

    RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
    Parser parser;
    try{
        parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
        if(!hasWSDLDefinitions(parser.parser)){
            throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
                    WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
        }
    }catch(XMLStreamException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);

    }catch(IOException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);
    }
    wsdlParser.extensionFacade.start(wsdlParser.context);
    wsdlParser.parseWSDL(parser, false);
    wsdlParser.wsdlDoc.freeze();
    wsdlParser.extensionFacade.finished(wsdlParser.context);
    wsdlParser.extensionFacade.postFinished(wsdlParser.context);

    if(wsdlParser.wsdlDoc.getServices().isEmpty())
        throw new WebServiceException(ClientMessages.WSDL_CONTAINS_NO_SERVICE(wsdlLoc));

    return wsdlParser.wsdlDoc;
}
 
Example #28
Source File: WSDLParserExtensionContextImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct {@link WSDLParserExtensionContextImpl} with information that whether its on client side
 * or server side.
 */
protected WSDLParserExtensionContextImpl(EditableWSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
    this.wsdlModel = model;
    this.isClientSide = isClientSide;
    this.container = container;
    this.policyResolver = policyResolver;
}
 
Example #29
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;
    RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
    parser.extensionFacade.start(parser.context);
    parser.parseWSDL(wsdl, false);
    parser.wsdlDoc.freeze();
    parser.extensionFacade.finished(parser.context);
    parser.extensionFacade.postFinished(parser.context);
    return parser.wsdlDoc;
}
 
Example #30
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 *
 * @param wsdlLoc
 *      Either this or {@code wsdl} parameter must be given.
 *      Null location means the system won't be able to resolve relative references in the WSDL,
 */
public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                  boolean isClientSide, Container container, Class serviceClass,
                                  @NotNull PolicyResolver policyResolver,
                                  boolean isUseStreamFromEntityResolverWrapper,
                                  WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
    assert resolver != null;

    RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
    Parser parser;
    try{
        parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
        if(!hasWSDLDefinitions(parser.parser)){
            throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
                    WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
        }
    }catch(XMLStreamException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);

    }catch(IOException e){
        //Try MEX if there is WSDLLoc available
        if(wsdlLoc == null)
            throw e;
        return tryWithMex(wsdlParser, wsdlLoc, resolver, isClientSide, container, e, serviceClass, policyResolver, extensions);
    }
    wsdlParser.extensionFacade.start(wsdlParser.context);
    wsdlParser.parseWSDL(parser, false);
    wsdlParser.wsdlDoc.freeze();
    wsdlParser.extensionFacade.finished(wsdlParser.context);
    wsdlParser.extensionFacade.postFinished(wsdlParser.context);

    if(wsdlParser.wsdlDoc.getServices().isEmpty())
        throw new WebServiceException(ClientMessages.WSDL_CONTAINS_NO_SERVICE(wsdlLoc));

    return wsdlParser.wsdlDoc;
}