Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.EjbJar$JAXB


    }

    public static ApplicationClient unmarshal(final URL url) throws Exception {
        final InputStream inputStream = IO.read(url);
        try {
            return Sxc.unmarshalJavaee(new ApplicationClient$JAXB(), inputStream);
        } finally {
            IO.close(inputStream);
        }
    }
View Full Code Here


            IO.close(inputStream);
        }
    }

    public static void marshal(final ApplicationClient applicationClient, final OutputStream outputStream) throws Exception {
        Sxc.marshal(new ApplicationClient$JAXB(), applicationClient, new StreamResult(outputStream));
    }
View Full Code Here

* @version $Rev$ $Date$
*/
public class ApplicationClientXml {

    public static ApplicationClient unmarshal(InputStream inputStream) throws Exception {
        return Sxc.unmarshalJavaee(new ApplicationClient$JAXB(), inputStream);
    }
View Full Code Here

    }

    public static ApplicationClient unmarshal(URL url) throws Exception {
        final InputStream inputStream = IO.read(url);
        try {
            return Sxc.unmarshalJavaee(new ApplicationClient$JAXB(), inputStream);
        } finally {
            IO.close(inputStream);
        }
    }
View Full Code Here

            IO.close(inputStream);
        }
    }

    public static void marshal(ApplicationClient applicationClient, OutputStream outputStream) throws Exception {
        Sxc.marshal(new ApplicationClient$JAXB(), applicationClient, new StreamResult(outputStream));
    }
View Full Code Here

        return convert(prefix + "ejb-jar.xml", prefix + "openejb-jar.xml", prefix + "orm.xml");
    }

    private EntityMappings convert(String ejbJarFileName, String openejbJarFileName, String expectedFileName) throws Exception {
        InputStream in = getClass().getClassLoader().getResourceAsStream(ejbJarFileName);
        EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, new ByteArrayInputStream(readContent(in).getBytes()));

        // create and configure the module
        EjbModule ejbModule = new EjbModule(getClass().getClassLoader(), "TestModule", ejbJarFileName, ejbJar, new OpenejbJar());
        InitEjbDeployments initEjbDeployments = new InitEjbDeployments();
        initEjbDeployments.deploy(ejbModule, new HashMap<String,String>());
View Full Code Here

*/
public class CheckInjectionTargetsTest extends TestCase {

    public void test() throws Exception {

        EjbModule module = new EjbModule(new EjbJar());
        StatelessBean bean = module.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));

        // Valid
        EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
        envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
View Full Code Here

            moduleName = naming.createChildName(earName, targetPath, NameFactory.EJB_MODULE);
            ejbModule.setModuleId(targetPath);
        }

        // Create XMLBeans version of EjbJarType for the AnnotatedApp interface
        EjbJar ejbJar = ejbModule.getEjbJar();
        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
        AnnotatedEjbJar annotatedEjbJar = new AnnotatedEjbJar(ejbJarType);

        EjbModule module = new EjbModule(ejbModule, standAlone, moduleName, environment, moduleFile, targetPath, "", annotatedEjbJar);
View Full Code Here

        EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, classLoader);

        ejbModule.setEjbJarInfo(ejbJarInfo);

        // update the original spec dd with the metadata complete dd
        EjbJar ejbJar = ejbModule.getEjbJar();
        ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));

        // Get the geronimo-openejb plan
        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
View Full Code Here

        // classes annotated with ejb annotations, it is not an ejb module
        if (ejbJarXml == null && !isEjbAnnotatedModule(moduleFile)) {
            return null;
        }

        EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml);
        if (ejbJar == null){
            ejbJar = new EjbJar();
        }

        // load the geronimo-openejb.xml
        boolean standAlone = earEnvironment == null;
        OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.loadGeronimOpenejbJar(plan, moduleFile, standAlone, targetPath, ejbJar);
        if (geronimoOpenejb == null) {
            // Avoid NPE GERONIMO-1220; todo: remove this if we can work around the requirement for a plan
            throw new DeploymentException("Currently a Geronimo deployment plan is required for an EJB module.  Please provide a plan as a deployer argument or packaged in the EJB JAR at META-INF/openejb-jar.xml");
        }

        // load the openejb-jar.xml
        XmlObject object = null;
        if (geronimoOpenejb.isSetOpenejbJar()) {
            XmlCursor xmlCursor = geronimoOpenejb.getOpenejbJar().newCursor();
            xmlCursor.toFirstChild();
            object = xmlCursor.getObject();
        }
        String openejbJarXml = XmlUtil.loadOpenejbJarXml(object, moduleFile);
        OpenejbJar openejbJar = XmlUtil.unmarshal(OpenejbJar.class, openejbJarXml);
        if (openejbJar == null){
            openejbJar = new OpenejbJar();
        }

        // initialize the geronimo environment
        EnvironmentType environmentType = geronimoOpenejb.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        if (earEnvironment != null) {
            EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
            environment = earEnvironment;
            if (!environment.getConfigId().isResolved()) {
                throw new IllegalStateException("EJB module ID should be fully resolved (not " + environment.getConfigId() + ")");
            }
        } else {
            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
        }

        // todo THIS WILL NOT WORK WITH ANNOTATIONS... move this to initContext when naming is fixed
        // since assembly descriptor will only be valid once metadata complete
        // which is only available once a class loader has been constructed in the init phase
        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
        if (ejbJar.getAssemblyDescriptor() != null) {
            AssemblyDescriptorType assemblyDescriptor = ejbJarType.getAssemblyDescriptor();
            namingBuilder.buildEnvironment(assemblyDescriptor, geronimoOpenejb, environment);
        }

        //overridden web service locations
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.EjbJar$JAXB

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.