[rhq] Branch 'drift' - modules/core modules/enterprise
by mazz
modules/core/domain/src/test/resources/org/rhq/core/domain/resource/ResourceTypeTest.xml | 1
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java | 22 +++++-----
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java | 12 +++++
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml | 15 ++++++
7 files changed, 41 insertions(+), 12 deletions(-)
New commits:
commit a961fe3de368abefa8ed7be38aaec31d79d1544a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 17:55:47 2011 -0400
add drift config metadata test
fix the main assert test method - it wasn't doing anything and actually provided false positives
after I fixed that, there was a test that was actually failing that I fixed (persistChildTypes)
diff --git a/modules/core/domain/src/test/resources/org/rhq/core/domain/resource/ResourceTypeTest.xml b/modules/core/domain/src/test/resources/org/rhq/core/domain/resource/ResourceTypeTest.xml
index 724b561..f649d64 100644
--- a/modules/core/domain/src/test/resources/org/rhq/core/domain/resource/ResourceTypeTest.xml
+++ b/modules/core/domain/src/test/resources/org/rhq/core/domain/resource/ResourceTypeTest.xml
@@ -102,6 +102,7 @@
<rhq_drift_template id="-2"
resource_type_id="-8"
config_template_id="-2"/>
+ <rhq_drift_template_map/>
<rhq_resource/>
<rhq_resource_group/>
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java
index 7182555..c0c6e27 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java
@@ -43,7 +43,7 @@ public class MetadataBeanTest extends AbstractEJB3Test {
private static List<String> plugins = new ArrayList<String>();
- @BeforeGroups(groups = {"plugin.metadata"}, dependsOnGroups = {"integration.ejb3"})
+ @BeforeGroups(groups = { "plugin.metadata" }, dependsOnGroups = { "integration.ejb3" })
public void startMBeanServer() throws Exception {
setupDB();
@@ -58,14 +58,13 @@ public class MetadataBeanTest extends AbstractEJB3Test {
* at what plugins are in the database, and then look for corresponding plugin files on the file system. MetadataTest
* however removes the generated plugin files during each test run.
*/
- @AfterGroups(groups = {"plugin.metadata"})
+ @AfterGroups(groups = { "plugin.metadata" })
void removePluginsFromDB() throws Exception {
unprepareScheduler();
getTransactionManager().begin();
- getEntityManager().createQuery("delete from Plugin p where p.name in (:plugins)")
- .setParameter("plugins", plugins)
- .executeUpdate();
+ getEntityManager().createQuery("delete from Plugin p where p.name in (:plugins)").setParameter("plugins",
+ plugins).executeUpdate();
getTransactionManager().commit();
}
@@ -104,8 +103,8 @@ public class MetadataBeanTest extends AbstractEJB3Test {
}
private IDataSet getDataSet() throws DataSetException {
- FlatXmlProducer xmlProducer = new FlatXmlProducer(
- new InputSource(getClass().getResourceAsStream(getDataSetFile())));
+ FlatXmlProducer xmlProducer = new FlatXmlProducer(new InputSource(getClass().getResourceAsStream(
+ getDataSetFile())));
xmlProducer.setColumnSensing(true);
return new FlatXmlDataSet(xmlProducer);
}
@@ -198,14 +197,15 @@ public class MetadataBeanTest extends AbstractEJB3Test {
String errors = "";
if (!missing.isEmpty()) {
- errors = "Failed to find the following " + propertyName + "(s) for type " + resourceTypeName +
- ": " + missing;
+ errors = "Failed to find the following " + propertyName + "(s) for type " + resourceTypeName + ": "
+ + missing;
}
if (unexpected.size() > 0) {
- errors += "\nFailed to find the following " + propertyName + "(s) for type " + resourceTypeName +
- ": " + unexpected;
+ errors += "\nFound unexpected " + propertyName + "(s) for type " + resourceTypeName + ": " + unexpected;
}
+
+ assert errors.isEmpty() : errors;
}
private boolean contains(ResourceType type, String propertyName, String expected) throws Exception {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
index 789377c..7e85df7 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
@@ -102,12 +102,22 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
}
@Test(dependsOnMethods = {"persistNewTypes"}, groups = {"plugin.metadata", "NewPlugin"})
+ public void persistDriftConfigurationTemplates() throws Exception {
+ assertResourceTypeAssociationEquals(
+ "ServerA",
+ "TestPlugin",
+ "driftConfigurationTemplates",
+ asList("drift1")
+ );
+ }
+
+ @Test(dependsOnMethods = {"persistNewTypes"}, groups = {"plugin.metadata", "NewPlugin"})
public void persistChildTypes() throws Exception {
assertResourceTypeAssociationEquals(
"ServerA",
"TestPlugin",
"childResourceTypes",
- asList("child1", "child2")
+ asList("Child1", "Child2")
);
}
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index ce93e9e..cfdc185 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -82,6 +82,7 @@
<rhq_content_source/>
<rhq_package/>
<rhq_bundle/>
+ <rhq_drift_template_map/>
<rhq_plugin id="1"
deployment="AGENT"
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 50f27e4..055f2fd 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -106,5 +106,6 @@
<rhq_content_source/>
<rhq_package/>
<rhq_bundle/>
+ <rhq_drift_template_map/>
<rhq_plugin/>
</dataset>
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
index 29351c4..d8c8d4e 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
@@ -318,6 +318,7 @@
<rhq_tagging_bundle_dest_map/>
<rhq_create_res_hist/>
<rhq_delete_res_hist/>
+ <rhq_drift_template_map/>
<jms_messages/>
<jms_transactions/>
<jms_users/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
index 944bd20..cd4ff11 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
@@ -51,6 +51,21 @@
</configuration>
</content>
+ <drift-configuration name="drift1">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>connectionPropertyX</value-name>
+ </basedir>
+ </drift-configuration>
+
+<!-- THIS CAUSES A DEADLOCK DURING PLUGIN REGISTRATION!
+ <bundle-target>
+ <destination-base-dir name="bundleTarget1">
+ <value-context>pluginConfiguration</value-context>
+ <value-name>connectionPropertyY</value-name>
+ </destination-base-dir>
+ </bundle-target>
+-->
<service name="Child1" description="Child 1 description"/>
<service name="Child2" description="Child 2 description"/>
</server>
12 years, 5 months
[rhq] Branch 'drift' - 12 commits - modules/core modules/enterprise modules/plugins pom.xml
by mazz
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 38 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 140 +++++
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml | 1
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 18
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java | 8
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 35 -
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java | 11
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 3
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java | 9
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 62 ++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java | 17
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java | 71 ++
pom.xml | 242 ++++------
16 files changed, 463 insertions(+), 200 deletions(-)
New commits:
commit e7a18e96f8d3082a19150238181edc184c01e27e
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:15:02 2011 +0200
Use the name as value and not the id.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 8463123..e872a80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -2438,7 +2438,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getName());
// TODO filter -- or leave up to search expression??
pds.getEnumeratedValues().add(pde);
}
commit 2a6258a05ea75e43108153c182d2e7ed90e0f65d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:36:14 2011 +0200
Fix detection of mod_cluster subsystem.
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 41c5c58..870ad38 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
@@ -177,28 +177,6 @@
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
- <service name="ModCluster"
- class="BaseComponent"
- discovery="SubsystemDiscovery"
- description="Mod_cluster support">
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
- </plugin-configuration>
-
- <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <resource-configuration>
- <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
- <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
- </c:simple-property>
- </resource-configuration>
- </service>
-
</server>
<server name="ServerGroup"
@@ -1376,6 +1354,36 @@ working area for individual server instances</li></ul>"/>
</service>
</server>
+ <server name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support"
+ singleton="true"
+ >
+
+ <runs-inside>
+ <parent-resource-type name="Profile" plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7-Standalone" plugin="jboss-as-7"/> <!-- FAKE as "runs inside Profile" only does not work -->
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd connected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" >
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </server>
+
+
<service name="NetworkInterface"
discovery="SubsystemDiscovery"
class="BaseComponent"
commit feea96566b815c58623fe8141568ee2420bb80af
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:01:09 2011 +0200
Change upload code because of a bug in the server (AS7-1145), add a property to enable json logging.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index f2bb47f..d89f4c4 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -43,21 +43,27 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*/
public class ASConnection {
+ public static final String MANAGEMENT = "/management";
+// public static final String MANAGEMENT = "/domain-api"; // Old one - leave it here for the moment for tests.
private final Log log = LogFactory.getLog(ASConnection.class);
URL url;
String urlString;
private ObjectMapper mapper;
- boolean verbose = true; // This is a variable on purpose, so devs can switch it on in the debugger
+ public static boolean verbose = false; // This is a variable on purpose, so devs can switch it on in the debugger or in the agent
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/management");
+ url = new URL("http",host,port, MANAGEMENT);
urlString = url.toString();
+
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
}
+ // read system property "as7plugin.verbose"
+ verbose = Boolean.getBoolean("as7plugin.verbose");
+
mapper = new ObjectMapper();
}
@@ -107,8 +113,7 @@ public class ASConnection {
String result = mapper.writeValueAsString(operation);
if (verbose) {
- System.out.println("Json to send: " + result);
- System.out.flush();
+ log.info("Json to send: " + result);
}
mapper.writeValue(out, operation);
@@ -141,8 +146,7 @@ public class ASConnection {
ObjectMapper om2 = new ObjectMapper();
om2.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
String tmp = om2.writeValueAsString(operationResult);
- System.out.println(tmp);
- System.out.flush();
+ log.info(tmp);
}
}
else {
@@ -156,8 +160,6 @@ public class ASConnection {
}
else {
log.error("IS was null and code was " + responseCode);
- if (verbose)
- System.err.println("IS was null and code was " + responseCode);
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index d876c80..3ab7c3c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/management/add-content";
+ private static final String UPLOAD_URL_PATH = ASConnection.MANAGEMENT + "/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
@@ -96,7 +96,7 @@ public class ASUploadConnection {
os.flush();
int code = connection.getResponseCode();
- System.err.println("Response code " + code);
+ log.info("Response code for file upload: " + code);
if (code==500)
is = connection.getErrorStream();
else
@@ -116,10 +116,10 @@ public class ASUploadConnection {
if (s!=null)
tree = mapper.readTree(s);
else
- System.out.println("- no result received from InputStream -");
+ log.warn("- no result received from InputStream -");
}
else
- System.out.println("- no InputStream available -");
+ log.warn("- no InputStream available -");
} catch (IOException e) {
e.printStackTrace(); // TODO: Customise this generated block
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index a51a96a..2ac49d0 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -80,6 +80,7 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
String key;
String host;
int port;
+ private boolean verbose = ASConnection.verbose;
/**
* Return availability of this resource
@@ -305,7 +306,9 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(), out);
JsonNode uploadResult = uploadConnection.finishUpload();
- System.out.println(uploadResult);
+ if (verbose)
+ log.info(uploadResult);
+
if (ASConnection.isErrorReply(uploadResult)) {
report.setStatus(CreateResourceStatus.FAILURE);
report.setErrorMessage(ASConnection.getFailureDescription(uploadResult));
@@ -319,7 +322,8 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
fileName=fileName.substring("C:\\fakepath\\".length());
}
- log.info("Deploying [" + fileName + "] ...");
+ boolean toServerGroup = context.getResourceKey().contains("server-group=");
+ log.info("Deploying [" + fileName + "] to domain only= " + !toServerGroup + " ...");
String tmpName = fileName; // TODO figure out the tmp-name biz with the AS guys
@@ -338,15 +342,22 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
step1.addAdditionalProperty("name", tmpName);
step1.addAdditionalProperty("runtime-name", fileName);
- CompositeOperation cop = new CompositeOperation();
- cop.addStep(step1);
String resourceKey;
-
+ JsonNode result ;
/*
* We need to check here if this is an upload to /deployment only
* or if this should be deployed to a server group too
*/
- if (context.getResourceKey().contains("server-group=")) {
+
+ if (!toServerGroup) {
+
+ result = connection.executeRaw(step1);
+ resourceKey = addressToPath(step1.getAddress());
+
+ }
+ else {
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>();
serverGroupAddress.addAll(pathToAddress(context.getResourceKey()));
@@ -359,19 +370,13 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
cop.addStep(step3);
resourceKey = addressToPath(serverGroupAddress);
- }
- else {
-/*
- List<PROPERTY_VALUE> address = step1.getAddress();
- Operation step3 = new Operation("deploy",address);
- cop.addStep(step3);
-*/
+ if (verbose)
+ log.info("Deploy operation: " + cop);
- resourceKey = addressToPath(step1.getAddress());
+ result = connection.executeRaw(cop);
}
- JsonNode result = connection.executeRaw(cop);
if (ASConnection.isErrorReply(result)) {
String failureDescription = ASConnection.getFailureDescription(result);
report.setErrorMessage(failureDescription);
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
index 3f57a06..3946dbe 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
@@ -98,6 +98,9 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
}
config.put(new PropertySimple("socket-binding-port-offset",serverInfo.portOffset));
+ String path = "host=" + hostName + ",server-config=" + serverInfo.name;
+ config.put(new PropertySimple("path",path));
+
// TODO this fails for the downed servers.
@@ -241,6 +244,14 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
boolean autoStart;
int portOffset;
String bindingGroup;
+
+ @Override
+ public String toString() {
+ return "ServerInfo{" +
+ "name='" + name + '\'' +
+ ", group='" + group + '\'' +
+ '}';
+ }
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
index a3ab676..60fc615 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
@@ -101,7 +101,8 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
if (cpath.contains("="))
path += "," + cpath;
- System.out.println("total path: [" + path + "]");
+ if (Boolean.getBoolean("as7plugin.verbose"))
+ log.info("total path: [" + path + "]");
JsonNode json ;
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 76d1bcf..41c5c58 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
@@ -169,14 +169,38 @@
<server name="Profile"
- description="One profile in a domain"
+ description="One profile in a domain. Profiles are assigned to server groups."
discovery="SubsystemDiscovery"
class="BaseComponent">
<plugin-configuration>
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
+
+ <service name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+
</server>
+
<server name="ServerGroup"
description="Server groups on this domain"
discovery="SubsystemDiscovery"
@@ -190,8 +214,12 @@
<resource-configuration>
- <c:simple-property name="profile" />
- <c:simple-property name="socket-binding-group"/>
+ <c:simple-property name="profile" description="The profile name" required="true"/>
+ <c:simple-property name="socket-binding-group" readOnly="false" required="true">
+ <c:option-source target="resource" expression="type=SocketBindingGroup"/>
+ </c:simple-property>
+ <c:simple-property name="socket-binding-port-offset" required="false" defaultValue="0" type="integer"
+ description="The default offset to be added to the port values given by the socket binding group."/>
<c:simple-property name="jvm" required="false"/>
</resource-configuration>
@@ -236,7 +264,9 @@
<operation name="domain-deployment:promote" displayName="Deploy to Server-Group" description="Deploy this deployment to a server group">
<parameters>
- <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string"/>
+ <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string">
+ <c:option-source target="resource" expression="type=ServerGroup" />
+ </c:simple-property>
<c:simple-property name="enabled" required="true" default="true" description="Should the deployment be enabled on the server group?" type="boolean"/>
</parameters>
<results>
@@ -327,6 +357,7 @@
<c:simple-property name="group" readOnly="true" displayName="Server Group" description="Server Group this instance belongs to."/>
<c:simple-property name="socket-binding-group" readOnly="true" displayName="Socket binding group" description="Socket bindngs to use"/>
<c:simple-property name="socket-binding-port-offset" readOnly="true" displayName="Port Offset" type="integer" default="0" description="Offset to the base ports"/>
+ <c:simple-property name="path" readOnly="true" />
&logSources;
</plugin-configuration>
@@ -351,7 +382,8 @@
</results>
</operation>
-
+ <metric property="status" dataType="trait" displayName="Server state" description="Detailed server state"
+ displayType="summary"/>
</server>
@@ -1387,8 +1419,8 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces." required="false"/>
<c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
<c:simple-property name="fixed-port" description="Whether the port value should remain fixed even if numeric offsets are applied to the other sockets in the socket group." type="boolean"/>
- <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." />
- <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer"/>
+ <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." required="false"/>
+ <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer" required="false"/>
</c:map-property>
</c:list-property>
</resource-configuration>
@@ -1420,5 +1452,4 @@ working area for individual server instances</li></ul>"/>
</service>
-
</plugin>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index b0d68ee..e18193d 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = UploadAndDeployTest.isEnabled) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,8 +49,10 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
+ protected static final boolean isEnabled = false;
- @Test(timeOut = 60*1000L, enabled=true)
+
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -62,7 +64,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=true)
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -75,7 +77,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=true)
+ @Test(timeOut = 60*1000L,enabled=isEnabled)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -155,7 +157,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -229,7 +231,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -295,7 +297,7 @@ public class UploadAndDeployTest {
* Test uploading to domain only, but not to a server group
* @throws Exception
*/
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite2() throws Exception {
String bytes_value = prepare();
commit 1b2fddb44dfa4175e5c095de2d2857988af0e827
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 15:18:52 2011 +0200
Add a test for a composite operation with only one member operation (i.e. deploy to domain only)
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index dfa9fd9..b0d68ee 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = false) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,7 +49,8 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
- @Test(timeOut = 60*1000L, enabled=false)
+
+ @Test(timeOut = 60*1000L, enabled=true)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -61,7 +62,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=false)
+ @Test(timeOut = 60*1000L, enabled=true)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -74,7 +75,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=false)
+ @Test(timeOut = 60*1000L,enabled=true)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -154,7 +155,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -228,7 +229,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -290,6 +291,62 @@ public class UploadAndDeployTest {
}
+ /**
+ * Test uploading to domain only, but not to a server group
+ * @throws Exception
+ */
+ @Test(timeOut = 60*1000L,enabled = true)
+ public void testUploadComposite2() throws Exception {
+
+ String bytes_value = prepare();
+
+ System.out.println("Prepare done");
+ System.out.flush();
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ List<Object> content = new ArrayList<Object>(1);
+ Map<String,Object> contentValues = new HashMap<String,Object>();
+ contentValues.put("hash",new PROPERTY_VALUE("BYTES_VALUE",bytes_value));
+ content.add(contentValues);
+ step1.addAdditionalProperty("content", content);
+ step1.addAdditionalProperty("name", TEST_WAR); // this needs to be unique per upload
+
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+
+
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT);
+ JsonNode ret = connection.executeRaw(cop);
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite deploy was no success " + ret.getTextValue();
+
+ // Wait for AS to settle
+ Thread.sleep(1000);
+
+
+ // Now undeploy again to clean up
+
+ cop = new CompositeOperation();
+ Operation step4 = new Operation("remove",deploymentsAddress);
+
+ cop.addStep(step4);
+ ret = connection.executeRaw(cop);
+
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite remove was no success " + ret.getTextValue();
+
+
+ }
+
private String prepare() throws IOException {
ASUploadConnection conn = new ASUploadConnection(DC_HOST, DC_HTTP_PORT);
OutputStream os = conn.getOutputStream("test.war");
commit ba4a00ce03d3d15001d70529c2cb8c2fd41ea4cd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jun 28 17:40:42 2011 -0400
make sure the Build-Number and Build-Time Manifest attributes always get set
to valid values, even for SNAPSHOT builds; however, if the project dir is not a
git working dir or the git executable is not available on the PATH, the
Build-Number attribute will not get set to a valid value, but the build should
not fail
diff --git a/pom.xml b/pom.xml
index 719a827..3c8cc4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -607,7 +607,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-4</version>
+ <version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -842,6 +842,113 @@
</configuration>
</plugin>
+ <!-- As of v1.0 of the buildnumber plugin, the create goal doesn't work,
+ and the create-timestamp goal doesn't provide a way to specify
+ a locale or a timezone, so comment this out for now and instead use
+ our own homemade mix of antrun and properties-file plugin executions
+ (just below this commented out block). (ips, 06/28/11)
+ -->
+ <!--
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>setBuildNumber</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ <configuration>
+ <useLastCommittedRevision>true</useLastCommittedRevision>
+ <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+ <revisionOnScmFailure></revisionOnScmFailure>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>setBuildTime</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create-timestamp</goal>
+ </goals>
+ <configuration>
+ <timestampFormat>MM/dd/yy hh:mm aa z</timestampFormat>
+ <timestampPropertyName>buildTime</timestampPropertyName>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>write-build-properties-file</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target" />
+
+ <tstamp>
+ <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
+ </tstamp>
+ <echo file="target/build.properties">buildTime = ${buildTime}${line.separator}</echo>
+
+ <exec executable="git" outputproperty="buildNumber" failonerror="false" failifexecutionfails="false">
+ <arg value="log"/>
+ <arg value="--pretty=format:%h"/>
+ <arg value="-n1"/>
+ </exec>
+ <echo file="target/build.properties" append="true">buildNumber = ${buildNumber}${line.separator}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>echo-build-properties</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo level="debug">buildTime = ${buildTime}</echo>
+ <echo level="debug">buildNumber = ${buildNumber}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>read-build-properties-file</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>read-project-properties</goal>
+ </goals>
+ <configuration>
+ <files>
+ <file>${project.build.directory}/build.properties</file>
+ </files>
+ <quiet>true</quiet>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
@@ -990,7 +1097,9 @@
</properties>
</profile>
- <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used. -->
+ <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used.
+ If using Java7 to run the build, this will ensure no APIs introduced in Java7 are
+ used. -->
<profile>
<id>check-java-api</id>
<activation>
@@ -1031,133 +1140,6 @@
</build>
</profile>
- <!-- Use buildnumber plugin only if SVN metadata is present. -->
- <profile>
- <id>build-number-generation</id>
- <activation>
- <file>
- <exists>.svn</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
- <revisionOnScmFailure>0</revisionOnScmFailure>
- <doCheck>false</doCheck>
- <doUpdate>false</doUpdate>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>build-properties</id>
- <activation>
- <file>
- <exists>.git</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>write-build-time-properties-file</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <tstamp>
- <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
- </tstamp>
- <mkdir dir="target" />
- <echo file="target/build-time.properties" level="error">buildTime = ${buildTime}
- </echo>
- </tasks>
- </configuration>
- </execution>
-
- <execution>
- <id>echo-build-properties</id>
- <phase>compile</phase>
- <inherited>false</inherited>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <echo level="debug">buildTime = ${buildTime}</echo>
- <echo level="debug">buildNumber = ${buildNumber}</echo>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-build-number-properties</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>exec</goal>
- </goals>
- <configuration>
- <executable>git</executable>
- <arguments>
- <argument>log</argument>
- <argument>--pretty=format:buildNumber = %h</argument>
- <argument>-n1</argument>
- </arguments>
- <outputFile>${project.build.directory}/build-number.properties</outputFile>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>read-build-properties</id>
- <phase>process-sources</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <files>
- <file>${project.build.directory}/build-time.properties</file>
- <file>${project.build.directory}/build-number.properties</file>
- </files>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
<!-- This profile should be enabled when a release is being published.
It will ensure that sources and javadoc jars are built and published
for each source module. -->
@@ -1262,7 +1244,7 @@
<licenses>
<license>
<name>GPL</name>
- <url>http://gnu.org</url>
+ <url>http://www.gnu.org/licenses/gpl.html</url>
</license>
</licenses>
commit 4c9c387956d25621791eda3441d36822b13f404f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 22 13:30:29 2011 +0200
Add a dependent value for the web connector
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 0ccacf6..76d1bcf 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
@@ -548,6 +548,7 @@
<service name="Connector"
discovery="SubsystemDiscovery"
class="BaseComponent"
+ createDeletePolicy="both"
>
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="connector"/>
@@ -563,8 +564,10 @@
<resource-configuration>
<c:simple-property name="protocol" required="true" type="string" readOnly="true" description="The web connector protocol."/>
- <c:simple-property name="socket-binding" required="true" type="string" readOnly="true"
- description="The web connector socket-binding reference, this connector should be bound to."/>
+ <c:simple-property name="socket-binding" required="true" type="string" readOnly="false"
+ description="The web connector socket-binding reference, this connector should be bound to.">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
<c:simple-property name="scheme" type="string" readOnly="true" default="http" description="The web connector scheme."/>
<c:simple-property name="executor" type="string" readOnly="true" required="false"
description="The name of the executor that should be used for the processing threads of this connector. Defaults to using an internal pool."/>
commit 15a7a42ad63eaf69b184a08b2f522efa99fbda10
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 21:59:52 2011 +0200
Support the new "rolled-back" element in the JSON response from the AS.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
index a5583b7..63c5262 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
@@ -40,6 +40,8 @@ public class Result {
private /*List<Map<String, String>>*/Object failureDescription;
@JsonIgnore
private boolean success = false;
+ @JsonProperty("rolled-back")
+ private boolean rolledBack = false;
public Result() {
@@ -83,4 +85,11 @@ public class Result {
this.failureDescription = failureDescription;
}
+ public boolean isRolledBack() {
+ return rolledBack;
+ }
+
+ public void setRolledBack(boolean rolledBack) {
+ this.rolledBack = rolledBack;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
index 53ac89e..b36a03b 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
@@ -185,7 +185,7 @@ public class OperationJsonTest {
public void arrayResult1() throws Exception {
- String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null}";
+ String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null, \"rolled-back\" : false}";
ObjectMapper mapper = new ObjectMapper();
Result result = mapper.readValue(resultString,Result.class);
@@ -197,6 +197,21 @@ public class OperationJsonTest {
assert stringList.size()==2;
assert stringList.get(0).equals("standard-sockets");
assert stringList.get(1).equals("messaging-sockets");
+ assert !result.isRolledBack();
+
+ }
+
+ public void rolledBack() throws Exception {
+
+ String resultString = "{\"outcome\":\"failed\", \"rolled-back\" : true}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ Result result = mapper.readValue(resultString,Result.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("failed");
+ assert !result.isSuccess();
+ assert result.isRolledBack();
}
commit bfde7283adbcfc558707c3d208a066d5626d88c7
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 13:43:36 2011 -0500
Fix dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index e4ef940..ce93e9e 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,8 +10,8 @@
mtime="123456"/>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 1f7b34b..50f27e4 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,7 +1,7 @@
<dataset>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
index d584809..29351c4 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
@@ -2,6 +2,7 @@
<rhq_config_def/>
<rhq_config_prop_grp_def/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
<rhq_config/>
commit 0fd8d03434a22a88a59fb19936dda22c7663eb09
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 17:30:10 2011 +0200
/domain-api got renamed to /management.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index c51f275..f2bb47f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -52,7 +52,7 @@ public class ASConnection {
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/domain-api");
+ url = new URL("http",host,port,"/management");
urlString = url.toString();
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index 80e8ea4..d876c80 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/domain-api/add-content";
+ private static final String UPLOAD_URL_PATH = "/management/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
commit 3f5888c667e51c6114a1b192c3b146de7c407aaa
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 09:58:25 2011 -0500
Attempt to correct the dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index fe4dfd4..e4ef940 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,6 +10,7 @@
mtime="123456"/>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 2ac6566..1f7b34b 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,5 +1,6 @@
<dataset>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
commit c34278c7a2c5f6aade874c84442326389b706074
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 0700bd617ccefd674486f627b670e64333aa63dd
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
12 years, 5 months
[rhq] Branch 'drift' - 4 commits - modules/core modules/enterprise modules/pom.xml
by Jay Shaughnessy
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 3
modules/core/domain/src/main/java/org/rhq/core/domain/drift/AbstractDriftFile.java | 91 +++++++++
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFile.java | 53 -----
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileBits.java | 94 ++++++++++
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileContent.java | 72 -------
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java | 26 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddConfigWizardInfoStep.java | 15 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 19 --
modules/pom.xml | 1
9 files changed, 224 insertions(+), 150 deletions(-)
New commits:
commit 78c19d59d26f9ff72a79d8ca8569cbfc35af2243
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 30 16:05:29 2011 -0400
user changeset headers to set DriftChangeSet category
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index f7faf09..ae13557 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -135,7 +135,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
@Override
@TransactionAttribute(REQUIRES_NEW)
public void storeChangeSet(final int resourceId, File changeSetZip) throws Exception {
- Resource resource = entityManager.find(Resource.class, resourceId);
+ final Resource resource = entityManager.find(Resource.class, resourceId);
if (null == resource) {
throw new IllegalArgumentException("Resource not found [" + resourceId + "]");
}
@@ -145,24 +145,23 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
c.addFilterResourceId(resourceId);
List<DriftChangeSet> changeSets = findDriftChangeSetsByCriteria(subjectManager.getOverlord(), c);
final int version = changeSets.size();
- // TODO: set category based on changeset parsing
- final DriftChangeSetCategory category = (0 == version) ? DriftChangeSetCategory.COVERAGE
- : DriftChangeSetCategory.DRIFT;
-
- // store the new change set info (not the actual blob)
- final DriftChangeSet driftChangeSet = new DriftChangeSet(resource, version, category);
- entityManager.persist(driftChangeSet);
ZipUtil.walkZipFile(changeSetZip, new ChangeSetFileVisitor() {
@Override
public boolean visit(ZipEntry zipEntry, ZipInputStream stream) throws Exception {
List<DriftFile> emptyDriftFiles = new ArrayList<DriftFile>();
+ DriftChangeSet driftChangeSet = null;
try {
ChangeSetReader reader = new ChangeSetReaderImpl(new BufferedReader(new InputStreamReader(
stream)));
+ // store the new change set info (not the actual blob)
+ DriftChangeSetCategory category = reader.getHeaders().getType();
+ driftChangeSet = new DriftChangeSet(resource, version, category);
+ entityManager.persist(driftChangeSet);
+
for (DirectoryEntry dir = reader.readDirectoryEntry(); null != dir; dir = reader
.readDirectoryEntry()) {
commit c3c2edad7b64e194115f75305efd03430287821e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 30 15:25:05 2011 -0400
add common/drift to 'agent' maven profile
diff --git a/modules/pom.xml b/modules/pom.xml
index ef5b009..dbd77a3 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -57,6 +57,7 @@
</activation>
<modules>
<module>core</module>
+ <module>common/drift</module>
<module>enterprise/comm</module>
<module>enterprise/agent</module>
<module>enterprise/agentupdate</module>
commit 37b5bca2cb2c86e2d709eb85b36b2c96def52e1a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 30 14:34:01 2011 -0400
Make DriftConfiguration.BaseDirectory abstract
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddConfigWizardInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddConfigWizardInfoStep.java
index 8f5b750..d1cda75 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddConfigWizardInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddConfigWizardInfoStep.java
@@ -34,9 +34,11 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.drift.DriftConfiguration;
import org.rhq.core.domain.drift.DriftConfigurationDefinition;
+import org.rhq.core.domain.drift.DriftConfiguration.BaseDirectory;
+import org.rhq.core.domain.drift.DriftConfigurationDefinition.BaseDirValueContext;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.util.FormUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
@@ -103,10 +105,13 @@ public class DriftAddConfigWizardInfoStep extends AbstractWizardStep {
// throw new IllegalStateException( "At least one drift configuration template should exist for the resource type" );
ConfigurationTemplate test = new ConfigurationTemplate("Test", "Test");
Configuration config = new Configuration();
- config.put(new PropertySimple("name", "Test"));
- config.put(new PropertySimple("basedir", "C:/workspace/rhq/dev-container/jbossas/server/default/conf"));
- config.put(new PropertySimple("interval", "6000"));
- test.setConfiguration(config);
+ DriftConfiguration driftConfig = new DriftConfiguration(config);
+ driftConfig
+ .setBasedir(new BaseDirectory(BaseDirValueContext.fileSystem,
+ "C:/workspace/rhq/dev-container/jbossas/server/default/deploy/rhq.ear/coregui.war/images/subsystems/content"));
+ driftConfig.setName("Test");
+ driftConfig.setInterval(6000L);
+ test.setConfiguration(driftConfig.getConfiguration());
test.setConfigurationDefinition(DriftConfigurationDefinition.getInstance());
templatesMap.put("TestOnly", test);
}
commit 6db86f01a579952b813725a0eaef09ac7bb21798
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 30 14:33:05 2011 -0400
Refact DriftFile and DriftFileContent to use abstract mapped pojo
superclass.
- rename DriftFileContent to DriftFileBits for clarity and consistency
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 10369f7..96e86f2 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -651,8 +651,7 @@
<!-- Content of a file being managed for drift. Used for diff and/or remediation -->
<table name="RHQ_DRIFT_FILE">
- <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/>
- <column name="DTYPE" type="VARCHAR2" required="true" size="10"/>
+ <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/>
<column name="CTIME" type="LONG" required="true"/>
<column name="DATA" type="LARGEOBJECT" required="false"/>
<column name="DATA_SIZE" type="LONG" required="false"/>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/AbstractDriftFile.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/AbstractDriftFile.java
new file mode 100644
index 0000000..ad9584d
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/AbstractDriftFile.java
@@ -0,0 +1,91 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.drift;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.PrePersist;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+/**
+ * A DriftFile represents one unique piece of content used for drift tracking. Because the bits are supported
+ * by java.sql.Blob and java.io streaming, we must hide the bits from entities used on the gwt client. This base
+ * class is used as the superclass for both DriftFile (no blob) and DriftFileBits (blob).
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ * @author John Sanda
+ */
+@MappedSuperclass
+(a)XmlAccessorType(XmlAccessType.FIELD)
+public class AbstractDriftFile implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Column(name = "CTIME", nullable = false)
+ protected Long ctime = -1L;
+
+ @Column(name = "DATA_SIZE", nullable = true)
+ protected Long dataSize;
+
+ @Column(name = "STATUS", nullable = false)
+ @Enumerated(EnumType.STRING)
+ protected DriftFileStatus status = DriftFileStatus.EMPTY;
+
+ protected AbstractDriftFile() {
+ }
+
+ public Long getCtime() {
+ return ctime;
+ }
+
+ @PrePersist
+ void onPersist() {
+ this.ctime = System.currentTimeMillis();
+ }
+
+ public void setDataSize(Long dataSize) {
+ this.dataSize = dataSize;
+ }
+
+ public long getDataSize() {
+ return dataSize;
+ }
+
+ public void setDataSize(long size) {
+ dataSize = size;
+ }
+
+ public DriftFileStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(DriftFileStatus status) {
+ this.status = status;
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFile.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFile.java
index a52d957..148b2b5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFile.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFile.java
@@ -25,28 +25,22 @@ package org.rhq.core.domain.drift;
import java.io.Serializable;
import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
import javax.persistence.Id;
-import javax.persistence.PrePersist;
import javax.persistence.Table;
/**
* A DriftFile represents one unique piece of content used for drift tracking. Note that DriftFile does not
* include the actual bits, and therefore can be used freely client-side (gwt). The bits are stored via the
- * DriftFileContent sub-class, which adds only a Blob field.
+ * DriftFileBits class, which is like this one but adds the Blob field.
*
* @author Jay Shaughnessy
+ * @author John Mazzitelli
* @author John Sanda
*/
-@DiscriminatorColumn(name = "DTYPE")
-@DiscriminatorValue("no-content")
@Entity
@Table(name = "RHQ_DRIFT_FILE")
-public class DriftFile implements Serializable {
+public class DriftFile extends AbstractDriftFile implements Serializable {
private static final long serialVersionUID = 1L;
// this is a hash/digest that should uniquely identify the content
@@ -54,20 +48,12 @@ public class DriftFile implements Serializable {
@Column(name = "HASH_ID", nullable = false)
private String hashId;
- @Column(name = "CTIME", nullable = false)
- private Long ctime = -1L;
-
- @Column(name = "DATA_SIZE", nullable = true)
- private Long dataSize;
-
- @Column(name = "STATUS", nullable = false)
- @Enumerated(EnumType.STRING)
- private DriftFileStatus status = DriftFileStatus.EMPTY;
-
protected DriftFile() {
+ super();
}
public DriftFile(String hashId) {
+ super();
this.hashId = hashId;
}
@@ -79,35 +65,6 @@ public class DriftFile implements Serializable {
this.hashId = hashId;
}
- public Long getCtime() {
- return ctime;
- }
-
- @PrePersist
- void onPersist() {
- this.ctime = System.currentTimeMillis();
- }
-
- public void setDataSize(Long dataSize) {
- this.dataSize = dataSize;
- }
-
- public long getDataSize() {
- return dataSize;
- }
-
- public void setDataSize(long size) {
- dataSize = size;
- }
-
- public DriftFileStatus getStatus() {
- return status;
- }
-
- public void setStatus(DriftFileStatus status) {
- this.status = status;
- }
-
@Override
public String toString() {
return "DriftFile [hashId=" + hashId + ", status=" + status + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileBits.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileBits.java
new file mode 100644
index 0000000..cb1e77c
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileBits.java
@@ -0,0 +1,94 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.drift;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.sql.Blob;
+import java.sql.SQLException;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+/**
+ * A DriftFile represents one unique piece of content used for drift tracking. Note that DriftFileBits provides
+ * access to the bits through java.sql.Blob. This entity can not be used client-side (gwt) whereas its sister class,
+ * DriftFile, can. Both enities share the same table and abstract superclass. See RHQDomain.gwt.xml for how to
+ * exclude unwanted domain classes from the gwt compile.
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ * @author John Sanda
+ */
+@Entity
+@Table(name = "RHQ_DRIFT_FILE")
+public class DriftFileBits extends AbstractDriftFile implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ // this is a hash/digest that should uniquely identify the content
+ @Id
+ @Column(name = "HASH_ID", nullable = false)
+ private String hashId;
+
+ protected DriftFileBits() {
+ super();
+ }
+
+ public DriftFileBits(String hashId) {
+ super();
+ this.hashId = hashId;
+ }
+
+ public String getHashId() {
+ return hashId;
+ }
+
+ public void setHashId(String hashId) {
+ this.hashId = hashId;
+ }
+
+ @Lob
+ @Column(name = "DATA", nullable = true)
+ private Blob data;
+
+ public Blob getBlob() {
+ return data;
+ }
+
+ public InputStream getData() throws SQLException {
+ return data.getBinaryStream();
+ }
+
+ public void setData(Blob blob) {
+ this.data = blob;
+ }
+
+ @Override
+ public String toString() {
+ return "DriftFileContent [hashId=" + hashId + ", status=" + status + "]";
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileContent.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileContent.java
deleted file mode 100644
index f2c23d1..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftFileContent.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * 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 and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.drift;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.sql.Blob;
-import java.sql.SQLException;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.Lob;
-
-/**
- * A DriftFile represents onee unique piece of content used for drift tracking. Note that DriftFileContent provides
- * access to the bits through java.sql.Blob. This entity can not be used client-side (gwt) whereas the super-class,
- * DriftFile can. See RHQDomain.gwt.xml for how to exclude unwanted domain classes from the gwt compile.
- *
- * @author Jay Shaughnessy
- * @author John Sanda
- */
-@DiscriminatorValue("content")
-@Entity
-public class DriftFileContent extends DriftFile implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Lob
- @Column(name = "DATA", nullable = true)
- private Blob data;
-
- protected DriftFileContent() {
- }
-
- public Blob getBlob() {
- return data;
- }
-
- public InputStream getData() throws SQLException {
- return data.getBinaryStream();
- }
-
- public void setData(Blob blob) {
- this.data = blob;
- }
-
- @Override
- public String toString() {
- return super.toString();
- }
-
-}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
index 532da59..dad1a6d 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
@@ -49,7 +49,7 @@ public class DriftFileTest extends AbstractEJB3Test {
String hashId = digestGen.calcDigestString(content);
// Create the initial driftFile
- final DriftFileContent df1 = new DriftFileContent();
+ final DriftFileBits df1 = new DriftFileBits();
df1.setHashId(hashId);
df1.setDataSize(content.length());
df1.setData(Hibernate.createBlob(toInputStream(content), content.length()));
@@ -66,7 +66,7 @@ public class DriftFileTest extends AbstractEJB3Test {
executeInTransaction(new TransactionCallback() {
@Override
public void execute() {
- DriftFileContent df2 = getEntityManager().find(DriftFileContent.class, df1.getHashId());
+ DriftFileBits df2 = getEntityManager().find(DriftFileBits.class, df1.getHashId());
df2.setData(Hibernate.createBlob(toInputStream(newContent), newContent.length()));
getEntityManager().merge(df2);
}
@@ -77,7 +77,7 @@ public class DriftFileTest extends AbstractEJB3Test {
@Override
public void execute() {
try {
- DriftFileContent df3 = getEntityManager().find(DriftFileContent.class, df1.getHashId());
+ DriftFileBits df3 = getEntityManager().find(DriftFileBits.class, df1.getHashId());
String expected = newContent;
String actual = IOUtils.toString(df3.getData());
@@ -101,7 +101,7 @@ public class DriftFileTest extends AbstractEJB3Test {
for (int i = 0; i < numDriftFiles; ++i) {
File dataFile = createDataFile("test_data.txt", 10, (char) ('a' + i));
- final DriftFileContent driftFile = new DriftFileContent();
+ final DriftFileBits driftFile = new DriftFileBits();
driftFile.setDataSize(dataFile.length());
driftFile.setHashId(digestGen.calcDigestString(dataFile));
driftFile.setData(Hibernate.createBlob(new BufferedInputStream(new FileInputStream(dataFile))));
@@ -117,14 +117,14 @@ public class DriftFileTest extends AbstractEJB3Test {
}
final List<Blob> blobs = new ArrayList<Blob>();
- final List<DriftFile> driftFiles = new ArrayList<DriftFile>();
+ final List<DriftFileBits> driftFiles = new ArrayList<DriftFileBits>();
for (final String hashId : driftFileHashIds) {
executeInTransaction(new TransactionCallback() {
@Override
public void execute() {
- DriftFileContent driftFile = getEntityManager().find(DriftFileContent.class, hashId);
- blobs.add(driftFile.getBlob());
- driftFiles.add(driftFile);
+ DriftFileBits driftFileBits = getEntityManager().find(DriftFileBits.class, hashId);
+ blobs.add(driftFileBits.getBlob());
+ driftFiles.add(driftFileBits);
}
});
}
@@ -141,7 +141,7 @@ public class DriftFileTest extends AbstractEJB3Test {
for (int i = 0; i < numDriftFiles; ++i) {
File dataFile = createDataFile("test_data.txt", 10, 'X');
- final DriftFileContent driftFile = new DriftFileContent();
+ final DriftFileBits driftFile = new DriftFileBits();
final int driftFileNum = i;
driftFile.setDataSize(dataFile.length());
driftFile.setHashId(digestGen.calcDigestString(dataFile));
@@ -165,14 +165,14 @@ public class DriftFileTest extends AbstractEJB3Test {
}
final List<Blob> blobs = new ArrayList<Blob>();
- final List<DriftFile> driftFiles = new ArrayList<DriftFile>();
+ final List<DriftFileBits> driftFiles = new ArrayList<DriftFileBits>();
for (final String hashId : driftFileHashIds) {
executeInTransaction(new TransactionCallback() {
@Override
public void execute() {
- DriftFileContent driftFile = getEntityManager().find(DriftFileContent.class, hashId);
- blobs.add(driftFile.getBlob());
- driftFiles.add(driftFile);
+ DriftFileBits driftFileBits = getEntityManager().find(DriftFileBits.class, hashId);
+ blobs.add(driftFileBits.getBlob());
+ driftFiles.add(driftFileBits);
}
});
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 5725d89..f7faf09 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -66,7 +66,7 @@ import org.rhq.core.domain.drift.DriftChangeSet;
import org.rhq.core.domain.drift.DriftChangeSetCategory;
import org.rhq.core.domain.drift.DriftConfiguration;
import org.rhq.core.domain.drift.DriftFile;
-import org.rhq.core.domain.drift.DriftFileContent;
+import org.rhq.core.domain.drift.DriftFileBits;
import org.rhq.core.domain.drift.DriftFileStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
@@ -253,7 +253,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
@TransactionAttribute(REQUIRES_NEW)
public void persistDriftFileData(DriftFile driftFile, InputStream data) throws Exception {
- DriftFileContent df = entityManager.find(DriftFileContent.class, driftFile.getHashId());
+ DriftFileBits df = entityManager.find(DriftFileBits.class, driftFile.getHashId());
if (null == df) {
throw new IllegalArgumentException("DriftFile not found [" + driftFile.getHashId() + "]");
}
12 years, 5 months
[rhq] Branch 'drift' - 3 commits - modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java | 19 ++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 75fddb05a1798dc37c88e21970524b0f9fc72f9f
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jun 30 15:16:31 2011 -0400
Changing the rate at which drift detection runs to 1 minute for development
The rate at which drift detection runs will be made configurable via a
plugin container configuration property later on down the road. The
shorter, hard-coded interval is just to intended to make manual
testing during development easier.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 619ef7d..be93ed5 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -67,7 +67,8 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
driftDetector.setDriftClient(this);
driftThreadPool = new ScheduledThreadPoolExecutor(5);
- driftThreadPool.scheduleAtFixedRate(driftDetector, 30, 1800, TimeUnit.SECONDS);
+ // TODO Make the drift detection rate configurable
+ driftThreadPool.scheduleAtFixedRate(driftDetector, 30, 60, TimeUnit.SECONDS);
}
@Override
commit 61956fb6f33fccf765410c1b7f4adf9e7657f6eb
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jun 30 11:30:56 2011 -0400
Copy file content into zip file
In the last commit I modified logic to create a flat zip file, but I was
not actually copying content into the zip file. This commit copies
content. There is still some more work to do to ensure streams are
closed and logic for error handling.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 5b74a3a..619ef7d 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -30,6 +30,7 @@ import org.rhq.core.pc.agent.AgentService;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.measurement.MeasurementManager;
+import org.rhq.core.util.stream.StreamUtil;
public class DriftManager extends AgentService implements DriftAgentService, DriftClient, ContainerService {
@@ -115,7 +116,10 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
//zipFileOrDirectory(contentDir, zipFile);
for (File file : contentDir.listFiles()) {
+ FileInputStream fis = new FileInputStream(file);
stream.putNextEntry(new ZipEntry(file.getName()));
+ StreamUtil.copy(fis, stream, false);
+ fis.close();
}
stream.close();
commit 9d0591cdba22a5b7aeb6979891631d4a0aec3d63
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jun 30 10:41:48 2011 -0400
Do not use ZipUtil for generating content zip file
The server expects a flat zip file but I discovered last night that
ZipUtil preserves paths.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index f252c08..5b74a3a 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -3,12 +3,16 @@ package org.rhq.core.pc.drift;
import static org.rhq.core.util.ZipUtil.zipFileOrDirectory;
import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -107,7 +111,13 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
public void sendChangeSetContentToServer(int resourceId, String driftConfigurationName, File contentDir) {
try {
File zipFile = new File(pluginContainerConfiguration.getTemporaryDirectory(), "content.zip");
- zipFileOrDirectory(contentDir, zipFile);
+ ZipOutputStream stream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
+ //zipFileOrDirectory(contentDir, zipFile);
+
+ for (File file : contentDir.listFiles()) {
+ stream.putNextEntry(new ZipEntry(file.getName()));
+ }
+ stream.close();
DriftServerService driftServer = pluginContainerConfiguration.getServerServices().getDriftServerService();
driftServer.sendFilesZip(resourceId, zipFile.length(), remoteInputStream(new BufferedInputStream(
12 years, 5 months
[rhq] Branch 'drift' - 5 commits - modules/core modules/enterprise modules/plugins
by mazz
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/DriftMetadataParser.java | 6
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java | 2
modules/core/client-api/src/main/resources/rhq-plugin.xsd | 109 +++++
modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/PluginMetadataParserTest.java | 161 +++----
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/config-data.xml | 166 -------
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 154 -------
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfiguration.java | 10
modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java | 38 -
modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/DriftDetectorTest.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftConfigurationDefinitionTest.java | 208 ----------
modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml | 12
12 files changed, 228 insertions(+), 645 deletions(-)
New commits:
commit 6c00837adededa9b74db227c378fefdc587bcfa7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 15:00:05 2011 -0400
webservice/jaxb requires this to be static and have no-arg constr
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfiguration.java
index 00f9ab9..2c9fe0a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfiguration.java
@@ -54,10 +54,14 @@ public class DriftConfiguration implements Serializable {
private static final long serialVersionUID = 1L;
- public class BaseDirectory implements Serializable {
+ public static class BaseDirectory implements Serializable {
private static final long serialVersionUID = 1L;
- private final BaseDirValueContext context;
- private final String name;
+ private BaseDirValueContext context;
+ private String name;
+
+ // required for jaxb/web services remoting
+ protected BaseDirectory() {
+ }
public BaseDirectory(BaseDirValueContext context, String name) {
this.context = context;
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/DriftDetectorTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/DriftDetectorTest.java
index b5f9bd2..efa504b 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/DriftDetectorTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/DriftDetectorTest.java
@@ -23,9 +23,8 @@ import org.rhq.common.drift.ChangeSetReader;
import org.rhq.common.drift.ChangeSetReaderImpl;
import org.rhq.common.drift.DirectoryEntry;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.drift.DriftConfiguration;
-import org.rhq.core.domain.drift.DriftConfigurationDefinition;
+import org.rhq.core.domain.drift.DriftConfiguration.BaseDirectory;
import org.rhq.test.JMockTest;
public class DriftDetectorTest extends JMockTest {
@@ -97,7 +96,7 @@ public class DriftDetectorTest extends JMockTest {
DriftConfiguration driftConfiguration(String name, String basedir) {
DriftConfiguration config = new DriftConfiguration(new Configuration());
config.setName(name);
- config.setBasedir(config.new BaseDirectory(fileSystem, basedir));
+ config.setBasedir(new BaseDirectory(fileSystem, basedir));
return config;
}
commit e2645d293a973bec0c6aeb201112eec324a6dccd
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 14:59:27 2011 -0400
revert these back, accidentally deleted tis thinking these server plugin references were agent related.
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
index 326c993..e76feab 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
@@ -83,6 +83,7 @@ public abstract class ServerPluginDescriptorUtil {
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_ENTITLEMENT, XmlSchemas.PKG_SERVERPLUGIN_ENTITLEMENT);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_BUNDLE, XmlSchemas.PKG_SERVERPLUGIN_BUNDLE);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_PACKAGETYPE, XmlSchemas.PKG_SERVERPLUGIN_PACKAGETYPE);
+ PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_DRIFT, XmlSchemas.PKG_SERVERPLUGIN_DRIFT);
// so we only have to do this once, build a ':' separated context path containing all schema package names
StringBuilder packages = new StringBuilder();
@@ -238,8 +239,8 @@ public abstract class ServerPluginDescriptorUtil {
pluginDescriptor = ((JAXBElement<? extends ServerPluginDescriptorType>) jaxbElement).getValue();
} finally {
if (unmarshaller != null) {
- ValidationEventCollector validationEventCollector = (ValidationEventCollector) unmarshaller
- .getEventHandler();
+ ValidationEventCollector validationEventCollector =
+ (ValidationEventCollector)unmarshaller.getEventHandler();
logValidationEvents(pluginJarFileUrl, validationEventCollector);
}
}
@@ -329,35 +330,34 @@ public abstract class ServerPluginDescriptorUtil {
//
StringBuilder message = new StringBuilder();
String severity = null;
- switch (event.getSeverity()) {
- case ValidationEvent.WARNING:
- severity = "warning";
- break;
- case ValidationEvent.ERROR:
- severity = "error";
- break;
- case ValidationEvent.FATAL_ERROR:
- severity = "fatal error";
- break;
+ switch(event.getSeverity()) {
+ case ValidationEvent.WARNING:
+ severity = "warning";
+ break;
+ case ValidationEvent.ERROR:
+ severity = "error";
+ break;
+ case ValidationEvent.FATAL_ERROR:
+ severity = "fatal error";
+ break;
}
message.append("Validation ").append(severity);
File pluginJarFile = new File(pluginJarFileUrl.getPath());
- message.append(" while parsing [").append(pluginJarFile.getName()).append(":").append(
- PLUGIN_DESCRIPTOR_PATH).append("]");
+ message.append(" while parsing [").append(pluginJarFile.getName()).append(":").append(PLUGIN_DESCRIPTOR_PATH).append("]");
ValidationEventLocator locator = event.getLocator();
message.append(" at line ").append(locator.getLineNumber());
message.append(", column ").append(locator.getColumnNumber());
message.append(": ").append(event.getMessage());
// Now write the message to the log at an appropriate level.
- switch (event.getSeverity()) {
- case ValidationEvent.WARNING:
- case ValidationEvent.ERROR:
- LOG.warn(message);
- break;
- case ValidationEvent.FATAL_ERROR:
- LOG.error(message);
- break;
+ switch(event.getSeverity()) {
+ case ValidationEvent.WARNING:
+ case ValidationEvent.ERROR:
+ LOG.warn(message);
+ break;
+ case ValidationEvent.FATAL_ERROR:
+ LOG.error(message);
+ break;
}
}
}
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
index 4aab442..ea48d0e 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
@@ -75,4 +75,8 @@ public interface XmlSchemas {
// the schema used to define content source metadata which is used by content plugins like the URL or Disk plugins
public static final String XSD_CONTENTSOURCE_PACKAGEDETAILS = "rhq-contentsource-packagedetails.xsd";
public static final String PKG_CONTENTSOURCE_PACKAGEDETAILS = "org.rhq.enterprise.server.xmlschema.generated.contentsource.packagedetails";
+
+ // the schema used to define content source metadata which is used by content plugins like the URL or Disk plugins
+ public static final String XSD_SERVERPLUGIN_DRIFT = "rhq-serverplugin-drift.xsd";
+ public static final String PKG_SERVERPLUGIN_DRIFT = "org.rhq.enterprise.server.xmlschema.generated.serverplugin.drift";
}
\ No newline at end of file
commit 5eb7bece78ee487d73a49f5a0600954245d4ba83
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 14:58:59 2011 -0400
rip out the pre-canned drift configuration definition - turns out, we don't really need this persisted.
the resource types will have relationships directly to templates, so we won't have floating or orphaned templates
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index e2a599d..39f0798 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.112</db.schema.version>
+ <db.schema.version>2.111</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/config-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/config-data.xml
deleted file mode 100644
index 904e10b..0000000
--- a/modules/core/dbutils/src/main/scripts/dbsetup/config-data.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<dbsetup name="config-data.xml">
- <table name="RHQ_CONFIG_DEF">
- <data id="1" name="GLOBAL_DRIFT_CONFIG_DEF" description="The drift configuration definition"
- config_format="STRUCTURED" />
- </table>
-
- <table name="RHQ_CONFIG_PROP_DEF">
- <data id="1" name="name" display_name="Drift Configuration Name" config_def_id="1"
- description="The drift configuration name"
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <data id="2" name="enabled" display_name="Enabled" config_def_id="1"
- description="Enables or disables the drift configuration"
- required="true"
- readonly="false"
- summary="true"
- order_index="1"
- dtype="property"
- simple_type="BOOLEAN"
- allow_custom_enum_value="false"
- default_value="false" />
-
- <data id="3" name="basedir" display_name="Base Directory" config_def_id="1"
- description="The root directory from which snapshots will be generated during drift monitoring."
- required="true"
- readonly="false"
- summary="true"
- order_index="2"
- dtype="map" />
-
- <data id="4" name="valueContext" display_name="Value Context" parent_map_definition_id="3"
- description="Identifies where the named value can be found."
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <data id="5" name="valueName" display_name="Value Name" parent_map_definition_id="3"
- description="The name of the value as found in the context"
- required="true"
- readonly="false"
- summary="true"
- order_index="1"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <data id="6" name="interval" display_name="Interval" config_def_id="1"
- description="The frequency in seconds in which drift monitoring should run. Defaults to 1800 seconds (i.e. 30 minutes)"
- required="false"
- readonly="false"
- summary="true"
- order_index="3"
- dtype="property"
- simple_type="LONG"
- allow_custom_enum_value="false"
- default_value="1800" />
-
- <!-- the JPA mapping is weird here - we insert the child row first, then the parent.
- This is because the child row does not specify any config_def_id OR parent_list_definition_id.
- All relationship references are null.
- The parent list will point its parent_list_definition_id to this map row's ID and is why
- we need to put the child row in first, so it exists for the parent to refer to.
- You do this to indicate it is the parent to this child row and this child row denotes
- the parent list's member definition
- -->
- <data id="8" name="include" display_name="Include"
- description="A pattern that specifies a file or directory to include."
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="map" />
-
- <data id="7" name="includes" display_name="Includes" config_def_id="1" parent_list_definition_id="8"
- description="A set of patterns that specify files and/or directories to include."
- required="false"
- readonly="false"
- summary="true"
- order_index="4"
- dtype="list" />
-
- <data id="9" name="path" display_name="Path" parent_map_definition_id="8"
- description="A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration."
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <data id="10" name="pattern" display_name="Pattern" parent_map_definition_id="8"
- description="Pathname pattern that must match for the items in the directory path to be included."
- required="false"
- readonly="false"
- summary="true"
- order_index="1"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <!-- the JPA mapping is weird here - we insert the child row first, then the parent.
- This is because the child row does not specify any config_def_id OR parent_list_definition_id.
- All relationship references are null.
- The parent list will point its parent_list_definition_id to this map row's ID and is why
- we need to put the child row in first, so it exists for the parent to refer to.
- You do this to indicate it is the parent to this child row and this child row denotes
- the parent list's member definition
- -->
- <data id="12" name="exclude" display_name="Exclude"
- description="A pattern that specifies a file or directory to exclude."
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="map" />
-
- <data id="11" name="excludes" display_name="Excludes" config_def_id="1" parent_list_definition_id="12"
- description="A set of patterns that specify files and/or directories to exclude."
- required="false"
- readonly="false"
- summary="true"
- order_index="5"
- dtype="list" />
-
- <data id="13" name="path" display_name="Path" parent_map_definition_id="12"
- description="A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration."
- required="true"
- readonly="false"
- summary="true"
- order_index="0"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
-
- <data id="14" name="pattern" display_name="Pattern" parent_map_definition_id="12"
- description="Pathname pattern that must match for the items in the directory path to be excluded."
- required="false"
- readonly="false"
- summary="true"
- order_index="1"
- dtype="property"
- simple_type="STRING"
- allow_custom_enum_value="false" />
- </table>
-
- <table name="RHQ_CONF_PROP_DEF_ENUM">
- <data id="1" name="pluginConfiguration" string_value="pluginConfiguration" order_index="0" property_def_id="4" />
- <data id="2" name="resourceConfiguration" string_value="resourceConfiguration" order_index="1" property_def_id="4" />
- <data id="3" name="measurementTrait" string_value="measurementTrait" order_index="2" property_def_id="4" />
- <data id="4" name="fileSystem" string_value="fileSystem" order_index="3" property_def_id="4" />
- </table>
-
-</dbsetup>
\ No newline at end of file
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 57c100c..bc4bc43 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3445,160 +3445,6 @@
</schemaSpec>
<schemaSpec version="2.111">
- <!-- BUILD THE STATIC CONFIG DEFINITION FOR DRIFT CONFIGURATION -->
-
- <!-- db agnostic insert the config def row -->
- <schema-directSQL>
- <statement desc="Creating global drift configuration definition">
- INSERT INTO rhq_config_def (id, name, description, config_format)
- VALUES (1, 'GLOBAL_DRIFT_CONFIG_DEF', 'The drift configuration definition', 'STRUCTURED')
- </statement>
- </schema-directSQL>
-
- <!-- db specific inserts to add the property defs -->
- <!-- POSTGRES -->
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (1, 'name', 'Drift Configuration Name', 1, 'The drift configuration name', 'true', 'false', 'true', 0, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value, default_value)
- VALUES (2, 'enabled', 'Enabled', 1, 'Enables or disables the drift configuration' , 'true', 'false', 'true', 1, 'property', 'BOOLEAN', 'false', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype)
- VALUES (3, 'basedir', 'Base Directory', 1, 'The root directory from which snapshots will be generated during drift monitoring.', 'true', 'false', 'true', 2, 'map')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (4, 'valueContext', 'Value Context', 3, 'Identifies where the named value can be found.', 'true', 'false', 'true', 0, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (5, 'valueName', 'Value Name', 3, 'The name of the value as found in the context', 'true', 'false', 'true', 1, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value, default_value)
- VALUES (6, 'interval', 'Interval', 1, 'The frequency in seconds in which drift monitoring should run. Defaults to 1800 seconds (i.e. 30 minutes)', 'false', 'false', 'true', 3, 'property', 'LONG', 'false', '1800')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, description, required, readonly, summary, order_index, dtype)
- VALUES (8, 'include', 'Include', 'A pattern that specifies a file or directory to include.', 'true', 'false', 'true', 0, 'map')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, parent_list_definition_id, description, required, readonly, summary, order_index, dtype)
- VALUES (7, 'includes', 'Includes', 1, 8, 'A set of patterns that specify files and/or directories to include.', 'false', 'false', 'true', 4, 'list')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (9, 'path', 'Path', 8, 'A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration.', 'true', 'false', 'true', 0, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (10, 'pattern', 'Pattern', 8, 'Pathname pattern that must match for the items in the directory path to be included.', 'false', 'false', 'true', 1, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, description, required, readonly, summary, order_index, dtype)
- VALUES (12, 'exclude', 'Exclude', 'A pattern that specifies a file or directory to exclude.', 'true', 'false', 'true', 0, 'map')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, parent_list_definition_id, description, required, readonly, summary, order_index, dtype)
- VALUES (11, 'excludes', 'Excludes', 1, 12, 'A set of patterns that specify files and/or directories to exclude.', 'false', 'false', 'true', 5, 'list')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (13, 'path', 'Path', 12, 'A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration.', 'true', 'false', 'true', 0, 'property', 'STRING', 'false')
- </statement>
- <statement targetDBVendor="postgresql">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (14, 'pattern', 'Pattern', 12, 'Pathname pattern that must match for the items in the directory path to be excluded.', 'false', 'false', 'true', 1, 'property', 'STRING', 'false')
- </statement>
- </schema-directSQL>
-
- <!-- ORACLE -->
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (1, 'name', 'Drift Configuration Name', 1, 'The drift configuration name', 1, 0, 1, 0, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value, default_value)
- VALUES (2, 'enabled', 'Enabled', 1, 'Enables or disables the drift configuration' , 1, 0, 1, 1, 'property', 'BOOLEAN', 0, 'false')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype)
- VALUES (3, 'basedir', 'Base Directory', 1, 'The root directory from which snapshots will be generated during drift monitoring.', 1, 0, 1, 2, 'map')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (4, 'valueContext', 'Value Context', 3, 'Identifies where the named value can be found.', 1, 0, 1, 0, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (5, 'valueName', 'Value Name', 3, 'The name of the value as found in the context', 1, 0, 1, 1, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value, default_value)
- VALUES (6, 'interval', 'Interval', 1, 'The frequency in seconds in which drift monitoring should run. Defaults to 1800 seconds (i.e. 30 minutes)', 0, 0, 1, 3, 'property', 'LONG', 0, '1800')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, description, required, readonly, summary, order_index, dtype)
- VALUES (8, 'include', 'Include', 'A pattern that specifies a file or directory to include.', 1, 0, 1, 0, 'map')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, parent_list_definition_id, description, required, readonly, summary, order_index, dtype)
- VALUES (7, 'includes', 'Includes', 1, 8, 'A set of patterns that specify files and/or directories to include.', 0, 0, 1, 4, 'list')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (9, 'path', 'Path', 8, 'A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration.', 1, 0, 1, 0, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (10, 'pattern', 'Pattern', 8, 'Pathname pattern that must match for the items in the directory path to be included.', 0, 0, 1, 1, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, description, required, readonly, summary, order_index, dtype)
- VALUES (12, 'exclude', 'Exclude', 'A pattern that specifies a file or directory to exclude.', 1, 0, 1, 0, 'map')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, config_def_id, parent_list_definition_id, description, required, readonly, summary, order_index, dtype)
- VALUES (11, 'excludes', 'Excludes', 1, 12, 'A set of patterns that specify files and/or directories to exclude.', 0, 0, 1, 5, 'list')
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (13, 'path', 'Path', 12, 'A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift configuration.', 1, 0, 1, 0, 'property', 'STRING', 0)
- </statement>
- <statement targetDBVendor="oracle">
- INSERT INTO rhq_config_prop_def (id, name, display_name, parent_map_definition_id, description, required, readonly, summary, order_index, dtype, simple_type, allow_custom_enum_value)
- VALUES (14, 'pattern', 'Pattern', 12, 'Pathname pattern that must match for the items in the directory path to be excluded.', 0, 0, 1, 1, 'property', 'STRING', 0)
- </statement>
- </schema-directSQL>
-
- <!-- db agnostic inserts to add the enum values -->
- <schema-directSQL>
- <statement>
- INSERT INTO rhq_conf_prop_def_enum (id, name, string_value, order_index, property_def_id)
- VALUES (1, 'pluginConfiguration', 'pluginConfiguration', 0, 4)
- </statement>
- <statement>
- INSERT INTO rhq_conf_prop_def_enum (id, name, string_value, order_index, property_def_id)
- VALUES (2, 'resourceConfiguration', 'resourceConfiguration', 1, 4)
- </statement>
- <statement>
- INSERT INTO rhq_conf_prop_def_enum (id, name, string_value, order_index, property_def_id)
- VALUES (3, 'measurementTrait', 'measurementTrait', 2, 4)
- </statement>
- <statement>
- INSERT INTO rhq_conf_prop_def_enum (id, name, string_value, order_index, property_def_id)
- VALUES (4, 'fileSystem', 'fileSystem', 3, 4)
- </statement>
- </schema-directSQL>
-
- </schemaSpec>
-
- <schemaSpec version="2.112">
<schema-directSQL>
<statement desc="Creating table RHQ_DRIFT_TEMPLATE">
CREATE TABLE RHQ_DRIFT_TEMPLATE (
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java
index bdf677d..3b4576d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java
@@ -79,7 +79,7 @@ public class DriftConfigurationDefinition implements Serializable {
}
static {
- INSTANCE.setId(1);
+ //INSTANCE.setId(1);
INSTANCE.setConfigurationFormat(ConfigurationFormat.STRUCTURED);
INSTANCE.put(createName());
@@ -98,7 +98,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(1);
+ //pd.setId(1);
pd.setDisplayName("Drift Configuration Name");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -115,7 +115,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.BOOLEAN;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(2);
+ //pd.setId(2);
pd.setDisplayName("Enabled");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -135,7 +135,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionSimple valueName = createBasedirValueName();
PropertyDefinitionMap pd = new PropertyDefinitionMap(name, description, required, valueContext, valueName);
- pd.setId(3);
+ //pd.setId(3);
pd.setDisplayName("Base Directory");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -152,7 +152,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(4);
+ //pd.setId(4);
pd.setDisplayName("Value Context");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -160,22 +160,22 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionEnumeration pcEnum = new PropertyDefinitionEnumeration(
BaseDirValueContext.pluginConfiguration.name(), BaseDirValueContext.pluginConfiguration.name());
- pcEnum.setId(1);
+ //pcEnum.setId(1);
pcEnum.setOrderIndex(0);
PropertyDefinitionEnumeration rcEnum = new PropertyDefinitionEnumeration(
BaseDirValueContext.resourceConfiguration.name(), BaseDirValueContext.resourceConfiguration.name());
- rcEnum.setId(2);
+ //rcEnum.setId(2);
rcEnum.setOrderIndex(1);
PropertyDefinitionEnumeration mtEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.measurementTrait
.name(), BaseDirValueContext.measurementTrait.name());
- mtEnum.setId(3);
+ //mtEnum.setId(3);
mtEnum.setOrderIndex(2);
PropertyDefinitionEnumeration fsEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.fileSystem.name(),
BaseDirValueContext.fileSystem.name());
- fsEnum.setId(4);
+ //fsEnum.setId(4);
fsEnum.setOrderIndex(3);
ArrayList<PropertyDefinitionEnumeration> pdEnums = new ArrayList<PropertyDefinitionEnumeration>(4);
@@ -195,7 +195,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(5);
+ //pd.setId(5);
pd.setDisplayName("Value Name");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -211,7 +211,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.LONG;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(6);
+ //pd.setId(6);
pd.setDisplayName("Interval");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -230,7 +230,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionMap map = createInclude();
PropertyDefinitionList pd = new PropertyDefinitionList(name, description, required, map);
- pd.setId(7);
+ //pd.setId(7);
pd.setDisplayName("Includes");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -248,7 +248,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionSimple pattern = createIncludePattern();
PropertyDefinitionMap pd = new PropertyDefinitionMap(name, description, required, path, pattern);
- pd.setId(8);
+ //pd.setId(8);
pd.setDisplayName("Include");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -263,7 +263,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(9);
+ //pd.setId(9);
pd.setDisplayName("Path");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -279,7 +279,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(10);
+ //pd.setId(10);
pd.setDisplayName("Pattern");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -296,7 +296,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionMap map = createExclude();
PropertyDefinitionList pd = new PropertyDefinitionList(name, description, required, map);
- pd.setId(11);
+ //pd.setId(11);
pd.setDisplayName("Excludes");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -314,7 +314,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertyDefinitionSimple pattern = createExcludePattern();
PropertyDefinitionMap pd = new PropertyDefinitionMap(name, description, required, path, pattern);
- pd.setId(12);
+ //pd.setId(12);
pd.setDisplayName("Exclude");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -329,7 +329,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(13);
+ //pd.setId(13);
pd.setDisplayName("Path");
pd.setReadOnly(false);
pd.setSummary(true);
@@ -345,7 +345,7 @@ public class DriftConfigurationDefinition implements Serializable {
PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
- pd.setId(14);
+ //pd.setId(14);
pd.setDisplayName("Pattern");
pd.setReadOnly(false);
pd.setSummary(true);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftConfigurationDefinitionTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftConfigurationDefinitionTest.java
deleted file mode 100644
index 6388292..0000000
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftConfigurationDefinitionTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 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.enterprise.server.drift;
-
-import java.util.List;
-
-import org.testng.annotations.Test;
-
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.drift.DriftConfigurationDefinition;
-import org.rhq.enterprise.server.test.AbstractEJB3Test;
-
-/**
- * Tests that our hard-coded singleton DriftConfigurationDefinition is persisted properly in the DB.
- */
-@Test
-public class DriftConfigurationDefinitionTest extends AbstractEJB3Test {
-
- public void testDriftConfigurationDefinition() throws Throwable {
- ConfigurationDefinition def;
- ConfigurationDefinition defDATABASE;
-
- getTransactionManager().begin();
- try {
- def = DriftConfigurationDefinition.getInstance();
- defDATABASE = getEntityManager().find(ConfigurationDefinition.class, def.getId());
- } finally {
- getTransactionManager().rollback();
- }
-
- assert defDATABASE.getId() == def.getId();
- assert defDATABASE.getPropertyDefinitions().size() == def.getPropertyDefinitions().size();
-
- PropertyDefinitionSimple simpleDATABASE;
- PropertyDefinitionSimple simple;
- PropertyDefinitionMap mapDATABASE;
- PropertyDefinitionMap map;
- PropertyDefinitionList listDATABASE;
- PropertyDefinitionList list;
-
- // NAME
- simpleDATABASE = defDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_NAME);
- simple = def.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_NAME);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // ENABLED
- simpleDATABASE = defDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_ENABLED);
- simple = def.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_ENABLED);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // INTERVAL
- simpleDATABASE = defDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_INTERVAL);
- simple = def.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_INTERVAL);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // BASEDIR
- mapDATABASE = defDATABASE.getPropertyDefinitionMap(DriftConfigurationDefinition.PROP_BASEDIR);
- map = def.getPropertyDefinitionMap(DriftConfigurationDefinition.PROP_BASEDIR);
- assertMapProperty(mapDATABASE, map);
-
- // BASEDIR VALUECONTEXT (implicitly also tests the enums)
- simpleDATABASE = mapDATABASE
- .getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // BASEDIR VALUENAME
- simpleDATABASE = mapDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // INCLUDES
- listDATABASE = defDATABASE.getPropertyDefinitionList(DriftConfigurationDefinition.PROP_INCLUDES);
- list = def.getPropertyDefinitionList(DriftConfigurationDefinition.PROP_INCLUDES);
- assertListProperty(listDATABASE, list);
-
- // INCLUDES INCLUDE
- mapDATABASE = (PropertyDefinitionMap) listDATABASE.getMemberDefinition();
- map = (PropertyDefinitionMap) list.getMemberDefinition();
- assertMapProperty(mapDATABASE, map);
-
- // INCLUDES INCLUDE PATH
- simpleDATABASE = mapDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATH);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATH);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // INCLUDES INCLUDE PATTERN
- simpleDATABASE = mapDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATTERN);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATTERN);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // EXCLUDES
- listDATABASE = defDATABASE.getPropertyDefinitionList(DriftConfigurationDefinition.PROP_EXCLUDES);
- list = def.getPropertyDefinitionList(DriftConfigurationDefinition.PROP_EXCLUDES);
- assertListProperty(listDATABASE, list);
-
- // EXCLUDES EXCLUDE
- mapDATABASE = (PropertyDefinitionMap) listDATABASE.getMemberDefinition();
- map = (PropertyDefinitionMap) list.getMemberDefinition();
- assertMapProperty(mapDATABASE, map);
-
- // EXCLUDES EXCLUDE PATH
- simpleDATABASE = mapDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATH);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATH);
- assertSimpleProperty(simpleDATABASE, simple);
-
- // EXCLUDES EXCLUDE PATTERN
- simpleDATABASE = mapDATABASE.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATTERN);
- simple = map.getPropertyDefinitionSimple(DriftConfigurationDefinition.PROP_PATTERN);
- assertSimpleProperty(simpleDATABASE, simple);
- }
-
- private void assertListProperty(PropertyDefinitionList listDb, PropertyDefinitionList list) throws Throwable {
-
- try {
- assert listDb.getId() == list.getId();
- assert listDb.getActivationPolicy() == list.getActivationPolicy();
- assert listDb.getDescription().equals(list.getDescription());
- assert listDb.getDisplayName().equals(list.getDisplayName());
- assert listDb.getName().equals(list.getName());
- assert listDb.getOrder() == list.getOrder();
- } catch (Throwable t) {
- System.out.println("Lists failed test:\nlistDb=[" + listDb + "]\nlist=[" + list + "]");
- throw t;
- }
- }
-
- private void assertMapProperty(PropertyDefinitionMap mapDb, PropertyDefinitionMap map) throws Throwable {
-
- try {
- assert mapDb.getId() == map.getId();
- assert mapDb.getActivationPolicy() == map.getActivationPolicy();
- assert mapDb.getDescription().equals(map.getDescription());
- assert mapDb.getDisplayName().equals(map.getDisplayName());
- assert mapDb.getName().equals(map.getName());
- assert mapDb.getOrder() == map.getOrder();
- } catch (Throwable t) {
- System.out.println("Maps failed test:\nmapDb=[" + mapDb + "]\nmap=[" + map + "]");
- throw t;
- }
- }
-
- private void assertSimpleProperty(PropertyDefinitionSimple simpleDb, PropertyDefinitionSimple simple)
- throws Throwable {
-
- try {
- assert simpleDb.getId() == simple.getId();
- assert simpleDb.getAllowCustomEnumeratedValue() == simple.getAllowCustomEnumeratedValue();
- assert simpleDb.getActivationPolicy() == simple.getActivationPolicy();
- assert simpleDb.getDescription().equals(simple.getDescription());
- assert simpleDb.getDisplayName().equals(simple.getDisplayName());
- assert simpleDb.getName().equals(simple.getName());
- assert simpleDb.getOrder() == simple.getOrder();
- assert simpleDb.getType() == simple.getType();
- if (simpleDb.getDefaultValue() == null) {
- assert simpleDb.getDefaultValue() == null && simple.getDefaultValue() == null;
- } else {
- assert simpleDb.getDefaultValue().equals(simple.getDefaultValue());
- }
- assertEnumeratedValues(simpleDb.getEnumeratedValues(), simple.getEnumeratedValues());
-
- } catch (Throwable t) {
- System.out.println("Simples failed test:\nsimpleDb=[" + simpleDb + "]\nsimple=[" + simple + "]");
- throw t;
- }
- }
-
- private void assertEnumeratedValues(List<PropertyDefinitionEnumeration> enumsDb,
- List<PropertyDefinitionEnumeration> enums) throws Throwable {
-
- assert enumsDb.size() == enums.size() : "enum sizes do not match: " + enumsDb.size() + ":" + enums.size();
-
- for (int i = 0; i < enumsDb.size(); i++) {
- PropertyDefinitionEnumeration eenumDb = enumsDb.get(i);
- PropertyDefinitionEnumeration eenum = enums.get(i);
-
- try {
- assert eenumDb.getId() == eenum.getId();
- assert eenumDb.getName().equals(eenum.getName());
- assert eenumDb.getOrderIndex() == eenum.getOrderIndex();
- assert eenumDb.getValue().equals(eenum.getValue());
- } catch (Throwable t) {
- System.out.println("Enum failed test:\neenumDb=[" + eenumDb + "]\neenums=[" + eenum + "]");
- throw t;
- }
- }
- }
-}
\ No newline at end of file
commit 00d8b7c8505c176709e37eecf77369784091a605
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 14:13:59 2011 -0400
an initial stab at a drift config for jboss-as.
diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
index a151196..2d11f7a 100644
--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
@@ -257,6 +257,18 @@
</configuration>
</content>
+ <drift-configuration name="Core Files">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>jbossHomeDir</value-name>
+ </basedir>
+ <includes>
+ <include path="bin" />
+ <include path="lib" />
+ <include path="client" />
+ </includes>
+ </drift-configuration>
+
<bundle-target>
<destination-base-dir name="Install Directory" description="The top directory where the JBossAS Server is installed. (i.e. the value found in the 'JBoss Home Directory' connection property)">
<value-context>pluginConfiguration</value-context>
commit 5843aece1e20f19bce486ac31c393f259a20015c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 14:13:43 2011 -0400
combine the drift schema into the main plugin xsd. we no longer have a separate drift.xsd
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/DriftMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/DriftMetadataParser.java
index 54892ab..c7c0a12 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/DriftMetadataParser.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/DriftMetadataParser.java
@@ -23,9 +23,9 @@
package org.rhq.core.clientapi.agent.metadata;
-import org.rhq.core.clientapi.descriptor.drift.DriftDescriptor;
-import org.rhq.core.clientapi.descriptor.drift.DriftFilterDescriptor;
-import org.rhq.core.clientapi.descriptor.drift.DriftDescriptor.Basedir;
+import org.rhq.core.clientapi.descriptor.plugin.DriftDescriptor;
+import org.rhq.core.clientapi.descriptor.plugin.DriftFilterDescriptor;
+import org.rhq.core.clientapi.descriptor.plugin.DriftDescriptor.Basedir;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
index 93c4417..f3aa13e 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
@@ -33,10 +33,10 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.rhq.core.clientapi.descriptor.drift.DriftDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.Bundle;
import org.rhq.core.clientapi.descriptor.plugin.BundleTargetDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.ContentDescriptor;
+import org.rhq.core.clientapi.descriptor.plugin.DriftDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.EventDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.MetricDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.OperationDescriptor;
diff --git a/modules/core/client-api/src/main/resources/rhq-plugin.xsd b/modules/core/client-api/src/main/resources/rhq-plugin.xsd
index 65d0fdb..e02013a 100644
--- a/modules/core/client-api/src/main/resources/rhq-plugin.xsd
+++ b/modules/core/client-api/src/main/resources/rhq-plugin.xsd
@@ -2,7 +2,6 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:config="urn:xmlns:rhq-configuration"
- xmlns:drift="urn:xmlns:rhq-drift"
xmlns:rhq="urn:xmlns:rhq-plugin"
targetNamespace="urn:xmlns:rhq-plugin"
elementFormDefault="qualified"
@@ -10,7 +9,6 @@
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" blockDefault="">
<xs:import namespace="urn:xmlns:rhq-configuration" schemaLocation="rhq-configuration.xsd"/>
- <xs:import namespace="urn:xmlns:rhq-drift" schemaLocation="rhq-drift.xsd"/>
<xs:annotation>
<xs:documentation>Schema for the definition of an AMPS plugin. AMPS plugins provide the metadata for new
@@ -550,6 +548,111 @@
</xs:complexType>
</xs:element>
+ <!-- == Drift ================================================== -->
+
+ <xs:complexType name="Drift">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class name="DriftDescriptor" />
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="basedir" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation>
+ The root directory from which snapshots will be generated during drift monitoring.
+ Each base directory's value is obtained from a particular context (e.g. in the
+ resource's plugin configuration or its resource configuration).
+ Within that context, the base directory value is obtained by looking up the named value in the given context.
+ For example, if the value-name is "install.dir" and the value-context is "pluginConfiguration",
+ then the destination base directory value is obtained by getting the "install.dir" property value
+ found in the resource's plugin configuration.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="value-context">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="pluginConfiguration"></xs:enumeration>
+ <xs:enumeration value="resourceConfiguration"></xs:enumeration>
+ <xs:enumeration value="measurementTrait"></xs:enumeration>
+ <xs:enumeration value="fileSystem"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="value-name" type="xs:string"></xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="interval" type="xs:long" minOccurs="0" maxOccurs="1" default="1800">
+ <xs:annotation>
+ <xs:documentation>
+ The frequency in seconds in which drift monitoring should run. Defaults to thirty minutes.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="includes" type="rhq:DriftIncludes" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ A set of patterns that specify files and/or directories to include.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="excludes" type="rhq:DriftExcludes" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ A set of patterns that specify files and/or directories to exclude.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:complexType>
+
+ <xs:complexType name="DriftIncludes">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class name="DriftIncludesDescriptor" />
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="include" type="rhq:DriftFilter" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="DriftExcludes">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class name="DriftExcludesDescriptor" />
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="exclude" type="rhq:DriftFilter" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="DriftFilter">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class name="DriftFilterDescriptor" />
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:attribute name="path" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ A file system path that can be a directory or a file. The path is assumed to be
+ relative to the base directory of the drift configuration.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pattern" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>Provides a pattern that matches those files to be monitored for drift.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
<!-- BASE RESOURCE -->
<xs:element name="resource" type="rhq:resource">
@@ -622,7 +725,7 @@
<xs:element ref="rhq:event" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="rhq:content" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="resource-configuration" type="config:configuration" minOccurs="0"/>
- <xs:element name="drift-configuration" type="drift:Drift" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="drift-configuration" type="rhq:Drift" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="rhq:bundle-target" minOccurs="0" maxOccurs="1"/>
<xs:element ref="rhq:help" minOccurs="0" maxOccurs="1" />
</xs:sequence>
diff --git a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/PluginMetadataParserTest.java b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/PluginMetadataParserTest.java
index f44d2cb..527a5f9 100644
--- a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/PluginMetadataParserTest.java
+++ b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/PluginMetadataParserTest.java
@@ -364,14 +364,13 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -393,14 +392,13 @@ public class PluginMetadataParserTest {
toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>saywhat</d:value-context>" + // this is an invalid context
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
+ " <basedir>" + //
+ " <value-context>saywhat</value-context>" + // this is an invalid context
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -415,14 +413,13 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -443,15 +440,14 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>3600</d:interval>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
+ " <interval>3600</interval>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -472,18 +468,17 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
- " <d:includes>" + //
- " <d:include path='lib' pattern='*.jar'/>" + //
- " <d:include path='conf' pattern='*.xml'/>" + //
- " </d:includes>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
+ " <includes>" + //
+ " <include path='lib' pattern='*.jar'/>" + //
+ " <include path='conf' pattern='*.xml'/>" + //
+ " </includes>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -528,19 +523,18 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>3600</d:interval>" + //
- " <d:excludes>" + //
- " <d:exclude path='lib' pattern='*.jar'/>" + //
- " <d:exclude path='conf' pattern='*.xml'/>" + //
- " </d:excludes>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
+ " <interval>3600</interval>" + //
+ " <excludes>" + //
+ " <exclude path='lib' pattern='*.jar'/>" + //
+ " <exclude path='conf' pattern='*.xml'/>" + //
+ " </excludes>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
@@ -590,52 +584,51 @@ public class PluginMetadataParserTest {
PluginDescriptor descriptor = toPluginDescriptor("" + //
"<plugin name='drift-test-plugin' displayName='Drift Test' package='org.rhq.plugins.test'" + //
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + //
- " xmlns='urn:xmlns:rhq-plugin'" + //
- " xmlns:d='urn:xmlns:rhq-drift'>" + //
+ " xmlns='urn:xmlns:rhq-plugin'>" + //
" <server name='TestServer'>" + //
" <drift-configuration name='test1'>" + //
- " <d:basedir>" + //
- " <d:value-context>pluginConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test1</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>11111</d:interval>" + //
- " <d:includes>" + //
- " <d:include path='ilib' pattern='*.ijar'/>" + //
- " <d:include path='iconf' pattern='*.ixml'/>" + //
- " </d:includes>" + //
+ " <basedir>" + //
+ " <value-context>pluginConfiguration</value-context>" + //
+ " <value-name>var.lib.test1</value-name>" + //
+ " </basedir>" + //
+ " <interval>11111</interval>" + //
+ " <includes>" + //
+ " <include path='ilib' pattern='*.ijar'/>" + //
+ " <include path='iconf' pattern='*.ixml'/>" + //
+ " </includes>" + //
" </drift-configuration>" + //
" <drift-configuration name='test2'>" + //
- " <d:basedir>" + //
- " <d:value-context>resourceConfiguration</d:value-context>" + //
- " <d:value-name>var.lib.test2</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>22222</d:interval>" + //
- " <d:excludes>" + //
- " <d:exclude path='elib' pattern='*.ejar'/>" + //
- " <d:exclude path='econf' pattern='*.exml'/>" + //
- " </d:excludes>" + //
+ " <basedir>" + //
+ " <value-context>resourceConfiguration</value-context>" + //
+ " <value-name>var.lib.test2</value-name>" + //
+ " </basedir>" + //
+ " <interval>22222</interval>" + //
+ " <excludes>" + //
+ " <exclude path='elib' pattern='*.ejar'/>" + //
+ " <exclude path='econf' pattern='*.exml'/>" + //
+ " </excludes>" + //
" </drift-configuration>" + //
" <drift-configuration name='test3'>" + //
- " <d:basedir>" + //
- " <d:value-context>measurementTrait</d:value-context>" + //
- " <d:value-name>var.lib.test3</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>33333</d:interval>" + //
- " <d:includes>" + //
- " <d:include path='ilib' pattern='*.ijar'/>" + //
- " <d:include path='iconf' pattern='*.ixml'/>" + //
- " </d:includes>" + //
- " <d:excludes>" + //
- " <d:exclude path='elib' pattern='*.ejar'/>" + //
- " <d:exclude path='econf' pattern='*.exml'/>" + //
- " </d:excludes>" + //
+ " <basedir>" + //
+ " <value-context>measurementTrait</value-context>" + //
+ " <value-name>var.lib.test3</value-name>" + //
+ " </basedir>" + //
+ " <interval>33333</interval>" + //
+ " <includes>" + //
+ " <include path='ilib' pattern='*.ijar'/>" + //
+ " <include path='iconf' pattern='*.ixml'/>" + //
+ " </includes>" + //
+ " <excludes>" + //
+ " <exclude path='elib' pattern='*.ejar'/>" + //
+ " <exclude path='econf' pattern='*.exml'/>" + //
+ " </excludes>" + //
" </drift-configuration>" + //
" <drift-configuration name='test4'>" + //
- " <d:basedir>" + //
- " <d:value-context>fileSystem</d:value-context>" + //
- " <d:value-name>/wot/gorilla</d:value-name>" + //
- " </d:basedir>" + //
- " <d:interval>44444</d:interval>" + //
+ " <basedir>" + //
+ " <value-context>fileSystem</value-context>" + //
+ " <value-name>/wot/gorilla</value-name>" + //
+ " </basedir>" + //
+ " <interval>44444</interval>" + //
" </drift-configuration>" + //
" </server>" + //
"</plugin>");
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
index e76feab..326c993 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/ServerPluginDescriptorUtil.java
@@ -83,7 +83,6 @@ public abstract class ServerPluginDescriptorUtil {
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_ENTITLEMENT, XmlSchemas.PKG_SERVERPLUGIN_ENTITLEMENT);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_BUNDLE, XmlSchemas.PKG_SERVERPLUGIN_BUNDLE);
PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_PACKAGETYPE, XmlSchemas.PKG_SERVERPLUGIN_PACKAGETYPE);
- PLUGIN_SCHEMA_PACKAGES.put(XmlSchemas.XSD_SERVERPLUGIN_DRIFT, XmlSchemas.PKG_SERVERPLUGIN_DRIFT);
// so we only have to do this once, build a ':' separated context path containing all schema package names
StringBuilder packages = new StringBuilder();
@@ -239,8 +238,8 @@ public abstract class ServerPluginDescriptorUtil {
pluginDescriptor = ((JAXBElement<? extends ServerPluginDescriptorType>) jaxbElement).getValue();
} finally {
if (unmarshaller != null) {
- ValidationEventCollector validationEventCollector =
- (ValidationEventCollector)unmarshaller.getEventHandler();
+ ValidationEventCollector validationEventCollector = (ValidationEventCollector) unmarshaller
+ .getEventHandler();
logValidationEvents(pluginJarFileUrl, validationEventCollector);
}
}
@@ -330,34 +329,35 @@ public abstract class ServerPluginDescriptorUtil {
//
StringBuilder message = new StringBuilder();
String severity = null;
- switch(event.getSeverity()) {
- case ValidationEvent.WARNING:
- severity = "warning";
- break;
- case ValidationEvent.ERROR:
- severity = "error";
- break;
- case ValidationEvent.FATAL_ERROR:
- severity = "fatal error";
- break;
+ switch (event.getSeverity()) {
+ case ValidationEvent.WARNING:
+ severity = "warning";
+ break;
+ case ValidationEvent.ERROR:
+ severity = "error";
+ break;
+ case ValidationEvent.FATAL_ERROR:
+ severity = "fatal error";
+ break;
}
message.append("Validation ").append(severity);
File pluginJarFile = new File(pluginJarFileUrl.getPath());
- message.append(" while parsing [").append(pluginJarFile.getName()).append(":").append(PLUGIN_DESCRIPTOR_PATH).append("]");
+ message.append(" while parsing [").append(pluginJarFile.getName()).append(":").append(
+ PLUGIN_DESCRIPTOR_PATH).append("]");
ValidationEventLocator locator = event.getLocator();
message.append(" at line ").append(locator.getLineNumber());
message.append(", column ").append(locator.getColumnNumber());
message.append(": ").append(event.getMessage());
// Now write the message to the log at an appropriate level.
- switch(event.getSeverity()) {
- case ValidationEvent.WARNING:
- case ValidationEvent.ERROR:
- LOG.warn(message);
- break;
- case ValidationEvent.FATAL_ERROR:
- LOG.error(message);
- break;
+ switch (event.getSeverity()) {
+ case ValidationEvent.WARNING:
+ case ValidationEvent.ERROR:
+ LOG.warn(message);
+ break;
+ case ValidationEvent.FATAL_ERROR:
+ LOG.error(message);
+ break;
}
}
}
diff --git a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
index ea48d0e..4aab442 100644
--- a/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
+++ b/modules/enterprise/server/xml-schemas/src/main/java/org/rhq/enterprise/server/xmlschema/XmlSchemas.java
@@ -75,8 +75,4 @@ public interface XmlSchemas {
// the schema used to define content source metadata which is used by content plugins like the URL or Disk plugins
public static final String XSD_CONTENTSOURCE_PACKAGEDETAILS = "rhq-contentsource-packagedetails.xsd";
public static final String PKG_CONTENTSOURCE_PACKAGEDETAILS = "org.rhq.enterprise.server.xmlschema.generated.contentsource.packagedetails";
-
- // the schema used to define content source metadata which is used by content plugins like the URL or Disk plugins
- public static final String XSD_SERVERPLUGIN_DRIFT = "rhq-serverplugin-drift.xsd";
- public static final String PKG_SERVERPLUGIN_DRIFT = "org.rhq.enterprise.server.xmlschema.generated.serverplugin.drift";
}
\ No newline at end of file
12 years, 5 months
[rhq] Branch 'drift' - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_add_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_change_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_remove_16.png |binary
3 files changed
New commits:
commit 647acdce0aac4fd055cfd5694489253b85a8dff5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jun 30 13:29:15 2011 -0400
new drift icons for added, removed, and changed files
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_add_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_add_16.png
new file mode 100644
index 0000000..e34f9d7
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_add_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_change_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_change_16.png
new file mode 100644
index 0000000..1f9e3d6
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_change_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_remove_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_remove_16.png
new file mode 100644
index 0000000..80909b5
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/drift/Drift_remove_16.png differ
12 years, 5 months
[rhq] Branch 'drift' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationEditView.java | 21 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 26 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java | 8 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 80 +++++++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java | 33 ++++
5 files changed, 144 insertions(+), 24 deletions(-)
New commits:
commit c3a8220b3412606dc4b6de4350779ec7edb0e816
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Jun 29 17:57:22 2011 -0400
Drift GUI
- Get Delete Drift working
- Improve navigation after a drift config update
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationEditView.java
index 432d9b3..8d9c726 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationEditView.java
@@ -33,11 +33,13 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.drift.DriftConfiguration;
import org.rhq.core.domain.drift.DriftConfigurationDefinition;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
@@ -53,7 +55,6 @@ public class DriftConfigurationEditView extends LocatableVLayout implements Prop
private EntityContext context;
private int driftConfigId;
- private DriftConfiguration driftConfig;
private boolean hasWriteAccess;
private ConfigurationEditor editor;
private ToolStrip buttonbar;
@@ -149,8 +150,22 @@ public class DriftConfigurationEditView extends LocatableVLayout implements Prop
}
public void onSuccess(Void result) {
- Message message;
- message = new Message(MSG.view_drift_success_configurationUpdated(), Message.Severity.Info);
+ Message message = new Message(MSG.view_drift_success_configurationUpdated(), Message.Severity.Info);
+
+ switch (context.getType()) {
+ case Resource:
+ int resourceId = context.getResourceId();
+
+ String driftHistoryUrl = LinkManager.getResourceTabLink(resourceId,
+ ResourceDetailView.Tab.DRIFT, ResourceDetailView.ConfigurationSubTab.HISTORY);
+ driftHistoryUrl = driftHistoryUrl.substring(1); // chop off the leading '#'
+ CoreGUI.goToView(driftHistoryUrl, message);
+
+ break;
+
+ default:
+ throw new IllegalArgumentException("Entity Context Type not supported [" + context + "]");
+ }
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 858e0c2..b8031ea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -85,17 +85,23 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private static final String BASE_VIEW_PATH = "Resource";
public static class Tab {
- public static final String OPERATIONS = "Operations";
public static final String CONFIGURATION = "Configuration";
+ public static final String DRIFT = "Drift";
+ public static final String OPERATIONS = "Operations";
}
- public static class OperationsSubTab {
- public static final String SCHEDULES = "Schedules";
+ public static class ConfigurationSubTab {
+ public static final String CURRENT = "Current";
public static final String HISTORY = "History";
}
- public static class ConfigurationSubTab {
- public static final String CURRENT = "Current";
+ public static class DriftSubTab {
+ public static final String CONFIGURATION = "Configuration";
+ public static final String HISTORY = "History";
+ }
+
+ public static class OperationsSubTab {
+ public static final String SCHEDULES = "Schedules";
public static final String HISTORY = "History";
}
@@ -232,12 +238,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
tabs.add(configurationTab);
- driftTab = new TwoLevelTab(getTabSet().extendLocatorId("Drift"), new ViewName("Drift", MSG
+ driftTab = new TwoLevelTab(getTabSet().extendLocatorId(Tab.DRIFT), new ViewName(Tab.DRIFT, MSG
.view_tabs_common_drift()), "subsystems/drift/Drift_16.png");
- this.driftHistory = new SubTab(driftTab.extendLocatorId("History"), new ViewName("History", MSG
- .view_tabs_common_history()), null);
- this.driftConfig = new SubTab(driftTab.extendLocatorId("Config"), new ViewName("Config", MSG
- .view_tabs_common_configuration()), null);
+ this.driftHistory = new SubTab(driftTab.extendLocatorId(DriftSubTab.HISTORY), new ViewName(DriftSubTab.HISTORY,
+ MSG.view_tabs_common_history()), null);
+ this.driftConfig = new SubTab(driftTab.extendLocatorId(DriftSubTab.CONFIGURATION), new ViewName(
+ DriftSubTab.CONFIGURATION, MSG.view_tabs_common_configuration()), null);
driftTab.registerSubTabs(driftHistory, driftConfig);
tabs.add(driftTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
index 9d0cd0f..3f7aae1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
@@ -41,9 +41,7 @@ public class DriftGWTServiceImpl extends AbstractGWTServiceImpl implements Drift
@Override
public int deleteDrifts(int[] driftIds) throws RuntimeException {
try {
- // TODO
- //return this.driftManager.deleteDrifts(getSessionSubject(), driftIds);
- return 0;
+ return this.driftManager.deleteDrifts(getSessionSubject(), driftIds);
} catch (Throwable t) {
throw getExceptionToThrowToClient(t);
}
@@ -52,9 +50,7 @@ public class DriftGWTServiceImpl extends AbstractGWTServiceImpl implements Drift
@Override
public int deleteDriftsByContext(EntityContext entityContext) throws RuntimeException {
try {
- // TODO
- //return this.driftManager.deleteDriftsByContext(getSessionSubject(), entityContext);
- return 0;
+ return this.driftManager.deleteDriftsByContext(getSessionSubject(), entityContext);
} catch (Throwable t) {
throw getExceptionToThrowToClient(t);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index bb28468..5725d89 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -19,6 +19,8 @@
*/
package org.rhq.enterprise.server.drift;
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
@@ -47,6 +49,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Hibernate;
+import org.jboss.remoting.CannotConnectException;
+
import org.rhq.common.drift.ChangeSetReader;
import org.rhq.common.drift.ChangeSetReaderImpl;
import org.rhq.common.drift.DirectoryEntry;
@@ -75,8 +79,6 @@ import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
-import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
-
@Stateless
public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
private final Log log = LogFactory.getLog(this.getClass());
@@ -102,6 +104,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
+ // use a new transaction when putting things on the JMS queue. see
+ // http://management-platform.blogspot.com/2008/11/transaction-recovery-in-j...
@Override
@TransactionAttribute(REQUIRES_NEW)
public void addChangeSet(int resourceId, long zipSize, InputStream zipStream) throws Exception {
@@ -114,6 +118,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
connection.close();
}
+ // use a new transaction when putting things on the JMS queue. see
+ // http://management-platform.blogspot.com/2008/11/transaction-recovery-in-j...
@Override
@TransactionAttribute(REQUIRES_NEW)
public void addFiles(int resourceId, long zipSize, InputStream zipStream) throws Exception {
@@ -139,7 +145,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
c.addFilterResourceId(resourceId);
List<DriftChangeSet> changeSets = findDriftChangeSetsByCriteria(subjectManager.getOverlord(), c);
final int version = changeSets.size();
- // TODO: set caetgory based on changeset parsing
+ // TODO: set category based on changeset parsing
final DriftChangeSetCategory category = (0 == version) ? DriftChangeSetCategory.COVERAGE
: DriftChangeSetCategory.DRIFT;
@@ -287,6 +293,66 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
}
@Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public int deleteDriftsInNewTransaction(Subject subject, int... driftIds) {
+ int result = 0;
+
+ for (int driftId : driftIds) {
+ Drift doomed = entityManager.find(Drift.class, driftId);
+ if (null != doomed) {
+ entityManager.remove(doomed);
+ ++result;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public int deleteDrifts(Subject subject, int[] driftIds) {
+ // avoid big transactions by doing this one at a time. if this is too slow we can chunk in bigger increments.
+ int result = 0;
+
+ for (int driftId : driftIds) {
+ result += driftManager.deleteDriftsInNewTransaction(subject, driftId);
+ }
+
+ return result;
+ }
+
+ @Override
+ public int deleteDriftsByContext(Subject subject, EntityContext entityContext) throws RuntimeException {
+ int result = 0;
+ DriftCriteria criteria = new DriftCriteria();
+
+ switch (entityContext.getType()) {
+ case Resource:
+ criteria.addFilterResourceIds(entityContext.getResourceId());
+ break;
+
+ case SubsystemView:
+ // delete them all
+ break;
+
+ default:
+ throw new IllegalArgumentException("Entity Context Type not supported [" + entityContext + "]");
+ }
+
+ List<Drift> drifts = driftManager.findDriftsByCriteria(subject, criteria);
+ if (!drifts.isEmpty()) {
+ int[] driftIds = new int[drifts.size()];
+ int i = 0;
+ for (Drift drift : drifts) {
+ driftIds[i++] = drift.getId();
+ }
+
+ result = driftManager.deleteDrifts(subject, driftIds);
+ }
+
+ return result;
+ }
+
+ @Override
public void deleteDriftConfiguration(Subject subject, EntityContext entityContext, String driftConfigName) {
switch (entityContext.getType()) {
@@ -430,10 +496,14 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
AgentClient agentClient = agentManager.getAgentClient(subjectManager.getOverlord(), resourceId);
DriftAgentService service = agentClient.getDriftAgentService();
+ // this is a one-time on-demand call. If it fails throw an exception to make sure the user knows it
+ // did not happen. But clean it up a bit if it's a connect exception
try {
service.detectDrift(resourceId, driftConfig);
- } catch (Exception e) {
- log.warn(" Unable to inform agent of drift detection request [" + driftConfig + "]", e);
+ } catch (CannotConnectException e) {
+ throw new IllegalStateException(
+ "Agent could not be reached and may be down (see server logs for more). Could not perform drift detection request ["
+ + driftConfig + "]");
}
break;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
index 3184e79..9bb630f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
@@ -61,6 +61,39 @@ public interface DriftManagerLocal extends DriftManagerRemote {
void addFiles(int resourceId, long zipSize, InputStream zipStream) throws Exception;
/**
+ * Remove the specified drift in its own transaction. This is used for chunking transactions and
+ * should not be exposed in a Remote interface.
+ *
+ * @param subject
+ * @param
+ * @param driftConfig
+ *
+ * @return the number of Drift records deleted
+ */
+ int deleteDriftsInNewTransaction(Subject subject, int... driftIds);
+
+ /**
+ * Remove the specified drifts. Ids not identifying an actual drift record will be ignored.
+ *
+ * @param subject
+ * @param
+ * @param driftConfig
+ *
+ * @return the number of Drift records deleted
+ */
+ int deleteDrifts(Subject subject, int[] driftIds);
+
+ /**
+ * Remove all drifts on the specified entity context.
+ *
+ * @param subject
+ * @param entityContext the context
+ *
+ * @return the number of Drift records deleted
+ */
+ int deleteDriftsByContext(Subject subject, EntityContext entityContext) throws RuntimeException;
+
+ /**
* Remove the provided driftConfig (identified by name) on the specified entityContext.
* Agents, if available, will be notified of the change.
* @param subject
12 years, 5 months
[rhq] Branch 'as7plugin' - 10 commits - modules/core modules/enterprise pom.xml
by Heiko W. Rupp
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 38 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 140 +++++
pom.xml | 242 ++++------
4 files changed, 271 insertions(+), 155 deletions(-)
New commits:
commit 5ed2f29d30db493e579cd66e5a0c95c172357935
Merge: d6aa392 449b21b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:50:12 2011 +0200
Merge branch 'master' into as7plugin
commit 449b21b7bc705f458c6412f76ae02b06023e2c9e
Merge: f67bd01 26c6ae2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:34:48 2011 +0200
Merge branch 'dependent-values'
commit 26c6ae2e65c7493dd38d91e79eff20a32bffa0d4
Merge: 9687460 04f6861
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:22:01 2011 +0200
Merge branch 'dependent-values' of ssh://git.fedorahosted.org/git/rhq/rhq into dependent-values
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
commit 9687460e768d07c9ca16c28c950245cb3af84649
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:15:02 2011 +0200
Use the name as value and not the id.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 8463123..e872a80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -2438,7 +2438,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getName());
// TODO filter -- or leave up to search expression??
pds.getEnumeratedValues().add(pde);
}
commit 4e9188a94bb4839bc58efb1be8c30ee64eb09005
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 9a60502fbe010972f9becd9474a1aa5a9fb69cbb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
commit f67bd011101a1b463108fb8a79348eafc118b474
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jun 28 17:40:42 2011 -0400
make sure the Build-Number and Build-Time Manifest attributes always get set
to valid values, even for SNAPSHOT builds; however, if the project dir is not a
git working dir or the git executable is not available on the PATH, the
Build-Number attribute will not get set to a valid value, but the build should
not fail
diff --git a/pom.xml b/pom.xml
index 719a827..3c8cc4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -607,7 +607,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-4</version>
+ <version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -842,6 +842,113 @@
</configuration>
</plugin>
+ <!-- As of v1.0 of the buildnumber plugin, the create goal doesn't work,
+ and the create-timestamp goal doesn't provide a way to specify
+ a locale or a timezone, so comment this out for now and instead use
+ our own homemade mix of antrun and properties-file plugin executions
+ (just below this commented out block). (ips, 06/28/11)
+ -->
+ <!--
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>setBuildNumber</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ <configuration>
+ <useLastCommittedRevision>true</useLastCommittedRevision>
+ <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+ <revisionOnScmFailure></revisionOnScmFailure>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>setBuildTime</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create-timestamp</goal>
+ </goals>
+ <configuration>
+ <timestampFormat>MM/dd/yy hh:mm aa z</timestampFormat>
+ <timestampPropertyName>buildTime</timestampPropertyName>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>write-build-properties-file</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target" />
+
+ <tstamp>
+ <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
+ </tstamp>
+ <echo file="target/build.properties">buildTime = ${buildTime}${line.separator}</echo>
+
+ <exec executable="git" outputproperty="buildNumber" failonerror="false" failifexecutionfails="false">
+ <arg value="log"/>
+ <arg value="--pretty=format:%h"/>
+ <arg value="-n1"/>
+ </exec>
+ <echo file="target/build.properties" append="true">buildNumber = ${buildNumber}${line.separator}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>echo-build-properties</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo level="debug">buildTime = ${buildTime}</echo>
+ <echo level="debug">buildNumber = ${buildNumber}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>read-build-properties-file</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>read-project-properties</goal>
+ </goals>
+ <configuration>
+ <files>
+ <file>${project.build.directory}/build.properties</file>
+ </files>
+ <quiet>true</quiet>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
@@ -990,7 +1097,9 @@
</properties>
</profile>
- <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used. -->
+ <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used.
+ If using Java7 to run the build, this will ensure no APIs introduced in Java7 are
+ used. -->
<profile>
<id>check-java-api</id>
<activation>
@@ -1031,133 +1140,6 @@
</build>
</profile>
- <!-- Use buildnumber plugin only if SVN metadata is present. -->
- <profile>
- <id>build-number-generation</id>
- <activation>
- <file>
- <exists>.svn</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
- <revisionOnScmFailure>0</revisionOnScmFailure>
- <doCheck>false</doCheck>
- <doUpdate>false</doUpdate>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>build-properties</id>
- <activation>
- <file>
- <exists>.git</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>write-build-time-properties-file</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <tstamp>
- <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
- </tstamp>
- <mkdir dir="target" />
- <echo file="target/build-time.properties" level="error">buildTime = ${buildTime}
- </echo>
- </tasks>
- </configuration>
- </execution>
-
- <execution>
- <id>echo-build-properties</id>
- <phase>compile</phase>
- <inherited>false</inherited>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <echo level="debug">buildTime = ${buildTime}</echo>
- <echo level="debug">buildNumber = ${buildNumber}</echo>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-build-number-properties</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>exec</goal>
- </goals>
- <configuration>
- <executable>git</executable>
- <arguments>
- <argument>log</argument>
- <argument>--pretty=format:buildNumber = %h</argument>
- <argument>-n1</argument>
- </arguments>
- <outputFile>${project.build.directory}/build-number.properties</outputFile>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>read-build-properties</id>
- <phase>process-sources</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <files>
- <file>${project.build.directory}/build-time.properties</file>
- <file>${project.build.directory}/build-number.properties</file>
- </files>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
<!-- This profile should be enabled when a release is being published.
It will ensure that sources and javadoc jars are built and published
for each source module. -->
@@ -1262,7 +1244,7 @@
<licenses>
<license>
<name>GPL</name>
- <url>http://gnu.org</url>
+ <url>http://www.gnu.org/licenses/gpl.html</url>
</license>
</licenses>
commit 04f686144727920a5a25954962d84edf225efc9a
Merge: 2e85dca 1553673
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:58 2011 +0200
Merge branch 'master' into dependent-values
commit 2e85dca3f15e8702a073d1f0e06105042e126781
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 2c40f40c0e5c7d7fc37bab92cf71f2929d479db6
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
12 years, 5 months
[rhq] 13 commits - modules/core modules/enterprise modules/plugins
by Heiko W. Rupp
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 38 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 140 +++++++++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 18 -
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java | 8
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 35 +-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java | 11
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 3
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 62 +++-
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java | 71 ++++-
10 files changed, 323 insertions(+), 69 deletions(-)
New commits:
commit 5ed2f29d30db493e579cd66e5a0c95c172357935
Merge: d6aa392 449b21b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:50:12 2011 +0200
Merge branch 'master' into as7plugin
commit 449b21b7bc705f458c6412f76ae02b06023e2c9e
Merge: f67bd01 26c6ae2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:34:48 2011 +0200
Merge branch 'dependent-values'
commit 26c6ae2e65c7493dd38d91e79eff20a32bffa0d4
Merge: 9687460 04f6861
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:22:01 2011 +0200
Merge branch 'dependent-values' of ssh://git.fedorahosted.org/git/rhq/rhq into dependent-values
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
commit 9687460e768d07c9ca16c28c950245cb3af84649
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:15:02 2011 +0200
Use the name as value and not the id.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 8463123..e872a80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -2438,7 +2438,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getName());
// TODO filter -- or leave up to search expression??
pds.getEnumeratedValues().add(pde);
}
commit 4e9188a94bb4839bc58efb1be8c30ee64eb09005
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 9a60502fbe010972f9becd9474a1aa5a9fb69cbb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
commit d6aa39205a8b3cd0da96237d9b9dfbb54e1d5687
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:36:14 2011 +0200
Fix detection of mod_cluster subsystem.
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 41c5c58..870ad38 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
@@ -177,28 +177,6 @@
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
- <service name="ModCluster"
- class="BaseComponent"
- discovery="SubsystemDiscovery"
- description="Mod_cluster support">
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
- </plugin-configuration>
-
- <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <resource-configuration>
- <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
- <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
- </c:simple-property>
- </resource-configuration>
- </service>
-
</server>
<server name="ServerGroup"
@@ -1376,6 +1354,36 @@ working area for individual server instances</li></ul>"/>
</service>
</server>
+ <server name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support"
+ singleton="true"
+ >
+
+ <runs-inside>
+ <parent-resource-type name="Profile" plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7-Standalone" plugin="jboss-as-7"/> <!-- FAKE as "runs inside Profile" only does not work -->
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd connected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" >
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </server>
+
+
<service name="NetworkInterface"
discovery="SubsystemDiscovery"
class="BaseComponent"
commit 403973e67dae1cfd79a6591c815f7715a38c4537
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:01:09 2011 +0200
Change upload code because of a bug in the server (AS7-1145), add a property to enable json logging.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index f2bb47f..d89f4c4 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -43,21 +43,27 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*/
public class ASConnection {
+ public static final String MANAGEMENT = "/management";
+// public static final String MANAGEMENT = "/domain-api"; // Old one - leave it here for the moment for tests.
private final Log log = LogFactory.getLog(ASConnection.class);
URL url;
String urlString;
private ObjectMapper mapper;
- boolean verbose = true; // This is a variable on purpose, so devs can switch it on in the debugger
+ public static boolean verbose = false; // This is a variable on purpose, so devs can switch it on in the debugger or in the agent
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/management");
+ url = new URL("http",host,port, MANAGEMENT);
urlString = url.toString();
+
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
}
+ // read system property "as7plugin.verbose"
+ verbose = Boolean.getBoolean("as7plugin.verbose");
+
mapper = new ObjectMapper();
}
@@ -107,8 +113,7 @@ public class ASConnection {
String result = mapper.writeValueAsString(operation);
if (verbose) {
- System.out.println("Json to send: " + result);
- System.out.flush();
+ log.info("Json to send: " + result);
}
mapper.writeValue(out, operation);
@@ -141,8 +146,7 @@ public class ASConnection {
ObjectMapper om2 = new ObjectMapper();
om2.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
String tmp = om2.writeValueAsString(operationResult);
- System.out.println(tmp);
- System.out.flush();
+ log.info(tmp);
}
}
else {
@@ -156,8 +160,6 @@ public class ASConnection {
}
else {
log.error("IS was null and code was " + responseCode);
- if (verbose)
- System.err.println("IS was null and code was " + responseCode);
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index d876c80..3ab7c3c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/management/add-content";
+ private static final String UPLOAD_URL_PATH = ASConnection.MANAGEMENT + "/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
@@ -96,7 +96,7 @@ public class ASUploadConnection {
os.flush();
int code = connection.getResponseCode();
- System.err.println("Response code " + code);
+ log.info("Response code for file upload: " + code);
if (code==500)
is = connection.getErrorStream();
else
@@ -116,10 +116,10 @@ public class ASUploadConnection {
if (s!=null)
tree = mapper.readTree(s);
else
- System.out.println("- no result received from InputStream -");
+ log.warn("- no result received from InputStream -");
}
else
- System.out.println("- no InputStream available -");
+ log.warn("- no InputStream available -");
} catch (IOException e) {
e.printStackTrace(); // TODO: Customise this generated block
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index a51a96a..2ac49d0 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -80,6 +80,7 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
String key;
String host;
int port;
+ private boolean verbose = ASConnection.verbose;
/**
* Return availability of this resource
@@ -305,7 +306,9 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(), out);
JsonNode uploadResult = uploadConnection.finishUpload();
- System.out.println(uploadResult);
+ if (verbose)
+ log.info(uploadResult);
+
if (ASConnection.isErrorReply(uploadResult)) {
report.setStatus(CreateResourceStatus.FAILURE);
report.setErrorMessage(ASConnection.getFailureDescription(uploadResult));
@@ -319,7 +322,8 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
fileName=fileName.substring("C:\\fakepath\\".length());
}
- log.info("Deploying [" + fileName + "] ...");
+ boolean toServerGroup = context.getResourceKey().contains("server-group=");
+ log.info("Deploying [" + fileName + "] to domain only= " + !toServerGroup + " ...");
String tmpName = fileName; // TODO figure out the tmp-name biz with the AS guys
@@ -338,15 +342,22 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
step1.addAdditionalProperty("name", tmpName);
step1.addAdditionalProperty("runtime-name", fileName);
- CompositeOperation cop = new CompositeOperation();
- cop.addStep(step1);
String resourceKey;
-
+ JsonNode result ;
/*
* We need to check here if this is an upload to /deployment only
* or if this should be deployed to a server group too
*/
- if (context.getResourceKey().contains("server-group=")) {
+
+ if (!toServerGroup) {
+
+ result = connection.executeRaw(step1);
+ resourceKey = addressToPath(step1.getAddress());
+
+ }
+ else {
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>();
serverGroupAddress.addAll(pathToAddress(context.getResourceKey()));
@@ -359,19 +370,13 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
cop.addStep(step3);
resourceKey = addressToPath(serverGroupAddress);
- }
- else {
-/*
- List<PROPERTY_VALUE> address = step1.getAddress();
- Operation step3 = new Operation("deploy",address);
- cop.addStep(step3);
-*/
+ if (verbose)
+ log.info("Deploy operation: " + cop);
- resourceKey = addressToPath(step1.getAddress());
+ result = connection.executeRaw(cop);
}
- JsonNode result = connection.executeRaw(cop);
if (ASConnection.isErrorReply(result)) {
String failureDescription = ASConnection.getFailureDescription(result);
report.setErrorMessage(failureDescription);
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
index 3f57a06..3946dbe 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
@@ -98,6 +98,9 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
}
config.put(new PropertySimple("socket-binding-port-offset",serverInfo.portOffset));
+ String path = "host=" + hostName + ",server-config=" + serverInfo.name;
+ config.put(new PropertySimple("path",path));
+
// TODO this fails for the downed servers.
@@ -241,6 +244,14 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
boolean autoStart;
int portOffset;
String bindingGroup;
+
+ @Override
+ public String toString() {
+ return "ServerInfo{" +
+ "name='" + name + '\'' +
+ ", group='" + group + '\'' +
+ '}';
+ }
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
index a3ab676..60fc615 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
@@ -101,7 +101,8 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
if (cpath.contains("="))
path += "," + cpath;
- System.out.println("total path: [" + path + "]");
+ if (Boolean.getBoolean("as7plugin.verbose"))
+ log.info("total path: [" + path + "]");
JsonNode json ;
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 76d1bcf..41c5c58 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
@@ -169,14 +169,38 @@
<server name="Profile"
- description="One profile in a domain"
+ description="One profile in a domain. Profiles are assigned to server groups."
discovery="SubsystemDiscovery"
class="BaseComponent">
<plugin-configuration>
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
+
+ <service name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+
</server>
+
<server name="ServerGroup"
description="Server groups on this domain"
discovery="SubsystemDiscovery"
@@ -190,8 +214,12 @@
<resource-configuration>
- <c:simple-property name="profile" />
- <c:simple-property name="socket-binding-group"/>
+ <c:simple-property name="profile" description="The profile name" required="true"/>
+ <c:simple-property name="socket-binding-group" readOnly="false" required="true">
+ <c:option-source target="resource" expression="type=SocketBindingGroup"/>
+ </c:simple-property>
+ <c:simple-property name="socket-binding-port-offset" required="false" defaultValue="0" type="integer"
+ description="The default offset to be added to the port values given by the socket binding group."/>
<c:simple-property name="jvm" required="false"/>
</resource-configuration>
@@ -236,7 +264,9 @@
<operation name="domain-deployment:promote" displayName="Deploy to Server-Group" description="Deploy this deployment to a server group">
<parameters>
- <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string"/>
+ <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string">
+ <c:option-source target="resource" expression="type=ServerGroup" />
+ </c:simple-property>
<c:simple-property name="enabled" required="true" default="true" description="Should the deployment be enabled on the server group?" type="boolean"/>
</parameters>
<results>
@@ -327,6 +357,7 @@
<c:simple-property name="group" readOnly="true" displayName="Server Group" description="Server Group this instance belongs to."/>
<c:simple-property name="socket-binding-group" readOnly="true" displayName="Socket binding group" description="Socket bindngs to use"/>
<c:simple-property name="socket-binding-port-offset" readOnly="true" displayName="Port Offset" type="integer" default="0" description="Offset to the base ports"/>
+ <c:simple-property name="path" readOnly="true" />
&logSources;
</plugin-configuration>
@@ -351,7 +382,8 @@
</results>
</operation>
-
+ <metric property="status" dataType="trait" displayName="Server state" description="Detailed server state"
+ displayType="summary"/>
</server>
@@ -1387,8 +1419,8 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces." required="false"/>
<c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
<c:simple-property name="fixed-port" description="Whether the port value should remain fixed even if numeric offsets are applied to the other sockets in the socket group." type="boolean"/>
- <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." />
- <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer"/>
+ <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." required="false"/>
+ <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer" required="false"/>
</c:map-property>
</c:list-property>
</resource-configuration>
@@ -1420,5 +1452,4 @@ working area for individual server instances</li></ul>"/>
</service>
-
</plugin>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index b0d68ee..e18193d 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = UploadAndDeployTest.isEnabled) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,8 +49,10 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
+ protected static final boolean isEnabled = false;
- @Test(timeOut = 60*1000L, enabled=true)
+
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -62,7 +64,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=true)
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -75,7 +77,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=true)
+ @Test(timeOut = 60*1000L,enabled=isEnabled)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -155,7 +157,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -229,7 +231,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -295,7 +297,7 @@ public class UploadAndDeployTest {
* Test uploading to domain only, but not to a server group
* @throws Exception
*/
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite2() throws Exception {
String bytes_value = prepare();
commit ee7349dd14ba42c4364b2264d7a8da1e6dfed9d9
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 15:18:52 2011 +0200
Add a test for a composite operation with only one member operation (i.e. deploy to domain only)
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index dfa9fd9..b0d68ee 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = false) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,7 +49,8 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
- @Test(timeOut = 60*1000L, enabled=false)
+
+ @Test(timeOut = 60*1000L, enabled=true)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -61,7 +62,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=false)
+ @Test(timeOut = 60*1000L, enabled=true)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -74,7 +75,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=false)
+ @Test(timeOut = 60*1000L,enabled=true)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -154,7 +155,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -228,7 +229,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -290,6 +291,62 @@ public class UploadAndDeployTest {
}
+ /**
+ * Test uploading to domain only, but not to a server group
+ * @throws Exception
+ */
+ @Test(timeOut = 60*1000L,enabled = true)
+ public void testUploadComposite2() throws Exception {
+
+ String bytes_value = prepare();
+
+ System.out.println("Prepare done");
+ System.out.flush();
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ List<Object> content = new ArrayList<Object>(1);
+ Map<String,Object> contentValues = new HashMap<String,Object>();
+ contentValues.put("hash",new PROPERTY_VALUE("BYTES_VALUE",bytes_value));
+ content.add(contentValues);
+ step1.addAdditionalProperty("content", content);
+ step1.addAdditionalProperty("name", TEST_WAR); // this needs to be unique per upload
+
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+
+
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT);
+ JsonNode ret = connection.executeRaw(cop);
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite deploy was no success " + ret.getTextValue();
+
+ // Wait for AS to settle
+ Thread.sleep(1000);
+
+
+ // Now undeploy again to clean up
+
+ cop = new CompositeOperation();
+ Operation step4 = new Operation("remove",deploymentsAddress);
+
+ cop.addStep(step4);
+ ret = connection.executeRaw(cop);
+
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite remove was no success " + ret.getTextValue();
+
+
+ }
+
private String prepare() throws IOException {
ASUploadConnection conn = new ASUploadConnection(DC_HOST, DC_HTTP_PORT);
OutputStream os = conn.getOutputStream("test.war");
commit b8b1edbac9e407404be7a7bf88d0738df175bd5b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 22 13:30:29 2011 +0200
Add a dependent value for the web connector
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 0ccacf6..76d1bcf 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
@@ -548,6 +548,7 @@
<service name="Connector"
discovery="SubsystemDiscovery"
class="BaseComponent"
+ createDeletePolicy="both"
>
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="connector"/>
@@ -563,8 +564,10 @@
<resource-configuration>
<c:simple-property name="protocol" required="true" type="string" readOnly="true" description="The web connector protocol."/>
- <c:simple-property name="socket-binding" required="true" type="string" readOnly="true"
- description="The web connector socket-binding reference, this connector should be bound to."/>
+ <c:simple-property name="socket-binding" required="true" type="string" readOnly="false"
+ description="The web connector socket-binding reference, this connector should be bound to.">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
<c:simple-property name="scheme" type="string" readOnly="true" default="http" description="The web connector scheme."/>
<c:simple-property name="executor" type="string" readOnly="true" required="false"
description="The name of the executor that should be used for the processing threads of this connector. Defaults to using an internal pool."/>
commit 04f686144727920a5a25954962d84edf225efc9a
Merge: 2e85dca 1553673
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:58 2011 +0200
Merge branch 'master' into dependent-values
commit 2e85dca3f15e8702a073d1f0e06105042e126781
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 2c40f40c0e5c7d7fc37bab92cf71f2929d479db6
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
12 years, 5 months
[rhq] Branch 'dependent-values' - 9 commits - modules/core modules/enterprise modules/plugins
by Heiko W. Rupp
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 42 +++-------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 2
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml | 1
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml | 1
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java | 9 ++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java | 17 +++-
10 files changed, 48 insertions(+), 31 deletions(-)
New commits:
commit 26c6ae2e65c7493dd38d91e79eff20a32bffa0d4
Merge: 9687460 04f6861
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:22:01 2011 +0200
Merge branch 'dependent-values' of ssh://git.fedorahosted.org/git/rhq/rhq into dependent-values
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
commit 9687460e768d07c9ca16c28c950245cb3af84649
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:15:02 2011 +0200
Use the name as value and not the id.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 8463123..e872a80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -2438,7 +2438,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getName());
// TODO filter -- or leave up to search expression??
pds.getEnumeratedValues().add(pde);
}
commit 4e9188a94bb4839bc58efb1be8c30ee64eb09005
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 9a60502fbe010972f9becd9474a1aa5a9fb69cbb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
commit aed0881f6c23e7015c7c8665074d2c444acad189
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 21:59:52 2011 +0200
Support the new "rolled-back" element in the JSON response from the AS.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
index a5583b7..63c5262 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
@@ -40,6 +40,8 @@ public class Result {
private /*List<Map<String, String>>*/Object failureDescription;
@JsonIgnore
private boolean success = false;
+ @JsonProperty("rolled-back")
+ private boolean rolledBack = false;
public Result() {
@@ -83,4 +85,11 @@ public class Result {
this.failureDescription = failureDescription;
}
+ public boolean isRolledBack() {
+ return rolledBack;
+ }
+
+ public void setRolledBack(boolean rolledBack) {
+ this.rolledBack = rolledBack;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
index 53ac89e..b36a03b 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
@@ -185,7 +185,7 @@ public class OperationJsonTest {
public void arrayResult1() throws Exception {
- String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null}";
+ String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null, \"rolled-back\" : false}";
ObjectMapper mapper = new ObjectMapper();
Result result = mapper.readValue(resultString,Result.class);
@@ -197,6 +197,21 @@ public class OperationJsonTest {
assert stringList.size()==2;
assert stringList.get(0).equals("standard-sockets");
assert stringList.get(1).equals("messaging-sockets");
+ assert !result.isRolledBack();
+
+ }
+
+ public void rolledBack() throws Exception {
+
+ String resultString = "{\"outcome\":\"failed\", \"rolled-back\" : true}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ Result result = mapper.readValue(resultString,Result.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("failed");
+ assert !result.isSuccess();
+ assert result.isRolledBack();
}
commit f3a39fd7c84e203b90c3a0b6e35bc0e0fc8c4c9b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 13:43:36 2011 -0500
Fix dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index 290ad18..51e689e 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,8 +10,8 @@
mtime="123456"/>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 306297c..0cfe2f1 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,7 +1,7 @@
<dataset>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
index d584809..29351c4 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
@@ -2,6 +2,7 @@
<rhq_config_def/>
<rhq_config_prop_grp_def/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
<rhq_config/>
commit 50fb5956ca8b06cc826766bd2a9d84806d79cda2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 17:30:10 2011 +0200
/domain-api got renamed to /management.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index c51f275..f2bb47f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -52,7 +52,7 @@ public class ASConnection {
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/domain-api");
+ url = new URL("http",host,port,"/management");
urlString = url.toString();
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index 80e8ea4..d876c80 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/domain-api/add-content";
+ private static final String UPLOAD_URL_PATH = "/management/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
commit c4bc8030a89861799fc79ff1611fa7cfc0009168
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 09:58:25 2011 -0500
Attempt to correct the dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index 79ba415..290ad18 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,6 +10,7 @@
mtime="123456"/>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 7e6ae2a..306297c 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,5 +1,6 @@
<dataset>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
commit 19558e110cd6f9233225e7122d8af4baafb1ea56
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Jun 27 17:27:39 2011 -0400
we can't rename tables (which is essentially removing an old table and creating a new table)
because dbsetup won't work - the dbsetup uninstall won't know about the old table to remove if it is still around
collapse the two dbupgrade steps into one
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 39f0798..a368986 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.111</db.schema.version>
+ <db.schema.version>2.110</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 9950e58..df0daf7 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3417,44 +3417,34 @@
<schemaSpec version="2.110">
<schema-directSQL>
- <statement desc="Creating table RHQ_PROP_DEF_OPT_SRC">
- CREATE TABLE RHQ_PROP_DEF_OPT_SRC ( ID INTEGER PRIMARY KEY )
+ <statement desc="Creating table RHQ_CONFIG_PD_OSRC">
+ CREATE TABLE RHQ_CONFIG_PD_OSRC ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
- <schema-addColumn table="RHQ_PROP_DEF_OPT_SRC" column="LINK_TO_TARGET" columnType="BOOLEAN"/>
- <schema-alterColumn table="RHQ_PROP_DEF_OPT_SRC" column="LINK_TO_TARGET" nullable="TRUE"/>
+ <schema-addColumn table="RHQ_CONFIG_PD_OSRC" column="LINK_TO_TARGET" columnType="BOOLEAN"/>
+ <schema-alterColumn table="RHQ_CONFIG_PD_OSRC" column="LINK_TO_TARGET" nullable="TRUE"/>
- <schema-addColumn table="RHQ_PROP_DEF_OPT_SRC" column="FILTER" columnType="VARCHAR2" precision="40"/>
- <schema-alterColumn table="RHQ_PROP_DEF_OPT_SRC" column="FILTER" nullable="TRUE"/>
+ <schema-addColumn table="RHQ_CONFIG_PD_OSRC" column="FILTER" columnType="VARCHAR2" precision="40"/>
+ <schema-alterColumn table="RHQ_CONFIG_PD_OSRC" column="FILTER" nullable="TRUE"/>
- <schema-addColumn table="RHQ_PROP_DEF_OPT_SRC" column="EXPRESSION" columnType="VARCHAR2" precision="400"/>
- <schema-alterColumn table="RHQ_PROP_DEF_OPT_SRC" column="EXPRESSION" nullable="FALSE"/>
+ <schema-addColumn table="RHQ_CONFIG_PD_OSRC" column="EXPRESSION" columnType="VARCHAR2" precision="400"/>
+ <schema-alterColumn table="RHQ_CONFIG_PD_OSRC" column="EXPRESSION" nullable="FALSE"/>
- <schema-addColumn table="RHQ_PROP_DEF_OPT_SRC" column="TARGET_TYPE" columnType="VARCHAR2" precision="20"/>
- <schema-alterColumn table="RHQ_PROP_DEF_OPT_SRC" column="TARGET_TYPE" nullable="FALSE"/>
+ <schema-addColumn table="RHQ_CONFIG_PD_OSRC" column="TARGET_TYPE" columnType="VARCHAR2" precision="20"/>
+ <schema-alterColumn table="RHQ_CONFIG_PD_OSRC" column="TARGET_TYPE" nullable="FALSE"/>
- <schema-addColumn table="RHQ_PROP_DEF_OPT_SRC" column="PROPERTY_DEF_ID" columnType="INTEGER"/>
+ <schema-addColumn table="RHQ_CONFIG_PD_OSRC" column="PROPERTY_DEF_ID" columnType="INTEGER"/>
<schema-directSQL>
- <statement desc="Adding a fk">
- ALTER TABLE RHQ_PROP_DEF_OPT_SRC
- ADD CONSTRAINT RHQ_PROP_DEF_OPT_SRC_ID_FK
+ <statement desc="Adding a foreign key constraint to RHQ_CONFIG_PD_OSRC">
+ ALTER TABLE RHQ_CONFIG_PD_OSRC
+ ADD CONSTRAINT RHQ_CONFIG_PD_OSRC_ID_FK
FOREIGN KEY (PROPERTY_DEF_ID)
REFERENCES RHQ_CONFIG_PROP_DEF (ID)
</statement>
</schema-directSQL>
- <schema-createSequence name="rhq_config_prop_def_opt_src_id_seq" initial="10001" />
- </schemaSpec>
- <schemaSpec version="2.111">
- <schema-directSQL>
- <statement desc="rename to correct name">
- ALTER TABLE RHQ_PROP_DEF_OPT_SRC
- RENAME TO RHQ_CONFIG_PD_OSRC
- </statement>
- <statement desc="rename sequence">
- ALTER TABLE rhq_config_prop_def_opt_src_id_seq RENAME TO rhq_config_pd_osrc_id_seq
- </statement>
- </schema-directSQL>
+ <schema-createSequence name="rhq_config_pd_osrc_id_seq" initial="10001" />
</schemaSpec>
+
</dbupgrade>
</target>
</project>
12 years, 5 months