Package org.apache.axis2.tool.service.bean

Examples of org.apache.axis2.tool.service.bean.ClassFileSelectionBean


    }


    public void process(WizardBean bean) throws ProcessException, Exception {

        ClassFileSelectionBean page1Bean = bean.getPage1bean();
        WSDLFileLocationBean wsdlBean = bean.getWsdlBean();
        LibrarySelectionBean libBean = bean.getLibraryBean();
        Page2Bean page2Bean = bean.getPage2bean();
        Page3Bean page3Bean = bean.getPage3bean();

        File serviceFile = null;
        File wsdlFile = null;
        File classFileFolder = null;
        File outputFolder = null;
        String outputFileName = null;
        boolean isServiceCreated = false;
        boolean isWSDLAvailable = false;

        //see if the class file location is valid
        classFileFolder = new File(page1Bean.getFileLocation());
        if (!classFileFolder.exists()) {
            throw new ProcessException(
                    "Specified Class file location is empty!!");
        }
        if (!classFileFolder.isDirectory()) {
            throw new ProcessException(
                    "The class file location must be a folder!");
        }

        //see if the  service.xml file is valid
        if (page2Bean.isManual()) {
            serviceFile = new File(page2Bean.getManualFileName());
            if (!serviceFile.exists()) {
                throw new ProcessException(
                        "Specified Service XML file is missing!");
            }
        } else {
            ArrayList methodList = page2Bean.getSelectedMethodNames();
            if (methodList.isEmpty()) {
                throw new ProcessException(
                        "There are no methods selected to generate the service!!");
            }
            String currentUserDir = System.getProperty("user.dir");
            String fileName = "services.xml";
            ServiceXMLCreater serviceXMLCreater = new ServiceXMLCreater(page2Bean.getServiceName(),
                                     page2Bean.getAutomaticClassName(),
                                     page2Bean.getSelectedMethodNames());
            String serviceFileString = serviceXMLCreater.toString();
              serviceFile = new File(currentUserDir + File.separator + fileName);
            if (serviceFile.exists()){serviceFile.delete();}
            FileWriter serviceXMLFileWriter = new FileWriter(serviceFile, true);
            BufferedWriter writer = new BufferedWriter(serviceXMLFileWriter) ;
            writer.write(serviceFileString) ;
            writer.close() ;
           
//                    new ServiceFileCreator().createServiceFile(
//                            page2Bean.getServiceName(),
//                            page2Bean.getAutomaticClassName(),
//                            page2Bean.getSelectedMethodNames());//create the file here
             
            isServiceCreated = true;
        }

        //see if the WSDL file is available
        if (!wsdlBean.isSkip()){
            wsdlFile = new File(wsdlBean.getWSDLFileName());
            if (!wsdlFile.exists()) {
                throw new ProcessException(
                        "Specified WSDL file is missing!");
            }else{
                isWSDLAvailable = true;
            }
        }
       
        List fileList = new ArrayList();
        //check the libs
        if (libBean!=null){
            String[] files = libBean.getFileList();
            File tempFile = null;
            if (files!=null){
               for (int i=0;i<files.length;i++){
                 tempFile = new File(files[i]);
                 if (!tempFile.exists()||tempFile.isDirectory()){
                     throw new ProcessException("Invalid libraries");
                 }else{
                     fileList.add(tempFile);
                 }
               }
            }
        }
       
        outputFolder = new File(page3Bean.getOutputFolderName());
        outputFileName = page3Bean.getOutputFileName();
        if (!outputFileName.toLowerCase().endsWith(".jar") && !outputFileName.toLowerCase().endsWith(".aar")) {
            outputFileName = outputFileName + ".aar";
        }

        File tempFileFolder = null;
        String xmlFilter = ".xml";
        String wsdlFilter = ".wsdl";

        try {
            //create a temporary directory and copy the files
            tempFileFolder = new File("Service-copy");
            if (tempFileFolder.exists()){deleteDir(tempFileFolder);}
            tempFileFolder.mkdir();
           
            File metaInfFolder = new File(tempFileFolder, "META-INF");
            metaInfFolder.mkdir();
           
            File libFolder = new File(tempFileFolder,"lib");
            libFolder.mkdir();
           
            FileCopier classFilecopier = new FileCopier();
            //copy the classes
            classFilecopier.copyFiles(classFileFolder, tempFileFolder,page1Bean.getFilter());
           
            //copy the service.xml
            FileCopier serviceXMLcopier = new FileCopier();
            serviceXMLcopier.copyFiles(serviceFile, metaInfFolder,xmlFilter);
           
View Full Code Here


        if (wizardBean.getPage1bean() != null) {
            myBean = wizardBean.getPage1bean();
            this.classFileLocationTextBox.setText(myBean.getFileLocation());
        } else {
            myBean = new ClassFileSelectionBean();
            wizardBean.setPage1bean(myBean);
        }


    }
View Full Code Here

    public String getClassFileLocation(){
        return classFileLocationText.getText();
    }
   
    public ClassFileSelectionBean getBean(){
        ClassFileSelectionBean pageBean = new ClassFileSelectionBean();
        pageBean.setFileLocation(this.classFileLocationText.getText());
        if (filterByClassFilesCheckBox.getSelection()){
            pageBean.setFilter(".class");
        }
        return pageBean;
    }
View Full Code Here

    }


    public void process(WizardBean bean) throws ProcessException, Exception {

        ClassFileSelectionBean page1Bean = bean.getPage1bean();
        WSDLFileLocationBean wsdlBean = bean.getWsdlBean();
        LibrarySelectionBean libBean = bean.getLibraryBean();
        Page2Bean page2Bean = bean.getPage2bean();
        Page3Bean page3Bean = bean.getPage3bean();

        File serviceFile = null;
        File wsdlFile = null;
        File classFileFolder = null;
        File outputFolder = null;
        String outputFileName = null;
        boolean isServiceCreated = false;
        boolean isWSDLAvailable = false;

        //see if the class file location is valid
        classFileFolder = new File(page1Bean.getFileLocation());
        if (!classFileFolder.exists()) {
            throw new ProcessException(
                    "Specified Class file location is empty!!");
        }
        if (!classFileFolder.isDirectory()) {
            throw new ProcessException(
                    "The class file location must be a folder!");
        }

        //see if the  service.xml file is valid
        if (page2Bean.isManual()) {
            serviceFile = new File(page2Bean.getManualFileName());
            if (!serviceFile.exists()) {
                throw new ProcessException(
                        "Specified Service XML file is missing!");
            }
        } else {
            ArrayList methodList = page2Bean.getSelectedMethodNames();
            if (methodList.isEmpty()) {
                throw new ProcessException(
                        "There are no methods selected to generate the service!!");
            }
            String currentUserDir = System.getProperty("user.dir");
            String fileName = "services.xml";
            ServiceXMLCreater serviceXMLCreater = new ServiceXMLCreater(page2Bean.getServiceName(),
                                     page2Bean.getAutomaticClassName(),
                                     page2Bean.getSelectedMethodNames());
            String serviceFileString = serviceXMLCreater.toString();
              serviceFile = new File(currentUserDir + File.separator + fileName);
            if (serviceFile.exists()){serviceFile.delete();}
            FileWriter serviceXMLFileWriter = new FileWriter(serviceFile, true);
            BufferedWriter writer = new BufferedWriter(serviceXMLFileWriter) ;
            writer.write(serviceFileString) ;
            writer.close() ;
           
//                    new ServiceFileCreator().createServiceFile(
//                            page2Bean.getServiceName(),
//                            page2Bean.getAutomaticClassName(),
//                            page2Bean.getSelectedMethodNames());//create the file here
             
            isServiceCreated = true;
        }

        //see if the WSDL file is available
        if (!wsdlBean.isSkip()){
            wsdlFile = new File(wsdlBean.getWSDLFileName());
            if (!wsdlFile.exists()) {
                throw new ProcessException(
                        "Specified WSDL file is missing!");
            }else{
                isWSDLAvailable = true;
            }
        }
       
        List fileList = new ArrayList();
        //check the libs
        if (libBean!=null){
            String[] files = libBean.getFileList();
            File tempFile = null;
            if (files!=null){
               for (int i=0;i<files.length;i++){
                 tempFile = new File(files[i]);
                 if (!tempFile.exists()||tempFile.isDirectory()){
                     throw new ProcessException("Invalid libraries");
                 }else{
                     fileList.add(tempFile);
                 }
               }
            }
        }
       
        outputFolder = new File(page3Bean.getOutputFolderName());
        outputFileName = page3Bean.getOutputFileName();
        if (!outputFileName.toLowerCase().endsWith(".jar") && !outputFileName.toLowerCase().endsWith(".aar")) {
            outputFileName = outputFileName + ".aar";
        }

        File tempFileFolder = null;
        String xmlFilter = ".xml";
        String wsdlFilter = ".wsdl";

        try {
          String metaInfFolderName="META-INF";
          String libFolderName="lib";
         
            //create a temporary directory and copy the files
            tempFileFolder = File.createTempFile("temp",".tmp");
            tempFileFolder.deleteOnExit();
            if (tempFileFolder.exists()){deleteDir(tempFileFolder);}
            tempFileFolder.mkdir();
           
            File metaInfFolder = new File(tempFileFolder, metaInfFolderName);
            metaInfFolder.mkdir();
           
            File libFolder = new File(tempFileFolder,libFolderName);
            libFolder.mkdir();
           
            FileCopier classFilecopier = new FileCopier();
            //copy the classes
            classFilecopier.copyFiles(classFileFolder, tempFileFolder,page1Bean.getFilter());
          
            //copy the service.xml
            FileCopier serviceXMLcopier = new FileCopier();
            serviceXMLcopier.copyFiles(serviceFile, metaInfFolder,xmlFilter);
          
View Full Code Here

    }


    public void process(WizardBean bean) throws ProcessException, Exception {

        ClassFileSelectionBean page1Bean = bean.getPage1bean();
        WSDLFileLocationBean wsdlBean = bean.getWsdlBean();
        LibrarySelectionBean libBean = bean.getLibraryBean();
        Page2Bean page2Bean = bean.getPage2bean();
        Page3Bean page3Bean = bean.getPage3bean();

        File serviceFile = null;
        File wsdlFile = null;
        File classFileFolder = null;
        File outputFolder = null;
        String outputFileName = null;
        boolean isServiceCreated = false;
        boolean isWSDLAvailable = false;

        //see if the class file location is valid
        classFileFolder = new File(page1Bean.getFileLocation());
        if (!classFileFolder.exists()) {
            throw new ProcessException(
                    "Specified Class file location is empty!!");
        }
        if (!classFileFolder.isDirectory()) {
            throw new ProcessException(
                    "The class file location must be a folder!");
        }

        //see if the  service.xml file is valid
        if (page2Bean.isManual()) {
            serviceFile = new File(page2Bean.getManualFileName());
            if (!serviceFile.exists()) {
                throw new ProcessException(
                        "Specified Service XML file is missing!");
            }
        } else {
            ArrayList methodList = page2Bean.getSelectedMethodNames();
            if (methodList.isEmpty()) {
                throw new ProcessException(
                        "There are no methods selected to generate the service!!");
            }
            String currentUserDir = System.getProperty("user.dir");
            String fileName = "services.xml";
            ServiceXMLCreater serviceXMLCreater = new ServiceXMLCreater(page2Bean.getServiceName(),
                                     page2Bean.getAutomaticClassName(),
                                     page2Bean.getSelectedMethodNames());
            String serviceFileString = serviceXMLCreater.toString();
              serviceFile = new File(currentUserDir + File.separator + fileName);
            if (serviceFile.exists()){serviceFile.delete();}
            FileWriter serviceXMLFileWriter = new FileWriter(serviceFile, true);
            BufferedWriter writer = new BufferedWriter(serviceXMLFileWriter) ;
            writer.write(serviceFileString) ;
            writer.close() ;
           
//                    new ServiceFileCreator().createServiceFile(
//                            page2Bean.getServiceName(),
//                            page2Bean.getAutomaticClassName(),
//                            page2Bean.getSelectedMethodNames());//create the file here
             
            isServiceCreated = true;
        }

        //see if the WSDL file is available
        if (!wsdlBean.isSkip()){
            wsdlFile = new File(wsdlBean.getWSDLFileName());
            if (!wsdlFile.exists()) {
                throw new ProcessException(
                        "Specified WSDL file is missing!");
            }else{
                isWSDLAvailable = true;
            }
        }
       
        List fileList = new ArrayList();
        //check the libs
        if (libBean!=null){
            String[] files = libBean.getFileList();
            File tempFile = null;
            if (files!=null){
               for (int i=0;i<files.length;i++){
                 tempFile = new File(files[i]);
                 if (!tempFile.exists()||tempFile.isDirectory()){
                     throw new ProcessException("Invalid libraries");
                 }else{
                     fileList.add(tempFile);
                 }
               }
            }
        }
       
        outputFolder = new File(page3Bean.getOutputFolderName());
        outputFileName = page3Bean.getOutputFileName();
        if (!outputFileName.toLowerCase().endsWith(".jar") && !outputFileName.toLowerCase().endsWith(".aar")) {
            outputFileName = outputFileName + ".aar";
        }

        File tempFileFolder = null;
        String xmlFilter = ".xml";
        String wsdlFilter = ".wsdl";

        try {
          String metaInfFolderName="META-INF";
          String libFolderName="lib";
         
            //create a temporary directory and copy the files
            tempFileFolder = File.createTempFile("temp",".tmp");
            tempFileFolder.deleteOnExit();
            if (tempFileFolder.exists()){deleteDir(tempFileFolder);}
            tempFileFolder.mkdir();
           
            File metaInfFolder = new File(tempFileFolder, metaInfFolderName);
            metaInfFolder.mkdir();
           
            File libFolder = new File(tempFileFolder,libFolderName);
            libFolder.mkdir();
           
            FileCopier classFilecopier = new FileCopier();
            //copy the classes
            classFilecopier.copyFiles(classFileFolder, tempFileFolder,page1Bean.getFilter());
          
            //copy the service.xml
            FileCopier serviceXMLcopier = new FileCopier();
            serviceXMLcopier.copyFiles(serviceFile, metaInfFolder,xmlFilter);
          
View Full Code Here

        if (wizardBean.getPage1bean() != null) {
            myBean = wizardBean.getPage1bean();
            this.classFileLocationTextBox.setText(myBean.getFileLocation());
        } else {
            myBean = new ClassFileSelectionBean();
            wizardBean.setPage1bean(myBean);
        }


    }
View Full Code Here

    public String getClassFileLocation(){
        return classFileLocationText.getText();
    }
   
    public ClassFileSelectionBean getBean(){
        ClassFileSelectionBean pageBean = new ClassFileSelectionBean();
        pageBean.setFileLocation(this.classFileLocationText.getText());
        if (filterByClassFilesCheckBox.getSelection()){
            pageBean.setFilter(".class");
        }
        return pageBean;
    }
View Full Code Here

        if (wizardBean.getPage1bean() != null) {
            myBean = wizardBean.getPage1bean();
            this.classFileLocationTextBox.setText(myBean.getFileLocation());
        } else {
            myBean = new ClassFileSelectionBean();
            wizardBean.setPage1bean(myBean);
        }


    }
View Full Code Here

    public String getClassFileLocation(){
        return classFileLocationText.getText();
    }
   
    public ClassFileSelectionBean getBean(){
        ClassFileSelectionBean pageBean = new ClassFileSelectionBean();
        pageBean.setFileLocation(this.classFileLocationText.getText());
        if (filterByClassFilesCheckBox.getSelection()){
            pageBean.setFilter(".class");
        }
        return pageBean;
    }
View Full Code Here

    }


    public void process(WizardBean bean) throws ProcessException, Exception {

        ClassFileSelectionBean page1Bean = bean.getPage1bean();
        WSDLFileLocationBean wsdlBean = bean.getWsdlBean();
        LibrarySelectionBean libBean = bean.getLibraryBean();
        Page2Bean page2Bean = bean.getPage2bean();
        Page3Bean page3Bean = bean.getPage3bean();

        File serviceFile = null;
        File wsdlFile = null;
        File classFileFolder = null;
        File outputFolder = null;
        String outputFileName = null;
        boolean isServiceCreated = false;
        boolean isWSDLAvailable = false;

        //see if the class file location is valid
        classFileFolder = new File(page1Bean.getFileLocation());
        if (!classFileFolder.exists()) {
            throw new ProcessException(
                    "Specified Class file location is empty!!");
        }
        if (!classFileFolder.isDirectory()) {
            throw new ProcessException(
                    "The class file location must be a folder!");
        }

        //see if the  service.xml file is valid
        if (page2Bean.isManual()) {
            serviceFile = new File(page2Bean.getManualFileName());
            if (!serviceFile.exists()) {
                throw new ProcessException(
                        "Specified Service XML file is missing!");
            }
        } else {
            ArrayList methodList = page2Bean.getSelectedMethodNames();
            if (methodList.isEmpty()) {
                throw new ProcessException(
                        "There are no methods selected to generate the service!!");
            }
            String currentUserDir = System.getProperty("user.dir");
            String fileName = "services.xml";
            ServiceXMLCreater serviceXMLCreater = new ServiceXMLCreater(page2Bean.getServiceName(),
                                     page2Bean.getAutomaticClassName(),
                                     page2Bean.getSelectedMethodNames());
            String serviceFileString = serviceXMLCreater.toString();
              serviceFile = new File(currentUserDir + File.separator + fileName);
            FileWriter serviceXMLFileWriter = new FileWriter(serviceFile, true);
            BufferedWriter writer = new BufferedWriter(serviceXMLFileWriter) ;
            writer.write(serviceFileString) ;
            writer.close() ;
           
//                    new ServiceFileCreator().createServiceFile(
//                            page2Bean.getServiceName(),
//                            page2Bean.getAutomaticClassName(),
//                            page2Bean.getSelectedMethodNames());//create the file here
             
            isServiceCreated = true;
        }

        //see if the WSDL file is available
        if (!wsdlBean.isSkip()){
            wsdlFile = new File(wsdlBean.getWSDLFileName());
            if (!wsdlFile.exists()) {
                throw new ProcessException(
                        "Specified WSDL file is missing!");
            }else{
                isWSDLAvailable = true;
            }
        }
       
        List fileList = new ArrayList();
        //check the libs
        if (libBean!=null){
            String[] files = libBean.getFileList();
            File tempFile = null;
            if (files!=null){
               for (int i=0;i<files.length;i++){
                 tempFile = new File(files[i]);
                 if (!tempFile.exists()||tempFile.isDirectory()){
                     throw new ProcessException("Invalid libraries");
                 }else{
                     fileList.add(tempFile);
                 }
               }
            }
        }
       
        outputFolder = new File(page3Bean.getOutputFolderName());
        outputFileName = page3Bean.getOutputFileName();
        if (!outputFileName.toLowerCase().endsWith(".jar")) {
            outputFileName = outputFileName + ".jar";
        }

        File tempFileFolder = null;

        try {
            //create a temporary directory and copy the files
            tempFileFolder = new File("Service-copy");
            tempFileFolder.mkdir();
           
            File metaInfFolder = new File(tempFileFolder, "META-INF");
            metaInfFolder.mkdir();
           
            File libFolder = new File(tempFileFolder,"lib");
            libFolder.mkdir();
           
            FileCopier copier = new FileCopier();
            //copy the classes
            copier.copyFiles(classFileFolder, tempFileFolder,page1Bean.getFilter());
            //copy the service.xml
            copier.copyFiles(serviceFile, metaInfFolder,null);
            //copy the libs
            for (int i=0;i < fileList.size();i++){
               copier.copyFiles((File)fileList.get(i),libFolder,null);
View Full Code Here

TOP

Related Classes of org.apache.axis2.tool.service.bean.ClassFileSelectionBean

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.