Search in sources :

Example 1 with Service

use of org.apache.openejb.config.sys.Service in project tomee by apache.

the class AppInfoBuilder method buildAppServices.

private void buildAppServices(final AppModule appModule, final AppInfo appInfo) throws OpenEJBException {
    final Collection<Service> services = appModule.getServices();
    for (final Service service : services) {
        final ServiceInfo info = this.configFactory.configureService(service, ServiceInfo.class);
        appInfo.services.add(info);
    }
}
Also used : ServiceInfo(org.apache.openejb.assembler.classic.ServiceInfo) Service(org.apache.openejb.config.sys.Service)

Example 2 with Service

use of org.apache.openejb.config.sys.Service in project tomee by apache.

the class TomEEConfigurableJohnzonTest method service.

@Module
public static EjbModule service() throws Exception {
    final EjbModule module = new EjbModule(new EjbJar(), new OpenejbJar());
    final EnterpriseBean bean = new SingletonBean(Endpoint.class).localBean();
    module.getEjbJar().addEnterpriseBean(bean);
    final Resources resources = new Resources();
    final Service sorter = new Service("testSorter", null);
    sorter.setClassName(Sorter.class.getName());
    resources.getService().add(sorter);
    final Service converter = new Service("customerConverter", null);
    converter.setClassName(MyConverter.class.getName());
    resources.getService().add(converter);
    final Service johnzon = new Service("johnzon", null);
    johnzon.setClassName(TomEEConfigurableJohnzon.class.getName());
    johnzon.getProperties().put("datePattern", "yyyy");
    // johnzon.getProperties().put("converter", "$customerConverter"); // or the collection syntax
    johnzon.getProperties().put("converters", "collection:$customerConverter,$customerConverter");
    johnzon.getProperties().put("attributeOrder", "$testSorter");
    resources.getService().add(johnzon);
    module.initResources(resources);
    final PojoDeployment e = new PojoDeployment();
    e.setClassName("jaxrs-application");
    e.getProperties().setProperty("cxf.jaxrs.providers", "johnzon");
    module.getOpenejbJar().getPojoDeployment().add(e);
    return module;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) Resources(org.apache.openejb.config.sys.Resources) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module)

Example 3 with Service

use of org.apache.openejb.config.sys.Service in project tomee by apache.

the class LoggingJAXRSCommons method getEjbModule.

protected EjbModule getEjbModule(String pojoDeploymentClassName, String ejbModuleId) throws Exception {
    final EjbModule module = new EjbModule(new EjbJar(), new OpenejbJar());
    if (ejbModuleId != null) {
        module.setModuleId(ejbModuleId);
    }
    final EnterpriseBean bean = new SingletonBean(LogginTestBean.class).localBean();
    module.getEjbJar().addEnterpriseBean(bean);
    final Resources resources = new Resources();
    final Service feature = new Service("xml", null);
    feature.setClassName(JAXBElementProvider.class.getName());
    feature.getProperties().put("eventHandler", "$handler");
    resources.getService().add(feature);
    module.initResources(resources);
    if (pojoDeploymentClassName != null) {
        final PojoDeployment e = new PojoDeployment();
        e.setClassName(pojoDeploymentClassName);
        e.getProperties().setProperty("cxf.jaxrs.providers", "xml");
        module.getOpenejbJar().getPojoDeployment().add(e);
    }
    return module;
}
Also used : JAXBElementProvider(org.apache.cxf.jaxrs.provider.JAXBElementProvider) SingletonBean(org.apache.openejb.jee.SingletonBean) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) RESTService(org.apache.openejb.server.rest.RESTService) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) Resources(org.apache.openejb.config.sys.Resources) EjbJar(org.apache.openejb.jee.EjbJar)

Example 4 with Service

use of org.apache.openejb.config.sys.Service in project tomee by apache.

the class WebServiceInjectionConfigurator method getServices.

