public ConsoleManager() { try { this.jndiDataSourceName = EmailConnectorConfig.getConfigInstance().getDataSource(); boolean checkCertificates = EmailConnectorConfig.getConfigInstance().getCheckCertificates(); if (checkCertificates) { this.sslSocketFactory = Def.SSL_SOCKET_FACTORY_STANDARD; } else { this.sslSocketFactory = Def.SSL_SOCKET_FACTORY_FUNAMBOL; } idMailServerSpace = DBIDGeneratorFactory.getDBIDGenerator( Def.ID_COUNTER_MAILSERVER, DataSourceTools.lookupDataSource(CORE_DB_JNDI_NAME)); cdao = new ConsoleDAO(); } catch (EmailConfigException e) { log.error("Error Getting Connector Parameters ", e); } catch (NamingException e) { log.error("Error Getting ID Generator ", e); } catch (InboxListenerConfigException e) { log.error("Error creating DAO layer ", e); } catch (Exception e) { log.error("Error Getting ID Generator ", e); } }
/** * Initializes the RegistryDao that works on the given table. See also class description for some * information about clusterSize and serverIndex * * @param registryTableName the registry table name * @param entriesIdSpace the idSpace to use creating the new entry ids * @param ds the datasource * @param clusterSize number of the members in the cluster * @param serverIndex unique index of the instance in the cluster */ private void init( String registryTableName, String entriesIdSpace, DataSource ds, int clusterSize, int serverIndex) throws DataAccessException { if (ds == null) { throw new IllegalArgumentException("The datasource must be not null"); } this.dataSource = ds; if (registryTableName == null || registryTableName.length() == 0) { registryTableName = DEFAULT_REGISTRY_TABLE_NAME; } if (entriesIdSpace == null || entriesIdSpace.length() == 0) { this.idSpace = DEFAULT_ID_SPACE; } else { this.idSpace = entriesIdSpace; } fillQueryDescriptor(registryTableName, clusterSize, serverIndex); dbIdGenerator = DBIDGeneratorFactory.getDBIDGenerator(this.idSpace, this.dataSource); }