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


Java PropertiesUtil.toInteger方法代码示例

本文整理汇总了Java中org.apache.sling.commons.osgi.PropertiesUtil.toInteger方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesUtil.toInteger方法的具体用法?Java PropertiesUtil.toInteger怎么用?Java PropertiesUtil.toInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.sling.commons.osgi.PropertiesUtil的用法示例。


在下文中一共展示了PropertiesUtil.toInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

示例2: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(Map<String, Object> properties) {
  LOGGER.info("Activating ExternalSnippetHttpClient - {}", this);

  Long connectionTtl = PropertiesUtil
      .toLong(properties.get(CONNECTION_TTL_PARAMETER), DEFAULT_CONNECTION_TTL);
  Integer maxConcurrentConnections = PropertiesUtil
      .toInteger(properties.get(MAX_CONCURRENT_CONNECTIONS_PARAMETER),
          DEFAULT_MAX_CONCURRENT_CONNECTIONS);

  final PoolingHttpClientConnectionManager poolingConnManager =
      new PoolingHttpClientConnectionManager(connectionTtl, TimeUnit.SECONDS);
  poolingConnManager.setMaxTotal(maxConcurrentConnections);

  httpClient = HttpClients.custom().setConnectionManager(poolingConnManager).build();
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:17,代码来源:ExternalSnippetHttpClient.java

示例3: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(Map properties) {
  ft = PropertiesUtil.toLong(properties.get(PARAM_FAILURE_TIMEOUT),
      DEFAULT_TASK_RUN_FAILURE_TIMEOUT_SECONDS);
  mttl = PropertiesUtil
      .toLong(properties.get(PARAM_MESSAGE_TTL), DEFAULT_MESSAGE_TIME_TO_LIVE_SECONDS) * 1000;
  urlPackageSize = PropertiesUtil.toInteger(properties.get(PARAM_URL_PACKAGE_SIZE),
      DEFAULT_URL_PACKAGE_SIZE);
  maxMessagesInCollectorQueue = PropertiesUtil.toInteger(
      properties.get(PARAM_MAX_MESSAGES_IN_COLLECTOR_QUEUE),
      DEFAULT_MAX_MESSAGES_IN_COLLECTOR_QUEUE);

  runnerMode = RunnerMode.valueOf(PropertiesUtil.toString(properties.get(RUNNER_MODE), "online")
      .toUpperCase());

  LOG.info(
      "Running with parameters: [ft: {} sec ; mttl: {} ; urlPackageSize: {} ; maxMessagesInCollectorQueue: {}; runnerMode: {}.]",
      ft, mttl, urlPackageSize, maxMessagesInCollectorQueue, runnerMode);

  Injector injector = Guice
      .createInjector(
          new SimpleRunnerModule(ft, mttl, urlPackageSize, maxMessagesInCollectorQueue,
              jmsConnection, messagesManager, runnerMode, metadataDAO));
  messageListener = injector.getInstance(RunnerMessageListener.class);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:26,代码来源:Runner.java

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

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

示例6: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
protected void activate(ComponentContext componentContext) {
    Dictionary<?, ?> properties = componentContext.getProperties();
    int defaultThreadCount = Math.max(1, Runtime.getRuntime().availableProcessors()/2);

    maxCpu = PropertiesUtil.toDouble(properties.get("max.cpu"), 0.85);
    maxHeap = PropertiesUtil.toDouble(properties.get("max.heap"), 0.85);
    maxThreads = PropertiesUtil.toInteger(properties.get("max.threads"), defaultThreadCount);
    cooldownWaitTime = PropertiesUtil.toInteger(properties.get("cooldown.wait.time"), 100);
    taskTimeout = PropertiesUtil.toInteger(properties.get("task.timeout"), 60000);

    try {
        memBeanName = ObjectName.getInstance("java.lang:type=Memory");
        osBeanName = ObjectName.getInstance("java.lang:type=OperatingSystem");
    } catch (MalformedObjectNameException | NullPointerException ex) {
        LOG.error("Error getting OS MBean (shouldn't ever happen)", ex);
    }

    initThreadPool();
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:20,代码来源:ThrottledTaskRunnerImpl.java

示例7: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
@SuppressWarnings("squid:S1149")
protected void activate(ComponentContext componentContext) {
    final BundleContext bundleContext = componentContext.getBundleContext();
    final Dictionary<?, ?> props = componentContext.getProperties();
    final int size = PropertiesUtil.toInteger(props.get(PROP_MD5_CACHE_SIZE), DEFAULT_MD5_CACHE_SIZE);
    this.md5Cache = CacheBuilder.newBuilder().recordStats().maximumSize(size).build();
    this.disableVersioning = PropertiesUtil.toBoolean(props.get(PROP_DISABLE_VERSIONING), DEFAULT_DISABLE_VERSIONING);
    this.enforceMd5 = PropertiesUtil.toBoolean(props.get(PROP_ENFORCE_MD5), DEFAULT_ENFORCE_MD5);
    if (enforceMd5) {
        Dictionary<String, Object> filterProps = new Hashtable<String, Object>();
        filterProps.put("sling.filter.scope", "REQUEST");
        filterProps.put("service.ranking", Integer.valueOf(0));

        filterReg = bundleContext.registerService(Filter.class.getName(),
                new BadMd5VersionedClientLibsFilter(), filterProps);
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:19,代码来源:VersionedClientlibsTransformerFactory.java

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

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

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

示例11: modified

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Modified
public void modified(final Map<String, Object> properties) {
    this.name = String.valueOf(properties.get(NAME_PROPERTY));
    this.gender = String.valueOf(properties.get(GENDER_PROPERTY));
    this.phoneNumbers = Arrays.asList(PropertiesUtil.toStringArray(properties.get(PHONE_NUMBERS_PROPERTY)));
    this.isAlive = PropertiesUtil.toBoolean(properties.get(IS_ALIVE_PROPERTY), false);
    this.children = PropertiesUtil.toInteger(properties.get(HOW_MANY_CHILDREN), 0);

    LOG.info("Map is : {}", this.toString());
}
 
开发者ID:Shashi-Bhushan,项目名称:General,代码行数:11,代码来源:FactoryConfigCleanerWay.java

示例12: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(Map<String, Object> properties) {
    this.httpProxyHost = PropertiesUtil.toString(properties.get(PROP_HTTP_PROXY_HOST), null);
    this.httpProxyPort = PropertiesUtil.toInteger(properties.get(PROP_HTTP_PROXY_PORT), 0);
    this.useSsl = PropertiesUtil.toBoolean(properties.get(PROP_USE_SSL), DEFAULT_USE_SSL);
    this.factory = new TwitterFactory(buildConfiguration());
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:TwitterAdapterFactory.java

示例13: doActivate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Override
protected void doActivate(ComponentContext context) throws Exception {
    super.doActivate(context);

    @SuppressWarnings("unchecked")
    Dictionary<String, Object> props = context.getProperties();
    dayOfWeek = PropertiesUtil.toInteger(props.get(PROP_EXPIRES_DAY_OF_WEEK), -1);
    if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) {
        throw new ConfigurationException(PROP_EXPIRES_DAY_OF_WEEK, "Day of week must be valid value from Calendar DAY_OF_WEEK attribute.");
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:12,代码来源:WeeklyExpiresHeaderFilter.java

示例14: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
protected void activate(final ComponentContext componentContext) {
    final Dictionary<?, ?> properties = componentContext.getProperties();

    final String[] attrProp = PropertiesUtil
            .toStringArray(properties.get(PROP_ATTRIBUTES), DEFAULT_ATTRIBUTES);
    this.attributes = ParameterUtil.toMap(attrProp, ":", ",");

    final String[] matchingPatternsProp = PropertiesUtil.toStringArray(properties.get(PROP_MATCHING_PATTERNS));
    this.matchingPatterns = initializeMatchingPatterns(matchingPatternsProp);

    this.prefixes = PropertiesUtil.toStringArray(properties.get(PROP_PREFIXES), new String[0]);
    this.staticHostPattern = PropertiesUtil.toStringArray(properties.get(PROP_HOST_NAME_PATTERN), null);
    this.staticHostCount = PropertiesUtil.toInteger(properties.get(PROP_HOST_COUNT), DEFAULT_HOST_COUNT);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:16,代码来源:StaticReferenceRewriteTransformerFactory.java

示例15: activate

import org.apache.sling.commons.osgi.PropertiesUtil; //导入方法依赖的package包/类
@Activate
public void activate(Map properties) {
  timeoutValue = PropertiesUtil
      .toInteger(properties.get(SOURCE_COLLECTOR_TIMEOUT_VALUE), DEFAULT_TIMEOUT);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:6,代码来源:SourceCollectorFactory.java


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