Examples of EJCExecutor


Examples of org.milyn.ejc.EJCExecutor

    @MojoParameter(required = false)
    private String packageName;

    public void execute() throws MojoExecutionException {
        EJCExecutor ejc = new EJCExecutor();

        try {
            if(ediMappingFile.startsWith("urn:")) {
                if(packageName != null) {
                    throw new MojoExecutionException("Invalid EJC configuration.  'packageName' must not be configured for 'urn' mapping model configurations.");
                }

                String urn = ediMappingFile.substring(4).trim();
                String[] urnTokens;

                urn = urn.replace("-", "_");
                urnTokens = urn.split(":");

                if(urnTokens.length != 3) {
                    throw new MojoExecutionException("'ediMappingFile' urn value must have a minimum of 3 colon separated tokens (4 tokens if including the leading 'urn' token).");
                }

                String directoryMapping = urnTokens[1];
                if(directoryMapping.endsWith("_mapping")) {
                    directoryMapping = directoryMapping.substring(0, directoryMapping.length() - "_mapping".length());
                }

                packageName = urnTokens[0] + "." + directoryMapping;
            } else if(packageName == null) {
                throw new MojoExecutionException("Invalid EJC configuration.  'packageName' must be configured for non 'urn' mapping model configurations.");
            } else {
                File mappingFileObj = new File(project.getBasedir(), ediMappingFile);
                if(mappingFileObj.exists()) {
                    ediMappingFile = mappingFileObj.toURI().toString();
                }
            }

            ejc.setMessages(messages);
            ejc.setDestDir(destDir);
            ejc.setEdiMappingModel(ediMappingFile);
            ejc.setPackageName(packageName);

            if(destDir.exists()) {
                destDir.delete();
            }

            ejc.execute();
            project.addCompileSourceRoot(destDir.getPath());

            Resource resource = new Resource();
            resource.setDirectory(destDir.getPath());
            resource.addInclude("**/*.xml");
 
View Full Code Here

Examples of org.milyn.ejc.EJCExecutor

    private Archive buildBindingModel(String urn, String[] messages) throws IOException, SAXException, IllegalNameException, ClassNotFoundException {
        ClassLoader origTCCL = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(mappingModelClassLoader);
        try {
            AntRunner antRunner = new AntRunner("build.xml");
            EJCExecutor ejc = new EJCExecutor();
            File destDir = new File("target/ejc/src");

            antRunner.run("delete");

            if(messages != null && messages.length != 0) {
                ejc.setMessages(CollectionsUtil.toSet(messages));
            }
            ejc.setDestDir(destDir);
            ejc.setEdiMappingModel("urn:" + urn);
            ejc.setPackageName(EJCTestUtil.ORG_SMOOKS_EJC_TEST);

            // Build the source...
            ejc.execute();

            // Compile it...
            antRunner.run("compile");

            // Build and return an archive instance from the compiled sources...
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.