Package org.apache.axis2.rmi

Examples of org.apache.axis2.rmi.Configurator


                // client. Should / would be ignored by any transport other than
                // nhttp. For example, JMS would not send a reply message for one-way
                // operations.
                MessageContext outMsgCtx =
                        (MessageContext) context.getAttribute(OUTGOING_MESSAGE_CONTEXT);
                MessageReceiver mr = outMsgCtx.getAxisOperation().getMessageReceiver();

                // the following check is to support the dual channel invocation. Hence the
                // response will be sent as a new request to the client over a different channel
                // client sends back a 202 Accepted response to synapse and we need to neglect that
                // 202 Accepted message
                if (!outMsgCtx.isPropertyTrue(NhttpConstants.IGNORE_SC_ACCEPTED)) {

                    try {
                        MessageContext responseMsgCtx = outMsgCtx.getOperationContext().
                                getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
                        if (responseMsgCtx == null ||
                                outMsgCtx.getOptions().isUseSeparateListener()) {
                            // Since we need to notify the SynapseCallback receiver to remove the
                            // call backs registered  we set a custom property
                            if (outMsgCtx.getOperationContext().isComplete()) {
                                setHeaders(context, response, outMsgCtx, responseMsgCtx);
                                outMsgCtx.setProperty(NhttpConstants.HTTP_202_RECEIVED, "true");
                                mr.receive(outMsgCtx);
                            }
                            return;
                        }
                        setHeaders(context, response, outMsgCtx, responseMsgCtx);
                        responseMsgCtx.setServerSide(true);
                        responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST());
                        responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN,
                                outMsgCtx.getProperty(MessageContext.TRANSPORT_IN));
                        responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn());
                        responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut());

                        responseMsgCtx.setAxisMessage(outMsgCtx.getAxisOperation().
                                getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
                        responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext());
                        responseMsgCtx.setConfigurationContext(outMsgCtx.getConfigurationContext());
                        responseMsgCtx.setTo(null);

                        if (!outMsgCtx.isDoingREST() && !outMsgCtx.isSOAP11()) {
                            responseMsgCtx.setEnvelope(OMAbstractFactory.getSOAP12Factory().getDefaultEnvelope());
                        } else {
                            responseMsgCtx.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
                        }
                        responseMsgCtx.setProperty(AddressingConstants.
                                DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
                        responseMsgCtx.setProperty(NhttpConstants.SC_ACCEPTED, Boolean.TRUE);
                        mr.receive(responseMsgCtx);

                    } catch (org.apache.axis2.AxisFault af) {
                        log.debug("Unable to report back " +
                                "202 Accepted state to the message receiver");
                    }
