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);
}
}
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;
}
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;
}
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;
}
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");
}
});
}
};
}
Aggregations