Package org.oasisopen.sca

Examples of org.oasisopen.sca.ServiceRuntimeException


        try {
            InputStream is = openStream(configurationURL);
            NodeConfiguration configuration = loadConfiguration(is, configurationURL);
            return createNode(configuration);
        } catch (IOException e) {
            throw new ServiceRuntimeException(e);
        }
    }
View Full Code Here


                                break;
                            }
                        }
                        if (composite == null) {
                            // Not found
                            throw new ServiceRuntimeException("Deployment composite " + dcURI
                                + " cannot be found within contribution "
                                + contribution.getLocation());
                        }
                    } else {
                        URL url = dcURI.toURL();
View Full Code Here

     * @return a new SCA node.
     */
    public Node createNode(String deploymentCompositeURI, Contribution... contributions) {
        if (contributions == null || contributions.length == 0) {
            if (deploymentCompositeURI == null || deploymentCompositeURI.indexOf(':') != -1) {
                throw new ServiceRuntimeException("No SCA contribution is provided or discovered");
            }
            // Try to find contributions on the classpath by the composite URI
            List<String> locations = getContributionLocations(null, deploymentCompositeURI);
            if (locations.isEmpty()) {
                throw new ServiceRuntimeException("No SCA contributions are found on the classpath");
            }
            contributions = getContributions(locations);
        }
        NodeConfiguration configuration = createConfiguration(contributions);
        if (deploymentCompositeURI != null && configuration.getContributions().size() > 0) {
View Full Code Here

    public Node createNode() {
        List<String> locations = new ArrayList<String>();
        locations.addAll(getContributionLocations(null, SCA_CONTRIBUTION_META));
        locations.addAll(getContributionLocations(null, SCA_CONTRIBUTION_GENERATED_META));
        if (locations.isEmpty()) {
            throw new ServiceRuntimeException("No SCA contributions are found on the classpath");
        }
        Contribution[] contributions = getContributions(locations);
        return createNode(contributions);
    }
View Full Code Here

    public <B> B getService(Class<B> businessInterface, String serviceName) {

        ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
        if (serviceReference == null) {
            throw new ServiceRuntimeException("Service not found: " + serviceName);
        }
        return serviceReference.getService();
    }
View Full Code Here

           
            RuntimeEndpointReference epr;
            try {
                epr = createEndpointReference(javaInterfaceFactory, compositeContext, assemblyFactory, endpoint, serviceInterface);
            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }

            this.handler = Proxy.getInvocationHandler(proxyFactory.createProxy(serviceInterface, epr));
        }
        return handler;
View Full Code Here

                            return null;
                        }
                    }
                });
            } catch (PrivilegedActionException e) {
                throw new ServiceRuntimeException(e.getException());
            }
        }

        if (axis2Config == null) {
            return null;
        }

        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<ConfigurationContext>() {
                public ConfigurationContext run() throws AxisFault {
                    ClassLoader oldTCCL = axis2Config.classLoaderContext.setContextClassLoader();
                    try {
                        ConfigurationContext configurationContext =
                            ConfigurationContextFactory.createConfigurationContextFromURIs(axis2Config.axis2xmlURL,
                                                                                           axis2Config.repositoryURL);
                        return configurationContext;
                    } finally {
                        if (oldTCCL != null) {
                            Thread.currentThread().setContextClassLoader(oldTCCL);
                        }
                    }
                }
            });
        } catch (PrivilegedActionException e) {
            throw new ServiceRuntimeException(e.getException());
        }
    }
View Full Code Here

          
            org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(),
                                                                      axisConfiguration);
            axisConfiguration.validateSystemPredefinedPhases();
        } catch (IOException e) {
            throw new ServiceRuntimeException(e);
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
    }  
View Full Code Here

    public Object extractPayloadFromJMSMessage(Message msg) {
        try {
            if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
                Object exc = ((ObjectMessage)msg).getObject();
                if (exc instanceof RuntimeException) {
                    throw new ServiceRuntimeException("remote service exception, see nested exception", (Throwable)exc);
                } else {
                    return new InvocationTargetException((Throwable) exc);
                }
            }
        } catch (JMSException e) {
View Full Code Here

        this.component = (RuntimeComponent)endpointReference.getComponent();
        this.reference = (RuntimeComponentReference)endpointReference.getReference();

        // A WSDL document should always be present in the binding
        if (wsBinding.getGeneratedWSDLDocument() == null) {
            throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + reference.getName());
        }

        // Set to use the Axiom data binding
        InterfaceContract contract = wsBinding.getBindingInterfaceContract();
        if (contract.getInterface() != null) {
            contract.getInterface().resetDataBinding(OMElement.class.getName());
        }
       
        // TODO - why don't intents get aggregated to EPR correctly?
        isSOAP11Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP11_INTENT);
        isSOAP12Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP12_INTENT);
       
        isMTOMRequired = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
       
        // if the endpoint contains any WS Policy expressions then we probably need rampart
        // TODO - need to take into account Axis configuration policy also
        QName wsPolicyQName = new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
        if (PolicyHelper.getPolicies(endpointReference, wsPolicyQName).size() > 0){
            isRampartRequired = true;
        }        

        // Validate the configuration for provided policies
       
        // check the WSDL style as we currently only support some of them
        if (wsBinding.isRpcEncoded()){
            throw new ServiceRuntimeException("rpc/encoded WSDL style not supported. Component " + endpointReference.getComponent().getName() +
                                              " Reference " + endpointReference.getReference() +
                                              " Binding " + endpointReference.getBinding().getName());
        }

        if (wsBinding.isDocEncoded()){
            throw new ServiceRuntimeException("doc/encoded WSDL style not supported. Component " + endpointReference.getComponent().getName() +
                                              " Reference " + endpointReference.getReference() +
                                              " Binding " + endpointReference.getBinding().getName());
        }
       
        if (wsBinding.isDocLiteralUnwrapped()){
            //throw new ServiceRuntimeException("doc/literal/unwrapped WSDL style not supported for endpoint reference " + endpointReference);
        }
       
        // Validate that the WSDL is not using SOAP v1.2 if requires="SOAP.v1_1" has been specified
        if ( isSOAP11Required ) {
          Definition def = wsBinding.getGeneratedWSDLDocument();
          Binding binding = def.getBinding(wsBinding.getBinding().getQName());
          for ( Object ext : binding.getExtensibilityElements() ) {
            if ( ext instanceof SOAP12Binding )
              throw new ServiceRuntimeException("WSDL document is using SOAP v1.2 but SOAP v1.1 " +
                  "is required by the specified policy intents");
          }
        }
       
        // Validate that the WSDL is not using SOAP v1.1 if requires="SOAP.v1_2" has been specified
        if ( isSOAP12Required ) {
          Definition def = wsBinding.getGeneratedWSDLDocument();
          Binding binding = def.getBinding(wsBinding.getBinding().getQName());
          for ( Object ext : binding.getExtensibilityElements() ) {
            if ( ext instanceof SOAPBinding )
              throw new ServiceRuntimeException("WSDL document is using SOAP v1.1 but SOAP v1.2 " +
                  "is required by the specified policy intents");
          }
        }
    }
View Full Code Here

TOP

Related Classes of org.oasisopen.sca.ServiceRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.