View Full Code Here


                }
            }

            // set the message payload to the message context
            InputStream in;
            ManagedDataSource dataSource;
            if (builder instanceof DataSourceMessageBuilder && entry.isStreaming()) {
                in = null;
                dataSource = ManagedDataSourceFactory.create(
                        new FileObjectDataSource(file, contentType));
            } else {
                in = content.getInputStream();
                dataSource = null;
            }
           
            try {
                OMElement documentElement;
                if (in != null) {
                    documentElement = builder.processDocument(in, contentType, msgContext);
                } else {
                    documentElement = ((DataSourceMessageBuilder)builder).processDocument(
                            dataSource, contentType, msgContext);
                }
                msgContext.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement));
               
                handleIncomingMessage(
                    msgContext,
                    transportHeaders,
                    null, //* SOAP Action - not applicable *//
                    contentType
                );
            }
            finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException ex) {
                        handleException("Error closing stream", ex);
                    }
                } else {
                    dataSource.destroy();
                }
            }

            if (log.isDebugEnabled()) {
                log.debug("Processed file : " + file + " of Content-type : " + contentType);
View Full Code Here

public class TestService3 {

    private Configurator configurator;

    public TestService3() {
        this.configurator = new Configurator();
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.exception", "http://sample/service/exception");
    }
View Full Code Here

    private Configurator configurator;

    public TestService4() {

        this.configurator = new Configurator();
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");
        this.configurator.addExtension(ParentClass.class);
        this.configurator.addExtension(ChildClass.class);
    }
View Full Code Here

    private Configurator configurator;

    public TestService1() {

        this.configurator = new Configurator();

        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");

        ClassInfo classInfo = new ClassInfo(TestClass1.class);
View Full Code Here

    private Configurator configurator;

    public TestService2() {

        this.configurator = new Configurator();
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");
    }
View Full Code Here

public class TestService1 {

    private Configurator configurator;

    public TestService1() {
        this.configurator = new Configurator();
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.exception", "http://sample/service/exception");
    }
View Full Code Here

public class TestService2 {

    private Configurator configurator;

    public TestService2() {
        this.configurator = new Configurator();
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server", "http://sample/service");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.dto", "http://sample/service/types");
        this.configurator.addPackageToNamespaceMaping("sample.rmi.server.exception", "http://sample/service/exception");
        this.configurator.addExtension(ParentClass.class);
        this.configurator.addExtension(ChildClass.class);
View Full Code Here

            String absolutePath = deploymentFileData.getFile().getAbsolutePath();

            // gettting the file reader for zipinput stream
            Config configObject = getConfig(absolutePath);

            Configurator configurator = getConfigurator(configObject, deploymentClassLoader);

            Service[] services = configObject.getServices().getService();
            ClassDeployer classDeployer =
                    new ClassDeployer(configurationContext, deploymentClassLoader, configurator);
            Class serviceClass;
View Full Code Here

        }
    }

    private Configurator getConfigurator(Config configObject, ClassLoader deploymentClassLoader)
            throws ClassNotFoundException, DeploymentException {
        Configurator configurator = new Configurator();

        if (configObject.getExtensionClasses() != null) {
            String[] extensionClasses = configObject.getExtensionClasses().getExtensionClass();
            if (extensionClasses != null) {
                Class extensionClass;
                for (int i = 0; i < extensionClasses.length; i++) {
                    extensionClass = Loader.loadClass(deploymentClassLoader, extensionClasses[i]);
                    configurator.addExtension(extensionClass);
                }
            }
        }

        if (configObject.getPackageToNamespaceMapings() != null) {
            PackageToNamespaceMap[] packageToNamespaceMapings =
                    configObject.getPackageToNamespaceMapings().getPackageToNamespaceMap();
            if (packageToNamespaceMapings != null) {
                for (int i = 0; i < packageToNamespaceMapings.length; i++) {
                    configurator.addPackageToNamespaceMaping(packageToNamespaceMapings[i].getPackageName(),
                            packageToNamespaceMapings[i].getNamespace());
                }
            }
        }

        // set the simple type data handler if it is set
        if ((configObject.getSimpleDataHandlerClass() != null)
                && (configObject.getSimpleDataHandlerClass().trim().length() > 0)){
            Class simpleTypeHandlerClass =
                    Loader.loadClass(deploymentClassLoader,configObject.getSimpleDataHandlerClass());
            try {
                SimpleTypeHandler simpleTypeHandler = (SimpleTypeHandler) simpleTypeHandlerClass.newInstance();
                configurator.setSimpleTypeHandler(simpleTypeHandler);
            } catch (InstantiationException e) {
                throw new DeploymentException("Can not instantiate simple type handler",e);
            } catch (IllegalAccessException e) {
                throw new DeploymentException("Can not instantiate simple type handler",e);
            }
        }

        // setting the custom class info
        ClassInfo[] classInfos = null;
        FieldInfo[] filsInfos = null;
        org.apache.axis2.rmi.config.ClassInfo classInfo;
        Class customClass = null;
        if (configObject.getCustomClassInfo() != null) {
            CustomClassInfo customClassInfo = configObject.getCustomClassInfo();
            if ((customClassInfo.getClassInfo() != null) && (customClassInfo.getClassInfo().length > 0)) {
                classInfos = customClassInfo.getClassInfo();
                for (int i = 0; i < classInfos.length; i++) {

                    if ((classInfos[i].getFieldInfo() != null) &&
                            (classInfos[i].getFieldInfo().length > 0)){
                        customClass = Loader.loadClass(deploymentClassLoader,classInfos[i].getClassName());
                        classInfo = new org.apache.axis2.rmi.config.ClassInfo(customClass);
                        filsInfos = classInfos[i].getFieldInfo();
                        for (int j = 0; j < filsInfos.length; j++) {
                           classInfo.addFieldInfo(
                                   new org.apache.axis2.rmi.config.FieldInfo(
                                           filsInfos[j].getJavaName(),
                                           filsInfos[j].getXmlName(),
                                           filsInfos[j].isElement()));
                        }
                        configurator.addClassInfo(classInfo);
                    }
                }
            }
        }
        return configurator;
View Full Code Here

TOP

Related Classes of org.apache.axis2.rmi.Configurator

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.