public ClientMetadataBuilder(Map mapOfPuProperties, final KunderaMetadata kunderaMetadata, String... persistenceUnits) { this.persistenceUnits = persistenceUnits; this.mapExternalProperties = mapOfPuProperties; this.schemaConfiguration = new SchemaConfiguration(mapOfPuProperties, kunderaMetadata, persistenceUnits); }
private HashMap<String, String> initializeProperties() { if (clientProperties != null && clientProperties.getDatastores() != null) { for (DataStore dataStore : clientProperties.getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase("redis")) { return new HashMap(dataStore.getConnection().getProperties()); } } } return null; }
public List<Server> getConnectionServers() { DataStore ds = getDataStore(); List<Server> servers = new ArrayList<Server>(); if (ds != null && ds.getConnection() != null) { servers = ds.getConnection().getServers(); return servers; } return servers; } }
public DataStore getDataStore() { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase("mongo")) { return dataStore; } } } return null; }
public Properties getConnectionProperties() { DataStore ds = getDataStore("elasticsearch"); if (ds != null) { Connection connection = ds.getConnection(); if (connection != null) { Properties properties = connection.getProperties(); return properties; } } return null; } }
public void testParseXMLWithAsolutePath() { String pu = "PropertyTest"; EntityManagerFactory emf = Persistence.createEntityManagerFactory(pu); PropertyReader reader = new DummyPropertyReader(null, ((EntityManagerFactoryImpl) emf) .getKunderaMetadataInstance().getApplicationMetadata().getPersistenceUnitMetadata(pu)); ClientProperties cp = null; reader.read(pu); cp = DummyPropertyReader.dsmd.getClientProperties(); assertValues(cp); }
protected DataStore getDataStore(final String dataStoreName) { if (getClientProperties() != null) { if (getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase(dataStoreName)) { return dataStore; } } } if (log.isWarnEnabled()) { log.warn("No data store configuration found, returning null."); } } return null; } }
/** * Initialize and load clientFactory for all persistenceUnit with external * properties. * * @param persistenceUnit * @param externalProperties */ private void configureClientFactories() { ClientMetadataBuilder builder = new ClientMetadataBuilder(getProperties(), kunderaMetadata, getPersistenceUnits()); builder.buildClientFactoryMetadata(clientFactories, kunderaMetadata); }
public DummyPropertyReader(Map externalProperties, final PersistenceUnitMetadata puMetadata) { super(externalProperties, puMetadata); dsmd = new DummySchemaMetadata(); }
public Properties getDatastoreProperties() { DataStore ds = getDataStore(dataStoreName); Properties properties = new Properties(); if (ds != null && ds.getProperties() != null) { properties.putAll(ds.getProperties()); } return properties; } }
public DataStore getDataStore() { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase("hbase")) { return dataStore; } } } return null; } }
/** * @return the zookeeper_host */ public String getZookeeperHost() { DataStore ds = getDataStore(); if (ds != null && ds.getConnection() != null) { Connection conn = ds.getConnection(); if (conn.getProperties() != null && !conn.getProperties().isEmpty()) { zookeeperHost = conn.getProperties().getProperty(HBaseConstants.ZOOKEEPER_HOST.trim()); } } return zookeeperHost; }
public void testParseXMLWithVariable() { String pu = "PropertyTest"; EntityManagerFactory emf = Persistence.createEntityManagerFactory(pu); PropertyReader reader = new DummyPropertyReader(null, ((EntityManagerFactoryImpl) emf) .getKunderaMetadataInstance().getApplicationMetadata().getPersistenceUnitMetadata(pu)); ClientProperties cp = null; reader.read(pu); cp = DummyPropertyReader.dsmd.getClientProperties(); assertValues(cp); }
public List<Server> getConnectionServers() { DataStore ds = getDataStore(dataStoreName); List<Server> servers = new ArrayList<Server>(); if (ds != null && ds.getConnection() != null) { servers = ds.getConnection().getServers(); return servers; } return servers; }
/** * Returns datastore instance for given {@link ClientProperties} for * OracleNoSQL * * @return */ public DataStore getDataStore() { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase(ORACLE_NOSQL_DATASTORE)) { return dataStore; } } } return null; }
/** * @return the zookeeper_port */ public String getZookeeperPort() { DataStore ds = getDataStore(); if (ds != null && ds.getConnection() != null) { Connection conn = ds.getConnection(); if (conn.getProperties() != null && !conn.getProperties().isEmpty()) { zookeeperPort = conn.getProperties().getProperty(HBaseConstants.ZOOKEEPER_PORT).trim(); } } return zookeeperPort; }
/** * Test method for * {@link com.impetus.kundera.configure.AbstractPropertyReader#onParseXML(java.lang.String)} * . */ @Test public void testParseXML() { String pu = "PropertyTest"; EntityManagerFactory emf = Persistence.createEntityManagerFactory(pu); PropertyReader reader = new DummyPropertyReader(null, ((EntityManagerFactoryImpl) emf) .getKunderaMetadataInstance().getApplicationMetadata().getPersistenceUnitMetadata(pu)); ClientProperties cp = null; reader.read(pu); cp = DummyPropertyReader.dsmd.getClientProperties(); assertValues(cp); }
/** * Gets the data store. * * @param datastore * the datastore * @return the data store */ public DataStore getDataStore(String datastore) { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase(datastore)) { return dataStore; } } } return null; }
/** * Gets the data store. * * @param datastore * the datastore * @return the data store */ public DataStore getDataStore(String datastore) { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase(datastore)) { return dataStore; } } } return null; }
/** * Gets the data store. * * @return the data store */ public DataStore getDataStore() { if (getClientProperties() != null && getClientProperties().getDatastores() != null) { for (DataStore dataStore : getClientProperties().getDatastores()) { if (dataStore.getName() != null && dataStore.getName().trim().equalsIgnoreCase(HBASE)) { return dataStore; } } } return null; } }