From dce6c0306a6c0872d6e969e8890c04cc2b95cfd8 Mon Sep 17 00:00:00 2001 From: David BRASSELY Date: Mon, 3 Mar 2014 17:06:03 +0100 Subject: [PATCH] Standalone container : big refactor --- .../JDBC Connection parameters.xlsx | Bin 0 -> 8337 bytes .../Documentation/JDNI for OE SE.docx | Bin 0 -> 13046 bytes .../pom.xml | 61 +++- .../standalone/framework/JSEJBIFramework.java | 0 .../framework/JSEJBIFrameworkMBean.java | 0 .../framework/JSEPlatformContext.java | 0 .../naming/jndi/DataSourcePoolFactory.java | 17 + .../jndi/impl/InitialContexFactoryImpl.java | 221 +++++++++++++ .../tomcat/TomcatDataSourcePoolFactory.java | 311 ++++++++++++++++++ .../naming/test/TestConnection01.java | 79 +++++ .../standalone/naming/utils/Bundle.properties | 28 ++ .../standalone/naming/utils/I18NBundle.java | 184 +++++++++++ .../standalone/naming/utils/OEContext.xml | 79 +++++ .../standalone/naming/utils/OEContext.xsd | 66 ++++ .../naming/utils/OEContextSample.xml | 208 ++++++++++++ .../security/SecurityProviderImpl.java | 82 +++++ .../security/auth/login/JMXauthenticator.java | 42 +++ .../security/realm/AbstractRealm.java | 26 ++ .../standalone/security/realm/Realm.java | 11 + .../security/realm/RealmBuilder.java | 33 ++ .../security/realm/RealmHandler.java | 15 + .../realm/impl/AbstractRealmHandler.java | 55 ++++ .../security/realm/impl/PropertiesRealm.java | 48 +++ .../realm/impl/PropertiesRealmHandler.java | 61 ++++ .../realm/shiro/PropertiesRealmConverter.java | 35 ++ .../security/realm/shiro/RealmConverter.java | 15 + .../realm/shiro/ShiroAuthenticator.java | 59 ++++ .../settings/ImmutableSettings.java | 0 .../openesb/standalone/settings/Settings.java | 0 .../settings/SettingsException.java | 0 ...esb.standalone.security.realm.RealmHandler | 1 + ...dalone.security.realm.shiro.RealmConverter | 1 + .../standalone/naming/utils/Bundle.properties | 28 ++ .../standalone/naming/utils/OEContext.xsd | 66 ++++ .../naming/utils/OEContextSample.xml | 208 ++++++++++++ openesb-standalone-packaging/pom.xml | 12 +- .../src/main/assembly/distribution.xml | 4 +- pom.xml | 4 +- 38 files changed, 2028 insertions(+), 32 deletions(-) create mode 100644 openesb-standalone-container/Documentation/JDBC Connection parameters.xlsx create mode 100644 openesb-standalone-container/Documentation/JDNI for OE SE.docx rename {openesb-standalone-framework => openesb-standalone-container}/pom.xml (52%) rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/framework/JSEJBIFramework.java (100%) rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/framework/JSEJBIFrameworkMBean.java (100%) rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/framework/JSEPlatformContext.java (100%) create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/DataSourcePoolFactory.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/impl/InitialContexFactoryImpl.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/tomcat/TomcatDataSourcePoolFactory.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/test/TestConnection01.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/Bundle.properties create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/I18NBundle.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xml create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xsd create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContextSample.xml create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/SecurityProviderImpl.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/auth/login/JMXauthenticator.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/AbstractRealm.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/Realm.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmBuilder.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmHandler.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/AbstractRealmHandler.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealm.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealmHandler.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/PropertiesRealmConverter.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/RealmConverter.java create mode 100644 openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/ShiroAuthenticator.java rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/settings/ImmutableSettings.java (100%) rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/settings/Settings.java (100%) rename {openesb-standalone-framework => openesb-standalone-container}/src/main/java/net/openesb/standalone/settings/SettingsException.java (100%) create mode 100644 openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.RealmHandler create mode 100644 openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.shiro.RealmConverter create mode 100644 openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/Bundle.properties create mode 100644 openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContext.xsd create mode 100644 openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContextSample.xml diff --git a/openesb-standalone-container/Documentation/JDBC Connection parameters.xlsx b/openesb-standalone-container/Documentation/JDBC Connection parameters.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..4d7b8801607a5e628e4a78fe6df3baf7b7ebf77f GIT binary patch literal 8337 zcmeHMXH-+|vJN6$Isy`kbflLcC=lrc5Ty4SKza`WX-coss~`vjL6lykW2j0|igW?# zEz$*~-sm~s)ek*u-Cy_5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k167A;#=a2-(z z4s2{+F#+nmVN$&Tj2Z-|D_1@D~Df;Ab)bm#{ENpe=CXn z%IEJ#D1UMR07_p00RK2p`4#@_miA8uYUFd%5Z;Qs;7i$%=< literal 0 HcmV?d00001 diff --git a/openesb-standalone-framework/pom.xml b/openesb-standalone-container/pom.xml similarity index 52% rename from openesb-standalone-framework/pom.xml rename to openesb-standalone-container/pom.xml index 735a5ed..34091a7 100644 --- a/openesb-standalone-framework/pom.xml +++ b/openesb-standalone-container/pom.xml @@ -8,24 +8,35 @@ 0.0.1-SNAPSHOT - openesb-standalone-framework + openesb-standalone-container - OpenESB - Standalone - Framework - OpenESB runtime in standalone mode - Framework + OpenESB - Standalone - Container + OpenESB runtime in standalone mode - Container + + + + + org.codehaus.mojo + jaxb2-maven-plugin + 1.5 + + + xjc + + xjc + + + + + OEContext.xsd + ${project.basedir}/src/main/resources/net/openesb/standalone/naming/utils + net.openesb.standalone.naming.jaxb + + + + - - - net.open-esb.runtime.standalone - openesb-standalone-naming - ${project.version} - - - net.open-esb.runtime.standalone - openesb-standalone-security - ${project.version} - - net.open-esb @@ -45,6 +56,13 @@ ${atomikos.version} + + + org.apache.shiro + shiro-core + ${shiro.version} + + + + org.apache.tomcat + tomcat-jdbc + ${tomcat.version} + + + org.apache.tomcat + tomcat-catalina + ${tomcat.version} + runtime + + junit junit diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEJBIFramework.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEJBIFramework.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEJBIFramework.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEJBIFramework.java diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEJBIFrameworkMBean.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEJBIFrameworkMBean.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEJBIFrameworkMBean.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEJBIFrameworkMBean.java diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEPlatformContext.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEPlatformContext.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/framework/JSEPlatformContext.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/framework/JSEPlatformContext.java diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/DataSourcePoolFactory.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/DataSourcePoolFactory.java new file mode 100644 index 0000000..e45851d --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/DataSourcePoolFactory.java @@ -0,0 +1,17 @@ +package net.openesb.standalone.naming.jndi; + +import javax.sql.DataSource; +import javax.sql.XADataSource; +import net.openesb.standalone.naming.jaxb.DataSourcePoolPropertiesComplexType; + +/** + * + * @author Paul PEREZ (paul.perez at pymma.com) + * @author OpenESB Community + */ +public interface DataSourcePoolFactory { + + public DataSource getDataSource (DataSourcePoolPropertiesComplexType dSPProperties) ; + public XADataSource getXADataSource (DataSourcePoolPropertiesComplexType dSPProperties) ; + +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/impl/InitialContexFactoryImpl.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/impl/InitialContexFactoryImpl.java new file mode 100644 index 0000000..80ef67d --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/impl/InitialContexFactoryImpl.java @@ -0,0 +1,221 @@ +package net.openesb.standalone.naming.jndi.impl; + +import net.openesb.standalone.naming.jndi.tomcat.TomcatDataSourcePoolFactory; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import javax.naming.spi.InitialContextFactory; +import javax.sql.DataSource; +import javax.sql.XADataSource; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import net.openesb.standalone.naming.jaxb.DataSourcePoolPropertiesComplexType; +import net.openesb.standalone.naming.jaxb.JdbcResourceComplexType; +import net.openesb.standalone.naming.jaxb.OeContextComplexType; +import net.openesb.standalone.naming.jndi.DataSourcePoolFactory; +import net.openesb.standalone.naming.utils.I18NBundle; + +/** + * + * @author Paul PEREZ (paul.perez at pymma.com) + * @author OpenESB Community + */ +public class InitialContexFactoryImpl implements InitialContextFactory { + + public static final String DATASOURCE_TYPE = "Datasource"; + public static final String XADATASOURCE_TYPE = "XADatasource"; + private static final Logger sLogger = Logger.getLogger("net.openesb.standalone.naming"); + private final Map mDSPMap = new HashMap(); + private final DataSourcePoolFactory mDSPFactory = new TomcatDataSourcePoolFactory(); + private final String mClassName = "InitialContexFactoryImpl"; + private final ResourceBundle mResourceBundle; + private String mMessage; + + // Constructor + public InitialContexFactoryImpl() { + + I18NBundle nBundle = new I18NBundle("net.openesb.standalone.naming.utils"); + mResourceBundle = nBundle.getBundle(); + } + + /* Regarding the exception management, If the context file if not correct, + * I choosed to return an initial context in any case even empty. So if input data + is not correct, I log this information but catch the exception in order to return + an initial context. Another policy would be to stop at any exception. I did not choose + it. Naming exception will be thrown only if I cannot create the initial context */ + /* The initial context I use is the one found in Tomcat 7 */ + @Override + public Context getInitialContext(Hashtable environment) throws NamingException { + Map datasourceMap = new HashMap(); + String methodName = "getInitialContext"; + /*Context initialisation Just set the system properties and use the class InitialContext*/ + System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory"); + System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming"); + Context initialContext = new InitialContext(); + mMessage = mResourceBundle.getString("context.created"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage); + + /* Second step read the XML file URL where context configuration is described + * The URL can be file:// http:// ... + * The XML File URL must be in environement hashmap and read the key URL must be equal to + * CONTEXT_URL*/ + String urlValue = null; + if (environment.containsKey(Context.PROVIDER_URL)) { + urlValue = (String) environment.get(Context.PROVIDER_URL); + mMessage = mResourceBundle.getString("context.url.read"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{urlValue}); + } else { + mMessage = mResourceBundle.getString("context.url.not.provided") + " " + mResourceBundle.getString("context.url.not.provided.ID"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage); + } + + /* Read the context from the URL */ + @SuppressWarnings("UnusedAssignment") JAXBElement root = null; + try { + JAXBContext jc = JAXBContext.newInstance("net.openesb.standalone.naming.jaxb"); + Unmarshaller unmarshaller = jc.createUnmarshaller(); + root = (JAXBElement) unmarshaller.unmarshal(new URL(urlValue)); + } catch (MalformedURLException ex) { + mMessage = mResourceBundle.getString("url.context.name.malformed") ; + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, new Object[] {urlValue}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, ex); + return initialContext ; + } catch (JAXBException ex) { + mMessage = mResourceBundle.getString("jaxb.unmarshalling.failed"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, new Object[] {urlValue}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, ex); + return initialContext ; + } + + // This must be made with the xml file has an element root + // Log level Fine Unmarshalling ok + OeContextComplexType oeContext = root.getValue(); + mMessage = mResourceBundle.getString("context.binding.ok"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage); + + /* OeContext contains the complete context */ + /* I create a map with the datasourcePool Name as key and datasourcePool as Value + * This will be useful to instanciate the db connector later. + */ + List dataSourcePoolList = oeContext.getDataSourcePoolProperties(); + int listSize = dataSourcePoolList.size(); + mMessage = mResourceBundle.getString("number.dataSourcePoolProperties.found"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{listSize}); + + + //Loop on dataSourcePoolList iterator + for (DataSourcePoolPropertiesComplexType dspComplexType : dataSourcePoolList) { + mDSPMap.put(dspComplexType.getDbConnectorName(), dspComplexType); + mMessage = mResourceBundle.getString("datasourcepoolproperties.found.in.context"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{dspComplexType.getDbConnectorName()}); + } + + // Now Let's read JdbcResource + List jdbcResourceList = oeContext.getJdbcResources(); + listSize = jdbcResourceList.size(); + mMessage = mResourceBundle.getString("number.jdbcResource.declaration.found"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{listSize}); + + //Loop on JDBCResourceList iterator + for (JdbcResourceComplexType jdbcResource : jdbcResourceList) { + /* For each jcbc resource I want to associate a dbConnector. + * DBConnector provide a connectionPool or a XAConnectionPool + * I instanciate the dbConnetor in a lazy mode (when needed) + * Once instanciated dbConnector are put in a map for reusing purpose + * ex: when two JNDI names target the same dbConnector + */ + + // Get JNDI Name + String jndiName = jdbcResource.getJndiName(); + mMessage = jndiName + " " + mResourceBundle.getString("in.process"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage); + + + /* Check if this JNDI name is already in the context. In that case the + * second instance is not taken into account + */ + try { + initialContext.lookup(jndiName); + mMessage = mResourceBundle.getString("jndi.value.already.defined"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{jndiName}); + continue; + } catch (NamingException ex) { + // Nothing else to do. Having an exception is the normal process + } + + + /* Create datasource or XA Datasource thanks to the underlying dbConnector + * DBConnector refeence is in the DataSourcePoolProperties. DBConnector are instanciated + * dynamically and must be present in the classpath + * */ + String dbConnectorName = jdbcResource.getDbConnectorName(); + /* check if the datasource has been created already for a previous + * JNDI Name. In that case we reuse it. + */ + if (datasourceMap.containsKey(dbConnectorName)) { + if (datasourceMap.get(dbConnectorName) instanceof XADataSource) { + initialContext.rebind(jndiName, (XADataSource) datasourceMap.get(dbConnectorName)); + } else { + initialContext.rebind(jndiName, datasourceMap.get(dbConnectorName)); + } + continue; + } + + // Retrieve DataSourcePoolPropertie + DataSourcePoolPropertiesComplexType dspProperties = mDSPMap.get(dbConnectorName); + // Check if Datasourse or XA Datasource + if (dspProperties.getResourceType().equals(InitialContexFactoryImpl.DATASOURCE_TYPE)) { + mMessage = mResourceBundle.getString("datasource.in.process"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{jndiName}); + DataSource dataSource = mDSPFactory.getDataSource(dspProperties); + /* Check if datasource is not null then put in the context since exception are catch */ + if (null != dataSource) { + datasourceMap.put(dbConnectorName, dataSource); + try { + initialContext.rebind(jndiName, dataSource); + } catch (NamingException ex) { + initialContext.bind(jndiName, dataSource); + } + mMessage = mResourceBundle.getString("datasource.processed.bind.success"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{jndiName}); + } + + } else if (dspProperties.getResourceType() + .equals(InitialContexFactoryImpl.XADATASOURCE_TYPE)) { + mMessage = mResourceBundle.getString("xadatasource.in.process"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{jndiName}); + XADataSource xaDataSource = mDSPFactory.getXADataSource(dspProperties); + if (null != xaDataSource) { + /* Store the XAdatasource in a map for reusing purpose see above */ + datasourceMap.put(dbConnectorName, (DataSource) xaDataSource); + initialContext.rebind(jndiName, xaDataSource); + mMessage = mResourceBundle.getString("xadatasource.processed.bind.success"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{jndiName}); + } + } else { + mMessage = mResourceBundle.getString("bad.resource.type"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{dspProperties.getResourceType(), dspProperties.getDatabaseName()}); + + } + } + + /* the context contains the binding and the datasource or xaDatasource links + * Return the context + */ + return initialContext; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/tomcat/TomcatDataSourcePoolFactory.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/tomcat/TomcatDataSourcePoolFactory.java new file mode 100644 index 0000000..3bc3024 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/jndi/tomcat/TomcatDataSourcePoolFactory.java @@ -0,0 +1,311 @@ +package net.openesb.standalone.naming.jndi.tomcat; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.sql.DataSource; +import javax.sql.XADataSource; +import javax.xml.bind.JAXBElement; +import net.openesb.standalone.naming.jaxb.DataSourcePoolPropertiesComplexType; +import net.openesb.standalone.naming.jaxb.DataSourcePropertiesComplexType; +import net.openesb.standalone.naming.jaxb.PoolPropertiesComplexType; +import net.openesb.standalone.naming.jaxb.PropertyComplexType; +import net.openesb.standalone.naming.jndi.DataSourcePoolFactory; +import net.openesb.standalone.naming.utils.I18NBundle; +import org.apache.tomcat.jdbc.pool.PoolProperties; + +/** + * + * @author Paul PEREZ (paul.perez at pymma.com) + * @author OpenESB Community + */ +public class TomcatDataSourcePoolFactory implements DataSourcePoolFactory { + + private final ResourceBundle mResourceBundle; + private String mMessage; + private final String mClassName = "DataSourcePoolFactoryimpl"; + private static final Logger sLogger = Logger.getLogger("net.openesb.standalone.naming"); + + public TomcatDataSourcePoolFactory() { + I18NBundle nBundle = new I18NBundle("net.openesb.standalone.naming.utils"); + mResourceBundle = nBundle.getBundle(); + } + + @Override + /* GetDatasource method is used to create dynamically and set up a pooled datasource. Information and parameters + * are provided by dspProperties. The first part of the method create dynamically a native datasource. + * Introspection is used to set up datasource properties. We setup just the properties declared in + * context.xml (or else). + * Using the same way, the second part setup Apache pool. Important: Pool Datasource property is + * set up with the native datasource, so there is no need for setting up other pool properties + * related to the connection. + * Then we create an Apache datasource with the pool as parameter + */ + public DataSource getDataSource(DataSourcePoolPropertiesComplexType dspProperties) { + PoolProperties poolProperties = this.createNativeDataSource(dspProperties); + org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(poolProperties); + ds.setName(dspProperties.getDbConnectorName()); + registerMBean(ds); + + return ds; + } + + @Override + public XADataSource getXADataSource(DataSourcePoolPropertiesComplexType dspProperties) { + PoolProperties poolProperties = this.createNativeDataSource(dspProperties); + org.apache.tomcat.jdbc.pool.XADataSource ds = new org.apache.tomcat.jdbc.pool.XADataSource(poolProperties); + ds.setName(dspProperties.getDbConnectorName()); + registerMBean(ds); + + return ds; + } + + private void registerMBean(org.apache.tomcat.jdbc.pool.DataSource ds) { + try { + ds.createPool(); + ds.setJmxEnabled(true); + + MBeanServer mBeanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer(); + + String mBeanName = "net.open-esb.standalone:type=DataSources,name=" + ds.getName(); + mBeanServer.registerMBean(ds.getPool().getJmxPool(), new ObjectName(mBeanName)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private PoolProperties createNativeDataSource(DataSourcePoolPropertiesComplexType dspProperties) { + String methodName = "createNativeDataSource"; + + /* get the properties for the native Datasource. it is not created yet*/ + DataSourcePropertiesComplexType dataSourceProperties = dspProperties.getDataSourceProperties(); + Map datasourceMap = this.listToMap(dataSourceProperties.getProperty()); + + /* Get datasource name from OE Context. Native DS is create dynamically + * so the class must be present in the classpath. DS Instance not created yet + */ + String dsName = dspProperties.getDatasourceClassname(); + mMessage = mResourceBundle.getString("start.instanciate.datasource"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{dsName}); + Class dsClass; + try { + dsClass = Class.forName(dsName); + } catch (ClassNotFoundException ex) { + mMessage = mResourceBundle.getString("datasource.class.not.found"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, new Object[]{dsName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, ex); + /* An exception don't stop JNDI context process so we return a null Datasource. */ + return null; + } + + /*Return Fields declared in a class and its ancesters */ + Map dsFields = this.getAllFields(dsClass); + /*Create datasource instance. This is the instance that will be set with reflexion and returned + * to the caller + */ + + Object nativeDS; + try { + nativeDS = dsClass.newInstance(); + } catch (InstantiationException ex) { + mMessage = mResourceBundle.getString("impossible.instanciate.datasource"); + sLogger.logp(Level.SEVERE, mClassName, methodName, mMessage, new Object[]{dsName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + return null; + } catch (IllegalAccessException ex) { + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + return null; + } + + /* Use java reflexion to set up Native Datasource declared in the context */ + Set dspSet = datasourceMap.keySet(); + Iterator keys = dspSet.iterator(); + while (keys.hasNext()) { + String fieldName = keys.next(); + Field field = dsFields.get(fieldName); + if (null == field) { + mMessage = mResourceBundle.getString("invalid.field.name"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName, dsName}); + } else { + if (!field.isAccessible()) { + field.setAccessible(true); + } + String fieldValue = datasourceMap.get(fieldName); + try { + if (field.getType().equals(byte.class)) { + field.set(nativeDS, Byte.parseByte(fieldValue)); + } else if (field.getType().equals(boolean.class)) { + field.set(nativeDS, Boolean.parseBoolean(fieldValue)); + } else if (field.getType().equals(char.class)) { + field.set(nativeDS, fieldValue.charAt(0)); + } else if (field.getType().equals(short.class)) { + field.set(nativeDS, Short.parseShort(fieldValue)); + } else if (field.getType().equals(int.class)) { + field.set(nativeDS, Integer.parseInt(fieldValue)); + } else if (field.getType().equals(long.class)) { + field.set(nativeDS, Long.parseLong(fieldValue)); + } else if (field.getType().equals(float.class)) { + field.set(nativeDS, Float.parseFloat(fieldValue)); + } else if (field.getType().equals(double.class)) { + field.set(nativeDS, Double.parseDouble(fieldValue)); + } else if (field.getType().equals(String.class)) { + field.set(nativeDS, fieldValue); + } else { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("field.type.not.process"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName, dsName, field.getType()}); + } + } catch (IllegalArgumentException ex) { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + } catch (IllegalAccessException ex) { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + } + } + } + + /* Datasouce fields are set with data proterties found in the context + * Now let's set the pool with the pool proterties found in the context + * get the properties for the pool */ + mMessage = mResourceBundle.getString("native.datasource.set.succesfully"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage, new Object[]{dsName}); + + /** + * ** Set up Pool + */ + mMessage = mResourceBundle.getString("start.pool.configuration"); + sLogger.logp(Level.FINE, mClassName, methodName, mMessage); + PoolPropertiesComplexType contextPoolProperties = dspProperties.getPoolProperties(); + Map poolMap = this.listToMap(contextPoolProperties.getProperty()); + // Create pool configuration + org.apache.tomcat.jdbc.pool.PoolProperties poolProperties = new PoolProperties(); + Class poolPropertiesClass = poolProperties.getClass(); + Map poolPropertiesFields = this.getAllFields(poolPropertiesClass); + /* Use java reflexion to set up pool configurationwith context properties + */ + Set poolPropertiesSet = poolMap.keySet(); + keys = poolPropertiesSet.iterator(); + + while (keys.hasNext()) { + + String fieldName = keys.next(); + Field field = poolPropertiesFields.get(fieldName); + if (null == field) { + mMessage = mResourceBundle.getString("invalid.field.name"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName, poolPropertiesClass}); + } else { + if (!field.isAccessible()) { + field.setAccessible(true); + } + String fieldValue = poolMap.get(fieldName); + try { + if (field.getType().equals(byte.class)) { + field.set(poolProperties, Byte.parseByte(fieldValue)); + } else if (field.getType().equals(boolean.class)) { + field.set(poolProperties, Boolean.parseBoolean(fieldValue)); + } else if (field.getType().equals(char.class)) { + field.set(poolProperties, fieldValue.charAt(0)); + } else if (field.getType().equals(short.class)) { + field.set(poolProperties, Short.parseShort(fieldValue)); + } else if (field.getType().equals(int.class)) { + field.set(poolProperties, Integer.parseInt(fieldValue)); + } else if (field.getType().equals(long.class)) { + field.set(poolProperties, Long.parseLong(fieldValue)); + } else if (field.getType().equals(float.class)) { + field.set(poolProperties, Float.parseFloat(fieldValue)); + } else if (field.getType().equals(double.class)) { + field.set(poolProperties, Double.parseDouble(fieldValue)); + } else if (field.getType().equals(String.class)) { + field.set(poolProperties, fieldValue); + } else { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("field.type.not.process"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName, poolPropertiesClass, field.getType()}); + } + } catch (IllegalArgumentException ex) { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + } catch (IllegalAccessException ex) { + mMessage = mResourceBundle.getString("field.not.set"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, new Object[]{fieldName}); + mMessage = mResourceBundle.getString("catch.exception"); + sLogger.logp(Level.INFO, mClassName, methodName, mMessage, ex); + } + } + } + // set the pool and get a Poolled Datasource + poolProperties.setDataSource(nativeDS); + poolProperties.setJmxEnabled(true); + + return poolProperties; + } + + /* List to Map is an internal methode used to convert a List to a Map. + * Map will be use to set the DataSource and the Pool + */ + private Map listToMap(List inputList) { + Map outputMap = new HashMap(); + Iterator it = inputList.iterator(); + while (it.hasNext()) { + PropertyComplexType prop = it.next(); + List> nameAndValueAndDescription = prop.getNameAndValueAndDescription(); + Iterator> it2 = nameAndValueAndDescription.iterator(); + String key = null, value = null; + while (it2.hasNext()) { + JAXBElement element = it2.next(); + String localpart = element.getName().getLocalPart(); + if ("name".equals(localpart)) { + key = element.getValue(); + } else if ("value".equals(localpart)) { + value = element.getValue(); + } + // Put the key valu in the Map + outputMap.put(key, value); + } + } + return outputMap; + } + + /* getAll field is used to get all the fields declared in a class + its ancesters + * getDeclaredField just returns the field declared at the class level and not + * at the ancester levels. The retured map contains key-values pairs with Field name and Field object + */ + private Map getAllFields(Class type) { + List listFields = new ArrayList(); + for (Class c = type; c + != Object.class; c = c.getSuperclass()) { + listFields.addAll(Arrays.asList(c.getDeclaredFields())); + } + Map mapFields = new HashMap(); + Iterator fieldIterator = listFields.iterator(); + + while (fieldIterator.hasNext()) { + Field field = fieldIterator.next(); + String fieldName = field.getName(); + mapFields.put(fieldName, field); + } + return mapFields; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/test/TestConnection01.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/test/TestConnection01.java new file mode 100644 index 0000000..1e70de7 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/test/TestConnection01.java @@ -0,0 +1,79 @@ +package net.openesb.standalone.naming.test; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Hashtable; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.naming.NamingException; +import net.openesb.standalone.naming.jndi.impl.InitialContexFactoryImpl; +import javax.naming.spi.InitialContextFactory; +import javax.sql.DataSource; + +/** + * + * @author Paul PEREZ (paul.perez at pymma.com) + * @author OpenESB Community + */ +public class TestConnection01 { + + public static void main(String[] args) throws Exception{ + InitialContextFactory factory = new InitialContexFactoryImpl(); + Hashtable environment = new Hashtable(); + environment.put(Context.PROVIDER_URL, "file:///G:/projects/jndi-standalone/jndi-standalone/src/main/resources/net/openesb/standalone/naming/utils/OEContextSample.xml"); + + Context context = null; + try { + context = factory.getInitialContext(environment); + } catch (NamingException ex) { + Logger.getLogger(TestConnection01.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("Get initial context Error"); + System.exit(1); + } + + DataSource dsMySQL = null; + try { + dsMySQL = (DataSource) context.lookup("MySQLServer01"); + } catch (NamingException ex) { + Logger.getLogger(TestConnection01.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("Look up Error"); + System.exit(1); + } + Connection connectionMySQL = null; + try { + connectionMySQL = dsMySQL.getConnection(); + PreparedStatement sta2 = connectionMySQL.prepareStatement("SELECT * FROM test.test"); + ResultSet rs = sta2.executeQuery(); + rs.next(); + String name = rs.getString("NAME"); + System.out.println(name); + } catch (SQLException ex) { + Logger.getLogger(TestConnection01.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("Look up Error"); + System.exit(1); + } + + + // Derby test + DataSource dsDerby = (DataSource)context.lookup("Derby01"); + Connection connectionDerby = dsDerby.getConnection(); + PreparedStatement staDerby = connectionDerby.prepareStatement("select * from APP.CUSTOMER where CUSTOMER_ID=1"); + ResultSet rsDerby = staDerby.executeQuery(); + rsDerby.next(); + String customerID = rsDerby.getString("NAME"); + System.out.println(customerID); + + //PostGresql test + DataSource dsPostgres = (DataSource)context.lookup("Postgres01"); + Connection connectionPG = dsPostgres.getConnection(); + PreparedStatement staPG = connectionPG.prepareStatement("SELECT * FROM public.distributors"); + ResultSet rsPG = staPG.executeQuery(); + rsPG.next(); + String customerName = rsPG.getString(2); + System.out.println(customerName); + + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/Bundle.properties b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/Bundle.properties new file mode 100644 index 0000000..a6df13a --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/Bundle.properties @@ -0,0 +1,28 @@ +context.created=Empty JNDI Context has been created +context.url.not.provided.ID=NAMING-0001 +context.url.not.provided=The URL context context is not provided. +context.url.read=The URL for the context has been retrieved and its value is {0} +url.context.name.malformed.ID=NAMING-0002 +url.context.name.malformed=The URL {0} provided for the context is malformed +jaxb.unmarshalling.failed=UNMarshalling failed with the provided URL {0} +context.binding.ok=context binding is successful and the data have been unmarshaled +number.dataSourcePoolProperties.found={0} DataSourcePool properties have been found in the context +datasourcepoolproperties.found.in.context=DatasourcePoolProperties {0} has been found in the context +number.jdbcResource.declaration.found={0} JDBC Resources have defined in the context +in.process=in process +datasource.created.succesfully=A datasource has been created successfully for the JNDI Name {0} +jndi.value.already.defined=The JNDI value {0} has been declare more than once. Just the first declaration is taken into account +datasource.in.process=Creation Datasource for {0} in process +datasource.processed.bind.success=Datasource for {0} has been processed and bind with success +xadatasource.in.process=Creation XADatasource for {0} in process +xadatasource.processed.bind.success=XADatasource for {0} has been processed and bind with success +bad.resource.type=The resource type {0} defined in the datasourcePoolProperties {1} is not supported +start.instanciate.datasource=Start datasource {0} instanciation +datasource.class.not.found=Datasource class {0} is not found, please check OpenESB classpath +impossible.instanciate.datasource=Impossible to instanciate the datasource {0} +catch.exception=The following exception has been catch +invalid.field.name=Field name "{0}" does not exist in the class {1} please check class and ancestor content and context properties. +field.type.not.process= The field {0} in the class {1} is a not supported type {2}. Just set filed with primitive and String type. +field.not.set=The field {0} has not been set. +native.datasource.set.succesfully=Native datasource {0} has been set successfully +start.pool.configuration= Start pool configuration \ No newline at end of file diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/I18NBundle.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/I18NBundle.java new file mode 100644 index 0000000..4c5ffdd --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/I18NBundle.java @@ -0,0 +1,184 @@ +package net.openesb.standalone.naming.utils; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * This class reads the i18n strings from locale specific bundle from the + * Bundle[locale].properties or bundle[locale].properties file in a specified + * package. This class has methods for formating the messages. + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class I18NBundle { + + private final Logger sLogger = Logger.getLogger("net.openesb.standalone.naming"); + /** + * package name + */ + private String mBundlePackageName = null; + /** + * resource bundle + */ + private ResourceBundle mBundle = null; + + + + /** + * constructor + * + * @param packageName packe name ( e.g. com.sun.mypackage ) in which to look + * for Bundle.properties file + */ + public I18NBundle(String packageName) { + this.mBundlePackageName = packageName; + this.mBundle = null; + } + + /** + * loads the bundle + * + * @param bundleName bundle name + * @param packageName packe name ( e.g. com.sun.mypackage ) in which to look + * for Bundle.properties file + */ + private void loadBundle(String packageName, String bundleName) { + + String bundleBaseName = packageName + "." + bundleName; + ResourceBundle resBundle = null; + try { + resBundle = ResourceBundle.getBundle(bundleBaseName); + } catch (MissingResourceException ex) { + // Try with locale independent defaultBundle + try { + resBundle = ResourceBundle.getBundle(bundleBaseName, new Locale("")); + } catch (Exception anyEx) { + sLogger.log(Level.FINE, anyEx.getMessage()); + } + } + + if (resBundle != null) { + this.mBundle = resBundle; + } + } + + /** + * gets the loaded resource bundle + * + * @return resource bundle + */ + public ResourceBundle getBundle() { + // lazzy init + if (this.mBundle == null) { + loadBundle(this.mBundlePackageName, "Bundle"); + // try to load the bundle with lower case first letter + if (this.mBundle == null) { + loadBundle(this.mBundlePackageName, "bundle"); + } + } + return this.mBundle; + } + + /** + * gets the i18n message + * + * @param aI18NMsg String. + * @param aArgs Object[] + * @return formated i18n string. + */ + public static String getFormattedMessage( + String aI18NMsg, Object[] aArgs) { + String formattedI18NMsg = aI18NMsg; + try { + MessageFormat mf = new MessageFormat(aI18NMsg); + formattedI18NMsg = mf.format(aArgs); + } catch (Exception ex) { + } + return formattedI18NMsg; + } + + /** + * gets the i18n message + * + * @param aI18NKey i18n key + * @param anArgsArray array of arguments for the formatted string + * @return formatted i18n string + */ + public String getMessage(String aI18NKey, Object[] anArgsArray) { + String i18nMessage = getBundle().getString(aI18NKey); + if (anArgsArray != null) { + return getFormattedMessage(i18nMessage, anArgsArray); + } else { + return i18nMessage; + } + } + + /** + * gets the i18n message + * + * @param aI18NKey i18n key + * @return i18n string + */ + public String getMessage(String aI18NKey) { + return getMessage(aI18NKey, null); + } + + /** + * gets the i18n message + * + * @param aI18NKey i18n key + * @param arg1 argrument object to message + * @return i18n string + */ + public String getMessage(String aI18NKey, Object arg1) { + Object[] args = {arg1}; + return getMessage(aI18NKey, args); + } + + /** + * gets the i18n message + * + * @param aI18NKey i18n key + * @param arg1 argrument object to message + * @param arg2 argrument object to message + * @return i18n string + */ + public String getMessage(String aI18NKey, Object arg1, Object arg2) { + Object[] args = {arg1, arg2}; + return getMessage(aI18NKey, args); + } + + /** + * gets the i18n message + * + * @param aI18NKey i18n key + * @param arg1 argrument object to message + * @param arg2 argrument object to message + * @param arg3 argrument object to message + * @return i18n string + */ + public String getMessage(String aI18NKey, Object arg1, Object arg2, Object arg3) { + Object[] args = {arg1, arg2, arg3}; + return getMessage(aI18NKey, args); + } + + /** + * main + * + * @param args string array. + */ + public static void main(String[] args) { + Locale l = new Locale(""); + System.out.println("Locale : " + l); + System.out.println("Default Locale : " + Locale.getDefault()); + I18NBundle bundle = new I18NBundle("net.openesb.standalone.naming.utils"); + bundle.loadBundle("net.openesb.standalone.naming.utils","toto"); + System.out.println( + bundle.getMessage("jbi.ui.ant.jmx.msg.jmxmp.connected", new String[]{"xyz"})); + } +} \ No newline at end of file diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xml b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xml new file mode 100644 index 0000000..a1486a0 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xml @@ -0,0 +1,79 @@ + + + + + + + Derby Connector + org.apache.derby.jdbc.ClientDataSource40 + Datasource + DERBY + OpenESB Community + 10.7.1.1 + DBConnector for Derby + + + user + app + + + + password + app + + + + serverName + localhost + + + + portNumber + 1527 + + + + databaseName + sample + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 10 + + + + minIdle + 10 + + + + + + + Derby Connector + Derby01 + Datasource connection to Derby + + + diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xsd b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xsd new file mode 100644 index 0000000..3bcd09b --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContext.xsd @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Datasource + + + + + XADatasource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContextSample.xml b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContextSample.xml new file mode 100644 index 0000000..b2a29c1 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/naming/utils/OEContextSample.xml @@ -0,0 +1,208 @@ + + + + + + + MYSQL Connector + com.mysql.jdbc.jdbc2.optional.MysqlDataSource + Datasource + MYSQL + Oracle + 5.6 + DBConnector for MySQL + + + user + root + + + + password + password + + + + hostName + localhost + + + + port + 3306 + + + + databaseName + test + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 11 + + + + minIdle + 10 + + + + + + + Derby Connector + org.apache.derby.jdbc.ClientDataSource40 + Datasource + DERBY + OpenESB Community + 10.7.1.1 + DBConnector for Derby + + + user + app + + + + password + app + + + + serverName + localhost + + + + portNumber + 1527 + + + + databaseName + sample + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 10 + + + + minIdle + 10 + + + + + + + Postgres Connector + org.postgresql.ds.PGSimpleDataSource + Datasource + POSTGRESQL + Postgres + 9.1-90 + DBConnector for postgres + + + user + postgres + + + + password + password + + + + serverName + localhost + + + + portNumber + 5432 + + + + databaseName + postgres + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 10 + + + + minIdle + 10 + + + + + + + MYSQL Connector + MySQLServer01 + Datasource connection to MySQ + + + + Derby Connector + Derby01 + Datasource connection to Derby + + + + Postgres Connector + Postgres01 + Datasource connection to Postgres + + diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/SecurityProviderImpl.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/SecurityProviderImpl.java new file mode 100644 index 0000000..1e9dd04 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/SecurityProviderImpl.java @@ -0,0 +1,82 @@ +package net.openesb.standalone.security; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.Subject; +import net.openesb.security.AuthenticationException; +import net.openesb.security.AuthenticationToken; +import net.openesb.security.SecurityProvider; +import net.openesb.standalone.security.realm.Realm; +import net.openesb.standalone.security.realm.RealmBuilder; +import net.openesb.standalone.security.realm.shiro.ShiroAuthenticator; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class SecurityProviderImpl implements SecurityProvider { + + private final Logger mLog = + Logger.getLogger(this.getClass().getPackage().getName()); + + private final static String MANAGEMENT_REALM = "admin"; + + private final Map realms = new HashMap(); + private final ShiroAuthenticator authenticator = new ShiroAuthenticator(); + + public SecurityProviderImpl(Map> realmsConfiguration) { + this.init(realmsConfiguration); + } + + private void init(Map> realmsConfiguration) { + if (realmsConfiguration != null) { + mLog.log(Level.INFO, "Loading security realms from configuration."); + + for(Map.Entry> realmConfig : realmsConfiguration.entrySet()) { + if (! realms.containsKey(realmConfig.getKey())) { + Realm realm = RealmBuilder. + realmBuilder(). + build(realmConfig.getKey(), realmConfig.getValue()); + + authenticator.loadRealm(realm); + realms.put(realmConfig.getKey(), realm); + + if (realm.getName().equals(MANAGEMENT_REALM)) { + mLog.log(Level.INFO, "Management Realm ({0}) has been correctly configured.", + realmConfig.getKey()); + } else { + mLog.log(Level.INFO, "Realm {0} has been correctly configured.", + realmConfig.getKey()); + } + } else { + mLog.log(Level.INFO, "Realm {0} is already defined, skipping...", + realmConfig.getKey()); + } + } + } else { + mLog.log(Level.WARNING, "No realm defined. Please have a look to " + + " the configuration !"); + } + } + + @Override + public Collection getRealms() { + return Collections.unmodifiableSet( + realms.keySet()); + } + + @Override + public Subject login(String realmName, AuthenticationToken authenticationToken) throws AuthenticationException { + return authenticator.authenticate(realmName, authenticationToken); + } + + @Override + public Subject login(AuthenticationToken authenticationToken) throws AuthenticationException { + return login(MANAGEMENT_REALM, authenticationToken); + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/auth/login/JMXauthenticator.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/auth/login/JMXauthenticator.java new file mode 100644 index 0000000..40da503 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/auth/login/JMXauthenticator.java @@ -0,0 +1,42 @@ +package net.openesb.standalone.security.auth.login; + +import javax.management.remote.JMXAuthenticator; +import javax.security.auth.Subject; +import net.openesb.security.AuthenticationException; +import net.openesb.security.AuthenticationToken; +import net.openesb.security.SecurityProvider; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class JMXauthenticator implements JMXAuthenticator { + + private final SecurityProvider securityProvider; + + public JMXauthenticator(final SecurityProvider securityProvider) { + this.securityProvider = securityProvider; + } + + @Override + public Subject authenticate(Object credentialsObj) { + final String [] credentials = (String []) credentialsObj; + + try { + return securityProvider.login(new AuthenticationToken() { + @Override + public Object getPrincipal() { + return credentials[0]; + } + + @Override + public Object getCredentials() { + return credentials[1]; + } + }); + } catch (AuthenticationException ae) { + throw new SecurityException(ae.getMessage()); + } + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/AbstractRealm.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/AbstractRealm.java new file mode 100644 index 0000000..eb12e41 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/AbstractRealm.java @@ -0,0 +1,26 @@ +package net.openesb.standalone.security.realm; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public abstract class AbstractRealm implements Realm { + + private String realmName; + + protected AbstractRealm() { + } + + protected AbstractRealm(String realmName) { + this.realmName = realmName; + } + + public String getName() { + return realmName; + } + + public void setName(String realmName) { + this.realmName = realmName; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/Realm.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/Realm.java new file mode 100644 index 0000000..41e4607 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/Realm.java @@ -0,0 +1,11 @@ +package net.openesb.standalone.security.realm; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public interface Realm { + + String getName(); +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmBuilder.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmBuilder.java new file mode 100644 index 0000000..9a19ae2 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmBuilder.java @@ -0,0 +1,33 @@ +package net.openesb.standalone.security.realm; + +import java.util.Map; +import java.util.ServiceLoader; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public final class RealmBuilder { + + private final static String REALM_TYPE = "type"; + + public static RealmBuilder realmBuilder() { + return new RealmBuilder(); + } + + public Realm build(String realmName, Map properties) { + ServiceLoader handlers = ServiceLoader.load(RealmHandler.class); + for(RealmHandler handler : handlers) { + String type = properties.get(REALM_TYPE); + if (handler.canHandle(type)) { + Realm realm = handler.create(realmName, properties); + + return realm; + } + } + + throw new IllegalStateException("Unable to create realm " + realmName + + " : no handler found !"); + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmHandler.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmHandler.java new file mode 100644 index 0000000..aea8778 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/RealmHandler.java @@ -0,0 +1,15 @@ +package net.openesb.standalone.security.realm; + +import java.util.Map; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public interface RealmHandler { + + boolean canHandle(String type); + + T create(String realmName, Map properties); +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/AbstractRealmHandler.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/AbstractRealmHandler.java new file mode 100644 index 0000000..38d4af6 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/AbstractRealmHandler.java @@ -0,0 +1,55 @@ +package net.openesb.standalone.security.realm.impl; + +import java.util.Map; +import net.openesb.standalone.security.realm.Realm; +import net.openesb.standalone.security.realm.RealmHandler; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public abstract class AbstractRealmHandler implements RealmHandler { + + @Override + public T create(String realmName, Map properties) { + return instantiate(realmName, properties); + } + + abstract T instantiate(String realmName, Map properties); + + /** + * System property replacement in the given string. + * + * @param str The original string + * @return the modified string + */ + protected String replace(String str) { + String result = str; + int pos_start = str.indexOf("${"); + if (pos_start >= 0) { + StringBuilder builder = new StringBuilder(); + int pos_end = -1; + while (pos_start >= 0) { + builder.append(str, pos_end + 1, pos_start); + pos_end = str.indexOf('}', pos_start + 2); + if (pos_end < 0) { + pos_end = pos_start - 1; + break; + } + String propName = str.substring(pos_start + 2, pos_end); + String replacement = propName.length() > 0 ? System + .getProperty(propName) : null; + if (replacement != null) { + builder.append(replacement); + } else { + builder.append(str, pos_start, pos_end + 1); + } + pos_start = str.indexOf("${", pos_end + 1); + } + builder.append(str, pos_end + 1, str.length()); + result = builder.toString(); + } + return result; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealm.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealm.java new file mode 100644 index 0000000..53e8a0e --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealm.java @@ -0,0 +1,48 @@ +package net.openesb.standalone.security.realm.impl; + +import net.openesb.standalone.security.realm.AbstractRealm; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class PropertiesRealm extends AbstractRealm { + + private String path; + + private boolean reload = false; + + /** + * Unit: seconds + */ + private int reloadInterval; + + public PropertiesRealm(String realmName) { + super(realmName); + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public boolean isReload() { + return reload; + } + + public void setReload(boolean reload) { + this.reload = reload; + } + + public int getReloadInterval() { + return reloadInterval; + } + + public void setReloadInterval(int reloadInterval) { + this.reloadInterval = reloadInterval; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealmHandler.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealmHandler.java new file mode 100644 index 0000000..b8a0fe3 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/impl/PropertiesRealmHandler.java @@ -0,0 +1,61 @@ +package net.openesb.standalone.security.realm.impl; + +import java.io.File; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class PropertiesRealmHandler extends AbstractRealmHandler { + + private final Logger mLog = + Logger.getLogger(this.getClass().getPackage().getName()); + + private final static String PROPERTIES_REALM = "properties"; + + private final static String PROPERTY_PATH = "file"; + private final static String PROPERTY_RELOAD_ENABLE = "reload"; + private final static String PROPERTY_RELOAD_INTERVAL = "interval"; + + @Override + public boolean canHandle(String type) { + return PROPERTIES_REALM.equalsIgnoreCase(type); + } + + @Override + public PropertiesRealm instantiate(String realmName, Map properties) { + String file = properties.get(PROPERTY_PATH); + file = replace(file); + + mLog.log(Level.INFO, "Creating properties realm using file: {0}", file); + + File propertyFile = new File(file); + if (! propertyFile.exists()) { + mLog.log(Level.SEVERE, "Properties realm, invalid path: {0}", + propertyFile.getAbsolutePath()); + + throw new IllegalStateException("Properties realm, invalid path: " + + propertyFile.getAbsolutePath()); + } + + boolean reload = Boolean.parseBoolean(properties.get(PROPERTY_RELOAD_ENABLE)); + PropertiesRealm propertiesRealm = new PropertiesRealm(realmName); + propertiesRealm.setPath(propertyFile.getAbsolutePath()); + + if (reload) { + String sInterval = properties.get(PROPERTY_RELOAD_INTERVAL); + try { + int interval = Integer.parseInt(sInterval); + propertiesRealm.setReloadInterval(interval); + } catch (NumberFormatException nfe) { + + } + } + + return propertiesRealm; + } +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/PropertiesRealmConverter.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/PropertiesRealmConverter.java new file mode 100644 index 0000000..856fd5f --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/PropertiesRealmConverter.java @@ -0,0 +1,35 @@ +package net.openesb.standalone.security.realm.shiro; + +import net.openesb.standalone.security.realm.Realm; +import org.apache.shiro.realm.text.PropertiesRealm; + + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class PropertiesRealmConverter implements + RealmConverter { + + @Override + public PropertiesRealm convert(net.openesb.standalone.security.realm.impl.PropertiesRealm realm) { + PropertiesRealm cRealm = new PropertiesRealm(); + cRealm.setResourcePath(realm.getPath()); + + if (realm.isReload()) { + cRealm.setReloadIntervalSeconds(realm.getReloadInterval()); + } + + // Initialize the realm + cRealm.onInit(); + + return cRealm; + } + + @Override + public boolean canHandle(Class realm) { + return realm.equals(net.openesb.standalone.security.realm.impl.PropertiesRealm.class); + } + +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/RealmConverter.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/RealmConverter.java new file mode 100644 index 0000000..e96bdf3 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/RealmConverter.java @@ -0,0 +1,15 @@ +package net.openesb.standalone.security.realm.shiro; + +import net.openesb.standalone.security.realm.Realm; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public interface RealmConverter { + + S convert(T realm); + + boolean canHandle(Class realm); +} diff --git a/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/ShiroAuthenticator.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/ShiroAuthenticator.java new file mode 100644 index 0000000..5ddea11 --- /dev/null +++ b/openesb-standalone-container/src/main/java/net/openesb/standalone/security/realm/shiro/ShiroAuthenticator.java @@ -0,0 +1,59 @@ +package net.openesb.standalone.security.realm.shiro; + +import java.util.HashMap; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.logging.Logger; +import javax.security.auth.Subject; +import net.openesb.security.AuthenticationException; +import net.openesb.security.AuthenticationToken; +import net.openesb.standalone.security.realm.Realm; +import net.openesb.standalone.security.realm.RealmHandler; +import net.openesb.standalone.security.realm.impl.PropertiesRealm; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.mgt.DefaultSecurityManager; + +/** + * + * @author David BRASSELY (brasseld at gmail.com) + * @author OpenESB Community + */ +public class ShiroAuthenticator { + + private final Logger mLog = + Logger.getLogger(this.getClass().getPackage().getName()); + + private final Map securityManagers = + new HashMap(); + + public void loadRealm(Realm realm) { + ServiceLoader converters = ServiceLoader.load(RealmConverter.class); + for (RealmConverter converter : converters) { + if (converter.canHandle(realm.getClass())) { + org.apache.shiro.realm.Realm sRealm = converter.convert((PropertiesRealm)realm); + DefaultSecurityManager manager = new DefaultSecurityManager(sRealm); + securityManagers.put(realm.getName(), manager); + } + } + } + + public Subject authenticate(String realmName, AuthenticationToken authenticationToken) + throws AuthenticationException { + org.apache.shiro.mgt.SecurityManager securityManager = securityManagers.get(realmName); + org.apache.shiro.subject.Subject currentUser = + new org.apache.shiro.subject.Subject.Builder(securityManager).buildSubject(); + + UsernamePasswordToken token = new UsernamePasswordToken( + (String) authenticationToken.getPrincipal(), + (char []) authenticationToken.getCredentials()); + + try { + currentUser.login(token); + + Subject subject = new Subject(); + return subject; + } catch (org.apache.shiro.authc.AuthenticationException ae) { + throw new AuthenticationException(ae.getMessage()); + } + } +} diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/ImmutableSettings.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/settings/ImmutableSettings.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/ImmutableSettings.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/settings/ImmutableSettings.java diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/Settings.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/settings/Settings.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/Settings.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/settings/Settings.java diff --git a/openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/SettingsException.java b/openesb-standalone-container/src/main/java/net/openesb/standalone/settings/SettingsException.java similarity index 100% rename from openesb-standalone-framework/src/main/java/net/openesb/standalone/settings/SettingsException.java rename to openesb-standalone-container/src/main/java/net/openesb/standalone/settings/SettingsException.java diff --git a/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.RealmHandler b/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.RealmHandler new file mode 100644 index 0000000..420fe6d --- /dev/null +++ b/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.RealmHandler @@ -0,0 +1 @@ +net.openesb.standalone.security.realm.impl.PropertiesRealmHandler \ No newline at end of file diff --git a/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.shiro.RealmConverter b/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.shiro.RealmConverter new file mode 100644 index 0000000..8eb6772 --- /dev/null +++ b/openesb-standalone-container/src/main/resources/META-INF/services/net.openesb.standalone.security.realm.shiro.RealmConverter @@ -0,0 +1 @@ +net.openesb.standalone.security.realm.shiro.PropertiesRealmConverter \ No newline at end of file diff --git a/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/Bundle.properties b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/Bundle.properties new file mode 100644 index 0000000..15cbbe6 --- /dev/null +++ b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/Bundle.properties @@ -0,0 +1,28 @@ +context.created=Empty JNDI Context has been created +context.url.not.provided.ID=NAMING-0001 +context.url.not.provided=The URL context context is not provided. +context.url.read=The URL for the context has been retrieved and its value is {0} +url.context.name.malformed.ID=NAMING-0002 +url.context.name.malformed=The URL {0} provided for the context is malformed +jaxb.unmarshalling.failed=Unmarshalling failed with the provided URL {0} +context.binding.ok=context binding is successful and the data have been unmarshaled +number.dataSourcePoolProperties.found={0} DataSourcePool properties have been found in the context +datasourcepoolproperties.found.in.context=DatasourcePoolProperties {0} has been found in the context +number.jdbcResource.declaration.found={0} JDBC Resources have defined in the context +in.process=in process +datasource.created.succesfully=A datasource has been created successfully for the JNDI Name {0} +jndi.value.already.defined=The JNDI value {0} has been declare more than once. Just the first declaration is taken into account +datasource.in.process=Creation Datasource for {0} in process +datasource.processed.bind.success=Datasource for {0} has been processed and bind with success +xadatasource.in.process=Creation XADatasource for {0} in process +xadatasource.processed.bind.success=XADatasource for {0} has been processed and bind with success +bad.resource.type=The resource type {0} defined in the datasourcePoolProperties {1} is not supported +start.instanciate.datasource=Start datasource {0} instanciation +datasource.class.not.found=Datasource class {0} is not found, please check OpenESB classpath +impossible.instanciate.datasource=Impossible to instanciate the datasource {0} +catch.exception=The following exception has been catch +invalid.field.name=Field name "{0}" does not exist in the class {1} please check class and ancestor content and context properties. +field.type.not.process= The field {0} in the class {1} is a not supported type {2}. Just set filed with primitive and String type. +field.not.set=The field {0} has not been set. +native.datasource.set.succesfully=Native datasource {0} has been set successfully +start.pool.configuration= Start pool configuration \ No newline at end of file diff --git a/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContext.xsd b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContext.xsd new file mode 100644 index 0000000..3bcd09b --- /dev/null +++ b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContext.xsd @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Datasource + + + + + XADatasource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContextSample.xml b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContextSample.xml new file mode 100644 index 0000000..b2a29c1 --- /dev/null +++ b/openesb-standalone-container/src/main/resources/net/openesb/standalone/naming/utils/OEContextSample.xml @@ -0,0 +1,208 @@ + + + + + + + MYSQL Connector + com.mysql.jdbc.jdbc2.optional.MysqlDataSource + Datasource + MYSQL + Oracle + 5.6 + DBConnector for MySQL + + + user + root + + + + password + password + + + + hostName + localhost + + + + port + 3306 + + + + databaseName + test + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 11 + + + + minIdle + 10 + + + + + + + Derby Connector + org.apache.derby.jdbc.ClientDataSource40 + Datasource + DERBY + OpenESB Community + 10.7.1.1 + DBConnector for Derby + + + user + app + + + + password + app + + + + serverName + localhost + + + + portNumber + 1527 + + + + databaseName + sample + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 10 + + + + minIdle + 10 + + + + + + + Postgres Connector + org.postgresql.ds.PGSimpleDataSource + Datasource + POSTGRESQL + Postgres + 9.1-90 + DBConnector for postgres + + + user + postgres + + + + password + password + + + + serverName + localhost + + + + portNumber + 5432 + + + + databaseName + postgres + + + + + + initialSize + 11 + + + + maxActive + 20 + + + + maxIdle + 10 + + + + minIdle + 10 + + + + + + + MYSQL Connector + MySQLServer01 + Datasource connection to MySQ + + + + Derby Connector + Derby01 + Datasource connection to Derby + + + + Postgres Connector + Postgres01 + Datasource connection to Postgres + + diff --git a/openesb-standalone-packaging/pom.xml b/openesb-standalone-packaging/pom.xml index 443f215..34c1c42 100644 --- a/openesb-standalone-packaging/pom.xml +++ b/openesb-standalone-packaging/pom.xml @@ -49,17 +49,7 @@ net.open-esb.runtime.standalone - openesb-standalone-framework - ${project.version} - - - net.open-esb.runtime.standalone - openesb-standalone-naming - ${project.version} - - - net.open-esb.runtime.standalone - openesb-standalone-security + openesb-standalone-container ${project.version} diff --git a/openesb-standalone-packaging/src/main/assembly/distribution.xml b/openesb-standalone-packaging/src/main/assembly/distribution.xml index 83685a0..60cd9df 100644 --- a/openesb-standalone-packaging/src/main/assembly/distribution.xml +++ b/openesb-standalone-packaging/src/main/assembly/distribution.xml @@ -108,10 +108,8 @@ true - net.open-esb.runtime.standalone:openesb-standalone-framework net.open-esb.runtime.standalone:openesb-standalone-bootstrap - net.open-esb.runtime.standalone:openesb-standalone-naming - net.open-esb.runtime.standalone:openesb-standalone-security + net.open-esb.runtime.standalone:openesb-standalone-container false diff --git a/pom.xml b/pom.xml index d9ea42b..6c1be7d 100644 --- a/pom.xml +++ b/pom.xml @@ -17,11 +17,9 @@ OpenESB runtime in standalone mode - openesb-standalone-framework + openesb-standalone-container openesb-standalone-bootstrap - openesb-standalone-naming openesb-standalone-packaging - openesb-standalone-security