本文整理汇总了Java中org.apache.sling.commons.osgi.PropertiesUtil.toString方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesUtil.toString方法的具体用法?Java PropertiesUtil.toString怎么用?Java PropertiesUtil.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.commons.osgi.PropertiesUtil
的用法示例。
在下文中一共展示了PropertiesUtil.toString方法的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: bindExtensionService
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Reference(
policy = ReferencePolicy.DYNAMIC,
service = RuntimeExtension.class,
cardinality = ReferenceCardinality.MULTIPLE
)
@SuppressWarnings("unused")
protected synchronized void bindExtensionService(RuntimeExtension extension, Map<String, Object> properties) {
Integer newPriority = PropertiesUtil.toInteger(properties.get(Constants.SERVICE_RANKING), 0);
String extensionName = PropertiesUtil.toString(properties.get(RuntimeExtension.NAME), "");
Integer priority = PropertiesUtil.toInteger(mappingPriorities.get(extensionName), 0);
if (newPriority > priority) {
mapping = Collections.unmodifiableMap(add(mapping, extension, extensionName));
mappingPriorities.put(extensionName, newPriority);
} else {
if (!mapping.containsKey(extensionName)) {
mapping = Collections.unmodifiableMap(add(mapping, extension, extensionName));
mappingPriorities.put(extensionName, newPriority);
}
}
}
示例3: 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();
}
示例4: getStringProperty
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
/**
* Get the value of an OSGi configuration string property for a given PID.
*
* @param pid The PID of the OSGi component to retrieve
* @param property The property of the config to retrieve
* @param value The value to assign the provided property
* @return The property value
*/
public String getStringProperty(final String pid, final String property, final String defaultValue) {
try {
Configuration conf = configAdmin.getConfiguration(pid);
@SuppressWarnings("unchecked")
Dictionary<String, Object> props = conf.getProperties();
if (props != null) {
return PropertiesUtil.toString(props.get(property), defaultValue);
}
} catch (IOException e) {
LOGGER.error("Could not get property", e);
}
return defaultValue;
}
示例5: 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
示例6: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate (ComponentContext ctx) {
packageRoot = PropertiesUtil.toString(ctx.getProperties().get(PROPERTY_PACKAGE_ROOT), DEFAULT_PACKAGE_ROOT);
final File directory = new File (packageRoot);
if (directory.exists() && directory.isDirectory()) {
LOG.info("Looking for packages in {}",directory.getAbsolutePath());
try {
//installPackages (directory);
} catch (Exception e) {
LOG.error("Got exception during service activation",e);
}
} else {
LOG.warn ("Package root directory {} does not exist or is not a directory", directory.getAbsolutePath());
}
}
示例7: bindSyntheticWorkflowProcesses
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
protected final void bindSyntheticWorkflowProcesses(final SyntheticWorkflowProcess process, final Map<Object, Object> props) {
if (process != null) {
// Workflow Process Labels
final String label = PropertiesUtil.toString(props.get(WORKFLOW_PROCESS_LABEL), null);
if (label != null) {
this.workflowProcessesByLabel.put(label, process);
log.trace("Synthetic {} Workflow Runner added Workflow Process by Label [ {} ]", process.getWorkflowType(), label);
}
// Workflow Process Name
String processName = (String) process.getProcessId();
if (processName != null) {
this.workflowProcessesByProcessName.put(processName, process);
log.trace("Synthetic {} Workflow Runner added Workflow Process by Process Name [ {} ]", process.getWorkflowType(), processName);
} else {
log.trace("Process name is null for [ {} ]", label);
}
}
}
示例8: bindNamedImageTransformers
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
protected final void bindNamedImageTransformers(final NamedImageTransformer service,
final Map<Object, Object> props) {
final String type = PropertiesUtil.toString(props.get(NamedImageTransformer.PROP_NAME), null);
if (type != null) {
this.namedImageTransformers.put(type, service);
}
}
示例9: unbindNamedImageTransformers
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
protected final void unbindNamedImageTransformers(final NamedImageTransformer service,
final Map<Object, Object> props) {
final String type = PropertiesUtil.toString(props.get(NamedImageTransformer.PROP_NAME), null);
if (type != null) {
this.namedImageTransformers.remove(type);
}
}
示例10: 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);
}
示例11: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(ComponentContext context) {
this.context = context;
this.protocol = PropertiesUtil.toString(context.getProperties().get(ElasticSearchHostConfiguration.PROPERTY_PROTOCOL), ElasticSearchHostConfiguration.PROPERTY_PROTOCOL_DEFAULT);
this.host = PropertiesUtil.toString(context.getProperties().get(ElasticSearchHostConfiguration.PROPERTY_HOST), null);
this.port = PropertiesUtil.toInteger(context.getProperties().get(ElasticSearchHostConfiguration.PROPERTY_PORT), ElasticSearchHostConfiguration.PROPERTY_PORT_DEFAULT);
}
示例12: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(Map<String, ?> properties) {
port = PropertiesUtil.toInteger(properties.get(PORT_PROPERTY_NAME), DEFAULT_PORT);
server = PropertiesUtil.toString(properties.get(SERVER_PROPERTY_NAME), DEFAULT_SERVER);
maxAttempts = PropertiesUtil
.toInteger(properties.get(MAX_ATTEMPTS_PROPERTY_NAME), DEFAULT_MAX_ATTEMPTS);
attemptsInterval = PropertiesUtil
.toInteger(properties.get(ATTEMPTS_INTERVAL_PROPERTY_NAME), DEFAULT_ATTEMPTS_INTERVAL);
}
示例13: activate
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(Map<String, String> properties) {
this.name = PropertiesUtil.toString(properties.get(NAME), DEFAULT_FF_NAME);
this.path = PropertiesUtil.toString(properties.get(PATH), null);
this.logFilePath = PropertiesUtil
.toString(properties.get(LOG_FILE_PATH), DEFAULT_FIREFOX_ERROR_LOG_FILE_PATH);
}
示例14: parsePackagesFromHeader
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
private List<String> parsePackagesFromHeader(String header) {
String values = PropertiesUtil.toString(bundle.getHeaders().get(header), null);
if (values == null) {
return Collections.emptyList();
}
String[] packages = StringUtils.deleteWhitespace(values).split(";");
return Arrays.asList(packages);
}
示例15: bindSampleService
import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
protected final void bindSampleService(final SampleService service,
final Map<Object, Object> props) {
final String type = PropertiesUtil.toString(props.get(SampleService.PROP_NAME), null);
if (type != null) {
this.sampleServices.put(type, service);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:8,代码来源:SampleMultiReferenceServiceImpl.java