modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
| 66 --------
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
| 81 ----------
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
| 10 -
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 73 ++++++---
4 files changed, 49 insertions(+), 181 deletions(-)
New commits:
commit 64d1a7cc342250063d5325aba89fed454c73cd45
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jun 1 17:59:12 2012 -0500
[BZ 827636] Updated Cache component and parents to use generic component code since
the functionality required was implemented in a generic fashion.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
deleted file mode 100644
index aec501b..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.modules.plugins.jbossas7.json.Address;
-import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.Result;
-
-/**
- * // TODO: Document this
- * @author Heiko W. Rupp
- */
-public class IspnCContainerComponent extends BaseComponent implements
CreateChildResourceFacet{
- static final String FLAVOR = "_flavor";
-
-// private final Log log = LogFactory.getLog(IspnCContainerComponent.class);
-
- /**
- * Create embedded cache elements
- * Ttick is to take the _flavor property and turn it into a part of the path
- * @param report contains all of the necessary information to create the specified
resource and should be populated
- * with the
- *
- * @return
- */
- @Override
- public CreateResourceReport createResource(CreateResourceReport report) {
-
- Configuration config = report.getResourceConfiguration();
- String flavor = config.getSimpleValue(FLAVOR,null);
- if (flavor==null) {
- report.setStatus(CreateResourceStatus.INVALID_CONFIGURATION);
- report.setErrorMessage("No flavor given");
-
- return report;
- }
- String newName = report.getUserSpecifiedResourceName();
- Address address = new Address(this.address);
- address.add(flavor,newName);
- Operation add = new Operation("add",address);
- for (Property prop: config.getProperties()) {
- if (prop.getName().equals(FLAVOR)) {
- continue;
- }
- PropertySimple ps = (PropertySimple) prop;
- add.addAdditionalProperty(prop.getName(),ps.getStringValue()); // TODO format
conversion?
-
- }
- Result result = getASConnection().execute(add);
- if (result.isSuccess()) {
- report.setResourceKey(address.getPath());
- report.setResourceName(address.getPath());
- report.setStatus(CreateResourceStatus.SUCCESS);
- }
- else {
- report.setErrorMessage(result.getFailureDescription());
- report.setStatus(CreateResourceStatus.FAILURE);
- }
-
- return report;
- }
-}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
deleted file mode 100644
index c6de975..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.modules.plugins.jbossas7;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-
-/**
- * Component class for Infinispan caches
- * @author Heiko W. Rupp
- */
-public class IspnCacheComponent extends BaseComponent implements ConfigurationFacet {
-
-
- @Override
- public void getValues(MeasurementReport report, Set metrics) throws Exception {
-
- Set<MeasurementScheduleRequest> requests = metrics;
- Set<MeasurementScheduleRequest> todo = new
HashSet<MeasurementScheduleRequest>();
-
- for (MeasurementScheduleRequest req: requests) {
- if (req.getName().equals("__flavor")) {
- String flavor = getCacheFlavorFromPath();
- MeasurementDataTrait trait = new MeasurementDataTrait(req,flavor);
- report.addData(trait);
- }
- else
- todo.add(req);
- }
-
-
- super.getValues(report, todo);
- }
-
- private String getCacheFlavorFromPath() {
- String flavor = path.substring(path.lastIndexOf(",")+1);
- flavor = flavor.substring(0,flavor.indexOf("="));
- return flavor;
- }
-
- @Override
- public Configuration loadResourceConfiguration() throws Exception {
- Configuration config = super.loadResourceConfiguration();
- String f = getCacheFlavorFromPath();
- PropertySimple flavor = new PropertySimple(IspnCContainerComponent.FLAVOR,f);
- config.put(flavor);
- return config;
- }
-
- @Override
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-
- report.getConfiguration().remove(IspnCContainerComponent.FLAVOR);
-
- super.updateResourceConfiguration(report);
- }
-}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
deleted file mode 100644
index bf809cf..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.rhq.modules.plugins.jbossas7;
-
-/**
- * Component class for Infinispan
- * @author Heiko W. Rupp
- */
-public class IspnComponent extends BaseComponent {
-
-
-}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index ec17e84..ffc0246 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1899,7 +1899,7 @@
<service name="Infinispan (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnComponent"
+ class="BaseComponent"
singleton="true">
<plugin-configuration>
@@ -1909,7 +1909,7 @@
<service name="Cache Container (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnCContainerComponent">
+ class="TemplatedSubResourcesComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="cache-container"/>
@@ -1936,21 +1936,13 @@
<service name="Cache (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnCacheComponent">
+ class="TemplatedComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="distributed-cache|local-cache|invalidation-cache|replicated-cache"/>
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="_flavor" displayName="Kind of
cache" required="true" readOnly="true"
default="local-cache" description="What special kind of cache is
this.">
- <c:property-options>
- <c:option value="local-cache"/>
- <c:option value="invalidation-cache"/>
- <c:option value="distributed-cache"/>
- <c:option value="replicated-cache"/>
- </c:property-options>
- </c:simple-property>
<c:simple-property name="start" required="false"
type="string" readOnly="true" default="LAZY"
description="The cache start mode, which can be EAGER (immediate start) or LAZY
(on-demand start).">
<c:property-options>
<c:option value="LAZY"/>
@@ -1980,6 +1972,27 @@
<c:simple-property name="module" required="false"
type="string" readOnly="true" description="The module whose class
loader should be used when building this cache's configuration."/>
<c:simple-property name="owners" required="false"
type="integer" readOnly="true" defaultValue="2"
description="Number of cluster-wide replicas for each cache entry. The
default value is 2."/>
<c:simple-property name="virtual-nodes"
required="false" type="integer" readOnly="true"
defaultValue="1" description="Controls the number of virtual nodes per
'real' node. If numVirtualNodes is 1, then virtual nodes are disabled.
The topology aware consistent hash must be used if you wish to take advantage of virtual
nodes. A default of 1 is used. The default value is 1."/>
+
+ <c:simple-property name="__type" displayName="Type of
cache" required="true" readOnly="true"
default="local-cache" description="Type of cache">
+ <c:property-options>
+ <c:option value="local-cache"/>
+ <c:option value="invalidation-cache"/>
+ <c:option value="distributed-cache"/>
+ <c:option value="replicated-cache"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Local Cache" description="Local
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="local-cache"/>
+ </c:template>
+ <c:template name="Invalidation Cache"
description="Invalidation Cache">
+ <c:simple-property name="__type" readOnly="true"
default="invalidation-cache"/>
+ </c:template>
+ <c:template name="Distributed Cache"
description="Distributed Cache">
+ <c:simple-property name="__type" readOnly="true"
default="distributed-cache"/>
+ </c:template>
+ <c:template name="Replicated Cache" description="Replicated
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="replicated-cache"/>
+ </c:template>
</resource-configuration>
</service>
@@ -11090,7 +11103,7 @@
<service name="Infinispan"
discovery="SubsystemDiscovery"
- class="IspnComponent"
+ class="BaseComponent"
singleton="true">
<runs-inside>
@@ -11104,7 +11117,7 @@
<service name="Cache Container"
discovery="SubsystemDiscovery"
- class="IspnCContainerComponent"
+ class="TemplatedSubResourcesComponent"
createDeletePolicy="both"
creationDataType="configuration">
@@ -11133,7 +11146,7 @@
<service name="Cache"
discovery="SubsystemDiscovery"
- class="IspnCacheComponent"
+ class="TemplatedComponent"
createDeletePolicy="both"
creationDataType="configuration">
@@ -11142,14 +11155,6 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="_flavor" displayName="Kind of
cache" required="true" readOnly="true"
default="local-cache" description="What special kind of cache is
this.">
- <c:property-options>
- <c:option value="local-cache"/>
- <c:option value="invalidation-cache"/>
- <c:option value="distributed-cache"/>
- <c:option value="replicated-cache"/>
- </c:property-options>
- </c:simple-property>
<c:simple-property name="start" required="false"
type="string" readOnly="false" default="LAZY"
description="The cache start mode, which can be EAGER (immediate start) or LAZY
(on-demand start).">
<c:property-options>
<c:option value="LAZY"/>
@@ -11165,7 +11170,7 @@
</c:property-options>
</c:simple-property>
<c:simple-property name="jndi-name" required="false"
type="string" readOnly="false" description="The jndi-name to
which to bind this cache instance."/>
- <c:simple-property name="mode" required="false"
type="string" readOnly="true" default="SYNC"
description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC
for synchronous operation.">
+ <c:simple-property name="mode" required="true"
type="string" readOnly="false" default="SYNC"
description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC
for synchronous operation.">
<c:property-options>
<c:option value="SYNC"/>
<c:option value="ASYNC"/>
@@ -11174,12 +11179,32 @@
<c:simple-property name="queue-size" required="false"
type="integer" readOnly="false" default="0"
description="In ASYNC mode, this attribute can be used to trigger flushing of the
queue when it reaches a specific threshold."/>
<c:simple-property name="queue-flush-interval"
required="false" type="long" readOnly="false"
default="10" description="In ASYNC mode, this attribute controls how often
the asynchronous thread used to flush the replication queue runs. This should be a
positive integer which represents thread wakeup time in milliseconds."/>
<c:simple-property name="remote-timeout"
required="false" type="long" readOnly="false"
default="17500" description="In SYNC mode, the timeout (in ms) used to wait
for an acknowledgment when making a remote call, after which the call is aborted and an
exception is thrown."/>
-
<c:simple-property name="async-marshalling"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="If enabled, this will cause marshalling
of entries to be performed asynchronously. The default value is false."/>
<c:simple-property name="l1-lifespan" required="false"
type="long" readOnly="false" defaultValue="600000"
description="Maximum lifespan of an entry placed in the L1 cache. This element
configures the L1 cache behavior in 'distributed' caches instances. In
any other cache modes, this element is ignored. The default value is 600000."/>
<c:simple-property name="module" required="false"
type="string" readOnly="false" description="The module whose
class loader should be used when building this cache's configuration."/>
<c:simple-property name="owners" required="false"
type="integer" readOnly="false" defaultValue="2"
description="Number of cluster-wide replicas for each cache entry. The
default value is 2."/>
<c:simple-property name="virtual-nodes" required="false"
type="integer" readOnly="false" defaultValue="1"
description="Controls the number of virtual nodes per 'real' node.
If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent
hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used.
The default value is 1."/>
+
+ <c:simple-property name="__type" displayName="Type of
cache" required="true" readOnly="true"
default="local-cache" description="Type of cache">
+ <c:property-options>
+ <c:option value="local-cache"/>
+ <c:option value="invalidation-cache"/>
+ <c:option value="distributed-cache"/>
+ <c:option value="replicated-cache"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Local Cache" description="Local
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="local-cache"/>
+ </c:template>
+ <c:template name="Invalidation Cache"
description="Invalidation Cache">
+ <c:simple-property name="__type" readOnly="true"
default="invalidation-cache"/>
+ </c:template>
+ <c:template name="Distributed Cache" description="Distributed
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="distributed-cache"/>
+ </c:template>
+ <c:template name="Replicated Cache" description="Replicated
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="replicated-cache"/>
+ </c:template>
</resource-configuration>
</service>