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


Java Configuration类代码示例

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


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


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