private static DataSource getDataSource(CommandLine cmd) throws ContentStoreException { String host = cmd.getOptionValue("host"); String port = "443"; if (cmd.hasOption("port")) { port = cmd.getOptionValue("port"); } String username = cmd.getOptionValue("username"); String password = cmd.getOptionValue("password"); ContentStoreManager mgr = new ContentStoreManagerImpl(host, port); mgr.login(getCredentials(username, password)); ContentStore contentStore; if (cmd.hasOption("store-id")) { contentStore = mgr.getContentStore(cmd.getOptionValue("store-id")); } else { contentStore = mgr.getPrimaryContentStore(); } return new DuraStoreDataSource(contentStore); }
String storeId) { ContentStoreManager storeManager = new ContentStoreManagerImpl(host, String.valueOf(port), context); storeManager.login(new Credential(username, password));
String host = vals[0]; String port = vals[1]; ContentStoreManager mgr = new ContentStoreManagerImpl(host, port);
if (dataset.getLockFor(Reason.pidRegister) == null) { ContentStoreManager storeManager = new ContentStoreManagerImpl(host, port, dpnContext); Credential credential = new Credential(System.getProperty("duracloud.username"), System.getProperty("duracloud.password"));
protected ContentStore getContentStore() { ContentStoreManager storeManager = new ContentStoreManagerImpl(syncOptConfig.getHost(), String.valueOf(syncOptConfig.getPort()), syncOptConfig.getContext()); Credential credential = new Credential(syncOptConfig.getUsername(), syncOptConfig.getPassword()); storeManager.login(credential); try { return storeManager.getPrimaryContentStore(); } catch (ContentStoreException e) { throw new RuntimeException("Unable to create ContentStore due to" + e.getMessage()); } }