• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.rhq.core.domain.configuration.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Configuration类属于org.rhq.core.domain.configuration包,在下文中一共展示了Configuration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadResourceConfiguration

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public Configuration loadResourceConfiguration() {
    Configuration configuration = new Configuration();
    ConfigurationDefinition configurationDefinition = this.getResourceContext().getResourceType()
        .getResourceConfigurationDefinition();

    for (PropertyDefinition property : configurationDefinition.getPropertyDefinitions().values()) {
        if (property instanceof PropertyDefinitionSimple) {
            EmsAttribute attribute = getEmsBean().getAttribute(property.getName());
            if (attribute != null) {
                configuration.put(new PropertySimple(property.getName(), attribute.refresh()));
            }
        }
    }

    return configuration;
}
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:18,代码来源:ArtemisResourceComponent.java


示例2: buildResourceKey

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
protected String buildResourceKey(Configuration pluginConfig, ResourceDiscoveryContext context, ProcessInfo process) {

        final String resourceKeyProperty = getResourceKeyProperty(pluginConfig);
        final String keyString;
        if (process == null) {
            keyString = pluginConfig.getSimpleValue(resourceKeyProperty);
        } else {
            keyString = getSystemPropertyValue(process, resourceKeyProperty);
        }

        if (keyString == null || keyString.isEmpty()) {
            if (process == null) {
                throw new InvalidPluginConfigurationException("Missing required property" + resourceKeyProperty);
            } else {
                throw new InvalidPluginConfigurationException("Process [" + process.getPid() + "] with command line "
                      + Arrays.toString(process.getCommandLine())
                      + " cannot be discovered, because it does not specify "
                      + "-D" + resourceKeyProperty + "=UNIQUE_KEY");
            }
        }
        return context.getResourceType().getName() + "{" + keyString + "}";
    }
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:23,代码来源:ArtemisServerDiscoveryComponent.java


示例3: populateResourceProperties

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
protected boolean populateResourceProperties(ResourceDiscoveryContext context, DiscoveredResourceDetails details) {

        // verify values for system properties group if process is not set, or get them from process if set
        List<PropertyDefinition> group = details.getResourceType().getPluginConfigurationDefinition().
              getPropertiesInGroup(SYSTEM_PROPERTIES_GROUP);

        final ProcessInfo processInfo = details.getProcessInfo();
        final Configuration pluginConfiguration = details.getPluginConfiguration();

        for (PropertyDefinition property : group) {
            final String name = property.getName();
            if (processInfo == null) {
                // make sure required system property is set
                final String value = pluginConfiguration.getSimpleValue(name);
                if (value == null || value.isEmpty()) {
                    throw new InvalidPluginConfigurationException("Missing system property " + name);
                }
            } else {
                pluginConfiguration.setSimpleValue(name, getSystemPropertyValue(processInfo, name));
            }
        }

        return true;
    }
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:25,代码来源:ArtemisServerDiscoveryComponent.java


示例4: substituteConfigProperties

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
private String substituteConfigProperties(String objectName, Configuration configuration, boolean isParent) {

        final Pattern p;
        if (isParent) {
            p = PROPERTY_NAME_PATTERN;
        } else {
            p = OBJECT_NAME_PROPERTY_PATTERN;
        }

        StringBuffer buffer = new StringBuffer();
        final Matcher m = p.matcher(objectName);
        while (m.find()) {
            String name = m.group(1);
            m.appendReplacement(buffer, configuration.getSimpleValue(name));
        }
        m.appendTail(buffer);
        return buffer.toString();
    }
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:19,代码来源:ArtemisMBeanDiscoveryComponent.java


示例5: discoverResources

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
public Set discoverResources(ResourceDiscoveryContext context) throws InvalidPluginConfigurationException,
    Exception {

    Set<DiscoveredResourceDetails> result = new HashSet<DiscoveredResourceDetails>();

    String key = "Metrics";
    String name = key;
    String description = "Jboss-Automated-Metrics";
    Configuration configuration = null;
    ResourceType resourceType = context.getResourceType();
    DiscoveredResourceDetails detail = new DiscoveredResourceDetails(resourceType, key, name, null, description,
        configuration, null);

    result.add(detail);

    return result;
}
 
开发者ID:panossot,项目名称:jam-metrics,代码行数:18,代码来源:MetricsDiscoveryComponent.java


