private DataSource findDataSource(DataSourceDefinition dsDefinition, JndiConsumer annotatedApp) { String dsDefinitionName = getJndiName(dsDefinition.name().trim()); Collection<DataSource> dataSources = annotatedApp.getDataSource(); for (DataSource ds : dataSources) { String dsName = getJndiName(ds.getName().trim()); if (dsDefinitionName.equals(dsName)) { return ds; } } return null; }
consumer.getDataSource().add(dataSource);
consumer.getDataSource().add(dataSource);
@Override public AppModule deploy(final AppModule appModule) throws OpenEJBException { final List<JndiConsumer> jndiConsumers = collectConsumers(appModule); final KeyedCollection<String, DataSource> dataSources = new KeyedCollection<String, DataSource>(); for (final JndiConsumer consumer : jndiConsumers) { if (consumer == null) { continue; } dataSources.addAll(consumer.getDataSource()); } for (final DataSource dataSource : dataSources) { appModule.getResources().add(toResource(dataSource)); } return appModule; }
dataSourcesFromCompManagedBeans.addAll(consumer.getDataSource()); continue; dataSources.addAll(consumer.getDataSource());
public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException { // step 1: process annotations and update deployment descriptor if ((module != null) && (module.getClassFinder() != null)) { List<Class<?>> classes; classes = module.getClassFinder().findAnnotatedClasses(DataSourceDefinitions.class); if (classes != null) { for (Class<?> clazz : classes) { DataSourceDefinitions dsDefinitions = clazz.getAnnotation(DataSourceDefinitions.class); for (DataSourceDefinition dsDefinition : dsDefinitions.value()) { processDefinition(dsDefinition, specDD); } } } classes = module.getClassFinder().findAnnotatedClasses(DataSourceDefinition.class); if (classes != null) { for (Class<?> clazz : classes) { DataSourceDefinition dsDefinition = clazz.getAnnotation(DataSourceDefinition.class); processDefinition(dsDefinition, specDD); } } } // step 2: bind all defined data sources into jndi Collection<DataSource> dataSources = specDD.getDataSource(); if (dataSources != null) { for (DataSource dataSource: dataSources) { addDataSourceGBean(module, sharedContext, dataSource); } } }
annotatedApp.getDataSource().add(dataSource);