public void createSolrCollections() { if (catalogManager.getConfiguration().getCatalog().getSearch().getMode().equals("cloud")) { createCatalogSolrCollections(); } else { createCatalogSolrCores(); } }
public MongoDBAdaptorFactory(Configuration catalogConfiguration) throws CatalogDBException { MongoDBConfiguration mongoDBConfiguration = MongoDBConfiguration.builder() .setUserPassword( catalogConfiguration.getCatalog().getDatabase().getUser(), catalogConfiguration.getCatalog().getDatabase().getPassword()) .load(catalogConfiguration.getCatalog().getDatabase().getOptions()) .build(); List<DataStoreServerAddress> dataStoreServerAddresses = new LinkedList<>(); for (String hostPort : catalogConfiguration.getCatalog().getDatabase().getHosts()) { if (hostPort.contains(":")) { String[] split = hostPort.split(":"); int port = Integer.valueOf(split[1]); dataStoreServerAddresses.add(new DataStoreServerAddress(split[0], port)); } else { dataStoreServerAddresses.add(new DataStoreServerAddress(hostPort, 27017)); } } this.mongoManager = new MongoDataStoreManager(dataStoreServerAddresses); this.configuration = mongoDBConfiguration; this.database = getCatalogDatabase(catalogConfiguration.getDatabasePrefix()); logger = LoggerFactory.getLogger(this.getClass()); connect(); }
private void clearCatalog() throws URISyntaxException { List<DataStoreServerAddress> dataStoreServerAddresses = new LinkedList<>(); for (String hostPort : configuration.getCatalog().getDatabase().getHosts()) { if (hostPort.contains(":")) { String[] split = hostPort.split(":"); Integer port = Integer.valueOf(split[1]); dataStoreServerAddresses.add(new DataStoreServerAddress(split[0], port)); } else { dataStoreServerAddresses.add(new DataStoreServerAddress(hostPort, 27017)); } } MongoDataStoreManager mongoManager = new MongoDataStoreManager(dataStoreServerAddresses); // MongoDataStore db = mongoManager.get(catalogConfiguration.getDatabase().getDatabase()); MongoDataStore db = mongoManager.get(getCatalogDatabase()); db.getDb().drop(); // mongoManager.close(catalogConfiguration.getDatabase().getDatabase()); mongoManager.close(getCatalogDatabase()); Path rootdir = Paths.get(UriUtils.createDirectoryUri(configuration.getDataDir())); deleteFolderTree(rootdir.toFile()); if (!configuration.getTempJobsDir().isEmpty()) { Path jobsDir = Paths.get(UriUtils.createDirectoryUri(configuration.getTempJobsDir())); if (jobsDir.toFile().exists()) { deleteFolderTree(jobsDir.toFile()); } } }
break; case "OPENCGA_CATALOG_DB_HOSTS": configuration.getCatalog().getDatabase().setHosts(Arrays.asList(envVariables.get(variable).split(","))); break; case "OPENCGA_CATALOG_DB_USER": configuration.getCatalog().getDatabase().setUser(envVariables.get(variable)); break; case "OPENCGA_CATALOG_DB_PASSWORD": configuration.getCatalog().getDatabase().setPassword(envVariables.get(variable)); break; case "OPENCGA_CATALOG_DB_AUTHENTICATION_DATABASE": configuration.getCatalog().getDatabase().getOptions().put("authenticationDatabase", envVariables.get(variable)); break; case "OPENCGA_CATALOG_DB_CONNECTIONS_PER_HOST": configuration.getCatalog().getDatabase().getOptions().put("connectionsPerHost", envVariables.get(variable)); break; case "OPENCGA_CATALOG_SEARCH_HOST": configuration.getCatalog().getSearch().setHost(envVariables.get(variable)); break; case "OPENCGA_CATALOG_SEARCH_TIMEOUT": configuration.getCatalog().getSearch().setTimeout(Integer.parseInt(envVariables.get(variable))); break; case "OPENCGA_CATALOG_SEARCH_BATCH": configuration.getCatalog().getSearch().setInsertBatchSize(Integer.parseInt(envVariables.get(variable))); break; case "OPENCGA_SERVER_REST_PORT":
List<String> aliasList = new ArrayList<>(); for (String studyStr : studyList) { if (StringUtils.isNumeric(studyStr) && Long.parseLong(studyStr) > configuration.getCatalog().getOffset()) { idList.add(Long.parseLong(studyStr)); } else {
public CatalogSolrManager(CatalogManager catalogManager) { this.catalogManager = catalogManager; SearchConfiguration searchConfiguration = catalogManager.getConfiguration().getCatalog().getSearch(); this.solrManager = new SolrManager(searchConfiguration.getHosts(), searchConfiguration.getMode(), searchConfiguration.getTimeout()); insertBatchSize = searchConfiguration.getInsertBatchSize() > 0 ? searchConfiguration.getInsertBatchSize() : DEFAULT_INSERT_BATCH_SIZE; DATABASE_PREFIX = catalogManager.getConfiguration().getDatabasePrefix() + "_"; populateConfigCollectionMap(); logger = LoggerFactory.getLogger(CatalogSolrManager.class); }
public static void clearCatalog(Configuration configuration) throws IOException, CatalogException, URISyntaxException { List<DataStoreServerAddress> dataStoreServerAddresses = new LinkedList<>(); for (String hostPort : configuration.getCatalog().getDatabase().getHosts()) { if (hostPort.contains(":")) { String[] split = hostPort.split(":");
public void initializeMetaCollection(Configuration configuration) throws CatalogException { Admin admin = configuration.getAdmin(); admin.setPassword(CatalogAuthenticationManager.cypherPassword(admin.getPassword())); Metadata metadata = new Metadata().setIdCounter(configuration.getCatalog().getOffset()).setVersion(VERSION); Document metadataObject = getMongoDBDocument(metadata, "Metadata"); metadataObject.put(PRIVATE_ID, MongoDBAdaptorFactory.METADATA_OBJECT_ID); Document adminDocument = getMongoDBDocument(admin, "Admin"); metadataObject.put("admin", adminDocument); metaCollection.insert(metadataObject, null); }
configuration.getCatalog().getDatabase().getHosts().get(0).split(":")[0], 27017); .add("username", configuration.getCatalog().getDatabase().getUser()) .add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build();
configuration.getAdmin().setAlgorithm("HS256"); MongoDBConfiguration mongoDBConfiguration = MongoDBConfiguration.builder() .add("username", configuration.getCatalog().getDatabase().getUser()) .add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build(); String[] split = configuration.getCatalog().getDatabase().getHosts().get(0).split(":"); DataStoreServerAddress dataStoreServerAddress = new DataStoreServerAddress(split[0], Integer.parseInt(split[1]));
long variableSetId; if (StringUtils.isNumeric(variableStr) && Long.parseLong(variableStr) > configuration.getCatalog().getOffset()) { variableSetId = Long.parseLong(variableStr); Query query = new Query(StudyDBAdaptor.QueryParams.VARIABLE_SET_UID.key(), variableSetId);
configuration.getCatalog().getDatabase().getHosts().get(0).split(":")[0], 27017); .add("username", configuration.getCatalog().getDatabase().getUser()) .add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build();