本文整理汇总了Java中org.gbif.utils.file.properties.PropertiesUtil类的典型用法代码示例。如果您正苦于以下问题:Java PropertiesUtil类的具体用法?Java PropertiesUtil怎么用?Java PropertiesUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertiesUtil类属于org.gbif.utils.file.properties包,在下文中一共展示了PropertiesUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Override
protected void initialize() {
LogFactory.useSlf4jLogging();
// makes things like logo_url map to logoUrl
mapUnderscoreToCamelCase(true);
// change MyBatis environment ID or set the default one
String myBatisEnvId = properties.getProperty(MYBATIS_ENV_ID, DEFAULT_MYBATIS_ENV_ID);
environmentId(myBatisEnvId);
LOG.debug("Configuring MyBatis environmentId {}", myBatisEnvId);
// check if some MyBatis configuration are provided
Properties myBatisConfig = PropertiesUtil.removeProperties(properties, MYBATIS_CFG_PREFIX);
Names.bindProperties(binder(), myBatisConfig);
bindTransactionFactoryType(JdbcTransactionFactory.class);
bindMappers();
bindTypeHandlers();
bindManagers();
if (bindDatasource) {
bind(datasourceKey).to(DataSource.class);
bind(sessionManagerKey).to(SqlSessionManager.class);
}
}
开发者ID:gbif,项目名称:common-mybatis,代码行数:27,代码来源:MyBatisModule.java
示例2: fromProperties
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
/**
* Creates a config instance from properties looking for:
* type: {@link SolrServerType}
* home: serverHome
* collection: name of the Solr collection
* delete: boolean, deleteOnExit
* Additional property prefixes can be removed by giving an optional prefix argument.
*
* @param properties the properties to convert
* @param prefix optional property prefix to strip
*/
public static SolrConfig fromProperties(Properties properties, @Nullable String prefix) {
Properties props;
if (prefix != null) {
props = PropertiesUtil.filterProperties(properties, prefix);
} else {
props = properties;
}
SolrConfig cfg = new SolrConfig();
cfg.serverType = SolrServerType.valueOf(props.getProperty(P_TYPE, cfg.serverType.name()));
cfg.serverHome = props.getProperty(P_HOME, cfg.serverHome);
cfg.collection = props.getProperty(P_COLLECTION, cfg.collection);
cfg.idField = props.getProperty(P_ID_FIELD, cfg.idField);
cfg.deleteOnExit = Boolean.valueOf(props.getProperty(P_DELETE, String.valueOf(cfg.deleteOnExit)));
return cfg;
}
开发者ID:gbif,项目名称:common-search,代码行数:27,代码来源:SolrConfig.java
示例3: setupSolr
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
/**
* Starts up a solr server and indexes the test database.
* Wrapped in a static method so we can set the solr server in the ChecklistBankSearchWsTestListener
* which must have a default, empty constructor.
*/
public static EmbeddedSolrReference setupSolr(Properties properties) {
EmbeddedSolrReference solrRef;
// Creates the injector, merging properties taken from default test indexing and checklistbank
try {
Properties props = PropertiesUtil.loadProperties(PROPERTY_INDEXER_DEFAULT);
props.putAll(properties);
Injector injector = Guice.createInjector(new SolrIndexingTestModule(props));
// Gets the indexer instance
solrRef = injector.getInstance(EmbeddedSolrReference.class);
// build the solr index
SolrBackfill nameUsageIndexer = injector.getInstance(SolrBackfill.class);
LOG.info("Build solr index");
nameUsageIndexer.run();
return solrRef;
} catch (IOException e) {
throw new RuntimeException("Cant load properties to build solr index", e);
}
}
开发者ID:gbif,项目名称:checklistbank,代码行数:29,代码来源:ChecklistBankSearchWsTestListener.java
示例4: setUp
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
LOG.info("setting up server");
try {
server = ClbServer.buildServer(PropertiesUtil.loadProperties(WsClientSuite.PROPERTIES_FILE));
LOG.info("Starting jetty at {}", server.getURI());
server.start();
clientInjector = Guice.createInjector(
new UrlBindingModule(server.getURI(), "/"),
new ChecklistBankWsClientModule(new Properties(), true, false)
);
} catch (Exception e) {
LOG.error("Failed to start clb webservice server", e);
tearDown();
}
}
开发者ID:gbif,项目名称:checklistbank,代码行数:20,代码来源:ClbServerTest.java
示例5: setUp
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
LOG.info("setting up server");
try {
server = ClbServer.buildServer(PropertiesUtil.loadProperties(PROPERTIES_FILE));
LOG.info("Starting jetty at {}", server.getURI());
server.start();
clientInjector = Guice.createInjector(new UrlBindingModule(server.getURI(), "/"),
new ChecklistBankWsClientModule(new Properties(), true, false));
} catch (Exception e) {
LOG.error("Failed to start clb webservice server", e);
tearDown();
}
}
开发者ID:gbif,项目名称:checklistbank,代码行数:18,代码来源:WsClientSuite.java
示例6: setup
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
public void setup() throws Exception {
// run liquibase & dbSetup
LOG.info("Run liquibase & dbSetup once");
try {
rule.apply(new Statement() {
public void evaluate() throws Throwable {
// do nothing
}
}, null).evaluate();
} catch (Throwable throwable) {
Throwables.propagate(throwable);
}
// Creates the injector, merging properties taken from default test indexing and checklistbank
Properties props = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_PROPERTY_FILE);
Properties props2 = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_INDEXING_PROPERTY_TEST_FILE);
props.putAll(props2);
Injector injector = Guice.createInjector(new SolrIndexingTestModule(props));
// Gets the indexer instance
solrRef = injector.getInstance(EmbeddedSolrReference.class);
nameUsageIndexer = injector.getInstance(SolrBackfill.class);
nameUsageIndexer.run();
}
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:SolrTestSetup.java
示例7: init
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Before
public void init() throws IOException {
Properties props = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_PROPERTY_FILE);
Properties props2 = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_INDEXING_PROPERTY_TEST_FILE);
props.putAll(props2);
props.list(System.out);
Injector inj = Guice.createInjector(new SolrIndexingTestModule(props), new SearchModule(props, false));
nameUsageService = inj.getInstance(UsageService.class);
vernacularNameService = (VernacularNameServiceMyBatis) inj.getInstance(VernacularNameService.class);
descriptionService = (DescriptionServiceMyBatis) inj.getInstance(DescriptionService.class);
distributionService = (DistributionServiceMyBatis) inj.getInstance(DistributionService.class);
speciesProfileService = (SpeciesProfileServiceMyBatis) inj.getInstance(SpeciesProfileService.class);
// Get solr
solrClient = inj.getInstance(SolrClient.class);
searchService = inj.getInstance(NameUsageSearchService.class);
}
开发者ID:gbif,项目名称:checklistbank,代码行数:19,代码来源:NameUsageIndexingJobIT.java
示例8: getModules
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Override
protected List<Module> getModules(Properties properties) {
List<Module> modules = Lists.newArrayList();
ChecklistBankServiceMyBatisModule clbMod = new ChecklistBankServiceMyBatisModule(properties);
modules.add(clbMod);
toBeClosed.add(clbMod);
boolean incDeleted = PropertiesUtil.propertyAsBool(properties, INCL_DELETED, false);
UUID datasetKey = UUID.fromString(properties.getProperty(NUB_DATASET_KEY, Constants.NUB_DATASET_KEY.toString()));
NubMatchingModule nubMod = new NubMatchingModule(new File(properties.getProperty(INDEX_DIR)), incDeleted, datasetKey);
modules.add(nubMod);
toBeClosed.add(nubMod);
// use the line below to run the webservice locally with the json test index data from the nub module
// modules.add(new NubMatchingTestModule());
return modules;
}
开发者ID:gbif,项目名称:checklistbank,代码行数:18,代码来源:NubWsListener.java
示例9: HBaseSourcedBackfill
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
public HBaseSourcedBackfill(String prefix) throws IllegalArgumentException, IOException {
props = PropertiesUtil.loadProperties(APPLICATION_PROPERTIES);
Joiner j = null;
// handle complete or missing prefixes with no separator
if (prefix == null || prefix.endsWith(".")) {
j = Joiner.on("").skipNulls();
} else {
j = Joiner.on('.');
}
cubeTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_CUBE_TABLE), true, null);
snapshotTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_SNAPSHOT_TABLE), true, null);
backfillTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_BACKFILL_TABLE), true, null);
counterTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_COUNTER_TABLE), false, null); // optional
lookupTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_LOOKUP_TABLE), false, null); // optional
cf = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_CF), true, null);
sourceTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, KEY_SOURCE_TABLE), true, null);
scannerCache = PropertiesUtil.propertyAsInt(props, j.join(prefix, KEY_SCANNER_CACHE), false, HBaseSourcedBackfill.DEFAULT_SCANNER_CACHE);
numReducers = PropertiesUtil.propertyAsInt(props, j.join(prefix, KEY_NUM_REDUCERS), false, DEFAULT_NUM_REDUCERS);
writeBatchSize = PropertiesUtil.propertyAsInt(props, j.join(prefix, KEY_WRITE_BATCH_SIZE), false, DEFAULT_WRITE_BATCH_SIZE);
}
开发者ID:gbif,项目名称:metrics,代码行数:22,代码来源:HBaseSourcedBackfill.java
示例10: main
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
/**
* Executes the download creation process.
* All the arguments are required and expected in the following order:
* 0. downloadFormat: output format
* 1. solrQuery: Solr query to produce to be used to retrieve the results.
* 2. downloadKey: occurrence download identifier.
* 3. filter: filter predicate.
* 4. downloadTableName: base table/file name.
*/
public static void main(String[] args) throws Exception {
Properties settings = PropertiesUtil.loadProperties(DownloadWorkflowModule.CONF_FILE);
settings.setProperty(DownloadWorkflowModule.DynamicSettings.DOWNLOAD_FORMAT_KEY, args[0]);
WorkflowConfiguration workflowConfiguration = new WorkflowConfiguration(settings);
run(workflowConfiguration, new DownloadJobConfiguration.Builder().withSolrQuery(args[1])
.withDownloadKey(args[2])
.withFilter(args[3])
.withDownloadTableName(args[4])
.withSourceDir(workflowConfiguration.getTempDir())
.withIsSmallDownload(true)
.withDownloadFormat(workflowConfiguration.getDownloadFormat())
.withUser(args[5])
.build());
}
开发者ID:gbif,项目名称:occurrence,代码行数:25,代码来源:FromSolrDownloadAction.java
示例11: getInjector
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Override
protected Injector getInjector() {
try {
Properties props = PropertiesUtil.readFromFile(ConfUtils.getAppConfFile(APP_CONF_FILE));
return Guice.createInjector(Stage.PRODUCTION, new JerseyModule(), new InternalMyBatisModule(props));
} catch (IOException e) {
Throwables.propagate(e);
return null;
}
}
开发者ID:gbif,项目名称:geocode,代码行数:11,代码来源:GuiceConfig.java
示例12: testSetup
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Before
public void testSetup() throws Exception {
Properties props = PropertiesUtil.loadProperties("drupal.properties");
Module mod = new DrupalMyBatisModule(props);
Injector inj = Guice.createInjector(mod);
service = inj.getInstance(UserService.class);
}
开发者ID:gbif,项目名称:drupal-mybatis,代码行数:8,代码来源:UserServiceImplIT.java
示例13: ColAnnotationImport
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
public ColAnnotationImport(String propsFile) throws IOException {
props = PropertiesUtil.readFromFile(propsFile);
// init guice
ChecklistBankServiceMyBatisModule myBatisModule = new ChecklistBankServiceMyBatisModule(props);
Injector inj = Guice.createInjector(myBatisModule);
annotationService = inj.getInstance(ColAnnotationService.class);
}
开发者ID:gbif,项目名称:checklistbank,代码行数:8,代码来源:ColAnnotationImport.java
示例14: setup
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@BeforeClass
public static void setup() throws IOException {
//return"hdfs://localhost:"+ hdfsCluster.getNameNodePort() + "/";
// run liquibase & dbSetup
LOG.info("Run liquibase & dbSetup once");
try {
ClbDbTestRule rule = ClbDbTestRule.squirrels();
rule.apply(new Statement() {
public void evaluate() throws Throwable {
// do nothing
}
}, null).evaluate();
} catch (Throwable throwable) {
Throwables.propagate(throwable);
}
miniDFSCluster = HdfsTestUtil.initHdfs();
// Creates the injector, merging properties taken from default test indexing and checklistbank
Properties props = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_PROPERTY_FILE);
Properties props2 = PropertiesUtil.loadProperties(IndexingConfigKeys.CLB_INDEXING_PROPERTY_TEST_FILE);
props.putAll(props2);
props.put(IndexingConfigKeys.KEYS_INDEXING_CONF_PREFIX + IndexingConfigKeys.NAME_NODE, HdfsTestUtil.getNameNodeUri(miniDFSCluster));
props.put(IndexingConfigKeys.KEYS_INDEXING_CONF_PREFIX + IndexingConfigKeys.TARGET_HDFS_DIR, HdfsTestUtil.TEST_HDFS_DIR);
miniDFSCluster.getFileSystem().mkdirs(new Path(HdfsTestUtil.TEST_HDFS_DIR));
Injector injector = Guice.createInjector(new AvroIndexingTestModule(props));
// Gets the exporter instance
nameUsageAvroExporter = injector.getInstance(AvroExporter.class);
}
开发者ID:gbif,项目名称:checklistbank,代码行数:29,代码来源:AvroExporterIT.java
示例15: ClbDbTestRule
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
/**
* @param tsvFolder the optional unqualified filename within the dbUnit package to be used in setting up
* the db
*/
private ClbDbTestRule(@Nullable String tsvFolder, Map<String, Integer> sequenceCounters) {
this.tsvFolder = tsvFolder;
this.sequenceCounters = sequenceCounters;
try {
properties = PropertiesUtil.loadProperties(DEFAULT_PROPERTY_FILE);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:ClbDbTestRule.java
示例16: init
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Before
public void init() throws IOException {
// This uses UrlBindingModule to dynamically set the named property (metrics.ws.url) taking into account that the
// port might have been set at runtime with system properties (hence the metrics-ws.url is omitted
// in the properties)
Injector clientInjector = Guice.createInjector(
new UrlBindingModule(getBaseURI().toString() + CONTEXT, "metrics.ws.url"),
new MetricsWsClientModule(PropertiesUtil.loadProperties(PROPERTIES_FILE)));
wsClient = clientInjector.getInstance(OccurrenceDatasetIndexService.class);
}
开发者ID:gbif,项目名称:metrics,代码行数:11,代码来源:OccurrenceDatasetIndexWsClientIT.java
示例17: init
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
@Before
public void init() throws IOException {
// This uses UrlBindingModule to dynamically set the named property (metrics.ws.url) taking into account that the
// port might have been set at runtime with system properties (hence the metrics-ws.url is omitted
// in the properties)
Injector clientInjector = Guice.createInjector(
new UrlBindingModule(getBaseURI().toString() + CONTEXT, "metrics.ws.url"),
new MetricsWsClientModule(PropertiesUtil.loadProperties(PROPERTIES_FILE)));
wsClient = clientInjector.getInstance(CubeService.class);
}
开发者ID:gbif,项目名称:metrics,代码行数:11,代码来源:CubeWsClientIT.java
示例18: CubeHBaseModule
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
public CubeHBaseModule(Properties props, String prefix) {
Joiner j = Joiner.on(".");
cubeTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, HBaseSourcedBackfill.KEY_CUBE_TABLE), true, null);
counterTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, HBaseSourcedBackfill.KEY_COUNTER_TABLE), false, null); // optional
lookupTable = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, HBaseSourcedBackfill.KEY_LOOKUP_TABLE), false, null); // optional
cf = PropertiesUtil.propertyAsUTF8Bytes(props, j.join(prefix, HBaseSourcedBackfill.KEY_CF), true, null);
writeBatchSize = PropertiesUtil.propertyAsInt(props, j.join(prefix, HBaseSourcedBackfill.KEY_WRITE_BATCH_SIZE), false, 1000);
}
开发者ID:gbif,项目名称:metrics,代码行数:9,代码来源:CubeHBaseModule.java
示例19: main
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
/**
* Executes the archive/zip creation process.
* The expected parameters are:
* 0. sourcePath: HDFS path to the directory that contains the data files.
* 1. targetPath: HDFS path where the resulting file will be copied.
* 2. downloadKey: occurrence download key.
* 3. MODE: ModalZipOutputStream.MODE of input files.
*/
public static void main(String[] args) throws IOException {
Properties properties = PropertiesUtil.loadProperties(DownloadWorkflowModule.CONF_FILE);
FileSystem sourceFileSystem =
DownloadFileUtils.getHdfs(properties.getProperty(DownloadWorkflowModule.DefaultSettings.NAME_NODE_KEY));
mergeToZip(sourceFileSystem,
sourceFileSystem,
args[0],
args[1],
args[2],
ModalZipOutputStream.MODE.valueOf(args[3]));
}
开发者ID:gbif,项目名称:occurrence,代码行数:20,代码来源:SimpleCsvArchiveBuilder.java
示例20: main
import org.gbif.utils.file.properties.PropertiesUtil; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
Properties properties = PropertiesUtil.loadProperties(DownloadWorkflowModule.CONF_FILE);
readCitations(properties.getProperty(DownloadWorkflowModule.DefaultSettings.NAME_NODE_KEY),
Preconditions.checkNotNull(args[0]),
Preconditions.checkNotNull(args[1]),
new PersistUsage(properties.getProperty(DownloadWorkflowModule.DefaultSettings.REGISTRY_URL_KEY)));
}
开发者ID:gbif,项目名称:occurrence,代码行数:9,代码来源:CitationsFileReader.java
注:本文中的org.gbif.utils.file.properties.PropertiesUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论