private File getRulesConfigFile(String packageType) throws IOException { JsonSimpleConfig config = new JsonSimpleConfig(); String harvestPath = "harvest/workflows/"; String rulesConfig = config.getString(null, "portal", "packageTypes", packageType, "jsonconfig"); if ("mint".equals(config.getString(null, "system"))) { harvestPath = "harvest/"; rulesConfig = packageType + ".json"; } return FascinatorHome.getPathFile(harvestPath + rulesConfig); }
public MagicMimeTypeIdentifierWrapper() { super(); try { JsonSimpleConfig config = new JsonSimpleConfig(); mimeTypes = new JsonSimple(config.getObject("mime-types")); identifier = new MagicMimeTypeIdentifier(); } catch (IOException e) { log.warn("Failed to load custom MIME types"); } }
name = config.getString(null, "config", "name"); if (name == null) { throw new Exception("Name name provided in queue configuration"); globalConfig = new JsonSimpleConfig(); autoCommit = globalConfig.getBoolean(true, "indexer", "solr", "autocommit"); bufferSize = 0; bufferOldest = 0; bufferDocLimit = globalConfig.getInteger(BUFFER_LIMIT_DOCS, "indexer", "buffer", "docLimit"); bufferSizeLimit = globalConfig.getInteger(BUFFER_LIMIT_SIZE, "indexer", "buffer", "sizeLimit"); bufferTimeLimit = globalConfig.getInteger(BUFFER_LIMIT_TIME, "indexer", "buffer", "timeLimit");
/** * Creates JSON Configuration object from the system config file * * @throws IOException if there was an error during creation */ public JsonSimpleConfig() throws IOException { super(JsonSimpleConfig.getSystemFile()); systemConfig = new JsonSimple(JsonSimpleConfig.getSystemFile()); loadIncludeDir(); }
/** * IndexClient Constructor * * @throws IOException If initialisation fail */ public IndexClient() throws IOException { config = new JsonSimpleConfig(); configFile = JsonSimpleConfig.getSystemFile(); setSetting(); }
fedoraUrl = config.getString(null, "subscriber", "vital", "server", "url"); fedoraNamespace = config.getString(null, "subscriber", "vital", "server", "namespace"); fedoraUsername = config.getString(null, "subscriber", "vital", "server", "username"); fedoraPassword = config.getString(null, "subscriber", "vital", "server", "password"); fedoraTimeout = config.getInteger(15, "subscriber", "vital", "server", "timeout"); if (fedoraUrl == null || fedoraNamespace == null || fedoraMessageTemplate = config.getString(DEFAULT_VITAL_MESSAGE, "subscriber", "vital", "server", "message"); String tempPath = config.getString(System.getProperty("java.io.tmpdir"), "subscriber", "vital", "tempDir"); if (tempPath != null) { pids = config.getJsonSimpleMap("subscriber", "vital", "dataStreams"); if (pids == null || pids.isEmpty()) { throw new SubscriberException("VITAL Subscriber:" + config.getObject("subscriber", "vital", "attachments")); attachDs = attachmentsConfig.getString("ATTACHMENT%02d", "dsID"); Pattern p = Pattern.compile("%\\d*d"); JsonSimple json; try {
JsonSimpleConfig config = new JsonSimpleConfig(text); String oid = config.getString(null, "oid"); log.info("Received job, object id='{}'", oid); boolean deleted = config.getBoolean(false, "deleted"); if (deleted) { log.info("Removing object {}...", oid);
/** * IndexClient Constructor * * @param jsonFile Configuration file * @throws IOException If initialisation fail */ public IndexClient(File jsonFile) throws IOException { config = new JsonSimpleConfig(jsonFile); configFile = jsonFile; setSetting(); }
public SpringStorageWrapper() { // initialise storage system JsonSimpleConfig systemConfiguration; try { systemConfiguration = new JsonSimpleConfig(); } catch (IOException e) { throw new RuntimeException(e); } String storageType = systemConfiguration.getString( DEFAULT_STORAGE_TYPE, "storage", "type"); storagePlugin = PluginManager.getStorage(storageType); if (storagePlugin == null) { throw new RuntimeException("Storage plugin '" + storageType + "'. Ensure it is in the classpath."); } try { storagePlugin.init(systemConfiguration.toString()); log.debug("Storage service has been initialiased: {}", storagePlugin.getName()); } catch (PluginException pe) { throw new RuntimeException("Failed to initialise storage", pe); } }
/** * Initialization method * * @param config Configuration to use * @throws IOException if the configuration file not found */ @Override public void init(JsonSimpleConfig config) throws Exception { name = config.getString(null, "config", "name"); QUEUE_ID = name; thread.setName(name); try { globalConfig = new JsonSimpleConfig(); indexer = PluginManager.getIndexer( globalConfig.getString("solr", "indexer", "type")); indexer.init(JsonSimpleConfig.getSystemFile()); storage = PluginManager.getStorage( globalConfig.getString("file-system", "storage", "type")); storage.init(JsonSimpleConfig.getSystemFile()); } catch (IOException ioe) { log.error("Failed to read configuration: {}", ioe.getMessage()); throw ioe; } catch (PluginException pe) { log.error("Failed to initialise plugin: {}", pe.getMessage()); throw pe; } }
@Override protected String getSystemPortal() { return systemConfig.getString(DEFAULT_PORTAL, "transformerDefaults", "jsonVelocityPDF", "portalId"); }
loaded = true; String storageType = config.getString(null, "storage", "type"); try { storage = PluginManager.getStorage(storageType); storage.init(config.toString()); } catch (PluginException pe) { throw new IndexerException(pe); JsonObject indexerConfig = config.getObject("indexer"); anotarAutoCommit = config.getBoolean(true, "indexer", "anotar", "autocommit"); propertiesId = config.getString(DEFAULT_METADATA_PAYLOAD, "indexer", "propertiesId"); useCache = config.getBoolean(true, "indexer", "useCache");
public void init(JsonSimpleConfig config) throws Exception { try { name = config.getString(null, "config", "name"); QUEUE_ID = name; thread.setName(name); globalConfig = new JsonSimpleConfig(); File sysFile = JsonSimpleConfig.getSystemFile(); indexer = PluginManager.getIndexer( globalConfig.getString("solr", "indexer", "type")); indexer.init(sysFile); storage = PluginManager.getStorage( globalConfig.getString("file-system", "storage", "type")); storage.init(sysFile); String userQueue = config.getString(null, "config", "user-renderer"); rendererNames.put(ConveyerBelt.CRITICAL_USER_SELECTOR, userQueue); JsonObject map = config.getObject("config", "normal-renderers"); for (Object selector : map.keySet()) { rendererNames.put(selector.toString(),
systemConfig = new JsonSimpleConfig(); String storageType = systemConfig.getString(null, "storage", "type"); if (storageType == null) { log.error("No storage configured!"); storage.init(systemConfig.toString()); log.info("Storage Plugin '{}' instantiated", storage.getName()); } catch (PluginException ex) { harvestRemap = systemConfig.getBoolean(false, "restoreTool", "harvestRemap", "enabled"); oldHarvestFiles = systemConfig.getBoolean(false, "restoreTool", "harvestRemap", "allowOlder"); failOnMissing = systemConfig.getBoolean(true, "restoreTool", "harvestRemap", "failOnMissing"); harvestUpdates = new HashMap<String, String>(); String scriptString = systemConfig.getString(null, "restoreTool", "migrationScript"); init(scriptString, harvestRemap, oldHarvestFiles, failOnMissing,
name = config.getString(null, "config", "name"); QUEUE_ID = name; thread.setName(name); globalConfig = new JsonSimpleConfig(); File sysFile = JsonSimpleConfig.getSystemFile(); List<String> subscribers = config.getStringList("config", "subscribers"); if (subscribers != null && !subscribers.isEmpty()) {
String url = getJsonConfig().getString(null, "harvester", "oai-pmh", "url"); if (url == null) { recordID = getJsonConfig().getString(null, "harvester", "oai-pmh", "recordID"); maxRequests = getJsonConfig().getInteger(-1, "harvester", "oai-pmh", "maxRequests"); if (maxRequests == -1) { maxRequests = Integer.MAX_VALUE; maxObjects = getJsonConfig().getInteger(-1, "harvester", "oai-pmh", "maxObjects"); if (maxObjects == -1) { dateFrom = validDate(getJsonConfig().getString(null, "harvester", "oai-pmh", "from")); dateUntil = validDate(getJsonConfig().getString(null, "harvester", "oai-pmh", "until")); if (dateFrom == null) { JsonObject configNode = getJsonConfig().getObject( "harvester", "oai-pmh"); metadataPrefixes = JsonSimple.getStringList(configNode, setSpec = getJsonConfig().getString(null, "harvester", "oai-pmh", "setSpec"); useSetInStorage = getJsonConfig().getBoolean(false,
name = config.getString(null, "config", "name"); QUEUE_ID = name; thread.setName(name); globalConfig = new JsonSimpleConfig(); sysFile = JsonSimpleConfig.getSystemFile(); String indexerId = globalConfig.getString( "solr", "indexer", "type"); if (indexerId == null) { String storageId = globalConfig.getString( "file-system", "storage", "type"); if (storageId == null) { Map<String, JsonSimple> map = globalConfig.getJsonSimpleMap( "transformerDefaults"); if (map != null && map.size() > 0) { String managerId = config.getString(null, "config", "transactionManagerPlugin"); if (managerId == null) {
public void run() { try { globalConfig = new JsonSimpleConfig(); boolean enabled = globalConfig.getBoolean(true, "messaging", "statistics", "enabled"); if (!enabled) { return; statsQueueName = globalConfig.getString(DEFAULT_STATS_QUEUE, "messaging", "statistics", "destination"); if (statsQueueName == null || statsQueueName.isEmpty()) { String brokerUrl = globalConfig.getString( ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL, "messaging", "url"); List<JsonSimple> qConfig = globalConfig.getJsonSimpleList( "messaging", "threads"); for (JsonSimple q : qConfig) {
@SuppressWarnings("unchecked") @ApiOperation(value = "get information about the ReDBox instance", tags = "info") @ApiResponses({ @ApiResponse(code = 200, message = "The datastreams are listed"), @ApiResponse(code = 500, message = "Server configuration not found", response = IOException.class) }) @Get("json") public String getServerInformation() throws IOException{ JsonObject responseObject = getSuccessResponse(null); JsonSimpleConfig config = new JsonSimpleConfig(); responseObject.put("institution", config.getString(null, "identity","institution")); responseObject.put("applicationVersion", config.getString(null, "redbox.version.string")); JSONArray packageTypes = new JSONArray(); if ("mint".equals(config.getString(null, "system"))) { packageTypes.addAll(getPackageTypesFromFileSystem()); } else { JsonObject packageTypesObject = config.getObject("portal", "packageTypes"); packageTypes.addAll(packageTypesObject.keySet()); } responseObject.put("packageTypes", packageTypes); return new JsonSimple(responseObject).toString(true); }
public void setConfig(JsonSimpleConfig config) throws IOException { // Get the basics file_path = config.getString(null, "roles", "internal", "path"); loadRoles(); JSONArray roleJsonArray = (JSONArray)config.getObject("roles", "internal").get("defaultRoles"); if(roleJsonArray != null) { defaultRoles = Arrays.copyOf(roleJsonArray.toArray(), roleJsonArray.size(), String[].class); } }