Package org.apache.axis2.datasource.jaxb

Examples of org.apache.axis2.datasource.jaxb.JAXBDSContext


            OMDataSource ds = ((OMSourcedElement) omElement).getDataSource();
            if (ds instanceof JAXBDataSource) {
                // Update the business context to use the one provided
                // by the datasource
                try {
                    JAXBDSContext dsContext = ((JAXBDataSource) ds).getContext();
                    busContext = new JAXBBlockContext(dsContext.getJAXBContext());
                } catch (JAXBException e) {
                    throw ExceptionFactory.makeWebServiceException(e);
                }
                return ((JAXBDataSource) ds).getObject();
            } else if (ds instanceof JAXBBlockImpl) {
View Full Code Here


       
        if (omElement instanceof OMSourcedElement) {
           
            if ( ((OMSourcedElement) omElement).getDataSource() instanceof JAXBDataSource) {
                JAXBDataSource ds = (JAXBDataSource) ((OMSourcedElement)omElement).getDataSource();
                JAXBDSContext dsContext = ds.getContext();
                try {
                    if (dsContext.getJAXBContext() == ((JAXBBlockContext)context).getJAXBContext()) {
                        // Shortcut, use existing JAXB object
                        Object jaxb = ds.getObject();
                        return new JAXBBlockImpl(jaxb, (JAXBBlockContext)context, qName, this);
                    }
                } catch (JAXBException e) {
View Full Code Here

        StringReader sr = new StringReader(sampleJAXBEnvelope);
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
        OMElement omElement = builder.getSOAPEnvelope();
       
        JAXBDSContext jds = null;
        if (installJAXBCustomBuilder) {
            jds = new JAXBDSContext(EchoStringResponse.class.getPackage().getName());
            JAXBCustomBuilder jcb = new JAXBCustomBuilder(jds);
            builder.registerCustomBuilderForPayload(jcb);
        }
       
        // Create a SOAP 1.1 Message from the sample incoming XML
        MessageFactory mf = (MessageFactory)
            FactoryRegistry.getFactory(MessageFactory.class);
        Message m = mf.createFrom(omElement, null);
       
        // Check to see if the message is a fault.  The client/server will always call this method.
        // The Message must respond appropriately without doing a conversion.
        boolean isFault = m.isFault();
        assertTrue(!isFault);
        assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
                    "OM".equals(m.getXMLPartContentType()));
       
        if (installJAXBCustomBuilder) {
            // The JAXBDSContext and the JAXBUtils access the JAXBContext
            // for the "test" package.
            // The JAXBContext creation is very expensive.
            // However the JAXBContext can also be very large.
            //
            // For these reasons, the JAXBUtils code caches the JAXBContext values.
            // And, the JAXBDSContext and JAXBUtils code use WeakReferences to refer
            // to the JAXBContext (so that it is easily gc'd).
           
            // The following code checks makes sure that the caching and gc is correct.
           
            // Get the JAXBContext
            JAXBContext context = jds.getJAXBContext();
           
            // Get the identity hash code.  This is an indicator of the unique memory pointer
            // for the context.
            int contextPointer = System.identityHashCode(context);
           
View Full Code Here

        // On inbound, there will already be a probably be an OM
        // which represents the message.  In this scenario, the OM contains
        // a OMSourcedElement that is backed by EchoString.
        OMFactory omFactory = OMAbstractFactory.getOMFactory();
        JAXBDSContext dsContext = new JAXBDSContext(jaxbContext);
        JAXBDataSource ds = new JAXBDataSource(jaxb, dsContext);
        OMNamespace ns = omFactory.createOMNamespace(expectedQName.getNamespaceURI(), "pre");
        OMElement om = omFactory.createOMElement(ds, expectedQName.getLocalPart(), ns);
       
View Full Code Here

        // On inbound, there will already be a probably be an OM
        // which represents the message.  In this scenario, the OM contains
        // a OMSourcedElement that is backed by EchoString.
        OMFactory omFactory = OMAbstractFactory.getOMFactory();
        JAXBDSContext dsContext = new JAXBDSContext(jaxbContext);
        JAXBDataSource ds = new JAXBDataSource(jaxb, dsContext);
        OMNamespace ns = omFactory.createOMNamespace(expectedQName.getNamespaceURI(), null);
        OMElement om = omFactory.createOMElement(ds, expectedQName.getLocalPart(), ns);
       
View Full Code Here

            deploymentFileData.setClassLoader(isDirectory, getClass().getClassLoader(),
                    (File) cfgCtx.getAxisConfiguration().getParameterValue(
                            Constants.Configuration.ARTIFACTS_TEMP_DIR),
                    cfgCtx.getAxisConfiguration().isChildFirstClassLoading());

            DeploymentClassLoader urlCl
                = (DeploymentClassLoader)deploymentFileData.getClassLoader();
            Thread.currentThread().setContextClassLoader(urlCl);

            // StartupFactory registration
            for (StartupFactory factory : getProviders(StartupFactory.class, urlCl)) {
View Full Code Here

    private void handleException(String message, Exception e) throws DeploymentException {
        if (log.isDebugEnabled()) {
            log.debug(message, e);
        }
        throw new DeploymentException(message, e);
    }
View Full Code Here

    private void handleException(String message, Throwable t) throws DeploymentException {
        if (log.isDebugEnabled()) {
            log.debug(message, t);
        }
        throw new DeploymentException(message, t);
    }
View Full Code Here

            }
        } else {
            String msg = "Artifact representing the filename "
                    + fileName + " is not deployed on Synapse";
            log.error(msg);
            throw new DeploymentException(msg);
        }

        if (log.isDebugEnabled()) {
            log.debug("UnDeployment of the synapse artifact from file : "
                    + fileName + " : COMPLETED");
View Full Code Here

    protected SynapseConfiguration getSynapseConfiguration() throws DeploymentException {
        Parameter synCfgParam =
                cfgCtx.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_CONFIG);
        if (synCfgParam == null) {
            throw new DeploymentException("SynapseConfiguration not found. " +
                    "Are you sure that you are running Synapse?");
        }
        return (SynapseConfiguration) synCfgParam.getValue();
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.datasource.jaxb.JAXBDSContext

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.