Package org.apache.axis2.deployment

Examples of org.apache.axis2.deployment.DeploymentException


                File metaInfFolder = new File(serviceFile, META_INF);

                if (!metaInfFolder.exists()) {
                    metaInfFolder = new File(serviceFile, META_INF.toLowerCase());
                    if (!metaInfFolder.exists()) {
                        throw new DeploymentException(
                                Messages.getMessage(
                                        DeploymentErrorMsgs.META_INF_MISSING,
                                        serviceFile.getName()));
                    }
                }

                processFilesInFolder(metaInfFolder, servicesMap);

            } catch (FileNotFoundException e) {
                throw new DeploymentException(e);
            } catch (IOException e) {
                throw new DeploymentException(e);
            } catch (XMLStreamException e) {
                throw new DeploymentException(e);
            }
        } else {
            ZipInputStream zin;
            FileInputStream fin;
            try {
                fin = new FileInputStream(serviceFile);
                zin = new ZipInputStream(fin);

                //TODO Check whether this WSDL is empty

                ZipEntry entry;
                byte[] buf = new byte[1024];
                int read;
                ByteArrayOutputStream out;
                while ((entry = zin.getNextEntry()) != null) {
                    String entryName = entry.getName().toLowerCase();
                    if (entryName.startsWith(META_INF.toLowerCase())
                        && entryName.endsWith(SUFFIX_WSDL)) {
                        out = new ByteArrayOutputStream();

                        // we do not want to generate the services for the
                        // imported wsdl of one file.
                        if ((entryName.indexOf("/") != entryName.lastIndexOf("/"))
                            || (entryName.indexOf("wsdl_") != -1)) {
                            //only care abt the toplevel wsdl
                            continue;
                        }

                        while ((read = zin.read(buf)) > 0) {
                            out.write(buf, 0, read);
                        }

                        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());

                        // now the question is which version of WSDL file this archive contains.
                        // lets check the namespace of the root element and decide. But since we are
                        // using axiom (dude, you are becoming handy here :)), we will not build the
                        // whole thing.
                        OMNamespace documentElementNS =
                                ((OMElement) XMLUtils.toOM(in)).getNamespace();
                        if (documentElementNS != null) {
                            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder;
                            if (WSDL2Constants.WSDL_NAMESPACE
                                    .equals(documentElementNS.getNamespaceURI())) {
                                // we have a WSDL 2.0 document here.
                                wsdlToAxisServiceBuilder = new WSDL20ToAllAxisServicesBuilder(
                                        new ByteArrayInputStream(out.toByteArray()));
                                wsdlToAxisServiceBuilder.setBaseUri(entryName);
                            } else if (Constants.NS_URI_WSDL11.
                                    equals(documentElementNS.getNamespaceURI())) {
                                wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(
                                        new ByteArrayInputStream(out.toByteArray()));
                                ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(entryName);
                            } else {
                                throw new DeploymentException(Messages.getMessage("invalidWSDLFound"));
                            }
                            List<AxisService> services = processWSDLFile(wsdlToAxisServiceBuilder,
                                                            serviceFile, true,
                                                            new ByteArrayInputStream(
                                                                    out.toByteArray()),
                                                            entry.getName());
                            if (services != null) {
                                for (AxisService axisService : services) {
                                    if (axisService != null) {
                                        servicesMap.put(axisService.getName(), axisService);
                                    }
                                }
                            }
                        }
                    }
                }
                try {
                    zin.close();
                } catch (IOException e) {
                    log.info(e);
                }
                try {
                    fin.close();
                } catch (IOException e) {
                    log.info(e);
                }
            } catch (FileNotFoundException e) {
                throw new DeploymentException(e);
            } catch (IOException e) {
                throw new DeploymentException(e);
            } catch (XMLStreamException e) {
                throw new DeploymentException(e);
            }
        }
        return servicesMap;
    }
View Full Code Here


                wsdlToAxisServiceBuilder.setCustomResolver(
                        new WarFileBasedURIResolver(loader));
                return ((WSDL20ToAllAxisServicesBuilder)wsdlToAxisServiceBuilder).populateAllServices();
            }
            else {
                throw new DeploymentException(Messages.getMessage("invalidWSDLFound"));
            }
        }
        return null;
    }
View Full Code Here

                        in2 = new FileInputStream(file1);
                        wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(in2);
                        ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(file1.toURI()
                                                                                                        .toString());
                    } else {
                        throw new DeploymentException(Messages.getMessage("invalidWSDLFound"));
                    }

                    FileInputStream in3 = new FileInputStream(file1);
                    List<AxisService> services = processWSDLFile(wsdlToAxisServiceBuilder, file1, false,
                                                    in2, file1.toURI().toString());
View Full Code Here

                    }
                }
                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 {
                    if (in != null) {
                        try {
                            in.close();
                        } catch (IOException e) {
                            log.info(Messages.getMessage("errorininputstreamclose"));
                        }
                    }
                }
            } else {
                throw new DeploymentException(
                        Messages.getMessage(
                                DeploymentErrorMsgs.MODULE_XML_MISSING,
                                deploymentFile.getAbsolutePath()));
            }
        }
View Full Code Here

        } catch (ClassNotFoundException e) {
            if (handlername.indexOf("jaxws") > 0) {
                log.warn("[JAXWS] - unable to load " + handlername);
                return false;
            }
            throw new DeploymentException(e);
        } catch (Exception e) {
            throw new DeploymentException(e);
        }
        return true;
    }
View Full Code Here

                            }
                        }
                    });
            return classLoader;
        } catch (MalformedURLException e) {
            throw new DeploymentException(e);
        }
    }
View Full Code Here

                }
                return classList;            
            }
        } catch (IOException e) {
            log.debug(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_EXCEPTION, e.getMessage()), e);
            throw new DeploymentException(e);
        }
    }
View Full Code Here

    }

    public void deployModule(String moduleFileName) throws DeploymentException {
        File moduleFile = new File(moduleFileName);
        if (!moduleFile.exists()) {
            throw new DeploymentException("Module archive '" + moduleFileName + "' doesn't exist");
        }
        DeploymentFileData dfd = new DeploymentFileData(moduleFile, new ModuleDeployer(this));
        dfd.deploy();
    }
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

TOP

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

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.