Package org.apache.openejb.config.sys

Examples of org.apache.openejb.config.sys.Openejb


    ConfigurationFactory factory = new ConfigurationFactory();

    String url = rootUrl.getPath();
    Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
    Openejb openejb = storeProperties(properties, factory);

    for (Resource resource : openejb.getResource()) {
      ResourceInfo serviceInfo = factory.configureService(resource, ResourceInfo.class);
      assembler.createResource(serviceInfo);
    }

    Deployer deployer = new DeployerEjb();
View Full Code Here


  }

  private Openejb storeProperties(Properties properties, ConfigurationFactory factory) {

    IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
    Openejb openejb = new Openejb();
    for (Object k : properties.keySet()) {
      Object v = properties.get(k);
      if (v instanceof String) {
        String key = (String) k;
        String value = (String) v;
        try {
          value = manager.performStringSubstitution(value, false);
        } catch (CoreException e) {
          e.printStackTrace();
        }
        SystemInstance.get().setProperty(key, value);
        if (value.startsWith("new://")) {
          try {
            URI uri = new URI(value);
            openejb.add(factory.toConfigDeclaration(key, uri));
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      }
View Full Code Here

            configuration.setProperty("httpejbd.print", "true");
            configuration.setProperty("httpejbd.indent.xml", "true");
            configuration.setProperty("logging.level.OpenEJB.server.http", "FINE");
        }

        Openejb openejb = null;
        final Map<Object, List<Method>> configs = new HashMap<Object, List<Method>>();
        findAnnotatedMethods(configs, Configuration.class);
        findAnnotatedMethods(configs, org.apache.openejb.junit.Configuration.class);
        for (final Map.Entry<Object, List<Method>> method : configs.entrySet()) {
            for (final Method m : method.getValue()) {
View Full Code Here

            configuration.setProperty("httpejbd.print", "true");
            configuration.setProperty("httpejbd.indent.xml", "true");
            configuration.setProperty("logging.level.OpenEJB.server.http", "FINE");
        }

        Openejb openejb = null;
        final Map<Object, List<Method>> configs = new HashMap<Object, List<Method>>();
        findAnnotatedMethods(configs, Configuration.class);
        findAnnotatedMethods(configs, org.apache.openejb.junit.Configuration.class);
        for (final Map.Entry<Object, List<Method>> method : configs.entrySet()) {
            for (final Method m : method.getValue()) {
View Full Code Here

        assertEquals("bar", System.getProperty("placeholder")); // the configured one
    }

    @Test
    public void simpleRead() throws IOException, OpenEJBException {
        final Openejb openejb = JSonConfigReader.read(Openejb.class, Thread.currentThread().getContextClassLoader().getResource(config()).openStream());

        assertEquals(1, openejb.getResource().size());
        final Resource resource = openejb.getResource().iterator().next();
        assertEquals("json-datasource", resource.getId());
        assertTrue("123".equals(resource.getProperties().getProperty("MaxActive")));
        assertTrue("jdbc:hsqldb:mem:json".equals(resource.getProperties().getProperty("JdbcUrl")));

        assertEquals(1, openejb.getDeployments().size());
        assertEquals("apps", openejb.getDeployments().iterator().next().getDir());

        assertEquals(1, openejb.getContainer().size());
        final Container container = openejb.getContainer().iterator().next();
        assertEquals("STATELESS", container.getType());
        assertEquals("10 seconds", container.getProperties().getProperty("AccessTimeout"));
    }
View Full Code Here

        final String xml = "<?xml version=\"1.0\"?>" +
            "<openejb>" +
            "   <Resource id=\"foo\" aliases=\"bar\" type=\"DataSource\" />" +
            "</openejb>";

        final Openejb openejb = JaxbOpenejb.readConfig(new InputSource(new ByteArrayInputStream(xml.getBytes())));
        assertEquals(1, openejb.getResource().size());

        final Resource resource = openejb.getResource().iterator().next();
        assertEquals(1, resource.getAliases().size());
        assertEquals("foo", resource.getId());
        assertEquals("bar", resource.getAliases().iterator().next());
    }
View Full Code Here

        final String className = "org.superbiz.foo.Orange";
        final File jar = subclass(Color.class, className);

        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        final Openejb openejb = new Openejb();
        final Resource resource = new Resource();
        openejb.getResource().add(resource);

        resource.setClassName(className);
        resource.setType(className);
        resource.setId("Orange");
        resource.getProperties().put("red", "FF");
View Full Code Here

            configuration.setProperty("httpejbd.print", "true");
            configuration.setProperty("httpejbd.indent.xml", "true");
            configuration.setProperty("logging.level.OpenEJB.server.http", "FINE");
        }

        Openejb openejb = null;
        final Map<Object, List<Method>> configs = new HashMap<Object, List<Method>>();
        findAnnotatedMethods(configs, Configuration.class);
        findAnnotatedMethods(configs, org.apache.openejb.junit.Configuration.class);
        for (final Map.Entry<Object, List<Method>> method : configs.entrySet()) {
            for (final Method m : method.getValue()) {
View Full Code Here

        final String className = "org.superbiz.foo.Orange";
        final File jar = subclass(Color.class, className);

        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());

        final Openejb openejb = new Openejb();
        final Resource resource = new Resource();
        openejb.getResource().add(resource);

        resource.setClassName(className);
        resource.setType(className);
        resource.setId("Orange");
        resource.getProperties().put("red", "FF");
View Full Code Here

            configuration.setProperty("httpejbd.print", "true");
            configuration.setProperty("httpejbd.indent.xml", "true");
            configuration.setProperty("logging.level.OpenEJB.server.http", "FINE");
        }

        Openejb openejb = null;
        final Map<Object, List<Method>> configs = new HashMap<>();
        findAnnotatedMethods(configs, Configuration.class);
        findAnnotatedMethods(configs, org.apache.openejb.junit.Configuration.class);
        for (final Map.Entry<Object, List<Method>> method : configs.entrySet()) {
            for (final Method m : method.getValue()) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.config.sys.Openejb

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.