com.sun.xml.internal.ws.util.JAXWSUtils Java Examples

The following examples show how to use com.sun.xml.internal.ws.util.JAXWSUtils. 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: MexEntityResolver.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #2
Source File: MexEntityResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #3
Source File: MexEntityResolver.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #4
Source File: MexEntityResolver.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #5
Source File: MexEntityResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #6
Source File: MexEntityResolver.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #7
Source File: MexEntityResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #8
Source File: MexEntityResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #9
Source File: HandlerChainsModel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #10
Source File: SCAnnotations.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #11
Source File: HandlerChainsModel.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #12
Source File: SCAnnotations.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #13
Source File: HandlerChainsModel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #14
Source File: SCAnnotations.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #15
Source File: HandlerChainsModel.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #16
Source File: SCAnnotations.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #17
Source File: HandlerChainsModel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #18
Source File: SCAnnotations.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #19
Source File: HandlerChainsModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #20
Source File: SCAnnotations.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #21
Source File: HandlerChainsModel.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #22
Source File: SCAnnotations.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}
 
Example #23
Source File: HandlerChainsModel.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){

        HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
        List<Handler> handlerClassList = new ArrayList<Handler>();
        Set<String> roles = new HashSet<String>();

        for(HandlerChainType hchain : handlerChains) {
            boolean hchainMatched = false;
            if((!hchain.isConstraintSet()) ||
                    JAXWSUtils.matchQNames(info.getServiceName(), hchain.getServiceNamePattern()) ||
                    JAXWSUtils.matchQNames(info.getPortName(), hchain.getPortNamePattern()) ||
                    hchain.getProtocolBindings().contains(info.getBindingID()) ){
                hchainMatched = true;

            }
            if(hchainMatched) {
                for(HandlerType handler : hchain.getHandlers()) {
                    try {
                        Handler handlerClass = (Handler) loadClass(annotatedClass.getClassLoader(),
                                handler.getHandlerClass()).newInstance();
                        callHandlerPostConstruct(handlerClass);
                        handlerClassList.add(handlerClass);
                    } catch (InstantiationException ie){
                        throw new RuntimeException(ie);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }

                    roles.addAll(handler.getSoapRoles());
                }

            }
        }

        handlerInfo.setHandlers(handlerClassList);
        handlerInfo.setRoles(roles);
        return handlerInfo;

    }
 
Example #24
Source File: SCAnnotations.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
SCAnnotations(final Class<?> sc) {
    AccessController.doPrivileged(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
            WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class);
            if(wsc==null) {
                throw new WebServiceException("Service Interface Annotations required, exiting...");
            }

            String tns = wsc.targetNamespace();
            try {
                JAXWSUtils.getFileOrURL(wsc.wsdlLocation());
            } catch (IOException e) {
                // TODO: report a reasonable error message
                throw new WebServiceException(e);
            }

            for (Method method : sc.getDeclaredMethods()) {
                WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class);
                if (webEndpoint != null) {
                    String endpointName = webEndpoint.name();
                    QName portQName = new QName(tns, endpointName);
                    portQNames.add(portQName);
                }
                Class<?> seiClazz = method.getReturnType();
                if (seiClazz!=void.class) {
                    classes.add(seiClazz);
                }
            }

            return null;
        }
    });
}