本文整理汇总了Java中org.apache.sling.commons.osgi.PropertiesUtil.toStringArray方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesUtil.toStringArray方法的具体用法?Java PropertiesUtil.toStringArray怎么用?Java PropertiesUtil.toStringArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.commons.osgi.PropertiesUtil
的用法示例。
在下文中一共展示了PropertiesUtil.toStringArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
@Modified
protected final void activate(final Map<String, Object> config) {
Map<String, Object> properties = Collections.emptyMap();
if (config != null) {
properties = config;
}
booleanProp = PropertiesUtil.toBoolean(properties.get(BOOLEAN_PROPERTY_NAME), BOOLEAN_PROPERTY_DEFAULT_VALUE);
stringProp = PropertiesUtil.toString(properties.get(STRING_PROPERTY_NAME), STRING_PROPERTY_DEFAULT_VALUE);
dropdownProp = PropertiesUtil.toString(properties.get(DROPDOWN_PROPERTY_NAME), DROPDOWN_PROPERTY_DEFAULT_VALUE);
stringArrayProp = PropertiesUtil.toStringArray(properties.get(STRING_ARRAY_PROPERTY_NAME));
passwordProp = PropertiesUtil.toString(properties.get(PASSWORD_PROPERTY_NAME), "").toCharArray();
longProp = PropertiesUtil.toLong(properties.get(LONG_PROPERTY_NAME), LONG_PROPERTY_DEFAULT_VALUE);
}
示例2: initialize
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void initialize(final ComponentContext context) {
this.subServiceName = PropertiesUtil.toString(context.getProperties().get(PROPERTY_SUBSERVICENAME), "");
scriptResources = PropertiesUtil.toStringArray(context.getProperties().get(PROPERTY_SCRIPTS_PATHS), new String[0]);
int poolTotalSize = PropertiesUtil.toInteger(context.getProperties().get(PROPERTY_POOL_TOTAL_SIZE), 20);
JavacriptEnginePoolFactory javacriptEnginePoolFactory = new JavacriptEnginePoolFactory(createLoader(scriptResources), null);
ObjectPool<JavascriptEngine> pool = createPool(poolTotalSize, javacriptEnginePoolFactory);
this.engine = new ReactScriptEngine(this, pool, isReloadScripts(context), finder, dynamicClassLoaderManager);
this.listener = new JcrResourceChangeListener(repositoryConnectionFactory, new JcrResourceChangeListener.Listener() {
@Override
public void changed(String script) {
createScripts();
}
}, subServiceName);
this.listener.activate(scriptResources);
this.createScripts();
}
示例3: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@Activate
private void activate(final ComponentContext componentContext) {
BundleContext bundleContext = componentContext.getBundleContext();
final Dictionary<?,?> properties = componentContext.getProperties();
// default.group
this.defaultGroup = PropertiesUtil.toString(properties.get(DEFAULT_GROUP), this.ADMIN_GROUP);
// payload.mappings
String[] mappings = PropertiesUtil.toStringArray(properties.get(PAYLOAD_MAPPINGS));
for (String mapping : mappings) {
this.getPayloadMappings().add(mapping.trim().split(":"));
}
}
开发者ID:VillanovaUniversity,项目名称:villanova-cqtools-workflow,代码行数:19,代码来源:PathBasedParticipantChooser.java
示例4: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
/**
* OSGi Activate method.
*
* @param config the OSGi config params
*/
@Activate
protected final void activate(final Map<String, Object> config) {
emailTemplatePath = PropertiesUtil.toString(config.get(PROP_TEMPLATE_PATH), DEFAULT_EMAIL_TEMPLATE_PATH);
emailSubject = PropertiesUtil.toString(config.get(PROP_EMAIL_SUBJECT), DEFAULT_EMAIL_SUBJECT_PREFIX);
fallbackHostname = PropertiesUtil.toString(config.get(PROP_FALLBACK_HOSTNAME), DEFAULT_FALLBACK_HOSTNAME);
recipientEmailAddresses = PropertiesUtil.toStringArray(config.get(PROP_RECIPIENTS_EMAIL_ADDRESSES), DEFAULT_RECIPIENT_EMAIL_ADDRESSES);
healthCheckTags = PropertiesUtil.toStringArray(config.get(PROP_HEALTH_CHECK_TAGS), DEFAULT_HEALTH_CHECK_TAGS);
healthCheckTagsOptionsOr = PropertiesUtil.toBoolean(config.get(PROP_HEALTH_CHECK_TAGS_OPTIONS_OR), DEFAULT_HEALTH_CHECK_TAGS_OPTIONS_OR);
sendEmailOnlyOnFailure = PropertiesUtil.toBoolean(config.get(PROP_SEND_EMAIL_ONLY_ON_FAILURE), DEFAULT_SEND_EMAIL_ONLY_ON_FAILURE);
throttleInMins = PropertiesUtil.toInteger(config.get(PROP_THROTTLE), DEFAULT_THROTTLE_IN_MINS);
if (throttleInMins < 0) {
throttleInMins = DEFAULT_THROTTLE_IN_MINS;
}
healthCheckTimeoutOverride = PropertiesUtil.toInteger(config.get(PROP_HEALTH_CHECK_TIMEOUT_OVERRIDE), DEFAULT_HEALTH_CHECK_TIMEOUT_OVERRIDE);
}
示例5: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(final Map<String, Object> config) {
supportMultiLevel = PropertiesUtil.toBoolean(config.get(PROP_SUPPORT_MULTI_LEVEL), DEFAULT_SUPPORT_MULTI_LEVEL);
// Property Names
namespaceablePropertyNames = PropertiesUtil.toStringArray(config.get(PROP_NAMESPACEABLE_PROPERTY_NAMES),
DEFAULT_NAMESPACEABLE_PROPERTY_NAMES);
// Property Value Patterns
namespaceablePropertyValuePatterns = new ArrayList<Pattern>();
String[] regexes = PropertiesUtil.toStringArray(config.get(PROP_NAMESPACEABLE_PROPERTY_VALUE_PATTERNS),
DEFAULT_NAMESPACEABLE_PROPERTY_VALUE_PATTERNS);
for (final String regex : regexes) {
namespaceablePropertyValuePatterns.add(Pattern.compile(regex));
}
final InfoWriter iw = new InfoWriter();
iw.title("ACS AEM Commons - CQInclude Property Namespace Servlet");
iw.message("Namespace-able Property Names: {}", Arrays.asList(namespaceablePropertyNames));
iw.message("Namespace-able Property Value Patterns: {}", namespaceablePropertyValuePatterns);
iw.end();
log.info(iw.toString());
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:25,代码来源:CQIncludePropertyNamespaceServlet.java
示例6: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
@SuppressWarnings("squid:S1149")
protected final void activate(ComponentContext context) throws Exception {
Dictionary<?, ?> properties = context.getProperties();
doActivate(context);
String[] filters = PropertiesUtil.toStringArray(properties.get(PROP_FILTER_PATTERN));
if (filters == null || filters.length == 0) {
throw new ConfigurationException(PROP_FILTER_PATTERN, "At least one filter pattern must be specified.");
}
for (String pattern : filters) {
Dictionary<String, String> filterProps = new Hashtable<String, String>();
log.debug("Adding filter ({}) to pattern: {}", this.toString(), pattern);
filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, pattern);
filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)");
ServiceRegistration filterReg = context.getBundleContext().registerService(Filter.class.getName(), this, filterProps);
filterRegistrations.add(filterReg);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:23,代码来源:AbstractDispatcherCacheHeaderFilter.java
示例7: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(Map<String, Object> props) {
List<Pattern> patterns = new ArrayList<Pattern>();
String[] regexes = PropertiesUtil.toStringArray(props.get(PAGE_ROOT_PATH), new String[] { DEFAULT_PAGE_ROOT_PATH });
for(String regex : regexes) {
try {
Pattern p = Pattern.compile("^(" + regex + ")(|/.*)$");
patterns.add(p);
log.debug("Added Page Root Pattern [ {} ] to PageRootProvider", p.toString());
} catch (Exception e) {
log.error("Could not compile regex [ {} ] to pattern. Skipping...", regex, e);
}
}
this.pageRootPatterns = Collections.unmodifiableList(patterns);
}
示例8: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(final Map<String, Object> props) throws ServiceException {
logger.debug("activate(): props = {}", props);
this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null);
if (this.filterRoots == null) {
throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!");
}
final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null));
if (localDirValue == null) {
throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!");
}
this.localDir = new File(localDirValue);
this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES),
DEFAULT_OVERWRITE_CONFIG_FILES);
this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED);
generateFiles();
Long expectedSyncOnceTime = null;
if (this.willSyncOnce) {
expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME),
DEFAULT_SYNC_ONCE_EXPECTED_TIME);
}
this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime);
}
示例9: getSyncRoots
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
private Set<String> getSyncRoots(final Dictionary<String, Object> properties) {
final Set<String> syncRoots = new LinkedHashSet<String>();
String[] syncRootArray = PropertiesUtil.toStringArray(properties.get(PROP_SYNCROOTS));
if (syncRootArray != null) {
syncRoots.addAll(Arrays.asList(syncRootArray));
syncRootArray = null;
}
return syncRoots;
}
示例10: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(ComponentContext context) {
this.context = context;
this.indexRules = PropertiesUtil.toStringArray(context.getProperties().get(ElasticSearchIndexConfiguration.PROPERTY_INDEX_RULES));
// if (PropertiesUtil.toBoolean(context.getProperties().get(ElasticSearchIndexConfiguration.PROPERTY_REINDEX), false)) {
//TODO: start reindexing for this configuration
//TODO: check if jobManager would be better
// if (reindexService != null && scheduler != null) {
// LOG.info("Scheduling reindexing for " + PropertiesUtil.toString(context.getProperties().get(ElasticSearchIndexConfiguration.PRIMARY_TYPE), StringUtils.EMPTY));
// ScheduleOptions options = scheduler.NOW();
// scheduler.schedule(reindexService, options);
// }
// }
}
示例11: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(ComponentContext context) {
bundleContext = context.getBundleContext();
Dictionary<String, Object> properties = context.getProperties();
if(properties != null) {
ignoredBundles = PropertiesUtil.toStringArray(properties.get(IGNORED_BUNDLES));
} else {
ignoredBundles = new String[]{};
}
}
示例12: initialize
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void initialize(final ComponentContext context) {
String[] scriptResources = PropertiesUtil.toStringArray(context.getProperties().get(PROPERTY_SCRIPTS_PATHS), new String[0]);
int poolTotalSize = PropertiesUtil.toInteger(context.getProperties().get(PROPERTY_POOL_TOTAL_SIZE), 20);
JavacriptEnginePoolFactory javacriptEnginePoolFactory = new JavacriptEnginePoolFactory(createLoader(scriptResources));
ObjectPool<JavascriptEngine> pool = createPool(poolTotalSize, javacriptEnginePoolFactory);
this.engine = new ReactScriptEngine(this, pool, isReloadScripts(context));
}
示例13: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(Configuration configuration) {
dataNameWhitelist = PropertiesUtil.toStringArray(configuration.name_whitelist());
allowExpressions = PropertiesUtil.toBoolean(configuration.allow_expressions(), PROP_ALLOW_EXPRESSION_DEFAULT);
formsHandlingServletHelper = new FormsHandlingServletHelper(dataNameWhitelist, validator, FormConstants.RT_ALL_CORE_FORM_CONTAINER,
allowExpressions, formStructureHelperFactory);
}
示例14: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(final Map<String, String> config) {
propertyIgnores = PropertiesUtil.toStringArray(config.get(PROPERTY_IGNORES), new String[] { "" });
resourceIgnores = PropertiesUtil.toStringArray(config.get(RESOURCE_IGNORES), new String[] { "" });
evolutionConfig = new EvolutionConfig(propertyIgnores, resourceIgnores);
log.debug("Ignored properties: {}", propertyIgnores);
log.debug("Ignored resources: {}", resourceIgnores);
}
示例15: ServiceUser
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
public ServiceUser(Map<String, Object> config) throws EnsureServiceUserException {
String tmp = PropertiesUtil.toString(config.get(EnsureServiceUser.PROP_PRINCIPAL_NAME), null);
if (StringUtils.contains(tmp, "/")) {
tmp = StringUtils.removeStart(tmp, PATH_SYSTEM_USERS);
tmp = StringUtils.removeStart(tmp, "/");
this.principalName = StringUtils.substringAfterLast(tmp, "/");
this.intermediatePath = PathUtil.makePath(PATH_SYSTEM_USERS, StringUtils.removeEnd(tmp, this.principalName));
} else {
this.principalName = tmp;
this.intermediatePath = "/home/users/system";
}
// Check the principal name for validity
if (StringUtils.isBlank(this.principalName)) {
throw new EnsureServiceUserException("No Principal Name provided to Ensure Service User");
} else if (ProtectedSystemUsers.isProtected(this.principalName)) {
throw new EnsureServiceUserException(String.format("[ %s ] is an System User provided by AEM or ACS AEM Commons. You cannot ensure this user.", this.principalName));
}
final String[] acesProperty = PropertiesUtil.toStringArray(config.get(EnsureServiceUser.PROP_ACES), new String[0]);
for (String entry : acesProperty) {
try {
aces.add(new Ace(entry));
} catch (EnsureServiceUserException e) {
log.warn("Malformed ACE config [ " + entry + " ] for Service User [ " + StringUtils.defaultIfEmpty(this.principalName, "NOT PROVIDED") + " ]", e);
}
}
}