Package org.apache.axis2.deployment

Examples of org.apache.axis2.deployment.ModuleBuilder


                zin = new ZipInputStream(new FileInputStream(filename));
                ZipEntry entry;
                while ((entry = zin.getNextEntry()) != null) {
                    if (entry.getName().equals(MODULEXML)) {
                        foundmoduleXML = true;
                        ModuleBuilder builder = new ModuleBuilder(zin, engine, module);
                        builder.populateModule();
                        break;
                    }
                }
                zin.close();
                if (!foundmoduleXML) {
                    throw new DeploymentException(Messages.getMessage(
                            DeploymentErrorMsgs.MODULEXML_NOT_FOUND_FOR_THE_MODULE, filename));
                }
            } catch (Exception e) {
                throw new DeploymentException(e);
            }
        } else {
            File file = new File(filename, MODULEXML);
            if (file.exists()) {
                InputStream in;
                try {
                    in = new FileInputStream(file);
                    ModuleBuilder builder = new ModuleBuilder(in, engine, module);
                    builder.populateModule();
                } catch (FileNotFoundException e) {
                    throw new DeploymentException("FileNotFound : " + e);
                }
            } else {
                throw new DeploymentException(Messages.getMessage(
View Full Code Here


                zin = new ZipInputStream(fin);
                ZipEntry entry;
                while ((entry = zin.getNextEntry()) != null) {
                    if (entry.getName().equalsIgnoreCase(MODULE_XML)) {
                        moduleXMLFound = true;
                        ModuleBuilder builder = new ModuleBuilder(zin, module, axisConfig);
                        // setting module name and version
                        module.setArchiveName(shortFileName);
                        builder.populateModule();
                        break;
                    }
                }
                zin.close();
                fin.close();
                if (!moduleXMLFound) {
                    throw new DeploymentException(
                            Messages.getMessage(
                                    DeploymentErrorMsgs.MODULE_XML_MISSING,
                                    deploymentFile.getAbsolutePath()));
                }
            } catch (Exception e) {
                throw new DeploymentException(e);
            }
        } else {
            File file = new File(deploymentFile.getAbsolutePath(), MODULE_XML);

            if (file.exists() ||
                (file = new File(deploymentFile.getAbsolutePath(), MODULE_XML.toLowerCase()))
                        .exists()) {
                InputStream in = null;
                try {
                    in = new FileInputStream(file);
                    ModuleBuilder builder = new ModuleBuilder(in, module, axisConfig);
                    // setting module name and version
                    module.setArchiveName(shortFileName);
                    builder.populateModule();
                } catch (FileNotFoundException e) {
                    throw new DeploymentException(
                            Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND,
                                                e.getMessage()));
                } finally {
View Full Code Here

            if (moduleStream == null) {
                throw new DeploymentException(
                        Messages.getMessage(
                                DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
            }
            ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
            moduleBuilder.populateModule();
        } catch (IOException e) {
            throw new DeploymentException(e);
        }
    }
View Full Code Here

            if (moduleStream == null) {
                throw new DeploymentException(
                        Messages.getMessage(
                                DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
            }
            ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
            moduleBuilder.populateModule();
        } catch (IOException e) {
            throw new DeploymentException(e);
        }
    }
View Full Code Here

                    AxisModule axismodule = new AxisModule();
                    ClassLoader loader =
                            new BundleClassLoader(bundle, Registry.class.getClassLoader());
                    axismodule.setModuleClassLoader(loader);
                    AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
                    ModuleBuilder builder =
                            new ModuleBuilder(url.openStream(), axismodule, axisConfig);
                    Dictionary headers = bundle.getHeaders();
                    String bundleSymbolicName = (String) headers.get("Bundle-SymbolicName");
                    if (bundleSymbolicName != null && bundleSymbolicName.length() != 0) {
                        axismodule.setName(bundleSymbolicName);
                    }
                    String bundleVersion = (String) headers.get("Bundle-Version");
                    if (bundleVersion != null && bundleVersion.length() != 0) {
                        /*
                            Bundle version is defined as
                            version ::=
                                major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
                                major ::= number
                                minor ::= number
                                micro ::= number
                                qualifier ::= ( alphanum | ’_’ | '-' )+
                         */
                        String[] versionSplit = bundleVersion.split("\\.");
                        int[] components = new int[Math.min(versionSplit.length, 3)];
                        for (int i=0; i<components.length; i++) {
                            components[i] = Integer.parseInt(versionSplit[i]);
                        }
                        axismodule.setVersion(new Version(components, versionSplit.length > 3 ?
                                versionSplit[3] : null));
                    }
                    builder.populateModule();
                    axismodule.setParent(axisConfig);
                    AxisModule module = axisConfig.getModule(axismodule.getName());
                    if (module == null) {
                        DeploymentEngine.addNewModule(axismodule, axisConfig);
                        //initialze the module if the module contains Module interface.
View Full Code Here

                    AxisModule axismodule = new AxisModule();
                    ClassLoader loader =
                            new BundleClassLoader(bundle, Registry.class.getClassLoader());
                    axismodule.setModuleClassLoader(loader);
                    AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
                    ModuleBuilder builder =
                            new ModuleBuilder(url.openStream(), axismodule, axisConfig);
                    Dictionary headers = bundle.getHeaders();
                    String bundleSymbolicName = (String) headers.get("Bundle-SymbolicName");
                    if (bundleSymbolicName != null && bundleSymbolicName.length() != 0) {
                        axismodule.setName(bundleSymbolicName);
                    }
                    String bundleVersion = (String) headers.get("Bundle-Version");
                    if (bundleVersion != null && bundleVersion.length() != 0) {
                        String moduleVersion = "SNAPSHOT";
                        /*
                            Bundle version is defined as
                            version ::=
                                major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
                                major ::= number
                                minor ::= number
                                micro ::= number
                                qualifier ::= ( alphanum | ’_’ | '-' )+

                            Hence, in order to sync up with Axis2 module versioning, which is a floating
                            point number, following logic is used to create the version
                            version := major(.minormircor)
                         */
                        String[] versionSplit = bundleVersion.split("\\.");
                        if (versionSplit.length == 3) {
                            moduleVersion =
                                    versionSplit[0] + "." + versionSplit[1] + versionSplit[2];
                        } else if (versionSplit.length == 2) {
                            moduleVersion = versionSplit[0] + "." + versionSplit[1];
                        } else if (versionSplit.length == 1) {
                            moduleVersion = versionSplit[0];
                        }
                        axismodule.setVersion(moduleVersion);
                    }
                    builder.populateModule();
                    axismodule.setParent(axisConfig);
                    AxisModule module = axisConfig.getModule(axismodule.getName());
                    if (module == null) {
                        DeploymentEngine.addNewModule(axismodule, axisConfig);
                        //initialze the module if the module contains Module interface.
View Full Code Here

                zin = new ZipInputStream(fin);
                ZipEntry entry;
                while ((entry = zin.getNextEntry()) != null) {
                    if (entry.getName().equalsIgnoreCase(MODULE_XML)) {
                        moduleXMLFound = true;
                        ModuleBuilder builder = new ModuleBuilder(zin, module, axisConfig);
                        // setting module name
                        module.setName(Utils.getModuleName(shortFileName));
                        module.setVersion(Utils.getModuleVersion(shortFileName));
                        builder.populateModule();
                        break;
                    }
                }
                zin.close();
                fin.close();
                if (!moduleXMLFound) {
                    throw new DeploymentException(
                            Messages.getMessage(
                                    DeploymentErrorMsgs.MODULE_XML_MISSING,
                                    deploymentFile.getAbsolutePath()));
                }
            } catch (Exception e) {
                throw new DeploymentException(e);
            }
        } else {
            File file = new File(deploymentFile.getAbsolutePath(), MODULE_XML);

            if (file.exists() ||
                (file = new File(deploymentFile.getAbsolutePath(), MODULE_XML.toLowerCase()))
                        .exists()) {
                InputStream in = null;
                try {
                    in = new FileInputStream(file);
                    ModuleBuilder builder = new ModuleBuilder(in, module, axisConfig);
                    // setting module name
                    module.setName(Utils.getModuleName(shortFileName));
                    module.setVersion(Utils.getModuleVersion(shortFileName));
                    builder.populateModule();
                } catch (FileNotFoundException e) {
                    throw new DeploymentException(
                            Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND,
                                                e.getMessage()));
                } finally {
View Full Code Here

        try {
            assertNotNull(ar);
            ModuleDescription module = new ModuleDescription();
            module.setParent(ar);
            InputStream in = new FileInputStream(repo + "/module_overide_global_non_locked_para.xml");
            ModuleBuilder mbuilder = new ModuleBuilder(in,module,ar);
            mbuilder.populateModule();
        }catch (FileNotFoundException e) {
            fail("This can not fail with this FileNotFoundException " + e) ;
        } catch (DeploymentException e) {

        }
View Full Code Here

        try {
            assertNotNull(ar);
            ModuleDescription module = new ModuleDescription();
            module.setParent(ar);
            InputStream in = new FileInputStream(repo + "/module_overide_locked_para.xml");
            ModuleBuilder mbuilder = new ModuleBuilder(in,module,ar);
            mbuilder.populateModule();
            fail("Parmter is locked can not overide" ) ;
        }catch (FileNotFoundException e) {
            fail("This can not fail with this FileNotFoundException " + e) ;
        } catch (DeploymentException e) {
View Full Code Here

                zin = new ZipInputStream(new FileInputStream(filename));
                ZipEntry entry;
                while ((entry = zin.getNextEntry()) != null) {
                    if (entry.getName().equals(MODULEXML)) {
                        foundmoduleXML = true;
                        ModuleBuilder builder = new ModuleBuilder(zin, module, axisConfig);
                        //setting module name
                        module.setName(new QName(DescriptionBuilder.getShortFileName(
                                engine.getCurrentFileItem().getServiceName())));
                        builder.populateModule();
                        break;
                    }
                }
                zin.close();
                if (!foundmoduleXML) {
                    throw new DeploymentException(Messages.getMessage(
                            DeploymentErrorMsgs.MODULEXML_NOT_FOUND_FOR_THE_MODULE, filename));
                }
            } catch (Exception e) {
                throw new DeploymentException(e);
            }
        } else {
            File file = new File(filename, MODULEXML);
            if (file.exists()) {
                InputStream in;
                try {
                    in = new FileInputStream(file);
                    ModuleBuilder builder = new ModuleBuilder(in, module, axisConfig);
                    // setting module name
                    module.setName(new QName(DescriptionBuilder.getShortFileName(
                            engine.getCurrentFileItem().getServiceName())));
                    builder.populateModule();
                } catch (FileNotFoundException e) {
                    throw new DeploymentException(Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND
                            , e.getMessage()));
                }
            } else {
View Full Code Here

TOP

Related Classes of org.apache.axis2.deployment.ModuleBuilder

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.