本文整理汇总了Java中org.exoplatform.commons.utils.PropertyManager类的典型用法代码示例。如果您正苦于以下问题:Java PropertyManager类的具体用法?Java PropertyManager怎么用?Java PropertyManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyManager类属于org.exoplatform.commons.utils包,在下文中一共展示了PropertyManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ElasticIndexingServiceConnector
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public ElasticIndexingServiceConnector(InitParams initParams) {
PropertiesParam param = initParams.getPropertiesParam("constructor.params");
this.index = param.getProperty("index");
setType(param.getProperty("type"));
//Get number of replicas in connector declaration or exo properties
if (StringUtils.isNotBlank(param.getProperty("replica.number"))) {
this.replicas = Integer.valueOf(param.getProperty("replica.number"));
}
else if (StringUtils.isNotBlank(PropertyManager.getProperty(REPLICAS_NUMBER_PROPERTY_NAME))) {
this.replicas = Integer.valueOf(PropertyManager.getProperty(REPLICAS_NUMBER_PROPERTY_NAME));
}
//Get number of shards in connector declaration or exo properties
if (StringUtils.isNotBlank(param.getProperty("shard.number"))) {
this.replicas = Integer.valueOf(param.getProperty("shard.number"));
}
else if (StringUtils.isNotBlank(PropertyManager.getProperty(SHARDS_PROPERTY_NAME))) {
this.shards = Integer.valueOf(PropertyManager.getProperty(SHARDS_PROPERTY_NAME));
}
}
示例2: ElasticIndexingOperationProcessor
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public ElasticIndexingOperationProcessor(IndexingOperationDAO indexingOperationDAO,
ElasticIndexingClient elasticIndexingClient,
ElasticContentRequestBuilder elasticContentRequestBuilder,
ElasticIndexingAuditTrail auditTrail,
DataInitializer dataInitializer) {
this.indexingOperationDAO = indexingOperationDAO;
this.auditTrail = auditTrail;
this.elasticIndexingClient = elasticIndexingClient;
this.elasticContentRequestBuilder = elasticContentRequestBuilder;
if (StringUtils.isNotBlank(PropertyManager.getProperty(BATCH_NUMBER_PROPERTY_NAME))) {
this.batchNumber = Integer.valueOf(PropertyManager.getProperty(BATCH_NUMBER_PROPERTY_NAME));
}
if (StringUtils.isNotBlank(PropertyManager.getProperty(REQUEST_SIZE_LIMIT_PROPERTY_NAME))) {
this.requestSizeLimit = Integer.valueOf(PropertyManager.getProperty(REQUEST_SIZE_LIMIT_PROPERTY_NAME));
}
if (StringUtils.isNotBlank(PropertyManager.getProperty(REINDEXING_BATCH_SIZE_PROPERTY_NAME))) {
this.reindexBatchSize = Integer.valueOf(PropertyManager.getProperty(REINDEXING_BATCH_SIZE_PROPERTY_NAME));
}
}
示例3: setUp
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
startEmbeddedES();
// If the test is executed standalone, the properties are not present at the
// beginning
// of the test, so they have to be removed at the end of the test to avoid
// java.lang.AssertionError: System properties invariant violated from
// com.carrotsearch.randomizedtesting
// If another test ran before and set the properties, we must not remove the
// properties
// If we do, we'll get the same exception.
propertiesSet = StringUtils.isBlank(System.getProperty("exo.es.index.server.url"));
PropertyManager.setProperty("exo.es.index.server.url", "http://localhost:" + esPort);
PropertyManager.setProperty("exo.es.search.server.url", "http://localhost:" + esPort);
elasticIndexingClient = new ElasticIndexingClient(new ElasticIndexingAuditTrail());
elasticSearchingClient = new ElasticSearchingClient(new ElasticIndexingAuditTrail());
}
示例4: cleanUrlProperties
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@AfterClass
public static void cleanUrlProperties() {
// Close ES Node
if(node != null) {
LOGGER.info("Embedded ES instance - Stopping");
node.close();
LOGGER.info("Embedded ES instance - Stopped");
}
if (propertiesSet) {
System.clearProperty("exo.es.index.server.url");
System.clearProperty("exo.es.indexing.batch.number");
System.clearProperty("exo.es.indexing.replica.number.default");
System.clearProperty("exo.es.indexing.shard.number.default");
System.clearProperty("exo.es.search.server.url");
System.clearProperty("jboss.i18n.generate-proxies");
} else {
//Reset server.url properties to default values
PropertyManager.setProperty("exo.es.index.server.url", "http://127.0.0.1:9200");
PropertyManager.setProperty("exo.es.search.server.url", "http://127.0.0.1:9200");
}
}
示例5: ElasticSearchingClient
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public ElasticSearchingClient(ElasticIndexingAuditTrail auditTrail) {
super(auditTrail);
//Get url client from exo global properties
if (StringUtils.isNotBlank(PropertyManager.getProperty(ES_SEARCH_CLIENT_PROPERTY_NAME))) {
this.urlClient = PropertyManager.getProperty(ES_SEARCH_CLIENT_PROPERTY_NAME);
LOG.info("Using {} as Searching URL", this.urlClient);
} else {
LOG.info("Using default as Searching URL");
}
}
示例6: ElasticIndexingClient
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public ElasticIndexingClient(ElasticIndexingAuditTrail auditTrail) {
super(auditTrail);
if (auditTrail == null) {
throw new IllegalArgumentException("AuditTrail is null");
}
this.auditTrail = auditTrail;
// Get url client from exo global properties
if (StringUtils.isNotBlank(PropertyManager.getProperty(ES_INDEX_CLIENT_PROPERTY_NAME))) {
this.urlClient = PropertyManager.getProperty(ES_INDEX_CLIENT_PROPERTY_NAME);
LOG.info("Using {} as Indexing URL", this.urlClient);
} else {
LOG.info("Using default as Indexing URL");
}
}
示例7: startEmbeddedES
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
/**
* Start an Elasticsearch instance
*/
private static void startEmbeddedES() {
if(esPort == null) {
try {
esPort = getAvailablePort();
} catch (IOException e) {
fail("Cannot get available port : " + e.getMessage());
}
}
// Init ES
LOGGER.info("Embedded ES instance - Starting on port " + esPort);
Settings.Builder elasticsearchSettings = Settings.settingsBuilder()
.put(Node.HTTP_ENABLED, true)
.put("network.host", "127.0.0.1")
.put("http.port", esPort)
.put("name", "esEmbeddedForTests" + esPort)
.put("path.home", "target/es")
.put("path.data", "target/es")
.put("plugins.load_classpath_plugins", true);
Environment environment = new Environment(elasticsearchSettings.build());
Collection plugins = new ArrayList<>();
Collections.<Class<? extends Plugin>>addAll(plugins, MapperAttachmentsPlugin.class, DeleteByQueryPlugin.class);
node = new EmbeddedNode(environment, Version.CURRENT, plugins);
node.start();
//node = nodeBuilder().local(true).settings(elasticsearchSettings.build()).node();
node.client().admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
assertNotNull(node);
assertFalse(node.isClosed());
LOGGER.info("Embedded ES instance - Started");
// Set URL of server in property
NodesInfoRequest nodesInfoRequest = new NodesInfoRequest().transport(true);
NodesInfoResponse response = node.client().admin().cluster().nodesInfo(nodesInfoRequest).actionGet();
NodeInfo nodeInfo = response.iterator().next();
InetSocketTransportAddress address = (InetSocketTransportAddress) nodeInfo.getHttp().getAddress().publishAddress();
String url = "http://" + address.address().getHostName() + ":" + address.address().getPort();
PropertyManager.setProperty("exo.es.index.server.url", url);
PropertyManager.setProperty("exo.es.search.server.url", url);
}
示例8: initMock
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Before
public void initMock() throws IOException {
MockitoAnnotations.initMocks(this);
PropertyManager.setProperty("exo.es.index.server.url", "http://127.0.0.1:9200");
elasticIndexingClient = new ElasticIndexingClient(auditTrail);
elasticIndexingClient.client = httpClient;
}
示例9: initMock
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Before
public void initMock() throws IOException {
MockitoAnnotations.initMocks(this);
PropertyManager.setProperty("exo.es.search.server.url", "http://127.0.0.1:9200");
elasticSearchingClient = new ElasticSearchingClient(auditTrail);
elasticSearchingClient.client = httpClient;
}
示例10: processRender
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public void processRender(WebuiRequestContext context) throws Exception {
if (REFRESH){
init();
SortAddons("popular", PropertyManager.getProperty(EXO_MARKETPLACE_FEATUED_CATEGORY_NAME).trim().toUpperCase());
}
//--- Get the paramter from url, this parameter is used to fetch categories by name
HttpServletRequest request = Util.getPortalRequestContext().getRequest();
if (request.getParameter(Constants.HTTP_PARAMETER_CATEGORY_NAME) != null) {
log.debug("MarketPlace Addon, Load addons based on parameter passed through URL {} ", request.getParameter("category"));
SortAddons("popular", request.getParameter(Constants.HTTP_PARAMETER_CATEGORY_NAME).toUpperCase());
}
super.processRender(context);
}
示例11: getEsUsernameProperty
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Override
protected String getEsUsernameProperty() {
return PropertyManager.getProperty(ES_SEARCH_CLIENT_PROPERTY_USERNAME);
}
示例12: getEsPasswordProperty
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Override
protected String getEsPasswordProperty() {
return PropertyManager.getProperty(ES_SEARCH_CLIENT_PROPERTY_PASSWORD);
}
示例13: getEsUsernameProperty
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Override
protected String getEsUsernameProperty() {
return PropertyManager.getProperty(ES_INDEX_CLIENT_PROPERTY_USERNAME);
}
示例14: getEsPasswordProperty
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
@Override
protected String getEsPasswordProperty() {
return PropertyManager.getProperty(ES_INDEX_CLIENT_PROPERTY_PASSWORD);
}
示例15: UIAddOnSearchForm
import org.exoplatform.commons.utils.PropertyManager; //导入依赖的package包/类
public UIAddOnSearchForm() throws Exception {
marketPlaceService = getApplicationComponent(MarketPlaceService.class);
UIFormStringInput uiKeywordInput = new UIFormStringInput(KEYWORD_INPUT,KEYWORD_INPUT, null);
uiKeywordInput.setHTMLAttribute("placeholder","Search");
addUIFormInput(uiKeywordInput);
ResourceBundle resourceBundle = WebuiRequestContext.getCurrentInstance().getApplicationResourceBundle();
List<SelectItemOption<String>> displayModes = new ArrayList<SelectItemOption<String>>(4);
displayModes.add(new SelectItemOption<String>(resourceBundle.getString("UIAddOnSearchPortlet.label.sort-" + FILTER_POPULAR), FILTER_POPULAR));
displayModes.add(new SelectItemOption<String>(resourceBundle.getString("UIAddOnSearchPortlet.label.sort-" + FILTER_AZ), FILTER_AZ));
displayModes.add(new SelectItemOption<String>(resourceBundle.getString("UIAddOnSearchPortlet.label.sort-" + FILTER_ZA), FILTER_ZA));
displayModes.add(new SelectItemOption<String>(resourceBundle.getString("UIAddOnSearchPortlet.label.sort-" + FILTER_LATEST), FILTER_LATEST));
UIDropDownControl uiDropDownControl = addChild(UIDropDownControl.class, "DisplayModesDropDown", null);
uiDropDownControl.setOptions(displayModes);
setSelectedMode(uiDropDownControl);
//--- Add DropDown to display categories
categoryNameDropDown = addChild(UIDropDownControl.class, "CategoryNameDropDown", null);
//--- Get the default featured category
//--- Get tribe manager name
featuredCategory = PropertyManager.getProperty(EXO_MARKETPLACE_FEATUED_CATEGORY_NAME).trim();
}