@Test public void testCreateDataStore_SessionPool() throws IOException { String jndiRef = "MyArcSdeResource_SessionPool"; Map<String, Serializable> params = new HashMap<String, Serializable>(); params.put(ArcSDEJNDIDataStoreFactory.JNDI_REFNAME.key, jndiRef); ISessionPool pool = testData.getConnectionPool(); try { InitialContext initialContext = GeoTools.getInitialContext(GeoTools.getDefaultHints()); initialContext.bind(jndiRef, pool); assertNotNull(initialContext.lookup(jndiRef)); } catch (NamingException e) { throw new RuntimeException(e); } ArcSDEDataStore dataStore = (ArcSDEDataStore) factory.createDataStore(params); assertNotNull(dataStore); ISession session = dataStore.getSession(Transaction.AUTO_COMMIT); assertNotNull(session); session.dispose(); }
public DataStore createDataStore(Map<String, Serializable> params) throws IOException { final String jndiName = (String) JNDI_REFNAME.lookUp(params); final Object lookup = lookupJndiResource(jndiName); final ISessionPool sessionPool = getSessionPool(jndiName, lookup); final String nsUri = (String) NAMESPACE_PARAM.lookUp(params); final String version = (String) VERSION_PARAM.lookUp(params); final boolean nonSpatial; { final Boolean allowNonSpatialTables = (Boolean) ALLOW_NON_SPATIAL_PARAM.lookUp(params); nonSpatial = allowNonSpatialTables == null ? false : allowNonSpatialTables .booleanValue(); } final ArcSDEConnectionConfig connectionConfig = sessionPool.getConfig(); final ArcSDEDataStoreConfig dsConfig; dsConfig = new ArcSDEDataStoreConfig(connectionConfig, nsUri, version, nonSpatial); LOGGER.info("Creating ArcSDE JNDI DataStore with shared session pool for " + dsConfig); final ArcSDEDataStore dataStore = delegateFactory.createDataStore(dsConfig, sessionPool); return dataStore; }
ArcSDEJNDIDataStoreFactory implements DataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { final String jndiName = (String) JNDI_REFNAME.lookUp(params); final Object lookup = lookupJndiResource(jndiName); final ISessionPool sessionPool = getSessionPool(jndiName, lookup); final String nsUri = (String) NAMESPACE_PARAM.lookUp(params); final String version = (String) VERSION_PARAM.lookUp(params); final boolean nonSpatial; { final Boolean allowNonSpatialTables = (Boolean) ALLOW_NON_SPATIAL_PARAM.lookUp(params); nonSpatial = allowNonSpatialTables == null ? false : allowNonSpatialTables .booleanValue(); } final ArcSDEConnectionConfig connectionConfig = sessionPool.getConfig(); final ArcSDEDataStoreConfig dsConfig; dsConfig = new ArcSDEDataStoreConfig(connectionConfig, nsUri, version, nonSpatial); LOGGER.info("Creating ArcSDE JNDI DataStore with shared session pool for " + dsConfig); final ArcSDEDataStore dataStore = delegateFactory.createDataStore(dsConfig, sessionPool); return dataStore; } }
ArcSDEJNDIDataStoreFactory implements DataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { final String jndiName = (String) JNDI_REFNAME.lookUp(params); final Object lookup = lookupJndiResource(jndiName); final ISessionPool sessionPool = getSessionPool(jndiName, lookup); final String nsUri = (String) NAMESPACE_PARAM.lookUp(params); final String version = (String) VERSION_PARAM.lookUp(params); final boolean nonSpatial; { final Boolean allowNonSpatialTables = (Boolean) ALLOW_NON_SPATIAL_PARAM.lookUp(params); nonSpatial = allowNonSpatialTables == null ? false : allowNonSpatialTables .booleanValue(); } final ArcSDEConnectionConfig connectionConfig = sessionPool.getConfig(); final ArcSDEDataStoreConfig dsConfig; dsConfig = new ArcSDEDataStoreConfig(connectionConfig, nsUri, version, nonSpatial); LOGGER.info("Creating ArcSDE JNDI DataStore with shared session pool for " + dsConfig); final ArcSDEDataStore dataStore = delegateFactory.createDataStore(dsConfig, sessionPool); return dataStore; } ArcSDEJNDIDataStoreFactory(); }
ArcSDEJNDIDataStoreFactory implements DataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { final String jndiName = (String) JNDI_REFNAME.lookUp(params); final Object lookup = lookupJndiResource(jndiName); final ISessionPool sessionPool = getSessionPool(jndiName, lookup); final String nsUri = (String) NAMESPACE_PARAM.lookUp(params); final String version = (String) VERSION_PARAM.lookUp(params); final boolean nonSpatial; { final Boolean allowNonSpatialTables = (Boolean) ALLOW_NON_SPATIAL_PARAM.lookUp(params); nonSpatial = allowNonSpatialTables == null ? false : allowNonSpatialTables .booleanValue(); } final ArcSDEConnectionConfig connectionConfig = sessionPool.getConfig(); final ArcSDEDataStoreConfig dsConfig; dsConfig = new ArcSDEDataStoreConfig(connectionConfig, nsUri, version, nonSpatial); LOGGER.info("Creating ArcSDE JNDI DataStore with shared session pool for " + dsConfig); final ArcSDEDataStore dataStore = delegateFactory.createDataStore(dsConfig, sessionPool); return dataStore; } ArcSDEJNDIDataStoreFactory(); DataStore createDataStore(Map<String, Serializable> params); boolean canProcess(Map<String, Serializable> params); String getDescription(); String getDisplayName(); Param[] getParametersInfo(); boolean isAvailable(); Map<Key, ?> getImplementationHints(); DataStore createNewDataStore(Map<String, Serializable> params); }
ArcSDEJNDIDataStoreFactory implements DataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { final String jndiName = (String) JNDI_REFNAME.lookUp(params); final Object lookup = lookupJndiResource(jndiName); final ISessionPool sessionPool = getSessionPool(jndiName, lookup); final String nsUri = (String) NAMESPACE_PARAM.lookUp(params); final String version = (String) VERSION_PARAM.lookUp(params); final boolean nonSpatial; { final Boolean allowNonSpatialTables = (Boolean) ALLOW_NON_SPATIAL_PARAM.lookUp(params); nonSpatial = allowNonSpatialTables == null ? false : allowNonSpatialTables .booleanValue(); } final ArcSDEConnectionConfig connectionConfig = sessionPool.getConfig(); final ArcSDEDataStoreConfig dsConfig; dsConfig = new ArcSDEDataStoreConfig(connectionConfig, nsUri, version, nonSpatial); LOGGER.info("Creating ArcSDE JNDI DataStore with shared session pool for " + dsConfig); final ArcSDEDataStore dataStore = delegateFactory.createDataStore(dsConfig, sessionPool); return dataStore; } ArcSDEJNDIDataStoreFactory(); DataStore createDataStore(Map<String, Serializable> params); boolean canProcess(Map<String, Serializable> params); String getDescription(); String getDisplayName(); Param[] getParametersInfo(); boolean isAvailable(); Map<Key, ?> getImplementationHints(); DataStore createNewDataStore(Map<String, Serializable> params); static final Param JNDI_REFNAME; }