private Collection<ServiceInfo> getServices(final Properties properties) {
    final ConfigurationFactory cf = SystemInstance.get().getComponent(ConfigurationFactory.class);
    if (cf == null || !ConfigurationFactory.class.isInstance(cf)) {
        return Collections.emptyList();
    }
    final Openejb openejb = new Openejb();
    ConfigurationFactory.fillOpenEjb(openejb, properties);
    final List<Service> services = openejb.getServices();
    if (services.isEmpty()) {
        return Collections.emptyList();
    }
    final Collection<ServiceInfo> info = new ArrayList<>(services.size());
    for (final Service s : services) {
        final String prefix = s.getId() + ".";
        for (final String key : properties.stringPropertyNames()) {
            if (key.startsWith(prefix)) {
                s.getProperties().put(key.substring(prefix.length()), properties.getProperty(key));
            }
        }
        try {
            info.add(cf.configureService(s, ServiceInfo.class));
        } catch (final OpenEJBException e) {
            throw new IllegalArgumentException(e);
        }
    }
    return info;
}
Also used : ServiceInfo(org.apache.openejb.assembler.classic.ServiceInfo) OpenEJBException(org.apache.openejb.OpenEJBException) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) ArrayList(java.util.ArrayList) Service(org.apache.openejb.config.sys.Service) Openejb(org.apache.openejb.config.sys.Openejb)

Example 5 with Service

use of org.apache.openejb.config.sys.Service in project tomee by apache.

the class MaxChildTest method app.

@Module
public AppModule app() {
    final String jarLocation = "target/" + getClass().getSimpleName();
    return new AppModule(Thread.currentThread().getContextClassLoader(), jarLocation, new Application(), true) {

        {
            getEjbModules().add(new EjbModule(new EjbJar("app"), new OpenejbJar() {

                {
                    getPojoDeployment().add(new PojoDeployment() {

                        {
                            setClassName(SimpleContractImpl.class.getName());
                            getProperties().setProperty("cxf.jaxws.properties", "cxfLargeMsgSize");
                        }
                    });
                }
            }));
            getWebModules().add(new WebModule(new WebApp().contextRoot("app").addServlet("ws", SimpleContractImpl.class.getName(), "/ws"), "app", Thread.currentThread().getContextClassLoader(), jarLocation, "app"));
            getServices().add(new Service() {

                {
                    setId("cxfLargeMsgSize");
                    setClassName(Properties.class.getName());
                    getProperties().setProperty("org.apache.cxf.stax.maxChildElements", "1");
                }
            });
        }
    };
}
Also used : AppModule(org.apache.openejb.config.AppModule) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) WebService(javax.jws.WebService) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) WebModule(org.apache.openejb.config.WebModule) Application(org.apache.openejb.jee.Application) EjbJar(org.apache.openejb.jee.EjbJar) WebApp(org.apache.openejb.jee.WebApp) WebModule(org.apache.openejb.config.WebModule) EjbModule(org.apache.openejb.config.EjbModule) AppModule(org.apache.openejb.config.AppModule) Module(org.apache.openejb.testing.Module)

Aggregations

Service (org.apache.openejb.config.sys.Service)9 EjbModule (org.apache.openejb.config.EjbModule)6 EjbJar (org.apache.openejb.jee.EjbJar)6 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)6 Resources (org.apache.openejb.config.sys.Resources)5 SingletonBean (org.apache.openejb.jee.SingletonBean)4 PojoDeployment (org.apache.openejb.jee.oejb3.PojoDeployment)4 ServiceInfo (org.apache.openejb.assembler.classic.ServiceInfo)3 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)3 Module (org.apache.openejb.testing.Module)3 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 JAXBElementProvider (org.apache.cxf.jaxrs.provider.JAXBElementProvider)2 OpenEJBException (org.apache.openejb.OpenEJBException)2 File (java.io.File)1 EJBContainer (javax.ejb.embeddable.EJBContainer)1 WebService (javax.jws.WebService)1 AppInfo (org.apache.openejb.assembler.classic.AppInfo)1 BmpEntityContainerInfo (org.apache.openejb.assembler.classic.BmpEntityContainerInfo)1 CmpEntityContainerInfo (org.apache.openejb.assembler.classic.CmpEntityContainerInfo)1