Package org.apache.tuscany.common.resource

Examples of org.apache.tuscany.common.resource.ResourceLoader


        if (isInitialized())
            return;
        super.initialize(modelContext);
       
        // Load the WSDL definition if necessary
        ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader();
        if (definition == null) {
            URL url = resourceLoader.getResource(location);
            if (url == null)
                throw new IllegalArgumentException("Cannot find " + location);
            definition = modelContext.getAssemblyLoader().loadDefinition(url.toString());
        }
    }
View Full Code Here


        // Create a default assembly model loader
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl();

        // Create a resource loader from the supplied classloader
        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);

        // Create an assembly model context
        return new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader);
    }
View Full Code Here

    public WSDLServiceContract load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
        assert AssemblyConstants.INTERFACE_WSDL.equals(reader.getName());
        WSDLServiceContract serviceContract = factory.createWSDLServiceContract();
        serviceContract.setScope(Scope.INSTANCE);
       
        ResourceLoader resourceLoader = loaderContext.getResourceLoader();

        String location = reader.getAttributeValue(WSDLI, WSDLI_LOCATION);
        if (location != null) {
            try {
                wsdlRegistry.loadDefinition(location, resourceLoader);
View Full Code Here

    }

    private void importFactory(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException {
        String factoryName = reader.getAttributeValue(null, "factory");
        if (factoryName != null) {
            ResourceLoader resourceLoader = loaderContext.getResourceLoader();
            ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
            try {
                // set TCCL as SDO needs it
                Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
                Class<?> factoryClass = resourceLoader.loadClass(factoryName);
                SDOUtil.registerStaticTypes(factoryClass);
            } catch (ClassNotFoundException e) {
                throw new ConfigurationLoadException(e.getMessage(), e);
            } finally {
                Thread.currentThread().setContextClassLoader(oldCL);
View Full Code Here

    private void importWSDLOrXSD(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException {
        String location = reader.getAttributeValue(null, "wsdlLocation");
        if (location == null)
            location = reader.getAttributeValue(null, "schemaLocation");
        if (location != null) {
            ResourceLoader resourceLoader = loaderContext.getResourceLoader();
            URL wsdlURL = resourceLoader.getResource(location);
            ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
            try {
//                Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
                InputStream xsdInputStream = wsdlURL.openStream();
                try {
View Full Code Here

        servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime);
        servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext);
    }

    private void loadContext(Context ctx) throws ConfigurationException {
        ResourceLoader resourceLoader = new ResourceLoaderImpl(ctx.getLoader().getClassLoader());
        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        try {
            AssemblyContextImpl modelContext = new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader, ctx.getName());
View Full Code Here

        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
        scdlLoaders.add(new SystemSCDLModelLoader());
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);

        // Create a resource loader from the supplied classloader
        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);

        // Create an assembly model context
        return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
    }
View Full Code Here

        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
        scdlLoaders.add(new SystemSCDLModelLoader());
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);

        // Create a resource loader from the supplied classloader
        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);

        // Create an assembly model context
        return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.common.resource.ResourceLoader

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.