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


Java Configuration.setSimpleValue方法代码示例

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


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

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

示例2: discoverResources0

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
private Set<DiscoveredResourceDetails> discoverResources0(
        ResourceDiscoveryContext resourceDiscoveryContext) throws Exception {

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

    @SuppressWarnings("unchecked")
    List<ProcessScanResult> parentProcessScans = resourceDiscoveryContext.getAutoDiscoveredProcesses();
    log.debug("process scans " + parentProcessScans);

    for (ProcessScanResult psr : parentProcessScans) {
        ProcessInfo pi = psr.getProcessInfo();

        String[] commandLineArgs = pi.getCommandLine();
        URL url = getUrl(commandLineArgs);
        Configuration conf = resourceDiscoveryContext.getDefaultPluginConfiguration();
        conf.setSimpleValue("url", url.toString());
        DiscoveredResourceDetails detail = super.discoverResource(conf, resourceDiscoveryContext);

        log.info("Discovered " + detail);
        log.info("plugin configuration " + detail.getPluginConfiguration());
        details.add(detail);
    }

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

示例3: testArg

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Test(enabled=false)
public void testArg() throws Exception {
    ResourceType rt = getResourceType(name);
    Configuration c = new Configuration();
    c.setSimpleValue("url", "http://" + host + ":9090/ws/v1/about");
    GWComponent gw = (GWComponent) manuallyAdd(rt, c);
    components.remove(gw); // affects other tests

    gw.discovered(new String[0]);
    assertEquals(host, gw.getUrl().getHost());

    File file = File.createTempFile("dttest", ".txt");
    file.deleteOnExit();
    FileWriter fw = new FileWriter(file);
    gw.discovered(new String[] { "blah", "-findport", file.getAbsolutePath(), "bbb" });
    assertEquals(host, gw.getUrl().getHost());

    fw.write("xyz:123\n");
    fw.close();
    gw.discovered(new String[] { "blah", "-findport", file.getAbsolutePath(), "bbb" });

    assertEquals("xyz", gw.getUrl().getHost());
    assertEquals(123, gw.getUrl().getPort());
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:25,代码来源:DataTorrentTest.java

示例4: before

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Override
protected void before() throws Exception {
    log.info("before");
    com.timesten.jdbc.Logger.setLogWriter(new PrintWriter(System.out));
    super.before();

    ResourceType rt = getResourceType(TIMES_TEN);
    Configuration configuration = getConfiguration(rt);
    String url = System.getProperty("jdbc.url", "jdbc:timesten:client:ttc_server=vp25q03ad-oracle034.iad.apple.com;tcp_port=53397;dsn=vp2_master2");
    configuration.setSimpleValue(URL, url);
    configuration.setSimpleValue(USERNAME, "iadm");
    configuration.setSimpleValue(PASSWORD, "iadm");
    configuration.setSimpleValue("java.library.path", "iadm");
    log.info(configuration.getProperties());

    server = manuallyAdd(rt, configuration);
    assertNotNull(server);

    MeasurementReport report = getMeasurementReport(server);
    assertAll(report, getResourceDescriptor(rt));
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:22,代码来源:TimesTenTest.java

示例5: testIt

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
public void testIt() throws Exception {
    TestAgent ta = new TestAgent(port);
    ta.start();
    Configuration c = new Configuration();
    c.setSimpleValue("transportAddress", "localhost/" + port);
    c.setSimpleValue("version", "1");
    SnmpComponent snmp = new SnmpComponent(c);

    log.info("SNMP get");
    Variable v = snmp.get(SnmpConstants.sysUpTime);

    OID oid = new OID(TestAgent.sysOID).append(new OID("1.0"));
    ta.register(oid);

    VariableBinding vb = new VariableBinding(oid, new OctetString(HI));
    log.info("SNMP set " + oid);
    snmp.set(vb);

    log.info("SNMP get " + oid);
    v = snmp.get(oid);
    assertEquals(HI, v.toString());

    log.info("SNMP stop");
    snmp.stop();
    ta.stop();
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:27,代码来源:TestAgentTest.java

示例6: measurements

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Test
public void measurements() throws Exception {
    log.info("measurements");
    assertUp(rc);
    ResourceDescriptor rd = getResourceDescriptor(du);
    MeasurementReport report = getMeasurementReport(rc);
    log.info("testing " + du);
    log.info("numeric " + report.getNumericData());
    assertAll(report, rd);
    assertUp(rc);

    ResourceType dut = getResourceType(du);
    Configuration config = getConfiguration(dut);
    config.setSimpleValue("dir", System.getProperty("java.home"));
    config.setSimpleValue("args", "--bad-arg");
    rc = manuallyAdd(dut, config);
    assertUp(rc);
    try {
        report = getMeasurementReport(rc);
        fail("output issue");
    } catch (Exception e) {}

    ((DUComponent)rc).setDir("/invalid_dir_1231232131");
    assertDown(rc);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:26,代码来源:DUTest.java

示例7: invokeOperation

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception {
    String extract = parameters.getSimpleValue("extract", "");
    if (name.equals("test")) {
        URL url = getUrl();
        boolean success = testUrl(url);
        OperationResult operationResult = new OperationResult();
        Configuration c = operationResult.getComplexResults();
        c.setSimpleValue("success", Boolean.toString(success));
        c.setSimpleValue("responseCode", String.valueOf(responseCode));
        c.setSimpleValue("url", url.toString());
        c.setSimpleValue("request", getRequestBodyString());
        if (!extract.isEmpty()) {
            Object value = getMeasurementProvider().extractValue(extract);
            c.setSimpleValue("response", value != null ? value.toString() : "");
        } else {
            c.setSimpleValue("response", body);
        }
        return operationResult;
    }
    throw new UnsupportedOperationException();
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:23,代码来源:HttpComponent.java

示例8: xpathOperation

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Test(dependsOnMethods={"up"})
public void xpathOperation() throws Exception {
    log.info("xml; xpath operation");
    body = "<i><t>999</t></i>";
    component.setFormat(HttpComponent.Format.xml);
    Configuration parameters = new Configuration();
    parameters.setSimpleValue("extract", xpath);
    OperationResult result = component.invokeOperation("test", parameters);
    Configuration conf = result.getComplexResults();
    log.debug("RESULT " + conf.getMap());
    assertEquals("true", conf.getSimpleValue("success"));
    assertEquals("999", conf.getSimpleValue("response"));
    assertEquals("", conf.getSimpleValue("request"));
    assertEquals("200", conf.getSimpleValue("responseCode"));

    parameters.setSimpleValue("extract", null);
    result = component.invokeOperation("test", parameters);
    conf = result.getComplexResults();
    assertEquals(body, conf.getSimpleValue("response"));
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:21,代码来源:ServerComponentTest.java

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

示例10: processStatsObjectName

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
private void processStatsObjectName(ResourceDiscoveryContext discoveryContext, DiscoveredResourceDetails details) {
    final Configuration pluginConfiguration = details.getPluginConfiguration();
    final Configuration parentConfiguration = (discoveryContext.getParentResourceContext() != null) ?
        discoveryContext.getParentResourceContext().getPluginConfiguration() : null;
    String statsObjectName = pluginConfiguration.getSimpleValue(STATS_OBJECT_NAME_PROPERTY);
    if (statsObjectName != null) {
        // get stats object name and substitute resource and parent properties
        statsObjectName = substituteConfigProperties(statsObjectName, pluginConfiguration, false);
        if (parentConfiguration != null) {
            statsObjectName = substituteConfigProperties(statsObjectName, parentConfiguration, true);
        }
        pluginConfiguration.setSimpleValue(STATS_OBJECT_NAME_PROPERTY, statsObjectName);
    }
}
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:15,代码来源:ArtemisMBeanDiscoveryComponent.java

示例11: start

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void start(ResourceContext context)
        throws InvalidPluginConfigurationException, Exception {
    JobsComponent parent = (JobsComponent) context.getParentResourceComponent();
    name = context.getResourceKey();
    Configuration c = new Configuration();
    c.setSimpleValue(HttpComponent.PLUGINCONFIG_URL, "/oozie/v1/jobs?filter=name%3D" + name + "&len=2");
    c.setSimpleValue(HttpComponent.PLUGINCONFIG_FORMAT, Format.jsonTree.name());
    this.jobStatus = new HttpComponent<ResourceComponent<?>>(c, parent);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:11,代码来源:WorkflowComponent.java

示例12: setConfiguration

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Override
protected void setConfiguration(Configuration configuration, ResourceType resourceType) {
    if (resourceType.getName().equals(name)) {
        log.info("setConfiguration " + port);
        Configuration c = resourceType.getPluginConfigurationDefinition().getDefaultTemplate().
            getConfiguration();
        c.setSimpleValue("transportAddress", "localhost/" + port);
        c.setSimpleValue("timeout", "100");
    }
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:11,代码来源:SnmpDiscoveryTest.java

示例13: test

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
public void test() throws Exception {
    ResourceType resourceType = getResourceType("JMX Server");
    Configuration config = getConfiguration(resourceType);
    config.setSimpleValue("type", "org.mc4j.ems.connection.support.metadata.InternalVMTypeDescriptor");
    config.setSimpleValue("connectorAddress", "vm");
    manuallyAdd(resourceType, config);
    ResourceComponent c = getComponent("JLang");
    assertUp(c);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:10,代码来源:DiscoveryTest.java

示例14: getDetailTree

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Returns JSON tree for details.
 * @throws Exception if JSON could not be obtained
 */
public Map<String, Object> getDetailTree() throws Exception {
    if (opId == null) {
        getAvailability();
    }
    String path = String.format(OPERATOR_PATH, getAppId(), opId);
    Configuration config = new Configuration();
    config.setSimpleValue(HttpComponent.PLUGINCONFIG_URL, path);
    config.setSimpleValue(HttpComponent.PLUGINCONFIG_FORMAT, Format.jsonTree.name());
    HttpComponent detail = new HttpComponent(config, app);
    MeasurementProvider mp = detail.getMeasurementProvider();
    JSONTreeProvider jtp = (JSONTreeProvider) mp;
    return (Map<String, Object>)jtp.getTree();
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:18,代码来源:OperatorComponent.java

示例15: before

import org.rhq.core.domain.configuration.Configuration; //导入方法依赖的package包/类
@Override
protected void before() throws Exception {
    super.before();

    ResourceType type = getResourceType(name);
    Configuration configuration = getConfiguration(type);
    String url = configuration.getSimpleValue("url").replaceAll("hostname", host);
    configuration.setSimpleValue("url", url);

    gw = manuallyAdd(type, configuration);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:12,代码来源:DataTorrentTest.java


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