当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesUtil.toString方法代码示例

本文整理汇总了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);
}
 
开发者ID:nateyolles,项目名称:aem-osgi-annotation-demo,代码行数:17,代码来源:SampleFelixServiceImpl.java

示例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);
        }
    }

}
 
开发者ID:deepthinkit,项目名称:patternlab-for-sling,代码行数:22,代码来源:ExtensionRegistryService.java

示例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();
}
 
开发者ID:sinnerschrader,项目名称:aem-react,代码行数:18,代码来源:ReactScriptEngineFactory.java

示例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;
}
 
开发者ID:nateyolles,项目名称:publick-sling-blog,代码行数:25,代码来源:OsgiConfigurationServiceImpl.java

示例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());
	}


}
 
开发者ID:joerghoh,项目名称:cqdeploy,代码行数:20,代码来源:PackageInstallerImpl.java

示例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);
        }
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:21,代码来源:SyntheticWorkflowRunnerImpl.java

示例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);
    }
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:8,代码来源:AssetProviderServlet.java

示例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);
    }
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:8,代码来源:AssetProviderServlet.java

示例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);
}
 
开发者ID:daniel-lima,项目名称:aem-vltsync,代码行数:31,代码来源:InitialRegistrationImpl.java

示例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);
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:8,代码来源:ElasticSearchHostConfiguration.java

示例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);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:10,代码来源:RestProxyManager.java

示例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);

}
 
开发者ID:Cognifide,项目名称:aet,代码行数:9,代码来源:FirefoxWebDriverFactory.java

示例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);
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:10,代码来源:ClassScanner.java

示例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


注:本文中的org.apache.sling.commons.osgi.PropertiesUtil.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。