Package org.apache.xmlbeans.impl.util

Examples of org.apache.xmlbeans.impl.util.FilerImpl


        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {

                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
                    }
                    String pkg = tn.substring(0, tn.lastIndexOf('.'));
                    tn = tn.substring(tn.lastIndexOf('.') + 1);
                    classCollector.addTypesClassName(pkg, tn, pkg + "." + tn);
                    return super.createSourceFile(typename);
                }
            };

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            /*
            if (codePrinter != null) {
                options.setSchemaCodePrinter(codePrinter);
            }
            */
            options.setGenerateJavaVersion("1.5");

            // save .xsb files
            typeSystem.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(typeSystem, filer, options);
            /*
            for (String s : classCollector.getGeneratedFileInfo()) {
                System.out.println(s);
            }
            */
            for (Map.Entry<String, String> ent : sourcesToCopyMap.entrySet()) {
                try {
                    OutputStream out = filer.createBinaryFile("schema"
                                                              + SchemaTypeSystemImpl.METADATA_PACKAGE_GEN
                                                              + "/src/" + ent.getValue());
                    URL url = new URL(ent.getKey());
                    InputStream in = url.openStream();
                    IOUtils.copy(in, out);
View Full Code Here


        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {

                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
                    }
                    String pkg = tn.substring(0, tn.lastIndexOf('.'));
                    tn = tn.substring(tn.lastIndexOf('.') + 1);
                    classCollector.addTypesClassName(pkg, tn, pkg + "." + tn);
                    return super.createSourceFile(typename);
                }
            };

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            /*
            if (codePrinter != null) {
                options.setSchemaCodePrinter(codePrinter);
            }
            */
            options.setGenerateJavaVersion("1.5");

            // save .xsb files
            typeSystem.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(typeSystem, filer, options);
            /*
            for (String s : classCollector.getGeneratedFileInfo()) {
                System.out.println(s);
            }
            */
            for (Map.Entry<String, String> ent : sourcesToCopyMap.entrySet()) {
                try {
                    OutputStream out = filer.createBinaryFile("schema"
                                                              + SchemaTypeSystemImpl.METADATA_PACKAGE_GEN
                                                              + "/src/" + ent.getValue());
                    URL url = new URL(ent.getKey());
                    InputStream in = url.openStream();
                    IOUtils.copy(in, out);
View Full Code Here

    static private final SchemaIdentityConstraint[] EMPTY_IC_ARRAY = new SchemaIdentityConstraint[0];
    static private final SchemaAnnotation[] EMPTY_ANN_ARRAY = new SchemaAnnotation[0];

    public void saveToDirectory(File classDir)
    {
        save(new FilerImpl(classDir, null, null, false, false));
    }
View Full Code Here

        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {

                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
                    }
                    String pkg = tn.substring(0, tn.lastIndexOf('.'));
                    tn = tn.substring(tn.lastIndexOf('.') + 1);
                    classCollector.addTypesClassName(pkg, tn, pkg + "." + tn);
                    return super.createSourceFile(typename);
                }
            };

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            /*
            if (codePrinter != null) {
                options.setSchemaCodePrinter(codePrinter);
            }
            */
            options.setGenerateJavaVersion("1.5");

            // save .xsb files
            typeSystem.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(typeSystem, filer, options);
            /*
            for (String s : classCollector.getGeneratedFileInfo()) {
                System.out.println(s);
            }
            */
            for (Map.Entry<String, String> ent : sourcesToCopyMap.entrySet()) {
                try {
                    OutputStream out = filer.createBinaryFile("schema"
                                                              + SchemaTypeSystemImpl.METADATA_PACKAGE_GEN
                                                              + "/src/" + ent.getValue());
                    URL url = new URL(ent.getKey());
                    InputStream in = url.openStream();
                    IOUtils.copy(in, out);
View Full Code Here

        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {

                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
                    }
                    String pkg = tn.substring(0, tn.lastIndexOf('.'));
                    tn = tn.substring(tn.lastIndexOf('.') + 1);
                    classCollector.addTypesClassName(pkg, tn, pkg + "." + tn);
                    return super.createSourceFile(typename);
                }
            };

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            /*
            if (codePrinter != null) {
                options.setSchemaCodePrinter(codePrinter);
            }
            */
            options.setGenerateJavaVersion("1.5");

            // save .xsb files
            typeSystem.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(typeSystem, filer, options);
            /*
            for (String s : classCollector.getGeneratedFileInfo()) {
                System.out.println(s);
            }
            */
            for (Map.Entry<String, String> ent : sourcesToCopyMap.entrySet()) {
                try {
                    OutputStream out = filer.createBinaryFile("schema"
                                                              + SchemaTypeSystemImpl.METADATA_PACKAGE_GEN
                                                              + "/src/" + ent.getValue());
                    URL url = new URL(ent.getKey());
                    InputStream in = url.openStream();
                    IOUtils.copy(in, out);
View Full Code Here

    static private final SchemaIdentityConstraint[] EMPTY_IC_ARRAY = new SchemaIdentityConstraint[0];
    static private final SchemaAnnotation[] EMPTY_ANN_ARRAY = new SchemaAnnotation[0];

    public void saveToDirectory(File classDir)
    {
        save(new FilerImpl(classDir, null, null, false, false));
    }
View Full Code Here

        {
            start = System.currentTimeMillis();

            // filer implementation writes binary .xsd and generated source to disk
            Repackager repackager = (repackage == null ? null : new Repackager(repackage));
            FilerImpl filer = new FilerImpl(classesDir, srcDir, repackager, verbose, incrSrcGen);

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            if (codePrinter != null)
                options.setSchemaCodePrinter(codePrinter);
            if (javasource != null)
                options.setGenerateJavaVersion(javasource);

            // save .xsb files
            system.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(system, filer, options);

            if (incrSrcGen)
            {
                // We have to delete extra source files that may be out of date
                SchemaCodeGenerator.deleteObsoleteFiles(srcDir, srcDir,
                    new HashSet(filer.getSourceFiles()));
            }

            if (result)
            {
                finish = System.currentTimeMillis();
                if (!quiet)
                    System.out.println("Time to generate code: " + ((double)(finish - start) / 1000.0) + " seconds" );
            }

            // compile source
            if (result && !nojavac)
            {
                start = System.currentTimeMillis();

                List sourcefiles = filer.getSourceFiles();

                if (javaFiles != null)
                    sourcefiles.addAll(java.util.Arrays.asList(javaFiles));
                if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, javasource, memoryInitialSize, memoryMaximumSize, quiet, verbose))
                    result = false;
View Full Code Here

        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {

                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
                    }
                    String pkg = tn.substring(0, tn.lastIndexOf('.'));
                    tn = tn.substring(tn.lastIndexOf('.') + 1);
                    classCollector.addTypesClassName(pkg, tn, pkg + "." + tn);
                    return super.createSourceFile(typename);
                }
            };

            // currently just for schemaCodePrinter
            XmlOptions options = new XmlOptions();
            /*
            if (codePrinter != null) {
                options.setSchemaCodePrinter(codePrinter);
            }
            */
            options.setGenerateJavaVersion("1.5");

            // save .xsb files
            typeSystem.save(filer);

            // gen source files
            result &= SchemaTypeSystemCompiler.generateTypes(typeSystem, filer, options);
            /*
            for (String s : classCollector.getGeneratedFileInfo()) {
                System.out.println(s);
            }
            */
            for (Map.Entry<String, String> ent : sourcesToCopyMap.entrySet()) {
                try {
                    OutputStream out = filer.createBinaryFile("schema"
                                                              + SchemaTypeSystemImpl.METADATA_PACKAGE_GEN
                                                              + "/src/" + ent.getValue());
                    URL url = new URL(ent.getKey());
                    InputStream in = url.openStream();
                    IOUtils.copy(in, out);
View Full Code Here

        // now code generate and compile the JAR
        if (result) {
            // filer implementation writes binary .xsd and generated source to disk
            final ClassCollector classCollector = context.get(ClassCollector.class);

            FilerImpl filer = new FilerImpl(classesDir, srcDir,
                                            null, verbose, false) {
                public Writer createSourceFile(String typename) throws IOException {
                    String tn = typename;
                    if (tn.contains("$")) {
                        tn = tn.substring(0, tn.indexOf('$'));
View Full Code Here

    static private final SchemaIdentityConstraint[] EMPTY_IC_ARRAY = new SchemaIdentityConstraint[0];
    static private final SchemaAnnotation[] EMPTY_ANN_ARRAY = new SchemaAnnotation[0];

    public void saveToDirectory(File classDir)
    {
        save(new FilerImpl(classDir, null, null, false, false));
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.impl.util.FilerImpl

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.