List of usage examples for org.apache.commons.configuration PropertiesConfiguration save
public void save() throws ConfigurationException
From source file:cross.Factory.java
/** * Write current configuration to file.// w w w .ja v a2s .c o m * * @param filename the filename to use * @param d the date stamp to use */ @Override public void dumpConfig(final String filename, final Date d) { //retrieve global, joint configuration final Configuration cfg = getConfiguration(); //retrieve pipeline.properties location String configFile = cfg.getString("pipeline.properties"); if (configFile != null) { final File pipelinePropertiesFile = new File(configFile); //resolve and retrieve pipeline.xml location final File pipelineXml; try { File configBasedir = pipelinePropertiesFile.getParentFile(); String pipelineLocation = cfg.getString("pipeline.xml").replace("config.basedir", configBasedir.getAbsolutePath()); pipelineLocation = pipelineLocation.substring("file:".length()); pipelineXml = new File(pipelineLocation); //setup output location final File location = new File(FileTools.prependDefaultDirsWithPrefix("", Factory.class, d), filename); //location for pipeline.properties dump final File pipelinePropertiesFileDump = new File(location.getParentFile(), pipelinePropertiesFile.getName()); PropertiesConfiguration pipelineProperties = new PropertiesConfiguration(pipelinePropertiesFile); PropertiesConfiguration newPipelineProperties = new PropertiesConfiguration( pipelinePropertiesFileDump); //copy configuration to dump configuration newPipelineProperties.copy(pipelineProperties); //correct pipeline.xml location newPipelineProperties.setProperty("pipeline.xml", "file:${config.basedir}/" + pipelineXml.getName()); newPipelineProperties.save(); //copy pipeline.xml to dump location FileUtils.copyFile(pipelineXml, new File(location.getParentFile(), pipelineXml.getName())); if (cfg.containsKey("configLocation")) { File configLocation = new File(URI.create(cfg.getString("configLocation"))); File configLocationNew = new File(location.getParentFile(), configLocation.getName()); FileUtils.copyFile(configLocation, configLocationNew); } LoggerFactory.getLogger(Factory.class).error("Saving configuration to: "); LoggerFactory.getLogger(Factory.class).error("{}", location.getAbsolutePath()); saveConfiguration(cfg, location); } catch (IOException | ConfigurationException ex) { LoggerFactory.getLogger(Factory.class).error("{}", ex); // } catch (URISyntaxException ex) { // Factory.getInstance().log.error("{}", ex); } } else { LoggerFactory.getLogger(Factory.class) .warn("Can not save configuration, no pipeline properties file given!"); } }
From source file:fr.inria.atlanmod.neoemf.data.blueprints.BlueprintsPersistenceBackendFactory.java
@Override public BlueprintsPersistenceBackend createPersistentBackend(File file, Map<?, ?> options) throws InvalidDataStoreException { BlueprintsPersistenceBackend backend; PropertiesConfiguration configuration = null; try {//from ww w .j a v a2s .co m configuration = getOrCreateBlueprintsConfiguration(file, options); try { Graph baseGraph = GraphFactory.open(configuration); if (baseGraph instanceof KeyIndexableGraph) { backend = new BlueprintsPersistenceBackend((KeyIndexableGraph) baseGraph); } else { NeoLogger.error("Graph type {0} does not support Key Indices", file.getAbsolutePath()); throw new InvalidDataStoreException( "Graph type " + file.getAbsolutePath() + " does not support Key Indices"); } } catch (RuntimeException e) { throw new InvalidDataStoreException(e); } } finally { if (nonNull(configuration)) { try { configuration.save(); } catch (ConfigurationException e) { /* * Unable to save configuration. * Supposedly it's a minor error, so we log it without rising an exception. */ NeoLogger.warn(e); } } } processGlobalConfiguration(file); return backend; }
From source file:fr.insalyon.creatis.vip.vipcoworkapplet.Cowork.java
/** Initializes the applet Main */ @Override/*from ww w .j a v a 2s . c o m*/ public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the applet */ try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { try { sessionId = getParameter("sessionId"); email = getParameter("email"); endpoint = getCodeBase().toString() + "/fr.insalyon.creatis.vip.portal.Main/coworkservice"; DesignFrame frame = new DesignFrame(true); frame.setAppletParams(endpoint, email, sessionId); String home = System.getProperty("user.home"); File config = new File(home + File.separator + ".cowork/config"); PropertiesConfiguration pc = new PropertiesConfiguration(config); String password = (String) pc.getProperty("password"), login = (String) pc.getProperty("login"); PasswordDialog p = new PasswordDialog(null, "Please login to the knowledge base"); while (password == null || login == null) { if (p.showDialog()) { login = p.getName(); password = p.getPass(); } if (login != null && password != null) { if (JOptionPane.showConfirmDialog(null, "Remember credentials (unencrypted)?", "Rememeber?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { pc.setProperty("password", password); pc.setProperty("login", login); pc.save(); } } } KnowledgeBase kb = new KnowledgeBase("jdbc:mysql://" + getCodeBase().getHost() + "/cowork", login, password, "http://cowork.i3s.cnrs.fr/"); frame.setKB(kb); frame.setVisible(true); } catch (ConfigurationException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } } }); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } }
From source file:com.manydesigns.portofino.actions.admin.mail.MailSettingsAction.java
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY) public Resolution update() { setupFormAndBean();/*w ww. java 2s . c o m*/ form.readFromRequest(context.getRequest()); if (form.validate()) { logger.debug("Applying settings to app configuration"); try { // mail configuration = portofino configuration + mail.properties defaults // CompositeConfiguration compositeConfiguration = (CompositeConfiguration) portofinoConfiguration; // FileConfiguration fileConfiguration = (FileConfiguration) compositeConfiguration.getConfiguration(0); // SUPERPAN ADD PropertiesConfiguration fileConfiguration = (PropertiesConfiguration) portofinoConfiguration; MailSettingsForm bean = new MailSettingsForm(); form.writeToObject(bean); fileConfiguration.setProperty(MailProperties.MAIL_ENABLED, bean.mailEnabled); fileConfiguration.setProperty(MailProperties.MAIL_KEEP_SENT, bean.keepSent); fileConfiguration.setProperty(MailProperties.MAIL_QUEUE_LOCATION, bean.queueLocation); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_HOST, bean.smtpHost); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_PORT, bean.smtpPort); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_SSL_ENABLED, bean.smtpSSL); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_TLS_ENABLED, bean.smtpTLS); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_LOGIN, bean.smtpLogin); fileConfiguration.setProperty(MailProperties.MAIL_SMTP_PASSWORD, bean.smtpPassword); fileConfiguration.save(); logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath()); } catch (Exception e) { logger.error("Configuration not saved", e); SessionMessages .addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved")); return new ForwardResolution("/m/mail/admin/settings.jsp"); } SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully")); return new RedirectResolution(this.getClass()); } else { return new ForwardResolution("/m/mail/admin/settings.jsp"); } }
From source file:com.mirth.connect.server.migration.Migrate3_1_0.java
private void migrateLog4jProperties() { PropertiesConfiguration log4jproperties = new PropertiesConfiguration(); log4jproperties.setDelimiterParsingDisabled(true); log4jproperties.setFile(new File(ClassPathResource.getResourceURI("log4j.properties"))); try {/*from w w w.ja v a 2 s . co m*/ log4jproperties.load(); String level = (String) log4jproperties.getProperty("log4j.logger.shutdown"); if (level != null) { log4jproperties.setProperty("log4j.logger.undeploy", level); log4jproperties.clearProperty("log4j.logger.shutdown"); Logger.getLogger("undeploy").setLevel(Level.toLevel(level)); } level = (String) log4jproperties .getProperty("log4j.logger.com.mirth.connect.donkey.server.channel.RecoveryTask"); if (StringUtils.isBlank(level)) { level = "INFO"; log4jproperties.setProperty("log4j.logger.com.mirth.connect.donkey.server.channel.RecoveryTask", level); Logger.getLogger("com.mirth.connect.donkey.server.channel.RecoveryTask") .setLevel(Level.toLevel(level)); } log4jproperties.save(); } catch (ConfigurationException e) { logger.error("Failed to migrate log4j properties."); } }
From source file:com.ibm.replication.iidr.metadata.Settings.java
/** * Retrieve the settings from the given properties file. * /*from ww w . jav a 2 s . c om*/ * @param propertiesFile * @throws ConfigurationException */ public Settings(String propertiesFile) throws ConfigurationException { PropertiesConfiguration config = new PropertiesConfiguration(propertiesFile); asHostName = config.getString("asHostName"); asUserName = config.getString("asUserName"); String encryptedAsPassword = config.getString("asPassword"); asPort = config.getInt("asPort", 10101); isHostName = config.getString("isHostName"); isUserName = config.getString("isUserName"); String encryptedISPassword = config.getString("isPassword"); isPort = config.getInt("isPort", 10101); bundleFilePath = config.getString("bundleFilePath"); defaultDataPath = config.getString("defaultDataPath"); trustSelfSignedCertificates = config.getBoolean("trustSelfSignedCertificates"); // Check if the password has already been encrypted // If not, encrypt and save the properties try { asPassword = Encryptor.decodeAndDecrypt(encryptedAsPassword); } catch (EncryptedDataException e) { logger.debug("Encrypting asPassword"); asPassword = encryptedAsPassword; encryptedAsPassword = Encryptor.encryptAndEncode(encryptedAsPassword); config.setProperty("asPassword", encryptedAsPassword); config.save(); } try { isPassword = Encryptor.decodeAndDecrypt(encryptedISPassword); } catch (EncryptedDataException e) { logger.debug("Encrypting isPassword"); isPassword = encryptedISPassword; encryptedISPassword = Encryptor.encryptAndEncode(encryptedISPassword); config.setProperty("isPassword", encryptedISPassword); config.save(); } // Now log the settings logSettings(config); }
From source file:com.ibm.replication.iidr.utils.Settings.java
/** * Load the properties/*from ww w.j av a 2 s . c om*/ */ private void loadProperties(String propertiesFile) throws ConfigurationException { PropertiesConfiguration config = new PropertiesConfiguration( System.getProperty("user.dir") + File.separatorChar + "conf" + File.separator + propertiesFile); checkFrequencySeconds = config.getInt("checkFrequencySeconds", checkFrequencySeconds); connectionResetFrequencyMin = config.getInt("connectionResetFrequencyMin", connectionResetFrequencyMin); logMetricsToDB = config.getBoolean("logMetricsToDB", logMetricsToDB); logSubscriptionStatusToDB = config.getBoolean("logSubscriptionStatusToDB", logSubscriptionStatusToDB); logEventsToDB = config.getBoolean("logEventsToDB", logEventsToDB); logMetricsToCsv = config.getBoolean("logMetricsToCsv", logMetricsToCsv); logSubscriptionStatusToCsv = config.getBoolean("logSubscriptionStatusToCsv", logSubscriptionStatusToCsv); logEventsToCsv = config.getBoolean("logEventsToCsv", logEventsToCsv); // Number of events to retrieve numberOfEvents = config.getInt("numberOfEvents", numberOfEvents); // Access Server settings asHostName = config.getString("asHostName"); asUserName = config.getString("asUserName"); String encryptedAsPassword = config.getString("asPassword"); asPort = config.getInt("asPort", 10101); // Check if the password has already been encrypted // If not, encrypt and save the properties try { asPassword = Encryptor.decodeAndDecrypt(encryptedAsPassword); } catch (EncryptedDataException e) { logger.debug("Encrypting asPassword"); asPassword = encryptedAsPassword; encryptedAsPassword = Encryptor.encryptAndEncode(encryptedAsPassword); config.setProperty("asPassword", encryptedAsPassword); config.save(); } // Metrics to include // if (includeMetrics.isEmpty()) // includeMetricsList = new ArrayList<String>(); // else includeMetricsList = new ArrayList<String>(Arrays.asList(config.getStringArray("includeMetrics"))); includeMetricsList.removeAll(Arrays.asList("")); // Metrics to exclude excludeMetricsList = new ArrayList<String>(Arrays.asList(config.getStringArray("excludeMetrics"))); excludeMetricsList.removeAll(Arrays.asList("")); // Database connection settings dbHostName = config.getString("dbHostName"); dbPort = config.getInt("dbPort"); dbDatabase = config.getString("dbDatabase"); dbUserName = config.getString("dbUserName"); String encryptedDbPassword = config.getString("dbPassword"); dbDriverName = config.getString("dbDriverName"); dbUrl = config.getString("dbUrl"); dbSchema = config.getString("dbSchema"); try { dbPassword = Encryptor.decodeAndDecrypt(encryptedDbPassword); } catch (EncryptedDataException e) { logger.debug("Encrypting dbPassword"); dbPassword = encryptedDbPassword; encryptedDbPassword = Encryptor.encryptAndEncode(encryptedDbPassword); config.setProperty("dbPassword", encryptedDbPassword); config.save(); } // CSV logging settings csvSeparator = config.getString("csvSeparator", csvSeparator); // Now report the settings logSettings(config); }
From source file:eu.tango.energymodeller.EnergyModeller.java
/** * This is common code for the constructors *///from w w w. jav a 2s .c o m private void startup(boolean performDataGathering) { try { if (datasource == null) { PropertiesConfiguration config; if (new File(CONFIG_FILE).exists()) { config = new PropertiesConfiguration(CONFIG_FILE); } else { config = new PropertiesConfiguration(); config.setFile(new File(CONFIG_FILE)); } config.setAutoSave(true); //This will save the configuration file back to disk. In case the defaults need setting. String datasourceStr = config.getString("energy.modeller.datasource", "SlurmDataSourceAdaptor"); setDataSource(datasourceStr); config.setProperty("energy.modeller.datasource", datasourceStr); String predictorStr = config.getString("energy.modeller.predictor", "CpuAndAcceleratorEnergyPredictor"); setEnergyPredictor(predictorStr); config.setProperty("energy.modeller.predictor", predictorStr); if (!new File(CONFIG_FILE).exists()) { config.save(); } } } catch (ConfigurationException ex) { Logger.getLogger(EnergyModeller.class.getName()).log(Level.INFO, "Error loading the configuration of the energy modeller", ex); } dataGatherer = new DataGatherer(datasource, database); dataGatherer.setPerformDataGathering(performDataGathering); try { dataGatherThread = new Thread(dataGatherer); dataGatherThread.setDaemon(true); dataGatherThread.start(); } catch (Exception ex) { Logger.getLogger(EnergyModeller.class.getName()).log(Level.SEVERE, "The energry modeller failed to start correctly", ex); } }
From source file:com.mirth.connect.server.controllers.DefaultConfigurationController.java
private void initialize() { try {/*from w ww.j a v a 2s.c o m*/ // Disable delimiter parsing so getString() returns the whole // property, even if there are commas mirthConfig.setDelimiterParsingDisabled(true); mirthConfig.setFile(new File(ClassPathResource.getResourceURI("mirth.properties"))); mirthConfig.load(); MigrationController.getInstance().migrateConfiguration(mirthConfig); // load the server version versionConfig.setDelimiterParsingDisabled(true); InputStream versionPropertiesStream = ResourceUtil.getResourceStream(this.getClass(), "version.properties"); versionConfig.load(versionPropertiesStream); IOUtils.closeQuietly(versionPropertiesStream); if (mirthConfig.getString(PROPERTY_TEMP_DIR) != null) { File tempDataDirFile = new File(mirthConfig.getString(PROPERTY_TEMP_DIR)); if (!tempDataDirFile.exists()) { if (tempDataDirFile.mkdirs()) { logger.debug("created tempdir: " + tempDataDirFile.getAbsolutePath()); } else { logger.error("error creating tempdir: " + tempDataDirFile.getAbsolutePath()); } } System.setProperty("java.io.tmpdir", tempDataDirFile.getAbsolutePath()); logger.debug("set temp data dir: " + tempDataDirFile.getAbsolutePath()); } File appDataDirFile = null; if (mirthConfig.getString(PROPERTY_APP_DATA_DIR) != null) { appDataDirFile = new File(mirthConfig.getString(PROPERTY_APP_DATA_DIR)); if (!appDataDirFile.exists()) { if (appDataDirFile.mkdir()) { logger.debug("created app data dir: " + appDataDirFile.getAbsolutePath()); } else { logger.error("error creating app data dir: " + appDataDirFile.getAbsolutePath()); } } } else { appDataDirFile = new File("."); } appDataDir = appDataDirFile.getAbsolutePath(); logger.debug("set app data dir: " + appDataDir); baseDir = new File(ClassPathResource.getResourceURI("mirth.properties")).getParentFile().getParent(); logger.debug("set base dir: " + baseDir); if (mirthConfig.getString(CHARSET) != null) { System.setProperty(CHARSET, mirthConfig.getString(CHARSET)); } String[] httpsClientProtocolsArray = mirthConfig.getStringArray(HTTPS_CLIENT_PROTOCOLS); if (ArrayUtils.isNotEmpty(httpsClientProtocolsArray)) { // Support both comma separated and multiline values List<String> httpsClientProtocolsList = new ArrayList<String>(); for (String protocol : httpsClientProtocolsArray) { httpsClientProtocolsList.addAll(Arrays.asList(StringUtils.split(protocol, ','))); } httpsClientProtocols = httpsClientProtocolsList .toArray(new String[httpsClientProtocolsList.size()]); } else { httpsClientProtocols = MirthSSLUtil.DEFAULT_HTTPS_CLIENT_PROTOCOLS; } String[] httpsServerProtocolsArray = mirthConfig.getStringArray(HTTPS_SERVER_PROTOCOLS); if (ArrayUtils.isNotEmpty(httpsServerProtocolsArray)) { // Support both comma separated and multiline values List<String> httpsServerProtocolsList = new ArrayList<String>(); for (String protocol : httpsServerProtocolsArray) { httpsServerProtocolsList.addAll(Arrays.asList(StringUtils.split(protocol, ','))); } httpsServerProtocols = httpsServerProtocolsList .toArray(new String[httpsServerProtocolsList.size()]); } else { httpsServerProtocols = MirthSSLUtil.DEFAULT_HTTPS_SERVER_PROTOCOLS; } String[] httpsCipherSuitesArray = mirthConfig.getStringArray(HTTPS_CIPHER_SUITES); if (ArrayUtils.isNotEmpty(httpsCipherSuitesArray)) { // Support both comma separated and multiline values List<String> httpsCipherSuitesList = new ArrayList<String>(); for (String cipherSuite : httpsCipherSuitesArray) { httpsCipherSuitesList.addAll(Arrays.asList(StringUtils.split(cipherSuite, ','))); } httpsCipherSuites = httpsCipherSuitesList.toArray(new String[httpsCipherSuitesList.size()]); } else { httpsCipherSuites = MirthSSLUtil.DEFAULT_HTTPS_CIPHER_SUITES; } String deploy = String.valueOf(mirthConfig.getProperty(STARTUP_DEPLOY)); if (StringUtils.isNotBlank(deploy)) { startupDeploy = Boolean.parseBoolean(deploy); } // Check for server GUID and generate a new one if it doesn't exist PropertiesConfiguration serverIdConfig = new PropertiesConfiguration( new File(getApplicationDataDir(), "server.id")); if ((serverIdConfig.getString("server.id") != null) && (serverIdConfig.getString("server.id").length() > 0)) { serverId = serverIdConfig.getString("server.id"); } else { serverId = generateGuid(); logger.debug("generated new server id: " + serverId); serverIdConfig.setProperty("server.id", serverId); serverIdConfig.save(); } passwordRequirements = PasswordRequirementsChecker.getInstance().loadPasswordRequirements(mirthConfig); apiBypassword = mirthConfig.getString(API_BYPASSWORD); if (StringUtils.isNotBlank(apiBypassword)) { apiBypassword = new String(Base64.decodeBase64(apiBypassword), "US-ASCII"); } statsUpdateInterval = NumberUtils.toInt(mirthConfig.getString(STATS_UPDATE_INTERVAL), DonkeyStatisticsUpdater.DEFAULT_UPDATE_INTERVAL); // Check for configuration map properties if (mirthConfig.getString(CONFIGURATION_MAP_PATH) != null) { configurationFile = mirthConfig.getString(CONFIGURATION_MAP_PATH); } else { configurationFile = getApplicationDataDir() + File.separator + "configuration.properties"; } PropertiesConfiguration configurationMapProperties = new PropertiesConfiguration(); configurationMapProperties.setDelimiterParsingDisabled(true); configurationMapProperties.setListDelimiter((char) 0); try { configurationMapProperties.load(new File(configurationFile)); } catch (ConfigurationException e) { logger.warn("Failed to find configuration map file"); } Map<String, ConfigurationProperty> configurationMap = new HashMap<String, ConfigurationProperty>(); Iterator<String> iterator = configurationMapProperties.getKeys(); while (iterator.hasNext()) { String key = iterator.next(); String value = configurationMapProperties.getString(key); String comment = configurationMapProperties.getLayout().getCanonicalComment(key, false); configurationMap.put(key, new ConfigurationProperty(value, comment)); } setConfigurationProperties(configurationMap, false); } catch (Exception e) { logger.error("Failed to initialize configuration controller", e); } }
From source file:fr.inria.corese.rdftograph.driver.TitanDriver.java
@Override public Graph createDatabase(String dbPathTemp) throws IOException { File f = new File(dbPathTemp); dbPath = f.getAbsolutePath();//w w w.ja v a 2 s . co m super.createDatabase(dbPath); PropertiesConfiguration configuration = null; File confFile = new File(dbPath + "/conf.properties"); try { configuration = new PropertiesConfiguration(confFile); } catch (ConfigurationException ex) { Logger.getLogger(TitanDriver.class.getName()).log(Level.SEVERE, null, ex); } configuration.setProperty("schema.default", "none"); configuration.setProperty("storage.batch-loading", true); // configuration.setProperty("storage.batch-loading", false); configuration.setProperty("storage.backend", "berkeleyje"); configuration.setProperty("storage.directory", dbPath + "/db"); configuration.setProperty("storage.buffer-size", 50_000); // configuration.setProperty("storage.berkeleyje.cache-percentage", 50); // configuration.setProperty("storage.read-only", true); configuration.setProperty("index.search.backend", "elasticsearch"); configuration.setProperty("index.search.directory", dbPath + "/es"); configuration.setProperty("index.search.elasticsearch.client-only", false); configuration.setProperty("index.search.elasticsearch.local-mode", true); configuration.setProperty("index.search.refresh_interval", 600); configuration.setProperty("ids.block-size", 50_000); configuration.setProperty("cache.db-cache", true); configuration.setProperty("cache.db-cache-size", 250_000_000); configuration.setProperty("cache.db-cache-time", 0); // configuration.setProperty("cache.tx-dirty-size", 100_000); // to make queries faster configuration.setProperty("query.batch", true); configuration.setProperty("query.fast-property", true); configuration.setProperty("query.force-index", false); configuration.setProperty("query.ignore-unknown-index-key", true); try { configuration.save(); } catch (ConfigurationException ex) { Logger.getLogger(TitanDriver.class.getName()).log(Level.SEVERE, null, ex); } g = TitanFactory.open(configuration); TitanManagement mgmt = getTitanGraph().openManagement(); if (!mgmt.containsVertexLabel(RDF_VERTEX_LABEL)) { mgmt.makeVertexLabel(RDF_VERTEX_LABEL).make(); } if (!mgmt.containsEdgeLabel(RDF_EDGE_LABEL)) { mgmt.makeEdgeLabel(RDF_EDGE_LABEL).multiplicity(Multiplicity.MULTI).make(); } mgmt.commit(); makeIfNotExistProperty(EDGE_P); makeIfNotExistProperty(VERTEX_VALUE); makeIfNotExistProperty(VERTEX_LARGE_VALUE); makeIfNotExistProperty(EDGE_G); makeIfNotExistProperty(EDGE_S); makeIfNotExistProperty(EDGE_O); makeIfNotExistProperty(KIND); makeIfNotExistProperty(TYPE); makeIfNotExistProperty(LANG); createIndexes(); return g; }