示例6: invokeOperation

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public OperationResult invokeOperation(final String name, final Configuration parameters) throws InterruptedException, Exception {
    if (OPERATION_RESET.equals(name)) {
        final Reference reference = getReference();
        final Application application = getApplication();
        if ((reference != null) && (application != null)) {
            final String referenceName = reference.getName().toString();
            final String applicationName = application.getName().toString();
            execute(new ResetReferenceMetrics(applicationName, referenceName), Void.class);
            clearReferenceMetrics();
        }
    } else if (LOG.isDebugEnabled()) {
        LOG.warn("Unknown Referencs operation " + name);
    }
    return null;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:ReferenceResourceComponent.java


示例7: invokeOperation

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public OperationResult invokeOperation(final String name, final Configuration parameters) throws InterruptedException, Exception {
    if (OPERATION_RESET.equals(name)) {
        final ComponentService componentService = getComponentService();
        final Application application = getApplication();
        if ((componentService != null) && (application != null)) {
            final String componentServiceName = componentService.getName().toString();
            final String applicationName = application.getName().toString();
            execute(new ResetComponentServiceMetrics(applicationName, componentServiceName), Void.class);
            clearComponentServiceMetrics();
        }
    } else if (LOG.isDebugEnabled()) {
        LOG.warn("Unknown Component Service operation " + name);
    }
    return null;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:ComponentServiceResourceComponent.java


示例8: discoverResources

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
/**
 * Discover existing resources.
 * 
 * @param context
 *            The context for the current discovery component.
 * @return The discovered resources.
 */
@Override
public Set<DiscoveredResourceDetails> discoverResources(final ResourceDiscoveryContext<BaseComponent<?>> context) {

    final HashSet<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();

    final GetVersionResult result = execute(context.getParentResourceComponent(), new GetVersion(), GetVersionResult.class);

    if (result != null) {
        final Configuration pluginConfig = context.getDefaultPluginConfiguration();

        final DiscoveredResourceDetails resource = new DiscoveredResourceDetails(
                context.getResourceType(), KEY_SWITCH_YARD,
                NAME_SWITCH_YARD, result.getVersion(),
                DESCRIPTION_SWITCH_YARD, pluginConfig, null);

        discoveredResources.add(resource);

        if (LOG.isDebugEnabled()) {
            LOG.debug("Discovered SwitchYard subsystem for " + context.getPluginContainerName());
        }
    }

    return discoveredResources;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:32,代码来源:SwitchYardDiscoveryComponent.java


示例9: doStart

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
protected void doStart() throws InvalidPluginConfigurationException {
    dataSourceComponent = getParent();
    adminOperations = dataSourceComponent.getServer().getMBeanClient("WebSphere:type=AdminOperations,*").getProxy(AdminOperations.class);
    Configuration config = getResourceContext().getPluginConfiguration();
    principal = config.getSimpleValue("principal", null);
    credentials = config.getSimpleValue("credentials", null);
    try {
        Class.forName("com.ibm.db2.jcc.DB2SimpleDataSource");
    } catch (ClassNotFoundException ex) {
        log.error("DB2 monitor unavailable: JDBC driver not present in the class path");
        throw new Error(ex);
    }
    if (principal != null) {
        measurementFacetSupport = new MeasurementFacetSupport(this);
        measurementFacetSupport.setDefaultHandler(new SnapshotMeasurementGroupHandler(this, adminOperations));
        measurementFacetSupport.addHandler("acr", new ACRMeasurementGroupHandler(this));
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:19,代码来源:DB2MonitorComponent.java


示例10: loadResourceConfiguration

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
public Configuration loadResourceConfiguration() throws Exception {
    Configuration config = new Configuration();
    Map<String,Object> dsProps = getContext().getDataSourceProperties();
    config.put(new PropertySimple("primary", dsProps.get("serverName") + ":" + dsProps.get("portNumber")));
    String alternateServerName = (String)dsProps.get("clientRerouteAlternateServerName");
    if (alternateServerName != null && alternateServerName.length() > 0) {
        config.put(new PropertySimple("alternate", alternateServerName + ":" + dsProps.get("clientRerouteAlternatePortNumber")));
    } else {
        config.put(new PropertySimple("alternate", null));
    }
    config.put(new PropertySimple("databaseName", (String)dsProps.get("databaseName")));
    if (log.isDebugEnabled()) {
        log.debug("Loaded resource configuration: " + config.toString(true));
    }
    return config;
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:17,代码来源:DB2MonitorComponent.java


示例11: initializeLoggingProvider

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
private void initializeLoggingProvider(Configuration pluginConfiguration) throws Error {
	loggingProviderName = pluginConfiguration.getSimpleValue("loggingProvider", "none");
	Class<? extends LoggingProvider> loggingProviderClass = loggingProviderClasses.get(loggingProviderName);
	if (loggingProviderClass == null) {
		throw new InvalidPluginConfigurationException("Unknown logging provider '" + loggingProviderName + "'");
	}
	if (log.isDebugEnabled()) {
		log.debug("Creating logging provider: name=" + loggingProviderName + ", class="
				+ loggingProviderClass.getName());
	}
	try {
		loggingProvider = loggingProviderClass.newInstance();
	} catch (Exception ex) {
		throw new Error("Failed to instantiate " + loggingProviderClass, ex);
	}
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:17,代码来源:WebSphereServerComponent.java


示例12: getEmsConnection

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public synchronized EmsConnection getEmsConnection() {
       if (connection == null) {
           Configuration pluginConfig = getResourceContext().getPluginConfiguration();
           ConnectionSettings connectionSettings = new ConnectionSettings();
           connectionSettings.setServerUrl(pluginConfig.getSimpleValue("host", null) + ":" + pluginConfig.getSimpleValue("port", null));
           ConnectionProvider connectionProvider = new WebsphereConnectionProvider(server.getAdminClient());
           // The connection settings are not required to establish the connection, but they
           // will still be used in logging:
           connectionProvider.initialize(connectionSettings);
           connection = connectionProvider.connect();
           
           // If this is not present, then EmbeddedJMXServerDiscoveryComponent will fail to
           // discover the platform MXBeans.
           connection.loadSynchronous(false);
       }
       return connection;
   }
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:19,代码来源:WebSphereServerComponent.java


示例13: invokeOperation

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception {
       if (name.equals("restart")) {
           Server server = getServer().getServerMBean().getProxy(Server.class);
           server.restart();
       } else if (name.equals("pauseAllMessageEndpoints")) {
           changeMessageEndpointState(true);
       } else if (name.equals("resumeAllMessageEndpoints")) {
           changeMessageEndpointState(false);
       } else if (name.equals("appendTraceString")) {
           TraceService traceService = getServer().getMBeanClient("WebSphere:type=TraceService,*").getProxy(TraceService.class);
           traceService.appendTraceString(parameters.getSimpleValue("traceString", null));
       } else if (name.equals("generateSystemDump")) {
           boolean performGC = Boolean.valueOf(parameters.getSimpleValue("performGC"));
           // Use WebSphere's MBean if possible (because XM4WAS may not be installed on the target server)
           if (performGC) {
               wasJvm.generateSystemDump();
           } else {
               xm4wasJvm.generateSystemDump(false);
           }
       }
       return null;
   }
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:24,代码来源:WebSphereServerComponent.java


示例14: discoverResource

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration, ResourceDiscoveryContext<ResourceComponent<?>> discoveryContext) throws InvalidPluginConfigurationException {
    ObjectName serverBeanName;
    try {
        AdminClient adminClient = new SecureAdminClientProvider(new ConfigurationBasedProcessLocator(pluginConfiguration)).createAdminClient();
        serverBeanName = adminClient.getServerMBean();
    } catch (ConnectorException ex) {
        throw new InvalidPluginConfigurationException("Unable to connect to server", ex);
    }
    String cell = serverBeanName.getKeyProperty("cell");
    String node = serverBeanName.getKeyProperty("node");
    String process = serverBeanName.getKeyProperty("process");
    String processType = serverBeanName.getKeyProperty("processType");
    boolean unmanaged;
    if (processType.equals("ManagedProcess")) {
        unmanaged = false;
    } else if (processType.equals("UnManagedProcess")) {
        unmanaged = true;
    } else {
        throw new InvalidPluginConfigurationException("Unsupported process type " + processType);
    }
    pluginConfiguration.getSimple("unmanaged").setBooleanValue(unmanaged);
    return new DiscoveredResourceDetails(discoveryContext.getResourceType(), cell + "/" + node + "/" + process,
            process, null, process + " (cell " + cell + ", node " + node + ")", pluginConfiguration, null);
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:25,代码来源:WebSphereServerDiscoveryComponent.java


示例15: invoke

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
public ControlResults invoke(String name, Configuration conf) {
    log.debug("invoke " + name);
    try {
        if (name.equals("ackup")) {
            String subject = conf.getSimpleValue("subject", "rhq");
            ackup(subject);
        } else if (name.equals("refire")) {
            refire();
        } else {
            throw new IllegalArgumentException(name);
        }
        return new ControlResults();
    } catch (Exception e) {
        log.error("failed to invoke " + name, e);
        ControlResults cr = new ControlResults();
        cr.setError(e);
        return cr;
    }
}
 
开发者ID:genman,项目名称:rhq-server-plugins,代码行数:21,代码来源:AlertCleanup.java


示例16: directory

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Test
public void directory() throws Exception {
    ResourceType type = getResourceType(HTTP_SERVER);
    Configuration configuration = new Configuration();
    configuration.setSimpleValue("url", "file:/tmp/");
    ResourceComponent component = manuallyAdd(type, configuration);
    assertUp(component);
    MeasurementReport report = getMeasurementReport(component);
    log.info("root directory " + map(report));

    /* TODO mkdir /tmp/bbb and run
    Configuration conf2 = new Configuration();
    conf2.setSimpleValue("url", "bbb");
    HttpComponent component2 = (HttpComponent) manuallyAdd(type, conf2, component);
    assertEquals("file:/tmp/bbb", component2.getUrl());
    log.info("tmp directory " + map(report));
    */
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:19,代码来源:ServerComponentTest.java


示例17: discoverResource

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
/**
 * Manual discovery
 */
@Override
public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
              ResourceDiscoveryContext ctx) throws InvalidPluginConfigurationException {

    String url = pluginConfiguration.getSimpleValue(HiveServerComponent.JDBC_URL, null);
    url = HiveServerComponent.scrub(url);
    String key = "Hive Server " + url;
    String name = key;
    String description = "Hive Server connecting to " + url;
    ResourceType resourceType = ctx.getResourceType();
    DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceType, key, name, null, description,
        pluginConfiguration, null);

    return details;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:19,代码来源:HiveServerDiscovery.java


示例18: before

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
@Override
protected void before() throws Exception {
    String path = "hdfs://hostname/data/iad/stg_uuid_cmp/period=daily/dt=2011-07-14/part=requests";
    assertEquals("/data/iad/stg_uuid_cmp", HiveTable.fixPath(path));

    path = "hdfs://hostname/data/iad/stg_uuid_cmp/period=daily and not so daily";
    assertEquals("/data/iad/stg_uuid_cmp", HiveTable.fixPath(path));

    assertEquals("/data/iad/stg_batch_txn_log", HiveTable.fixPath("/data/iad/stg_batch_txn_log/2011-11-04/201111040900"));
    assertEquals("/data/iad/iad_iadid_bot_stats_t", HiveTable.fixPath("/data/iad/iad_iadid_bot_stats_t/dt=$%7BDATE1}"));

    setProcessScan(false);
    super.before();
    ResourceType resourceType = getResourceType(name);
    Configuration configuration = getConfiguration(resourceType);
    set(configuration, "fs.default.name", "hdfs://vp25q03ad-hadoop091.iad.apple.com:8020/");
    set(configuration, "jdbc.url", "jdbc:mysql://vp25q03ad-hadoopfeeder011:3306/metastore_iadse?user=hive&password=hive");
    set(configuration, "table.match", "stg_uuid_cmp.*");
    hive = (HiveServerComponent) manuallyAdd(resourceType, configuration);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:21,代码来源:HiveTest.java


示例19: discoverResource

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
/**
 * Manual add facet.
 */
@Override
public DiscoveredResourceDetails discoverResource(
        Configuration conf,
        ResourceDiscoveryContext<NameNodeComponent> context)
        throws InvalidPluginConfigurationException
{
    String path = conf.getSimpleValue(PATH, "/");
    String name = "NameNode FSCK " + path;
    String key = path;
    String description = name;
    ResourceType resourceType = context.getResourceType();
    DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceType, key, name, null, description,
        conf, null);
    return details;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:19,代码来源:NameNodeFsckDiscovery.java


示例20: discoverResource

import org.rhq.core.domain.configuration.Configuration; //导入依赖的package包/类
/**
 * Manual add facet.
 */
@Override
public DiscoveredResourceDetails discoverResource(
        Configuration conf,
        ResourceDiscoveryContext context)
        throws InvalidPluginConfigurationException
{
    String url = conf.getSimpleValue("url");
    if (url == null)
        throw new InvalidPluginConfigurationException("url");
    String name = "PathInfo " + url;
    String key = url;
    String description = name;
    ResourceType resourceType = context.getResourceType();
    DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceType, key, name, null, description,
        conf, null);
    return details;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:21,代码来源:PathDiscovery.java



注:本文中的org.rhq.core.domain.configuration.Configuration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DemuxingProtocolCodecFactory类代码示例发布时间:2022-05-22
下一篇:
Java AbstractXMLStreamWriter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap