use of org.apache.commons.collections.ExtendedProperties in project backstage by zepheira.
the class BackstageModule method createRepository.
public Repository createRepository(HttpServletRequest request, String repoType, String slug) throws Exception {
ExtendedProperties properties = getProperties();
String dbDir = properties.getString("backstage.databaseDir", "databases");
SailRepository repository = null;
File thisDbDir = new File(new File(dbDir, repoType), slug);
if (repoType.equals(REPOTYPE_MEM)) {
DataLoadingUtilities.RepoSailTuple rs = DataLoadingUtilities.createMemoryRepository(thisDbDir);
repository = (SailRepository) rs.repository;
rs = null;
} else if (repoType.equals(REPOTYPE_DISK)) {
DataLoadingUtilities.RepoSailTuple rs = DataLoadingUtilities.createNativeRepository(thisDbDir);
repository = (SailRepository) rs.repository;
rs = null;
} else {
return null;
}
String lang = DataLoadingUtilities.contentTypeToLang(request.getContentType());
if (lang == null) {
throw new Exception("Unsupported content type");
}
DataLoadingUtilities.loadDataFromStream((InputStream) request.getInputStream(), request.getRequestURL().toString(), lang, repository.getSail());
return repository;
}
use of org.apache.commons.collections.ExtendedProperties in project intellij-community by JetBrains.
the class VelocityHelper method getEngine.
private static synchronized VelocityEngine getEngine() {
if (instance == null) {
try {
VelocityEngine engine = new VelocityEngine();
ExtendedProperties extendedProperties = new ExtendedProperties();
extendedProperties.addProperty(RuntimeConstants.RESOURCE_LOADER, "file");
extendedProperties.addProperty(RuntimeConstants.PARSER_POOL_SIZE, "1");
extendedProperties.addProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
extendedProperties.addProperty("file.resource.loader.path", PathManager.getPluginsPath() + "/Copyright/resources");
extendedProperties.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName());
extendedProperties.addProperty("runtime.log.logsystem.log4j.category", CopyrightManager.class.getName());
engine.setExtendedProperties(extendedProperties);
engine.init();
instance = engine;
} catch (Exception ignored) {
}
}
return instance;
}
use of org.apache.commons.collections.ExtendedProperties in project backstage by zepheira.
the class BackstageModule method getStandaloneDatabase.
public Database getStandaloneDatabase() {
if (s_standaloneDatabase == null) {
ExtendedProperties properties = getProperties();
String databaseString = properties.getString("backstage.hostedData.database");
File database = (databaseString == null || databaseString.length() == 0) ? new File("database") : new File(databaseString);
s_standaloneDatabase = new StandaloneDiskHostedDatabase(database);
}
return s_standaloneDatabase;
}
use of org.apache.commons.collections.ExtendedProperties in project intellij-community by JetBrains.
the class VelocityFactory method newVeloictyEngine.
/**
* Returns a new instance of the VelocityEngine.
* <p/>
* The engine is initialized and outputs its logging to IDEA logging.
*
* @return a new velocity engine that is initialized.
*/
private static VelocityEngine newVeloictyEngine() {
ExtendedProperties prop = new ExtendedProperties();
prop.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName());
prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString");
prop.addProperty(RuntimeConstants.RESOURCE_LOADER, "includes");
prop.addProperty("includes.resource.loader.class", VelocityIncludesClassLoader.class.getName());
VelocityEngine velocity = new VelocityEngine();
velocity.setExtendedProperties(prop);
velocity.init();
return velocity;
}
Aggregations