[rhq] Branch 'as7plugin' - 4 commits - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 40 ++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 115 +++++++---
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainComponent.java | 18 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java | 5
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/InterfaceDiscovery.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 59 ++++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupDiscovery.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 91 ++++---
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ComplexResult.java | 40 +++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadAttribute.java | 32 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadChildrenNames.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadResource.java | 32 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java | 70 ++++++
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 71 ++++--
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java | 46 ++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java | 95 ++++++++
16 files changed, 585 insertions(+), 135 deletions(-)
New commits:
commit 721b38accafbd2b609810dc2f6ad2665aa0e21cc
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Apr 12 14:10:32 2011 +0200
Transition resource path from /type/value/type.. to type=value pairs.
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 9037537..cdf7edb 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
@@ -27,8 +27,6 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,9 +34,9 @@ import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.jetbrains.annotations.Nullable;
-import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
-import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
+import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.Result;
/**
* Provide connections to the AS and reading / writing date from/to it.
@@ -52,6 +50,7 @@ public class ASConnection {
URL url;
String urlString;
private StringBuilder builder;
+ private ObjectMapper mapper;
public ASConnection(String host, int port) {
this.host = host;
@@ -63,6 +62,8 @@ public class ASConnection {
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
}
+
+ mapper = new ObjectMapper();
}
@@ -131,11 +132,6 @@ public class ASConnection {
return tree;
}
- JsonNode getAttributeValue(@Nullable String base, @Nullable String attributeName) throws Exception {
- String op = "operation=attribute&name=" + attributeName;
- return getLevelData(base,op);
- }
-
static boolean isErrorReply(JsonNode in) {
if (in == null)
@@ -181,8 +177,6 @@ public class ASConnection {
conn.setRequestMethod("POST");
OutputStream out = conn.getOutputStream();
- ObjectMapper mapper = new ObjectMapper();
-
String result = mapper.writeValueAsString(operation);
System.out.println("Json to send: " + result);
System.out.flush();
@@ -238,6 +232,22 @@ public class ASConnection {
return null;
}
+ public Result execute2(Operation op, boolean isComplex){
+ JsonNode node = execute(op);
+
+ try {
+ Result res;
+ if (isComplex)
+ res = mapper.readValue(node,ComplexResult.class);
+ else
+ res = mapper.readValue(node,Result.class);
+ return res;
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return null;
+ }
+ }
+
private URL getBaseUrl(String base, String ops) throws MalformedURLException {
String spec;
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 28b94f9..43509b8 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
@@ -33,6 +33,7 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinition;
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.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
@@ -45,11 +46,12 @@ import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
import org.rhq.modules.plugins.jbossas7.json.Operation;
import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
+import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+import org.rhq.modules.plugins.jbossas7.json.ReadResource;
+import org.rhq.modules.plugins.jbossas7.json.Result;
import java.util.ArrayList;
import java.util.Collections;
@@ -58,8 +60,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-
public class BaseComponent implements ResourceComponent, MeasurementFacet, ConfigurationFacet
{
final Log log = LogFactory.getLog(this.getClass());
@@ -129,14 +129,24 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
for (MeasurementScheduleRequest req : metrics) {
- JsonNode obj = connection.getAttributeValue(key, req.getName()); // TODO batching
- String val = obj.getValueAsText();
+ Operation op = new ReadAttribute(pathToAddress(path),req.getName()); // TODO batching
+ //JsonNode obj = connection.execute(op);
+ Result res = connection.execute2(op, false);
+ if (!res.isSuccess())
+ continue;
+
+ String val = (String) res.getResult();
+
if (req.getDataType()== DataType.MEASUREMENT) {
- Double d = Double.parseDouble(val);
- MeasurementDataNumeric data = new MeasurementDataNumeric(req,d);
- report.addData(data);
+ try {
+ Double d = Double.parseDouble(val);
+ MeasurementDataNumeric data = new MeasurementDataNumeric(req,d);
+ report.addData(data);
+ } catch (NumberFormatException e) {
+ log.warn("Non numeric input for [" + req.getName() + "] : [" + val + "]");
+ }
} else if (req.getDataType()== DataType.TRAIT) {
MeasurementDataTrait data = new MeasurementDataTrait(req,val);
report.addData(data);
@@ -154,15 +164,18 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
public Configuration loadResourceConfiguration() throws Exception {
ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
- String myPath = getResultingPath();
-
+// String myPath = getResultingPath();
- JsonNode json = connection.getLevelData(myPath,true,false);
+ List<PROPERTY_VALUE> address = pathToAddress(path);
+ Operation op = new ReadResource(address); // TOTO set recursive flag?
+ JsonNode json = connection.execute(op);
Configuration ret = new Configuration();
ObjectMapper mapper = new ObjectMapper();
- for (PropertyDefinition propDef: configDef.getNonGroupedProperties()) {
+ Set<Map.Entry<String, PropertyDefinition>> entrySet = configDef.getPropertyDefinitions().entrySet();
+ for (Map.Entry<String,PropertyDefinition> propDefEntry: entrySet) { // TODO all properties
+ PropertyDefinition propDef = propDefEntry.getValue();
JsonNode sub = json.findValue(propDef.getName());
if (propDef instanceof PropertyDefinitionSimple) {
PropertySimple propertySimple;
@@ -285,6 +298,16 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
}
}
ret.put(propertyList);
+ } // end List of ..
+ else if (propDef instanceof PropertyDefinitionMap) {
+ PropertyDefinitionMap mapDef = (PropertyDefinitionMap) propDef;
+ Map<String,PropertyDefinition> memberDefMap = mapDef.getPropertyDefinitions();
+ for (Map.Entry<String,PropertyDefinition> maEntry : memberDefMap.entrySet()) {
+ JsonNode valueNode = json.findValue(maEntry.getKey());
+ System.out.println(valueNode);
+ PropertySimple p = putProperty(valueNode,maEntry.getValue());
+ ret.put(p);
+ }
}
}
@@ -292,6 +315,31 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
return ret;
}
+ PropertySimple putProperty(JsonNode value, PropertyDefinition def) {
+ String name = def.getName();
+ PropertySimpleType type = ((PropertyDefinitionSimple) def).getType();
+ PropertySimple ps;
+ switch (type) {
+ case BOOLEAN:
+ ps = new PropertySimple(name,value.getBooleanValue());
+ break;
+ case FLOAT:
+ case DOUBLE:
+ ps = new PropertySimple(name,value.getDoubleValue());
+ break;
+ case INTEGER:
+ ps = new PropertySimple(name,value.getIntValue());
+ break;
+ case LONG:
+ ps = new PropertySimple(name,value.getLongValue());
+ break;
+ default:
+ ps = new PropertySimple(name,value.getTextValue());
+ }
+
+ return ps;
+ }
+
protected String getResultingPath() {
ResourceComponent parentResourceComponent = context.getParentResourceComponent();
String parentPath =null;
@@ -302,10 +350,7 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
}
if (parentPath!=null) {
- if (parentPath.endsWith("/") || path.startsWith("/"))
- myPath = parentPath + path;
- else
- myPath = parentPath + "/" + path;
+ myPath = parentPath + "," + path;
}
else
myPath = path;
@@ -329,21 +374,29 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
}
- protected List<PROPERTY_VALUE> pathToAddress(String path) {
+ /**
+ * Convert a path in the form key=value,key=value... to a List of properties.
+ * @param path Path to translate
+ * @return List of properties
+ */
+ public List<PROPERTY_VALUE> pathToAddress(String path) {
if (path==null || path.isEmpty())
return Collections.emptyList();
- if (path.endsWith("/"))
- path = path.substring(0,path.length()-1);
-
- if (path.startsWith("/"))
- path = path.substring(1);
-
List<PROPERTY_VALUE> result = new ArrayList<PROPERTY_VALUE>();
- String[] components = path.split("/");
- for (int i = 0; i < components.length ; i+=2) {
- PROPERTY_VALUE valuePair = new PROPERTY_VALUE(components[i],components[i+1]);
- result.add(valuePair);
+ String[] components = path.split(",");
+ for (String component : components) {
+ String tmp = component.trim();
+
+ if (tmp.contains("=")) {
+ // strip / from the start of the key if it happens to be there
+ if (tmp.startsWith("/"))
+ tmp = tmp.substring(1);
+
+ String[] pair = tmp.split("=");
+ PROPERTY_VALUE valuePair = new PROPERTY_VALUE(pair[0], pair[1]);
+ result.add(valuePair);
+ }
}
return result;
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
index 7608b9c..07c1522 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
@@ -21,7 +21,6 @@ package org.rhq.modules.plugins.jbossas7;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -29,13 +28,11 @@ import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.modules.plugins.jbossas7.json.Subsystem;
/**
* Discover the domain
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index ff7048b..b79c9a3 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -128,8 +128,7 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
@Override
public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
- List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
- serverGroupAddress.add(new PROPERTY_VALUE("server-group",serverGroupFromKey()));
+ List<PROPERTY_VALUE> serverGroupAddress = pathToAddress(path);
Operation op = new ReadChildrenNames(serverGroupAddress,"deployment"); // TODO read full packages not onyl names
JsonNode node = connection.execute(op);
@@ -194,7 +193,8 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
deploymentsAddress.add(new PROPERTY_VALUE("deployment", fileName));
Operation step1 = new Operation("add",deploymentsAddress);
step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
- step1.addAdditionalProperty("name", fileName);
+ step1.addAdditionalProperty("name", fileName); // TODO set a random name here - or wait on AS to "fix" this
+ step1.addAdditionalProperty("runtime-name", fileName);
List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
serverGroupAddress.add(new PROPERTY_VALUE("server-group",serverGroupFromKey()));
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 b6619b8..f233e3e 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
@@ -63,26 +63,31 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
Configuration config = context.getDefaultPluginConfiguration();
String cpath = config.getSimpleValue("path", null);
+ if (cpath==null) {
+ log.error("Path plugin config is null for ResourceType [" + context.getResourceType().getName() +"].");
+ return details;
+ }
+
+
boolean recursive = false;
String parentPath = parentComponent.getPath();
String path;
- if (cpath!=null && cpath.endsWith("/*")) {
- path = cpath.substring(0,cpath.length()-2);
+ String childType = null;
+ if (!cpath.contains("=")) { // NO = -> no sub path, but a type
recursive = true;
+ childType = cpath;
+
}
+
+ if (parentPath==null || parentPath.isEmpty())
+ path = "";
else
- path = cpath;
-
- if (parentPath!=null && !parentPath.isEmpty()) {
- if (recursive)
- path = parentPath;
- else if (parentPath.endsWith("/") || path.startsWith("/"))
- path = parentPath + path;
- else
- path = parentPath + "/" + path;
- }
+ path = parentPath;
+
+ if (cpath.contains("="))
+ path += "," + cpath;
System.out.println("total path: [" + path + "]");
@@ -93,19 +98,12 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
else {
List<PROPERTY_VALUE> addr ;
addr = parentComponent.pathToAddress(parentPath);
- String childType = cpath.substring(0, cpath.length() - 2);
- if (childType.startsWith("/"))
- childType = childType.substring(1);
json = connection.execute(new ReadChildrenNames(addr, childType));
}
if (!ASConnection.isErrorReply(json)) {
if (recursive) {
- int i = path.lastIndexOf("/");
- String subPath = path.substring(i+1);
JsonNode subNode = json.findPath("result");
- if (subNode==null || subNode.isNull())
- subNode = json.get(subPath); // TODO clean this up. to get the 'key' in a path from the AS we need to use get()
if (subNode!=null && subNode.isContainerNode()){
@@ -116,24 +114,24 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
String val = node.getTextValue();
- String newPath = cpath.replaceAll("\\*",val);
+ String newPath = cpath + "=" + val;
Configuration config2 = context.getDefaultPluginConfiguration();
- PropertySimple pathProp = new PropertySimple("path",newPath);
- config2.put(pathProp);
+
String resKey;
- String childType = cpath.substring(0, cpath.length() - 2);
- if (childType.startsWith("/"))
- childType = childType.substring(1);
- resKey = context.getParentResourceContext().getResourceKey() + "/" +childType + "/" + val;
- String name = resKey.substring(resKey.lastIndexOf("/") + 1);
+ if (path==null||path.isEmpty())
+ resKey = newPath;
+ else
+ resKey = path + "," +childType + "=" + val;
+ PropertySimple pathProp = new PropertySimple("path",resKey);
+ config2.put(pathProp);
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
context.getResourceType(), // DataType
resKey, // Key
- name, // Name
+ val, // Name
null, // Version
"TODO", // subsystem.description, // TODO Description
config2,
@@ -155,7 +153,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
String resKey = path;
- String name = resKey.substring(resKey.lastIndexOf("/") + 1);
+ String name = resKey.substring(resKey.lastIndexOf("=") + 1);
Configuration config2 = context.getDefaultPluginConfiguration();
PropertySimple pathProp = new PropertySimple("path",path);
config2.put(pathProp);
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ComplexResult.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ComplexResult.java
new file mode 100644
index 0000000..134026d
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ComplexResult.java
@@ -0,0 +1,40 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.json;
+
+import java.util.Map;
+
+import org.rhq.modules.plugins.jbossas7.json.Result;
+
+/**
+ * A result object with a complex 'result' member
+ * @author Heiko W. Rupp
+ */
+public class ComplexResult extends Result {
+
+ private Map<String,Object> result;
+
+ public Map<String, Object> getResult() {
+ return result;
+ }
+
+ public void setResult(Map<String, Object> result) {
+ this.result = result;
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadAttribute.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadAttribute.java
new file mode 100644
index 0000000..773e862
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadAttribute.java
@@ -0,0 +1,32 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.json;
+
+import java.util.List;
+
+/**
+ * Read Attribute operation
+ * @author Heiko W. Rupp
+ */
+public class ReadAttribute extends Operation {
+
+ public ReadAttribute(List<PROPERTY_VALUE> address, String name) {
+ super("read-attribute",address,"name",name);
+ }
+}
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
new file mode 100644
index 0000000..2d011fd
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
@@ -0,0 +1,70 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.json;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * {"outcome" : "success", "result" : "no metrics available", "compensating-operation" : null}
+ * @author Heiko W. Rupp
+ */
+public class Result {
+
+ private String outcome;
+ private Object result;
+ @JsonProperty("compensating-operation")
+ private Object compensatingOperation;
+ @JsonIgnore
+ private boolean success = false;
+
+ public Result() {
+
+ }
+
+ public String getOutcome() {
+ return outcome;
+ }
+
+ public void setOutcome(String outcome) {
+ this.outcome = outcome;
+ if (outcome.equalsIgnoreCase("success"))
+ success = true;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public Object getResult() {
+ return result;
+ }
+
+ public void setResult(Object result) {
+ this.result = result;
+ }
+
+ public Object getCompensatingOperation() {
+ return compensatingOperation;
+ }
+
+ public void setCompensatingOperation(Object compensatingOperation) {
+ this.compensatingOperation = compensatingOperation;
+ }
+}
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 435f58f..099d1b9 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
@@ -108,6 +108,12 @@
class="DomainComponent"
description="An AS7 management profile">
+ <subcategories>
+ <subcategory name="Integration" />
+ <subcategory name="Core"/>
+ <subcategory name="Web"/>
+ </subcategories>
+
<operation name="server-group:add" displayName="Add ServerGroup" description="Add a server group to the Domain.">
<parameters>
<c:simple-property name="name" description="Name of Group to add"/>
@@ -126,7 +132,7 @@
class="BaseComponent">
<plugin-configuration>
- <c:simple-property name="path" default="/profile/*" readOnly="true"/>
+ <c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
</server>
<server name="ServerGroup"
@@ -137,7 +143,7 @@
<!-- TODO move operation to createDeletePolicy="create-only" -->
<plugin-configuration>
- <c:simple-property name="path" default="/server-group/*" readOnly="true"/>
+ <c:simple-property name="path" default="server-group" readOnly="true"/>
</plugin-configuration>
@@ -153,7 +159,7 @@
<service name="Deployment" class="BaseComponent" discovery="SubsystemDiscovery" createDeletePolicy="create-only" creationDataType="content">
<plugin-configuration>
- <c:simple-property name="path" default="/deployment/*" readOnly="true"/>
+ <c:simple-property name="path" default="deployment" readOnly="true"/>
</plugin-configuration>
<content name="deployment" category="deployable" isCreationType="true" description="Deployments on this domain">
@@ -172,7 +178,7 @@
class="DomainComponent"
>
<plugin-configuration>
- <c:simple-property name="path" default="/host/*" readOnly="true"/>
+ <c:simple-property name="path" default="host" readOnly="true"/>
</plugin-configuration>
<operation name="server:add" displayName="Create server" description="Add a new server to this host.">
@@ -307,7 +313,7 @@
</runs-inside>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/subsystem/messaging"/>
+ <c:simple-property name="path" readOnly="true" default="subsystem=messaging"/>
</plugin-configuration>
<operation name="destination:add" displayName="Add destination" description="Add a Queue or Topic">
@@ -363,7 +369,7 @@
class="BaseComponent"
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="queue/*"/>
+ <c:simple-property name="path" readOnly="true" default="queue"/>
</plugin-configuration>
<resource-configuration>
<c:simple-property name="queue-address" required="true"/>
@@ -386,7 +392,7 @@
</runs-inside>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/subsystem/jms"/>
+ <c:simple-property name="path" readOnly="true" default="subsystem=jms"/>
</plugin-configuration>
<service name="Queue"
@@ -394,7 +400,7 @@
class="BaseComponent"
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="queue/*"/>
+ <c:simple-property name="path" readOnly="true" default="queue"/>
</plugin-configuration>
</service>
<service name="Topic"
@@ -402,7 +408,7 @@
class="BaseComponent"
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="topic/*"/>
+ <c:simple-property name="path" readOnly="true" default="topic"/>
</plugin-configuration>
</service>
<service name="Connection-Factory"
@@ -410,7 +416,7 @@
class="BaseComponent"
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="connection-factory/*"/>
+ <c:simple-property name="path" readOnly="true" default="connection-factory"/>
</plugin-configuration>
</service>
@@ -428,7 +434,7 @@
</runs-inside>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/subsystem/web"/>
+ <c:simple-property name="path" readOnly="true" default="subsystem=web"/>
</plugin-configuration>
<service name="Connector"
@@ -436,7 +442,7 @@
class="BaseComponent"
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/connector/*"/>
+ <c:simple-property name="path" readOnly="true" default="connector"/>
</plugin-configuration>
@@ -459,7 +465,7 @@
discovery="SubsystemDiscovery"
class="BaseComponent">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/virtual-server/*"/>
+ <c:simple-property name="path" readOnly="true" default="virtual-server"/>
</plugin-configuration>
<resource-configuration>
@@ -487,7 +493,7 @@
</runs-inside>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/subsystem/datasources"/>
+ <c:simple-property name="path" readOnly="true" default="subsystem=datasources"/>
</plugin-configuration>
<service name="DataSource"
@@ -497,7 +503,7 @@
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="data-source/*"/>
+ <c:simple-property name="path" readOnly="true" default="data-source"/>
</plugin-configuration>
<resource-configuration>
@@ -523,7 +529,7 @@
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="xa-data-source/*"/>
+ <c:simple-property name="path" readOnly="true" default="xa-data-source"/>
</plugin-configuration>
</service>
@@ -534,7 +540,7 @@
>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="jdbc-driver/*"/>
+ <c:simple-property name="path" readOnly="true" default="jdbc-driver"/>
</plugin-configuration>
</service>
@@ -552,7 +558,7 @@
</runs-inside>
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/"/>
+ <c:simple-property name="path" readOnly="true" default="interface"/>
</plugin-configuration>
</service>
@@ -567,7 +573,7 @@
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/socket-binding-group/"/>
+ <c:simple-property name="path" readOnly="true" default="socket-binding-group"/>
</plugin-configuration>
<resource-configuration>
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 9110fbd..64d9d30 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
@@ -26,9 +26,11 @@ import java.util.Map;
import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test;
+import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.Result;
/**
* @author Heiko W. Rupp
@@ -116,4 +118,48 @@ public class OperationJsonTest {
System.out.println(result);
}
+
+ public void simpleResult() throws Exception {
+
+ String resultString = "{\"outcome\" : \"success\", \"result\" : \"no metrics available\", \"compensating-operation\" : null}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ Result result = mapper.readValue(resultString,Result.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("success");
+ assert result.isSuccess();
+ }
+
+ public void simpleResult2() throws Exception {
+
+ String resultString = "{\"outcome\" : \"success\", \"result\" : \"DISABLED\", \"compensating-operation\" : null}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ Result result = mapper.readValue(resultString,Result.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("success");
+ assert result.isSuccess();
+ }
+
+ public void complexResult1() throws Exception {
+
+ String resultString = " {\"outcome\" : \"success\", \"result\" : {\"alias\" : [\"example.com\"], \"access-log\" : null, \"rewrite\" : null}, \"compensating-operation\" : null}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ ComplexResult result = mapper.readValue(resultString,ComplexResult.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("success");
+ assert result.isSuccess();
+ assert result.getResult().size()==3;
+ String rewrite = (String) result.getResult().get("rewrite");
+ assert rewrite == null;
+
+ List<String> aliases = (List<String>) result.getResult().get("alias");
+ assert aliases != null;
+ assert aliases.size()==1;
+ assert aliases.get(0).equals("example.com");
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java
new file mode 100644
index 0000000..a59b05e
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/PathHandlingTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7;
+
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
+
+/**
+ * Test handling of path elements.
+ * A path to a resource consists of pairs type=value that are
+ * separated by commas
+ * @author Heiko W. Rupp
+ */
+@Test
+public class PathHandlingTest {
+
+ public void buildPath1() throws Exception {
+
+ String path = "/subsystem=jms,profile=default,queue=foo";
+
+ BaseComponent bc = new BaseComponent();
+ List<PROPERTY_VALUE> list = bc.pathToAddress(path);
+
+ int found = 0;
+ for (PROPERTY_VALUE p : list) {
+ if (p.getKey().equals("subsystem")) {
+ assert p.getValue().equals("jms");
+ found++;
+ }
+ if (p.getKey().equals("queue")) {
+ found++;
+ assert p.getValue().equals("foo");
+ }
+ }
+ assert found == 2 : "did not find both keys, but " + found;
+ }
+
+ public void buildPath2() throws Exception {
+
+ String path = "/subsystem=jms,profile=default,queue=java:/foo";
+
+ BaseComponent bc = new BaseComponent();
+ List<PROPERTY_VALUE> list = bc.pathToAddress(path);
+
+ assert list.size()==3 : "We don't have 3 components, but " + list.size();
+ for (PROPERTY_VALUE p : list) {
+ if (p.getKey().equals("subsystem"))
+ assert p.getValue().equals("jms");
+ if (p.getKey().equals("queue"))
+ assert p.getValue().equals("java:/foo") : "Queue value is wrong: " + p.getValue();
+
+ }
+ }
+
+ public void buildIncomplete() throws Exception {
+
+ String path = "/subsystem=jms,profile=default,queue=java:/foo,topic";
+
+ BaseComponent bc = new BaseComponent();
+ List<PROPERTY_VALUE> list = bc.pathToAddress(path);
+
+ assert list.size()==3 : "We don't have 3 components, but " + list.size();
+ int found = 0;
+ for (PROPERTY_VALUE p : list) {
+ if (p.getKey().equals("subsystem")) {
+ assert p.getValue().equals("jms");
+ found++;
+ }
+ if (p.getKey().equals("queue")) {
+ assert p.getValue().equals("java:/foo") : "Queue value is wrong: " + p.getValue();
+ found++;
+ }
+ }
+ assert found == 2 : "did not find both keys, but " + found;
+ }
+}
commit 5522a71fd7559bf707094665c020095c3fc6add7
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Apr 11 15:01:01 2011 +0200
Better resource detection and keying, Creation of deployments.
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 491fb77..9037537 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
@@ -137,7 +137,7 @@ public class ASConnection {
}
- boolean isErrorReply(JsonNode in) {
+ static boolean isErrorReply(JsonNode in) {
if (in == null)
return true;
@@ -154,7 +154,7 @@ public class ASConnection {
reasonNode = in.findValue("host-failure-descriptions"); // TODO JBAS-9182
String reason = reasonNode.getTextValue();
- log.info(reason);
+// log.info(reason);
return true;
}
@@ -262,7 +262,7 @@ public class ASConnection {
return url2;
}
- public String getFailureDescription(JsonNode jsonNode) {
+ public static String getFailureDescription(JsonNode jsonNode) {
if (jsonNode==null)
return "getFailureDescription: -input was null-";
JsonNode node = jsonNode.findValue("failure-description");
@@ -273,7 +273,7 @@ public class ASConnection {
return node.getValueAsText();
}
- public String getSuccessDescription(JsonNode jsonNode) {
+ public static String getSuccessDescription(JsonNode jsonNode) {
if (jsonNode==null)
return "No message found";
JsonNode node = jsonNode.findValue("result");
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 644fc24..28b94f9 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
@@ -62,7 +62,7 @@ import com.sun.org.apache.xml.internal.security.utils.Base64;
public class BaseComponent implements ResourceComponent, MeasurementFacet, ConfigurationFacet
{
- private final Log log = LogFactory.getLog(this.getClass());
+ final Log log = LogFactory.getLog(this.getClass());
ResourceContext context;
Configuration conf;
@@ -321,9 +321,9 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
NameValuePair nvp = new NameValuePair(entry.getKey(),entry.getValue().getStringValue());
Operation writeAttribute = new Operation("write-attribute",pathToAddress(getResultingPath()),nvp);
JsonNode result= connection.execute(writeAttribute);
- if(connection.isErrorReply(result)) {
+ if(ASConnection.isErrorReply(result)) {
report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report.setErrorMessage(connection.getFailureDescription(result));
+ report.setErrorMessage(ASConnection.getFailureDescription(result));
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainComponent.java
index 21005a9..176e6ce 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainComponent.java
@@ -49,11 +49,17 @@ public class DomainComponent extends BaseComponent implements OperationFacet{
address.add(new PROPERTY_VALUE("host",host));
address.add(new PROPERTY_VALUE("server-config",myServerName));
Operation getStatus = new Operation("read-attribute",address,"name","status");
- JsonNode result = connection.execute(getStatus);
- if (connection.isErrorReply(result))
+ JsonNode result = null;
+ try {
+ result = connection.execute(getStatus);
+ } catch (Exception e) {
+ log.warn(e.getMessage());
+ return AvailabilityType.DOWN;
+ }
+ if (ASConnection.isErrorReply(result))
return AvailabilityType.DOWN;
- String msg = connection.getSuccessDescription(result);
+ String msg = ASConnection.getSuccessDescription(result);
if (msg.contains("STARTED"))
return AvailabilityType.UP;
else
@@ -126,11 +132,11 @@ public class DomainComponent extends BaseComponent implements OperationFacet{
if (operation!=null) {
JsonNode result = connection.execute(operation);
- if (connection.isErrorReply(result)) {
- operationResult.setErrorMessage(connection.getFailureDescription(result));
+ if (ASConnection.isErrorReply(result)) {
+ operationResult.setErrorMessage(ASConnection.getFailureDescription(result));
}
else {
- operationResult.setSimpleResult(connection.getSuccessDescription(result));
+ operationResult.setSimpleResult(ASConnection.getSuccessDescription(result));
}
}
else {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
index ad09c77..7608b9c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDiscovery.java
@@ -69,7 +69,7 @@ public class DomainDiscovery implements ResourceDiscoveryComponent<BaseComponent
// A domain has a server group so check for it.
boolean found = false;
JsonNode json = connection.getLevelData(null,null);
- if (!connection.isErrorReply(json)) {
+ if (!ASConnection.isErrorReply(json)) {
Iterator<String> fields = json.getFieldNames();
while (fields.hasNext()) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/InterfaceDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/InterfaceDiscovery.java
index 021b10c..1fc1e9b 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/InterfaceDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/InterfaceDiscovery.java
@@ -64,7 +64,7 @@ public class InterfaceDiscovery implements ResourceDiscoveryComponent<BaseCompon
JsonNode json = connection.getLevelData(null, null);
- if (!connection.isErrorReply(json)) {
+ if (!ASConnection.isErrorReply(json)) {
Domain domain = mapper.readValue(json, new TypeReference<Domain>() {});
for (Map.Entry<String,String> entry: domain.interfaces.entrySet()) {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index 0e26e7d..ff7048b 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -55,6 +55,8 @@ import org.rhq.modules.plugins.jbossas7.json.ReadChildrenNames;
*/
public class ServerGroupComponent extends DomainComponent implements ContentFacet, CreateChildResourceFacet {
+ private static final String SUCCESS = "success";
+ private static final String OUTCOME = "outcome";
private final Log log = LogFactory.getLog(ServerGroupComponent.class);
@Override
@@ -77,9 +79,9 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
OutputStream out = uploadConnection.getOutputStream(fileName);
contentServices.downloadPackageBits(cctx, details.getKey(), out, false);
JsonNode uploadResult = uploadConnection.finishUpload();
- if (uploadResult.has("outcome")) {
- String outcome = uploadResult.get("outcome").getTextValue();
- if (outcome.equals("success")) { // Upload was successful, so now add the file to the server group
+ if (uploadResult.has(OUTCOME)) {
+ String outcome = uploadResult.get(OUTCOME).getTextValue();
+ if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the file to the server group
JsonNode resultNode = uploadResult.get("result");
String hash = resultNode.get("BYTES_VALUE").getTextValue();
ASConnection connection = getASConnection();
@@ -100,7 +102,7 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
cop.addStep(step2);
JsonNode result = connection.execute(cop);
- if (connection.isErrorReply(result)) // TODO get failure message into response
+ if (ASConnection.isErrorReply(result)) // TODO get failure message into response
response.addPackageResponse(new DeployIndividualPackageResponse(details.getKey(),ContentResponseResult.FAILURE));
else
response.addPackageResponse(new DeployIndividualPackageResponse(details.getKey(),ContentResponseResult.SUCCESS));
@@ -131,7 +133,7 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
Operation op = new ReadChildrenNames(serverGroupAddress,"deployment"); // TODO read full packages not onyl names
JsonNode node = connection.execute(op);
- if (connection.isErrorReply(node))
+ if (ASConnection.isErrorReply(node))
return null;
JsonNode result = node.get("result");
@@ -168,16 +170,49 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
ContentServices contentServices = cctx.getContentServices();
String resourceTypeName = report.getResourceType().getName();
- ASUploadConnection connection = new ASUploadConnection();
- OutputStream out = connection.getOutputStream(details.getFileName());
+ ASUploadConnection uploadConnection = new ASUploadConnection();
+ OutputStream out = uploadConnection.getOutputStream(details.getFileName());
// contentServices.downloadPackageBits(cctx,details.getKey(),out,false);
contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(), out);
- JsonNode result = connection.finishUpload();
- System.out.println(result);
+ JsonNode uploadResult = uploadConnection.finishUpload();
+ System.out.println(uploadResult);
+ if (ASConnection.isErrorReply(uploadResult)) {
+ report.setStatus(CreateResourceStatus.FAILURE);
+ report.setErrorMessage(ASConnection.getFailureDescription(uploadResult));
+ return report;
+ }
+
+ String fileName = report.getUserSpecifiedResourceName();
+
+ JsonNode resultNode = uploadResult.get("result");
+ String hash = resultNode.get("BYTES_VALUE").getTextValue();
+ ASConnection connection = getASConnection();
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", fileName));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
+ step1.addAdditionalProperty("name", fileName);
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group",serverGroupFromKey()));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", fileName));
+ Operation step2 = new Operation("add",serverGroupAddress,"enabled","true");
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+ cop.addStep(step2);
- report.setStatus(CreateResourceStatus.SUCCESS) ;
+ JsonNode result = connection.execute(cop);
+ if (ASConnection.isErrorReply(result)) {
+ report.setErrorMessage(ASConnection.getFailureDescription(resultNode));
+ report.setStatus(CreateResourceStatus.FAILURE);
+ }
+ else {
+ report.setStatus(CreateResourceStatus.SUCCESS);
+ }
return report;
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupDiscovery.java
index 4411f8c..89472b8 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupDiscovery.java
@@ -64,7 +64,7 @@ public class SocketBindingGroupDiscovery implements ResourceDiscoveryComponent<B
JsonNode json = connection.getLevelData(null, null);
- if (!connection.isErrorReply(json)) {
+ if (!ASConnection.isErrorReply(json)) {
Domain domain = mapper.readValue(json, new TypeReference<Domain>() {});
for (Map.Entry<String,String> entry: domain.socketBindingGroup.entrySet()) {
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 e351237..b6619b8 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
@@ -98,7 +98,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
childType = childType.substring(1);
json = connection.execute(new ReadChildrenNames(addr, childType));
}
- if (!connection.isErrorReply(json)) {
+ if (!ASConnection.isErrorReply(json)) {
if (recursive) {
int i = path.lastIndexOf("/");
String subPath = path.substring(i+1);
@@ -130,13 +130,12 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
String name = resKey.substring(resKey.lastIndexOf("/") + 1);
-
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
context.getResourceType(), // DataType
resKey, // Key
name, // Name
null, // Version
- "TODO", // subsystem.description, // Description
+ "TODO", // subsystem.description, // TODO Description
config2,
null);
details.add(detail);
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadChildrenNames.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadChildrenNames.java
index 8c5b37c..23d10bb 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadChildrenNames.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadChildrenNames.java
@@ -27,7 +27,7 @@ import java.util.List;
public class ReadChildrenNames extends Operation {
/**
- * Reas children names of a given type below a given address
+ * Read children names of a given type below a given address
* @param address Address to look at e.g. /profile/default/subsystem/messaging
* @param childType e.g. queue
*/
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadResource.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadResource.java
new file mode 100644
index 0000000..c2eab45
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/ReadResource.java
@@ -0,0 +1,32 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.json;
+
+import java.util.List;
+
+/**
+ * Reads data for one AS 7 resource
+ * @author Heiko W. Rupp
+ */
+public class ReadResource extends Operation {
+
+ public ReadResource(List<PROPERTY_VALUE> address) {
+ super("read-resource", address);
+ }
+}
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 e3bd676..435f58f 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
@@ -150,10 +150,20 @@
<c:simple-property name="jvm"/>
<c:simple-property name="deployment" required="false"/> <!-- TODO change structure. Or put below as resource? -->
</resource-configuration>
- <service name="Deployment" class="BaseComponent" discovery="SubsystemDiscovery" createDeletePolicy="create-only">
+
+ <service name="Deployment" class="BaseComponent" discovery="SubsystemDiscovery" createDeletePolicy="create-only" creationDataType="content">
<plugin-configuration>
<c:simple-property name="path" default="/deployment/*" readOnly="true"/>
</plugin-configuration>
+
+ <content name="deployment" category="deployable" isCreationType="true" description="Deployments on this domain">
+ <configuration>
+ <c:group name="deployment" displayName="Deployment Options">
+ <c:simple-property name="runtimeName" required="true"/>
+ </c:group>
+ </configuration>
+ </content>
+
</service>
</server>
<server name="Host"
@@ -489,6 +499,21 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="data-source/*"/>
</plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="configuration">
+ <c:simple-property name="connection-url"/>
+ <c:simple-property name="driver-class"/>
+ <c:simple-property name="jndi-name"/>
+ <c:simple-property name="driver"/>
+ <c:simple-property name="pool-name"/>
+ <c:simple-property name="use-java-context" type="boolean"/>
+ <c:simple-property name="enabled" type="boolean"/>
+ <c:simple-property name="user-name"/>
+ <c:simple-property name="password"/>
+ <!-- TODO more when they become available in the AS -->
+ </c:map-property>
+ </resource-configuration>
</service>
<service name="XADataSource"
commit 13237c98e08a967eb8ffe7c397f9bf8e6cf0110f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Apr 11 11:39:40 2011 +0200
Small reformat + cleanup
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 0182077..e351237 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
@@ -107,51 +107,48 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
if (subNode==null || subNode.isNull())
subNode = json.get(subPath); // TODO clean this up. to get the 'key' in a path from the AS we need to use get()
-// Map<String,Subsystem> subsystemMap = mapper.readValue(subNode,new TypeReference<Map<String,Subsystem>>() {});
if (subNode!=null && subNode.isContainerNode()){
- Iterator<JsonNode> iter = subNode.getElements();
-// if (subsystemMap==null) {
-// log.warn("SubsystemMap was null for path [" + path + "] and subPath ["+ subPath + "] and subNode [" + subNode + "]");
-// return Collections.emptySet();
-// }
+ Iterator<JsonNode> iter = subNode.getElements();
while (iter.hasNext()) {
JsonNode node = iter.next();
- String val = node.getTextValue();
+ String val = node.getTextValue();
- String newPath = cpath.replaceAll("\\*",val);
- Configuration config2 = context.getDefaultPluginConfiguration();
- PropertySimple pathProp = new PropertySimple("path",newPath);
- config2.put(pathProp);
+ String newPath = cpath.replaceAll("\\*",val);
+ Configuration config2 = context.getDefaultPluginConfiguration();
+ PropertySimple pathProp = new PropertySimple("path",newPath);
+ config2.put(pathProp);
- String resKey;
- String childType = cpath.substring(0, cpath.length() - 2);
- if (childType.startsWith("/"))
- childType = childType.substring(1);
+ String resKey;
+ String childType = cpath.substring(0, cpath.length() - 2);
+ if (childType.startsWith("/"))
+ childType = childType.substring(1);
- resKey = context.getParentResourceContext().getResourceKey() + "/" +childType + "/" + val;
- String name = resKey.substring(resKey.lastIndexOf("/") + 1);
+ resKey = context.getParentResourceContext().getResourceKey() + "/" +childType + "/" + val;
+ String name = resKey.substring(resKey.lastIndexOf("/") + 1);
- DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
- context.getResourceType(), // DataType
- resKey, // Key
- name, // Name
- null, // Version
- "TODO", // subsystem.description, // Description
- config2,
- null);
- details.add(detail);
- }
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ context.getResourceType(), // DataType
+ resKey, // Key
+ name, // Name
+ null, // Version
+ "TODO", // subsystem.description, // Description
+ config2,
+ null);
+ details.add(detail);
+ }
}
else {
- System.out.println("subnode was no array");
- if (subNode==null)
+ if (subNode==null) {
log.error("subNode was null for " + path + " and type " + context.getResourceType().getName());
+ }
+ else if (!subNode.isNull())
+ log.info("subnode was no container");
}
}
commit 9129e2b888dd8131ee9e816bb45afb484c8a52ef
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Apr 11 11:26:57 2011 +0200
Create correct resource key looking at types.
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 747aff0..0182077 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
@@ -76,11 +76,14 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
path = cpath;
if (parentPath!=null && !parentPath.isEmpty()) {
- if (parentPath.endsWith("/") || path.startsWith("/"))
+ if (recursive)
+ path = parentPath;
+ else if (parentPath.endsWith("/") || path.startsWith("/"))
path = parentPath + path;
else
path = parentPath + "/" + path;
}
+
System.out.println("total path: [" + path + "]");
@@ -105,7 +108,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
subNode = json.get(subPath); // TODO clean this up. to get the 'key' in a path from the AS we need to use get()
// Map<String,Subsystem> subsystemMap = mapper.readValue(subNode,new TypeReference<Map<String,Subsystem>>() {});
- if (subNode!=null && subNode.isArray()) {
+ if (subNode!=null && subNode.isContainerNode()){
Iterator<JsonNode> iter = subNode.getElements();
// if (subsystemMap==null) {
@@ -123,13 +126,19 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
PropertySimple pathProp = new PropertySimple("path",newPath);
config2.put(pathProp);
- String resKey = context.getParentResourceContext().getResourceKey() + "/" + val;
+ String resKey;
+ String childType = cpath.substring(0, cpath.length() - 2);
+ if (childType.startsWith("/"))
+ childType = childType.substring(1);
+
+ resKey = context.getParentResourceContext().getResourceKey() + "/" +childType + "/" + val;
String name = resKey.substring(resKey.lastIndexOf("/") + 1);
+
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
context.getResourceType(), // DataType
- path + "/" + val, // Key
+ resKey, // Key
name, // Name
null, // Version
"TODO", // subsystem.description, // Description
13 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java | 41 ++++++----
1 file changed, 25 insertions(+), 16 deletions(-)
New commits:
commit 90254fb1bd8ca5d491b6107670f39adc67558caa
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Apr 11 13:19:40 2011 -0400
fix typo in dependsOnGroup name
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java
index 75ed400..c539a44 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java
@@ -18,6 +18,29 @@
*/
package org.rhq.enterprise.server.core.plugin;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+import javax.transaction.TransactionManager;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
import org.rhq.core.domain.plugin.Plugin;
@@ -27,23 +50,10 @@ import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.resource.metadata.PluginManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.testng.annotations.*;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import javax.transaction.TransactionManager;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
//make sure we run this after the plugins.metadata tests are done so that
//the db contents don't interfere
-@Test(dependsOnGroups = "plugins.metadata")
+@Test(dependsOnGroups = "plugin.metadata")
public class DatabaseAndFilePluginDeploymentTest extends AbstractEJB3Test {
private static final String PLUGIN_NAME = "DeployTest"; // as defined in our test descriptors
@@ -493,8 +503,7 @@ public class DatabaseAndFilePluginDeploymentTest extends AbstractEJB3Test {
pluginDup.setVersion(plugin.getVersion());
PluginDescriptor pluginDescriptor = this.testPluginDescriptors.get(pluginId);
File localPluginFile = this.testPluginFiles.get(pluginId);
- pluginMgr.registerPlugin(subjectManager.getOverlord(), pluginDup, pluginDescriptor, localPluginFile,
- false);
+ pluginMgr.registerPlugin(subjectManager.getOverlord(), pluginDup, pluginDescriptor, localPluginFile, false);
}
return;
}
13 years, 1 month
[rhq] Branch 'release-3.0.1' - modules/plugins
by John Sanda
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java | 4 -
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java | 4 -
modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java | 4 -
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 25 ++--------
4 files changed, 11 insertions(+), 26 deletions(-)
New commits:
commit 5ff23f8e90275d3edda686f0dd927f12c9aa70ca
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Apr 11 11:17:34 2011 -0400
[BZ 690430] Removing plugin config for disabling cert validation
Removing the plugin configuration property that disables SSL cert
validation for the URL used in availability checks. Cert validation is
automatically disabled if the URL is HTTPS.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 369c18f..ee7520f 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -233,12 +233,10 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
// try to find a pid file under the server root, and then check if the
// process is running.
boolean available;
- Configuration pluginConfig = resourceContext.getPluginConfiguration();
- PropertySimple disableCertValidation = pluginConfig.getSimple("disableCertificateValidation");
try {
if (this.url != null) {
long t1 = System.currentTimeMillis();
- available = WWWUtils.isAvailable(this.url, disableCertValidation.getBooleanValue());
+ available = WWWUtils.isAvailable(this.url);
availPingTime = System.currentTimeMillis() - t1;
} else {
available = getSNMPSession().ping();
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
index d470b03..c894fa9 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
@@ -133,9 +133,7 @@ public class ApacheVirtualHostServiceComponent implements ResourceComponent<Apac
}
public AvailabilityType getAvailability() {
- Configuration pluginConfig = resourceContext.getPluginConfiguration();
- PropertySimple disableCertValidation = pluginConfig.getSimple("disableCertificateValidation");
- return (this.url != null && WWWUtils.isAvailable(this.url, disableCertValidation.getBooleanValue())) ? AvailabilityType.UP : AvailabilityType.DOWN;
+ return (this.url != null && WWWUtils.isAvailable(this.url)) ? AvailabilityType.UP : AvailabilityType.DOWN;
}
public Configuration loadResourceConfiguration() throws Exception {
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
index 2b226be..5afb34a 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
@@ -49,14 +49,14 @@ public abstract class WWWUtils {
* @return true if connecting to the URL succeeds, or false otherwise
*/
- public static boolean isAvailable(URL httpURL, boolean disableCertValidation) {
+ public static boolean isAvailable(URL httpURL) {
String failMsg = "URL [" + httpURL + "] returned unavailable";
try {
HttpURLConnection connection = (HttpURLConnection) httpURL.openConnection();
connection.setRequestMethod("HEAD");
connection.setConnectTimeout(3000);
- if ((connection instanceof HttpsURLConnection) && disableCertValidation) {
+ if (connection instanceof HttpsURLConnection) {
disableCertificateVerification((HttpsURLConnection) connection);
}
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index adb7f73..dc5bb67 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -273,21 +273,16 @@
<c:simple-property name="configFile" required="true" readOnly="true"
description="the path to the httpd.conf file - if the path is not absolute, it will be resolved relative to the server root directory; if unset, default will be 'conf/httpd.conf' on UNIX"/>
<c:simple-property name="url" displayName="URL" required="false"
- description="the http or https URL that will be used to check availability for this Apache server; if not set, availablity will be determined based on whether plugin can connect to the Apache server's SNMP agent"/>
+ description="The http or https URL that will be used to check availability for this Apache
+ server; if not set, availablity will be determined based on whether plugin can connect
+ to the Apache server's SNMP agent. Note that SSL certificate validation is disabled
+ during availability checks if this is an HTTPS URL."/>
<c:simple-property name="snmpAgentHost" displayName="SNMP Agent Host" default="127.0.0.1"
description="the host name or IP address of the Apache SNMP agent (typically '127.0.0.1')"/>
<c:simple-property name="snmpAgentPort" displayName="SNMP Agent Port" type="integer" default="1610"
description="the UDP port of the Apache SNMP agent (typically '1610')"/>
<c:simple-property name="snmpAgentCommunity" displayName="SNMP Agent Community" default="public"
description="the SNMP community of the Apache SNMP agent (typically 'public')"/>
- <c:simple-property name="disableCertificateValidation" type="boolean" default="false"
- description="If you use HTTPS URLs for availability checks and the certificates aren't
- trusted by the JVM that runs the agent or the certificates aren't issued for the
- hostname that you use for the availability checks, you can use this property to switch
- off the certificate validation. Note that this opens up a possilibity of
- man-in-the-middle attacks and other SSL related security issues. The agent will switch
- off the validation only for the duration of the request to the configured URL and will
- contact no other URL than the one configured."/>
<c:simple-property name="restartAfterConfigurationUpdate" type="boolean" default="true" required="true">
<c:description>
@@ -499,15 +494,9 @@
<plugin-configuration>
<c:simple-property name="url" displayName="URL"
- description="the http or https URL that will be used to check availability for this virtual host"/>
- <c:simple-property name="disableCertificateValidation" type="boolean" default="false"
- description="If you use HTTPS URLs for availability checks and the certificates aren't
- trusted by the JVM that runs the agent or the certificates aren't issued for the
- hostname that you use for the availability checks, you can use this property to switch
- off the certificate validation. Note that this opens up a possilibity of
- man-in-the-middle attacks and other SSL related security issues. The agent will switch
- off the validation only for the duration of the request to the configured URL and will
- contact no other URL than the one configured."/>
+ description="The http or https URL that will be used to check availability for this
+ virtual host. Note that SSL certificate validation is disabled during availability
+ checks if this is an HTTPS URL."/>
<c:group name="ResponseTime">
<c:simple-property name="responseTimeLogFile" required="false"
description="the full path to the log file containing response-time stats for this virtual host"/>
13 years, 1 month
[rhq] modules/plugins
by John Sanda
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java | 4 -
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java | 4 -
modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java | 4 -
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 25 ++--------
4 files changed, 11 insertions(+), 26 deletions(-)
New commits:
commit f969d77b1fde23911c544fff01768048cc76c02c
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Apr 11 11:17:34 2011 -0400
[BZ 690430] Removing plugin config for disabling cert validation
Removing the plugin configuration property that disables SSL cert
validation for the URL used in availability checks. Cert validation is
automatically disabled if the URL is HTTPS.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 053be8a..a9e3949 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -231,12 +231,10 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
// try to find a pid file under the server root, and then check if the
// process is running.
boolean available;
- Configuration pluginConfig = resourceContext.getPluginConfiguration();
- PropertySimple disableCertValidation = pluginConfig.getSimple("disableCertificateValidation");
try {
if (this.url != null) {
long t1 = System.currentTimeMillis();
- available = WWWUtils.isAvailable(this.url, disableCertValidation.getBooleanValue());
+ available = WWWUtils.isAvailable(this.url);
availPingTime = System.currentTimeMillis() - t1;
} else {
available = getSNMPSession().ping();
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
index 898a9b3..b43e156 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
@@ -130,9 +130,7 @@ public class ApacheVirtualHostServiceComponent implements ResourceComponent<Apac
}
public AvailabilityType getAvailability() {
- Configuration pluginConfig = resourceContext.getPluginConfiguration();
- PropertySimple disableCertValidation = pluginConfig.getSimple("disableCertificateValidation");
- return (this.url != null && WWWUtils.isAvailable(this.url, disableCertValidation.getBooleanValue())) ? AvailabilityType.UP : AvailabilityType.DOWN;
+ return (this.url != null && WWWUtils.isAvailable(this.url)) ? AvailabilityType.UP : AvailabilityType.DOWN;
}
public Configuration loadResourceConfiguration() throws Exception {
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
index 2b226be..5afb34a 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/www/util/WWWUtils.java
@@ -49,14 +49,14 @@ public abstract class WWWUtils {
* @return true if connecting to the URL succeeds, or false otherwise
*/
- public static boolean isAvailable(URL httpURL, boolean disableCertValidation) {
+ public static boolean isAvailable(URL httpURL) {
String failMsg = "URL [" + httpURL + "] returned unavailable";
try {
HttpURLConnection connection = (HttpURLConnection) httpURL.openConnection();
connection.setRequestMethod("HEAD");
connection.setConnectTimeout(3000);
- if ((connection instanceof HttpsURLConnection) && disableCertValidation) {
+ if (connection instanceof HttpsURLConnection) {
disableCertificateVerification((HttpsURLConnection) connection);
}
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index 674b2fb..f6ab6eb 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -273,21 +273,16 @@
<c:simple-property name="configFile" required="true" readOnly="true"
description="the path to the httpd.conf file - if the path is not absolute, it will be resolved relative to the server root directory; if unset, default will be 'conf/httpd.conf' on UNIX"/>
<c:simple-property name="url" displayName="URL" required="false"
- description="the http or https URL that will be used to check availability for this Apache server; if not set, availablity will be determined based on whether plugin can connect to the Apache server's SNMP agent"/>
+ description="The http or https URL that will be used to check availability for this Apache
+ server; if not set, availablity will be determined based on whether plugin can connect
+ to the Apache server's SNMP agent. Note that SSL certificate validation is disabled
+ during availability checks if this is an HTTPS URL."/>
<c:simple-property name="snmpAgentHost" displayName="SNMP Agent Host" default="127.0.0.1"
description="the host name or IP address of the Apache SNMP agent (typically '127.0.0.1')"/>
<c:simple-property name="snmpAgentPort" displayName="SNMP Agent Port" type="integer" default="1610"
description="the UDP port of the Apache SNMP agent (typically '1610')"/>
<c:simple-property name="snmpAgentCommunity" displayName="SNMP Agent Community" default="public"
description="the SNMP community of the Apache SNMP agent (typically 'public')"/>
- <c:simple-property name="disableCertificateValidation" type="boolean" default="false"
- description="If you use HTTPS URLs for availability checks and the certificates aren't
- trusted by the JVM that runs the agent or the certificates aren't issued for the
- hostname that you use for the availability checks, you can use this property to switch
- off the certificate validation. Note that this opens up a possilibity of
- man-in-the-middle attacks and other SSL related security issues. The agent will switch
- off the validation only for the duration of the request to the configured URL and will
- contact no other URL than the one configured."/>
<c:simple-property name="restartAfterConfigurationUpdate" type="boolean" default="true" required="true">
<c:description>
@@ -500,15 +495,9 @@
<plugin-configuration>
<c:simple-property name="url" displayName="URL"
- description="the http or https URL that will be used to check availability for this virtual host"/>
- <c:simple-property name="disableCertificateValidation" type="boolean" default="false"
- description="If you use HTTPS URLs for availability checks and the certificates aren't
- trusted by the JVM that runs the agent or the certificates aren't issued for the
- hostname that you use for the availability checks, you can use this property to switch
- off the certificate validation. Note that this opens up a possilibity of
- man-in-the-middle attacks and other SSL related security issues. The agent will switch
- off the validation only for the duration of the request to the configured URL and will
- contact no other URL than the one configured."/>
+ description="The http or https URL that will be used to check availability for this
+ virtual host. Note that SSL certificate validation is disabled during availability
+ checks if this is an HTTPS URL."/>
<c:group name="ResponseTime">
<c:simple-property name="responseTimeLogFile" required="false"
description="the full path to the log file containing response-time stats for this virtual host"/>
13 years, 1 month
[rhq] 3 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 10 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/AbstractResourceFactoryWizard.java | 6 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java | 30 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java | 8 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java | 20 ++++--
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 4 -
7 files changed, 55 insertions(+), 24 deletions(-)
New commits:
commit 335e422d64018f4bee42f163e9dc6bc54f9d433f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 8 17:14:27 2011 -0400
since the two action buttons for create/import children are at the botto fo the screen, popup the context menu above the buttons, not below, to avoid them getting clipped
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index b22a79a..eb4d04a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -437,12 +437,12 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
menu.addItem(item);
}
- IMenuButton menuButton = new LocatableIMenuButton(tableAction.getLocatorId(), tableAction.getTitle(),
- menu);
+ IMenuButton menuButton = new LocatableIMenuButton(tableAction.getLocatorId(), tableAction.getTitle());
+ menuButton.setMenu(menu);
menuButton.setDisabled(true);
- // this makes it pretty tight, but maybe better than the default, which is pretty wide
- menuButton.setAutoFit(true);
+ menuButton.setAutoFit(true); // this makes it pretty tight, but maybe better than the default, which is pretty wide
menuButton.setOverflow(Overflow.VISIBLE);
+ menuButton.setShowMenuBelow(false);
tableAction.actionCanvas = menuButton;
footer.addMember(menuButton);
@@ -757,7 +757,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
unqualifiedLocatorId = locatorId;
}
TableActionInfo info = new TableActionInfo(this.footer.extendLocatorId(unqualifiedLocatorId), title,
- confirmation, valueMap, tableAction);
+ confirmation, valueMap, tableAction);
tableActions.add(info);
}
commit d501f6a28cfa4b74edbd320a398c77af5076d5a2
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 8 17:13:35 2011 -0400
BZ 680312 - do not null out parent resource in the delete history item so the child history ui can see what was deleted
also has a separate fix - code to support creating resource that doesn't have resource config.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index 6ddfa87..c7c1fdb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -186,7 +186,7 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
// set the resource deleted and update the db in case it matters to the child operations
resource.setInventoryStatus(InventoryStatus.DELETED);
- resource.setParentResource(null);
+ //resource.setParentResource(null); can't null this out since the query DeleteResourceHistory.QUERY_FIND_BY_PARENT_RESOURCE_ID needs it
resource.setItime(System.currentTimeMillis());
entityManager.merge(resource);
@@ -262,7 +262,7 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
ResourceType resourceType = entityManager.getReference(ResourceType.class, resourceTypeId);
// CreateResourceHistory.configuration is one-to-one, so make sure to clone the config, zeroing out all id's.
- Configuration configurationClone = configuration.deepCopy(false);
+ Configuration configurationClone = (configuration != null) ? configuration.deepCopy(false) : null;
// Persist and establish relationships
CreateResourceHistory history = new CreateResourceHistory(parentResource, resourceType, user.getName(),
commit a69cd5dda87fc06b56fc625b43bcc23cf231b281
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Apr 8 17:12:18 2011 -0400
support creating child resources that do not have resource config definition
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/AbstractResourceFactoryWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/AbstractResourceFactoryWizard.java
index a78a4ef..cc2f7c4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/AbstractResourceFactoryWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/AbstractResourceFactoryWizard.java
@@ -102,8 +102,10 @@ public abstract class AbstractResourceFactoryWizard extends AbstractWizard {
if (null == this.newResourceConfigurationDefinition
|| !this.newResourceConfigurationDefinition.equals(newResourceConfigurationDefinition)) {
this.newResourceConfigurationDefinition = newResourceConfigurationDefinition;
- this.newResourceStartingConfiguration = this.newResourceConfigurationDefinition.getDefaultTemplate()
- .createConfiguration();
+ if (newResourceConfigurationDefinition != null) {
+ this.newResourceStartingConfiguration = this.newResourceConfigurationDefinition.getDefaultTemplate()
+ .createConfiguration();
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java
index efa297c..a21a78a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java
@@ -22,9 +22,11 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Jay Shaughnessy
@@ -32,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
*/
public class ResourceFactoryConfigurationStep extends AbstractWizardStep {
+ private boolean noConfigurationNeeded = false; // if true, it has been determined the user doesn't have to set any config
private ConfigurationEditor editor;
AbstractResourceFactoryWizard wizard;
@@ -43,20 +46,33 @@ public class ResourceFactoryConfigurationStep extends AbstractWizardStep {
if (editor == null) {
ConfigurationDefinition def = wizard.getNewResourceConfigurationDefinition();
- Configuration startingConfig = wizard.getNewResourceStartingConfiguration();
-
- if (parent != null) {
- editor = new ConfigurationEditor(parent.extendLocatorId("ResourceFactoryConfig"), def, startingConfig);
+ if (def != null) {
+ Configuration startingConfig = wizard.getNewResourceStartingConfiguration();
+ if (parent != null) {
+ editor = new ConfigurationEditor(parent.extendLocatorId("ResourceFactoryConfig"), def,
+ startingConfig);
+ } else {
+ editor = new ConfigurationEditor("ResourceFactoryConfig", def, startingConfig);
+ }
} else {
- editor = new ConfigurationEditor("ResourceFactoryConfig", def, startingConfig);
+ // there is no configuration to edit, just return a static message indicating that there is nothing to do
+ noConfigurationNeeded = true;
+ LocatableVLayout layout = new LocatableVLayout("noConfigMsgLayout");
+ layout.setMargin(Integer.valueOf(20));
+ layout.setWidth100();
+ layout.setHeight(10);
+ HeaderLabel label = new HeaderLabel(MSG.widget_resourceFactoryWizard_editConfigStep_nothingToDo());
+ label.setWidth100();
+ layout.addMember(label);
+ return layout;
}
}
return editor;
}
public boolean nextPage() {
- if (editor.validate()) {
- wizard.setNewResourceConfiguration(editor.getConfiguration());
+ if (noConfigurationNeeded == true || (editor != null && editor.validate())) {
+ wizard.setNewResourceConfiguration((noConfigurationNeeded) ? null : editor.getConfiguration());
wizard.execute();
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
index 33982e9..81d08aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.LinkedHashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -79,7 +80,12 @@ public class ResourceFactoryCreateWizard extends AbstractResourceFactoryWizard {
ConfigurationDefinition resourceConfigDef = getChildType().getResourceConfigurationDefinition();
this.setNewResourceConfigurationDefinition(resourceConfigDef);
- Map<String, ConfigurationTemplate> templates = resourceConfigDef.getTemplates();
+ Map<String, ConfigurationTemplate> templates;
+ if (resourceConfigDef == null) {
+ templates = new LinkedHashMap<String, ConfigurationTemplate>();
+ } else {
+ templates = resourceConfigDef.getTemplates();
+ }
steps.add(new ResourceFactoryInfoStep(ResourceFactoryCreateWizard.this, MSG
.widget_resourceFactoryWizard_namePrompt(), MSG.widget_resourceFactoryWizard_configTemplatePrompt(),
templates));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
index 8e45760..225a933 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
@@ -25,6 +25,7 @@ import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -46,16 +47,21 @@ public class ResourceFactoryImportWizard extends AbstractResourceFactoryWizard {
public ResourceFactoryImportWizard(Resource parentResource, ResourceType childType) {
super(parentResource, childType);
- this.setNewResourceConfigurationDefinition(getChildType().getPluginConfigurationDefinition());
+
+ ConfigurationDefinition childTypePluginConfigDef = getChildType().getPluginConfigurationDefinition();
+
+ this.setNewResourceConfigurationDefinition(childTypePluginConfigDef);
ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- // skip the info step if the type has only the default template to offer for user selection.
- Map<String, ConfigurationTemplate> templates = childType.getPluginConfigurationDefinition().getTemplates();
- if (templates.size() > 1) {
- this.infoStep = new ResourceFactoryInfoStep(this, null, MSG.widget_resourceFactoryWizard_templatePrompt(),
- templates);
- steps.add(infoStep);
+ // skip the info step if the type has only the default template to offer for user selection or no plugin config
+ if (childTypePluginConfigDef != null) {
+ Map<String, ConfigurationTemplate> templates = childTypePluginConfigDef.getTemplates();
+ if (templates.size() > 1) {
+ this.infoStep = new ResourceFactoryInfoStep(this, null, MSG
+ .widget_resourceFactoryWizard_templatePrompt(), templates);
+ steps.add(infoStep);
+ }
}
configurationStep = new ResourceFactoryConfigurationStep(this);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 36a9b95..7f028ee 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -322,6 +322,7 @@ widget_resourceFactoryWizard_uploadInProgress = The upload is in progress... Thi
widget_resourceFactoryWizard_uploadFileStepName = Upload Resource Content File
widget_resourceFactoryWizard_uploadFailure = Failed to upload file
widget_resourceFactoryWizard_editConfigStepName = Edit Configuration
+widget_resourceFactoryWizard_editConfigStep_nothingToDo = There is no configuration that you need to define for this resource.
widget_resourceFactoryWizard_infoStepName = Resource Information
widget_resourceFactoryWizard_infoStep_loadFail = Failed to get available Architectures
widget_resourceFactoryWizard_namePrompt = New Resource Name
13 years, 1 month
[rhq] 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 154 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java | 14
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 5
15 files changed, 125 insertions(+), 91 deletions(-)
New commits:
commit 0589b9ee8488bd16132b6a1bd761880b81fec5d0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Apr 8 15:22:24 2011 -0400
[BZ 694892 - Non-Perm user error loading about box]
Added SystemManagerRemote call for getProductInfo. This call does not
require perms, as opposed to getServerDetails, which validly requires
MANAGE_SETTINGS and was previously used.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
index bb94c66..7127eb0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java
@@ -50,7 +50,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
@Override
public ProductInfo getProductInfo() throws RuntimeException {
try {
- return systemManager.getServerDetails(getSessionSubject()).getProductInfo();
+ return systemManager.getProductInfo(getSessionSubject());
} catch (Throwable t) {
throw getExceptionToThrowToClient(t);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index 1d4cb36..19a454a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -576,7 +576,7 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
return serverDetails;
}
- private ProductInfo getProductInfo(Subject subject) {
+ public ProductInfo getProductInfo(Subject subject) {
CoreServerMBean coreServer = LookupUtil.getCoreServer();
ProductInfo productInfo = coreServer.getProductInfo();
return productInfo;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
index 3db7b08..e023f48 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java
@@ -24,6 +24,7 @@ import javax.ejb.Local;
import org.rhq.core.db.DatabaseType;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.ProductInfo;
import org.rhq.core.domain.common.ServerDetails;
/**
@@ -141,6 +142,8 @@ public interface SystemManagerLocal {
//
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ ProductInfo getProductInfo(Subject subject);
+
ServerDetails getServerDetails(Subject subject);
Properties getSystemConfiguration(Subject subject);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
index d1bafbc..deb6216 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerRemote.java
@@ -26,6 +26,7 @@ import javax.jws.WebParam;
import javax.jws.WebService;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.ProductInfo;
import org.rhq.core.domain.common.ServerDetails;
/**
@@ -35,7 +36,18 @@ import org.rhq.core.domain.common.ServerDetails;
@Remote
public interface SystemManagerRemote {
/**
- * Provides details (such as product version) of the server processing the request.
+ * Provides product information suitable for "About" details.
+ *
+ * @param subject user making the request
+ *
+ * @return the product info
+ */
+ @WebMethod
+ ProductInfo getProductInfo( //
+ @WebParam(name = "subject") Subject subject);
+
+ /**
+ * Provides details (such as product version) of the server processing the request. Requires MANAGE_SETTINGS.
*
* @param subject user making the request
*
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 7a161ea..5530987 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -49,6 +49,7 @@ import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.common.EntityContext;
+import org.rhq.core.domain.common.ProductInfo;
import org.rhq.core.domain.common.ServerDetails;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
@@ -1127,6 +1128,10 @@ public class WebservicesManagerBean implements WebservicesRemote {
//SYSTEMMANAGER: BEGIN ------------------------------------
+ public ProductInfo getProductInfo(Subject subject) {
+ return systemManager.getProductInfo(subject);
+ }
+
public ServerDetails getServerDetails(Subject subject) {
return systemManager.getServerDetails(subject);
}
commit 9a590b9d71a34f884c9843880278762277028eac
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Apr 8 15:19:01 2011 -0400
[BZ 694641 - Able to perform url navigation after logout]
A user-initiated logout had various issues:
- the logged out user's last view remained on screen (potential security issue)
- the back button could be utilized to navigate to the user's past pages (potential security issue)
- subsequent login could navigate to the wrong view
- in certain situations the previous session could be refreshed (just plain bad)
Now on a user-initiated logout the entire background is greyed out to hide
previous state. The back button will maintain the LogOut view. Subsequent
logins will start at the default view.
Note that session-expirations also pop up the login box but do still
show the background view, on the assumption that the user may want to
log in again and pick up where he left off.
Also
- cleaned up some of the terminolgy around View/ViewPath/ViewId in
CoreGui, for better code clarity.
- fixed some jdoc in UserSessionManager
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index f276417..0aa06c8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -66,35 +66,32 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
*/
public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
+ public static final String CONTENT_CANVAS_ID = "BaseContent";
+
// This must come first to ensure proper I18N class loading for dev mode
private static final Messages MSG = GWT.create(Messages.class);
private static final MessageConstants MSGCONST = GWT.create(MessageConstants.class);
- private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID.getName();
+ private static final String DEFAULT_VIEW = DashboardsView.VIEW_ID.getName();
+ private static final String LOGOUT_VIEW = "LogOut";
+
+ private static String currentView;
+ private static ViewPath currentViewPath;
// just to avoid constructing this over and over. the ordering is important, more complex viewPaths first,
// javascript will greedily match "Resource" and give up trying after that, missing "Resource/AutoGroup" for
// example.
private static final String TREE_NAV_VIEW_PATTERN = "(" //
- + ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH + "|" //
- + ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH //
+ + ResourceGroupDetailView.AUTO_GROUP_VIEW + "|" //
+ + ResourceGroupDetailView.AUTO_CLUSTER_VIEW //
+ ResourceGroupTopView.VIEW_ID + "|" //
+ ResourceTopView.VIEW_ID + "|" //
+ ")/[^/]*";
- public static final String CONTENT_CANVAS_ID = "BaseContent";
-
private static ErrorHandler errorHandler = new ErrorHandler();
private static MessageCenter messageCenter;
- private static String currentPath;
-
- // @SuppressWarnings("unused")
- // private static Canvas content;
-
- private static ViewPath currentViewPath;
-
private static CoreGUI coreGUI;
// store a message to be posted in the message center during the next renderView processing.
@@ -158,10 +155,11 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
});
- /* after having this enabled for a while, the majority opinion is that this is more annoying than helpful
+ /* after having this enabled for a while, the majority opinion is that this is more annoying than helpful
+ *
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent event) {
- event.setMessage("Are you sure you want to leave RHQ?");
+ event.setMessage("Are you sure you want to leave RHQ?");
}
});
*/
@@ -202,7 +200,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
History.addValueChangeHandler(this);
}
- if (History.getToken().equals("") || History.getToken().equals("LogOut")) {
+ if (History.getToken().equals("") || History.getToken().equals(LOGOUT_VIEW)) {
// init the rootCanvas to ensure a clean slate for a new user
rootCanvas.initCanvas();
@@ -214,51 +212,57 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// otherwise just fire an event for the bookmarked URL they are returning to
History.fireCurrentHistoryState();
}
+
+ // The root canvas is hidden by user log out, show again if necessary
+ if (!rootCanvas.isVisible()) {
+ rootCanvas.show();
+ }
}
public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
- currentPath = URL.decodeComponent(stringValueChangeEvent.getValue());
- Log.debug("Handling history event for path: " + currentPath);
+ currentView = URL.decodeComponent(stringValueChangeEvent.getValue());
+ Log.debug("Handling history event for view: " + currentView);
- currentViewPath = new ViewPath(currentPath);
+ currentViewPath = new ViewPath(currentView);
coreGUI.rootCanvas.renderView(currentViewPath);
}
public static void refresh() {
- currentViewPath = new ViewPath(currentPath, true);
+ currentViewPath = new ViewPath(currentView, true);
coreGUI.rootCanvas.renderView(currentViewPath);
}
- public Canvas createContent(String breadcrumbName) {
+ public Canvas createContent(String viewName) {
Canvas canvas;
- if (breadcrumbName.equals(DashboardsView.VIEW_ID.getName())) {
- canvas = new DashboardsView(breadcrumbName);
- } else if (breadcrumbName.equals(InventoryView.VIEW_ID.getName())) {
+ if (viewName.equals(DashboardsView.VIEW_ID.getName())) {
+ canvas = new DashboardsView(viewName);
+ } else if (viewName.equals(InventoryView.VIEW_ID.getName())) {
canvas = new InventoryView();
- } else if (breadcrumbName.equals(ResourceTopView.VIEW_ID.getName())) {
- canvas = new ResourceTopView(breadcrumbName);
- } else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID.getName())) {
- canvas = new ResourceGroupTopView(breadcrumbName);
- } else if (breadcrumbName.equals(ReportTopView.VIEW_ID.getName())) {
+ } else if (viewName.equals(ResourceTopView.VIEW_ID.getName())) {
+ canvas = new ResourceTopView(viewName);
+ } else if (viewName.equals(ResourceGroupTopView.VIEW_ID.getName())) {
+ canvas = new ResourceGroupTopView(viewName);
+ } else if (viewName.equals(ReportTopView.VIEW_ID.getName())) {
canvas = new ReportTopView();
- } else if (breadcrumbName.equals(BundleTopView.VIEW_ID.getName())) {
- canvas = new BundleTopView(breadcrumbName);
- } else if (breadcrumbName.equals(AdministrationView.VIEW_ID.getName())) {
+ } else if (viewName.equals(BundleTopView.VIEW_ID.getName())) {
+ canvas = new BundleTopView(viewName);
+ } else if (viewName.equals(AdministrationView.VIEW_ID.getName())) {
canvas = new AdministrationView();
- } else if (breadcrumbName.equals(HelpView.VIEW_ID.getName())) {
+ } else if (viewName.equals(HelpView.VIEW_ID.getName())) {
canvas = new HelpView();
- } else if (breadcrumbName.equals("LogOut")) {
- // TODO: don't make LogOut a history event, just perform the logout action by responding to click event
+ } else if (viewName.equals(LOGOUT_VIEW)) {
+ UserSessionManager.logout();
+ rootCanvas.hide();
+
LoginView logoutView = new LoginView("Login");
canvas = logoutView;
- UserSessionManager.logout();
logoutView.showLoginDialog();
- } else if (breadcrumbName.equals(TaggedView.VIEW_ID.getName())) {
- canvas = new TaggedView(breadcrumbName);
- } else if (breadcrumbName.equals("Subsystems")) {
+ } else if (viewName.equals(TaggedView.VIEW_ID.getName())) {
+ canvas = new TaggedView(viewName);
+ } else if (viewName.equals("Subsystems")) {
canvas = new AlertHistoryView("Alert");
- } else if (breadcrumbName.equals(TestTopView.VIEW_ID.getName())) {
+ } else if (viewName.equals(TestTopView.VIEW_ID.getName())) {
canvas = new TestTopView();
} else {
canvas = null;
@@ -282,38 +286,38 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
private static String getDefaultView() {
// TODO: should this be Dashboard or a User Preference?
- return DEFAULT_VIEW_PATH;
+ return DEFAULT_VIEW;
}
- public static void goToView(String viewPath) {
- goToView(viewPath, null, false);
+ public static void goToView(String view) {
+ goToView(view, null, false);
}
- public static void goToView(String viewPath, Message message) {
- goToView(viewPath, message, false);
+ public static void goToView(String view, Message message) {
+ goToView(view, message, false);
}
- public static void goToView(String viewPath, boolean refresh) {
- goToView(viewPath, null, refresh);
+ public static void goToView(String view, boolean refresh) {
+ goToView(view, null, refresh);
}
- public static void goToView(String viewPath, Message message, boolean refresh) {
+ public static void goToView(String view, Message message, boolean refresh) {
pendingMessage = message;
pendingRefresh = refresh;
// if path starts with "#" (e.g. if caller used LinkManager to obtain some of the path), strip it off
- if (viewPath.charAt(0) == '#') {
- viewPath = viewPath.substring(1);
+ if (view.charAt(0) == '#') {
+ view = view.substring(1);
}
String currentViewPath = History.getToken();
- if (currentViewPath.equals(viewPath)) {
+ if (currentViewPath.equals(view)) {
// We're already there - just refresh the view.
refresh();
} else {
- if (viewPath.matches(TREE_NAV_VIEW_PATTERN)) {
+ if (view.matches(TREE_NAV_VIEW_PATTERN)) {
// e.g. "Resource/10001" or "Resource/AutoGroup/10003"
- if (!currentViewPath.startsWith(viewPath)) {
+ if (!currentViewPath.startsWith(view)) {
// The Node that was selected is not the same Node that was previously selected - it
// may not even be the same node type. For example, the user could have moved from a
// resource to an autogroup in the same tree. Try to keep the tab selection sticky as best as
@@ -325,10 +329,10 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// trying to render non-applicable detail views. We'll do this by chopping at the start
// of any other numeric in the path
suffix = suffix.replaceFirst("\\d.*", "");
- viewPath += suffix;
+ view += suffix;
}
}
- History.newItem(viewPath);
+ History.newItem(view);
}
}
@@ -351,35 +355,43 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
private String getViewPathTitle(ViewPath viewPath) {
// default title is the path minus any IDs we find. That should give a least some nice default title.
- StringBuilder path = new StringBuilder();
- for (ViewId view : viewPath.getViewPath()) {
+ StringBuilder viewPathTitle = new StringBuilder();
+ for (ViewId viewId : viewPath.getViewPath()) {
// none of our path elements start with a digit that is NOT an ID; if we see an ID, skip it
- if (!Character.isDigit(view.getPath().charAt(0))) {
- if (path.length() > 0) {
- path.append(" | ");
+ if (!Character.isDigit(viewId.getPath().charAt(0))) {
+ if (viewPathTitle.length() > 0) {
+ viewPathTitle.append(" | ");
}
- path.append(view.getPath());
+ viewPathTitle.append(viewId.getPath());
}
}
- if (path.length() == 0) {
- path.append("Core Application");
+ if (viewPathTitle.length() == 0) {
+ viewPathTitle.append("Core Application");
}
- return "RHQ: " + path.toString();
+ return "RHQ: " + viewPathTitle.toString();
}
public void initCanvas() {
// request a redraw of the MenuBarItem to ensure the correct session info is displayed
getMember(0).markForRedraw();
- // remove any current viewId so the next requested path generates new content
+ // remove any current viewId so the next requested view generates new content
this.currentViewId = null;
}
- public void renderView(final ViewPath viewPath) {
- Window.setTitle(getViewPathTitle(viewPath));
+ public void renderView(ViewPath viewPath) {
+ // If the session is logged out ensure that we only navigate to the log out view, otherwise keep
+ // our CoreGUI session alive by refreshing the session timer each time the user performs navigation
+ if (UserSessionManager.isLoggedOut()) {
+ if (!LOGOUT_VIEW.equals(viewPath.getCurrent().getPath())) {
+ History.newItem(LOGOUT_VIEW);
+ }
+ return;
+ } else {
+ UserSessionManager.refresh();
+ }
- // keep our CoreGUI session alive by refreshing the session timer each time the user performs navigation
- UserSessionManager.refresh();
+ Window.setTitle(getViewPathTitle(viewPath));
// clear any message when navigating to a new view (not refreshing), the user is probably no longer interested
if (!viewPath.isRefresh()) {
@@ -388,7 +400,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (viewPath.isEnd()) {
// default view
- History.newItem(DEFAULT_VIEW_PATH);
+ History.newItem(DEFAULT_VIEW);
} else {
if (pendingMessage != null) {
getMessageCenter().notify(pendingMessage);
@@ -425,13 +437,15 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (this.currentCanvas instanceof InitializableView) {
final InitializableView initializableView = (InitializableView) this.currentCanvas;
+ final ViewPath initializableViewPath = viewPath;
new Timer() {
final long startTime = System.currentTimeMillis();
public void run() {
if (initializableView.isInitialized()) {
if (RootCanvas.this.currentCanvas instanceof BookmarkableView) {
- ((BookmarkableView) RootCanvas.this.currentCanvas).renderView(viewPath.next());
+ ((BookmarkableView) RootCanvas.this.currentCanvas).renderView(initializableViewPath
+ .next());
} else {
RootCanvas.this.currentCanvas.markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index 07ec01f..b00d8a0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -77,7 +77,7 @@ public class UserSessionManager {
// Currently: 1 hour
private static int SESSION_TIMEOUT = 60 * 60 * 1000;
- // After CoreGUI logiut, the delay before the server-side logout. Thisis the period in which we allow in-flight
+ // After CoreGUI logout, the delay before the server-side logout. This is the period in which we allow in-flight
// async requests to complete.
// Currently: 5 seconds
private static int LOGOUT_DELAY = 5 * 1000; // 5 seconds
@@ -192,12 +192,12 @@ public class UserSessionManager {
Log.info("sessionAccess-savingSessionId: " + sessionId);
saveSessionId(sessionId);
- // new sessions get the full 29 minutes to expire
+ // new sessions get the full SESSION_TIMEOUT period prior to expire
Log.info("sessionAccess-schedulingSessionTimeout: " + SESSION_TIMEOUT);
coreGuiSessionTimer.schedule(SESSION_TIMEOUT);
} else {
- // existing sessions should expire 29 minutes from the previous access time
+ // existing sessions should expire SESSION_TIMEOUT minutes from the previous access time
long expiryTime = lastAccess + SESSION_TIMEOUT;
long expiryMillis = expiryTime - System.currentTimeMillis();
@@ -205,7 +205,7 @@ public class UserSessionManager {
if (expiryMillis < 1) {
expiryMillis = 1; // expire VERY quickly
} else if (expiryMillis > SESSION_TIMEOUT) {
- expiryMillis = SESSION_TIMEOUT; // guarantees maximum is 29 minutes
+ expiryMillis = SESSION_TIMEOUT; // guarantees maximum
}
Log.info("sessionAccess-reschedulingSessionTimeout: " + expiryMillis);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
index 5b909a9..7a21081 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupConfigurationUpdatesPortlet.java
@@ -390,11 +390,11 @@ public class GroupConfigurationUpdatesPortlet extends LocatableVLayout implement
}
private boolean isAutoGroup() {
- return ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_GROUP_VIEW.equals(getBaseViewPath());
}
private boolean isAutoCluster() {
- return ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_CLUSTER_VIEW.equals(getBaseViewPath());
}
public String getBaseViewPath() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index a1d0d1b..700de52 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -487,11 +487,11 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
}
private boolean isAutoGroup() {
- return ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_GROUP_VIEW.equals(getBaseViewPath());
}
private boolean isAutoCluster() {
- return ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_CLUSTER_VIEW.equals(getBaseViewPath());
}
public String getBaseViewPath() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
index 949371f..211f459 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
@@ -315,11 +315,11 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
}
private boolean isAutoGroup() {
- return ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_GROUP_VIEW.equals(getBaseViewPath());
}
private boolean isAutoCluster() {
- return ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH.equals(getBaseViewPath());
+ return ResourceGroupDetailView.AUTO_CLUSTER_VIEW.equals(getBaseViewPath());
}
public String getBaseViewPath() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 8e8eca7..8cb6a1d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -73,8 +73,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
* @author Ian Springer
*/
public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<ResourceGroupComposite, ResourceGroupTitleBar> {
- public static final String AUTO_CLUSTER_VIEW_PATH = "ResourceGroup/AutoCluster";
- public static final String AUTO_GROUP_VIEW_PATH = "Resource/AutoGroup";
+ public static final String AUTO_CLUSTER_VIEW = "ResourceGroup/AutoCluster";
+ public static final String AUTO_GROUP_VIEW = "Resource/AutoGroup";
private Integer groupId;
private ResourceGroupComposite groupComposite;
@@ -476,11 +476,11 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
private boolean isAutoGroup() {
- return AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
+ return AUTO_GROUP_VIEW.equals(getBaseViewPath());
}
private boolean isAutoCluster() {
- return AUTO_CLUSTER_VIEW_PATH.equals(getBaseViewPath());
+ return AUTO_CLUSTER_VIEW.equals(getBaseViewPath());
}
private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index 32d8110..d00f0a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -71,7 +71,7 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
if (null == detailView) {
if (isAutoClusterPath) {
detailView = new ResourceGroupDetailView(this.extendLocatorId("AutoClusterDetail"),
- ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH);
+ ResourceGroupDetailView.AUTO_CLUSTER_VIEW);
} else {
detailView = new ResourceGroupDetailView(this.extendLocatorId("groupDetail"), this.VIEW_ID.getName());
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index a469fa9..38d0fa5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -377,7 +377,7 @@ public class ResourceGroupTreeView extends LocatableVLayout implements Bookmarka
}
private void renderAutoCluster(ResourceGroup backingGroup) {
- String viewPath = ResourceGroupDetailView.AUTO_CLUSTER_VIEW_PATH + "/" + backingGroup.getId();
+ String viewPath = ResourceGroupDetailView.AUTO_CLUSTER_VIEW + "/" + backingGroup.getId();
String currentViewPath = History.getToken();
if (!currentViewPath.startsWith(viewPath)) {
CoreGUI.goToView(viewPath);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 09c75e6..a1a80ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -64,7 +64,7 @@ public class ResourceTopView extends LocatableHLayout implements BookmarkableVie
if ("AutoGroup".equals(viewPath.getCurrent().getPath())) {
if (null == autoGroupDetailView) {
this.autoGroupDetailView = new ResourceGroupDetailView(this.extendLocatorId("AutoGroupDetail"),
- ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH);
+ ResourceGroupDetailView.AUTO_GROUP_VIEW);
this.setContent(this.autoGroupDetailView);
this.detailView = null;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 5a5a7d1..a94ca04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -299,7 +299,7 @@ public class ResourceTreeView extends LocatableVLayout {
}
private void renderAutoGroup(ResourceGroup backingGroup) {
- String viewPath = ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH + "/" + backingGroup.getId();
+ String viewPath = ResourceGroupDetailView.AUTO_GROUP_VIEW + "/" + backingGroup.getId();
String currentViewPath = History.getToken();
if (!currentViewPath.startsWith(viewPath)) {
CoreGUI.goToView(viewPath);
13 years, 1 month
[rhq] Branch 'as7plugin' - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
New commits:
commit 1e328a1a6e156566cc5d28be7449915c6fdd5df1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Apr 8 19:12:53 2011 +0200
Re-activate the undeployment
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 e477886..11e25ad 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
@@ -80,8 +80,7 @@ public class UploadAndDeployTest {
assert ret.get("outcome").getTextValue().equals("success") : "add to sg was no success " + ret.getTextValue();
- // Now teat down stuff again
-/*
+ // Now tear down stuff again
Operation undeploy = new Operation("remove",serverGroupAddress);
ret = connection.execute(undeploy);
@@ -100,10 +99,8 @@ public class UploadAndDeployTest {
System.out.flush();
-*/
}
- @Test(enabled = false)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
13 years, 1 month
[rhq] Branch 'as7plugin' - 2 commits - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 1
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java | 34 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 88 ++++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 7
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/CompositeOperation.java | 64 +++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java | 3
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 6
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/CompositeOperationTest.java | 108 ++++++
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 | 172 ++++++++++
modules/plugins/jboss-as-7/src/test/resources/test-simple.war |binary
11 files changed, 485 insertions(+), 15 deletions(-)
New commits:
commit afa28b8660dbcd8c0041475a3d41e765f038dd08
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Apr 8 19:06:10 2011 +0200
Upload and deployment of files into server groups.
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 0c6d516..491fb77 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
@@ -185,6 +185,7 @@ public class ASConnection {
String result = mapper.writeValueAsString(operation);
System.out.println("Json to send: " + result);
+ System.out.flush();
mapper.writeValue(out, operation);
out.flush();
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 f3e9ee0..63b7881 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
@@ -20,9 +20,11 @@ package org.rhq.modules.plugins.jbossas7;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -32,6 +34,7 @@ import com.sun.org.apache.xerces.internal.impl.xpath.regex.REUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.map.ObjectMapper;
/**
* Connection for uploading of content.
@@ -53,7 +56,7 @@ public class ASUploadConnection {
private final Log log = LogFactory.getLog(ASUploadConnection.class);
BufferedOutputStream os = null;
- BufferedInputStream is = null;
+ InputStream is = null;
private HttpURLConnection connection;
public OutputStream getOutputStream(String fileName) {
@@ -78,12 +81,35 @@ public class ASUploadConnection {
}
public JsonNode finishUpload() {
+ JsonNode tree = null;
try {
os.write(buildPostRequestFooter());
os.flush();
- is = new BufferedInputStream(connection.getInputStream());
- // TODO read from IN
+ int code = connection.getResponseCode();
+ if (code==500)
+ is = connection.getErrorStream();
+ else
+ is = connection.getInputStream();
+
+ if (is != null) {
+ BufferedReader in = new BufferedReader(new InputStreamReader(is));
+ String line;
+ StringBuilder builder = new StringBuilder();
+ while ((line = in.readLine()) != null) {
+ builder.append(line);
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s = builder.toString();
+ if (s!=null)
+ tree = mapper.readTree(s);
+ else
+ System.out.println("- no result received from InputStream -");
+ }
+ else
+ System.out.println("- no InputStream available -");
} catch (IOException e) {
e.printStackTrace(); // TODO: Customise this generated block
@@ -93,7 +119,7 @@ public class ASUploadConnection {
closeQuietly(os);
}
- return null;
+ return tree;
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index 9650731..0e26e7d 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -20,6 +20,9 @@ package org.rhq.modules.plugins.jbossas7;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -27,7 +30,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
+import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
import org.rhq.core.domain.content.transfer.DeployPackageStep;
import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
@@ -38,6 +44,10 @@ import org.rhq.core.pluginapi.content.ContentFacet;
import org.rhq.core.pluginapi.content.ContentServices;
import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.modules.plugins.jbossas7.json.CompositeOperation;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
+import org.rhq.modules.plugins.jbossas7.json.ReadChildrenNames;
/**
* Component dealing with server group specific things
@@ -58,17 +68,54 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
ContentContext cctx = context.getContentContext();
- String uploadUrl = "http://localhost:9990/domain-api/add-content";
+ DeployPackagesResponse response = new DeployPackagesResponse();
for (ResourcePackageDetails details : packages) {
+
ASUploadConnection uploadConnection = new ASUploadConnection();
- OutputStream out = uploadConnection.getOutputStream(details.getFileName());
+ String fileName = details.getFileName();
+ OutputStream out = uploadConnection.getOutputStream(fileName);
contentServices.downloadPackageBits(cctx, details.getKey(), out, false);
- JsonNode result = uploadConnection.finishUpload();
+ JsonNode uploadResult = uploadConnection.finishUpload();
+ if (uploadResult.has("outcome")) {
+ String outcome = uploadResult.get("outcome").getTextValue();
+ if (outcome.equals("success")) { // Upload was successful, so now add the file to the server group
+ JsonNode resultNode = uploadResult.get("result");
+ String hash = resultNode.get("BYTES_VALUE").getTextValue();
+ ASConnection connection = getASConnection();
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", fileName));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
+ step1.addAdditionalProperty("name", fileName);
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group",serverGroupFromKey()));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", fileName));
+ Operation step2 = new Operation("add",serverGroupAddress,"enabled","true");
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+ cop.addStep(step2);
+
+ JsonNode result = connection.execute(cop);
+ if (connection.isErrorReply(result)) // TODO get failure message into response
+ response.addPackageResponse(new DeployIndividualPackageResponse(details.getKey(),ContentResponseResult.FAILURE));
+ else
+ response.addPackageResponse(new DeployIndividualPackageResponse(details.getKey(),ContentResponseResult.SUCCESS));
+ }
+ else
+ response.addPackageResponse(new DeployIndividualPackageResponse(details.getKey(),ContentResponseResult.FAILURE));
+ }
+ else {
+ response.addPackageResponse(
+ new DeployIndividualPackageResponse(details.getKey(), ContentResponseResult.FAILURE));
+ }
}
- return null; // TODO: Customise this generated block
+ return response;
}
@Override
@@ -78,7 +125,32 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
@Override
public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
- return null; // TODO: Customise this generated block
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group",serverGroupFromKey()));
+
+ Operation op = new ReadChildrenNames(serverGroupAddress,"deployment"); // TODO read full packages not onyl names
+ JsonNode node = connection.execute(op);
+ if (connection.isErrorReply(node))
+ return null;
+
+ JsonNode result = node.get("result");
+ Iterator<JsonNode> iter = result.getElements();
+ Set<ResourcePackageDetails> details = new HashSet<ResourcePackageDetails>();
+ while (iter.hasNext()) {
+ JsonNode jNode = iter.next();
+ String file = jNode.getTextValue();
+ String t;
+ if (file.contains("."))
+ t = file.substring(file.lastIndexOf(".")+1);
+ else
+ t = "-none-";
+
+ ResourcePackageDetails detail = new ResourcePackageDetails(new PackageDetailsKey(file,"1.0",t,"all"));
+ details.add(detail);
+ }
+ return details;
+
}
@Override
@@ -110,4 +182,10 @@ public class ServerGroupComponent extends DomainComponent implements ContentFace
return report;
}
+
+
+ private String serverGroupFromKey() {
+ String key1 = context.getResourceKey();
+ return key1.substring(key1.lastIndexOf("/")+1);
+ }
}
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 9aea097..747aff0 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
@@ -68,7 +68,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
String parentPath = parentComponent.getPath();
String path;
- if (cpath.endsWith("/*")) {
+ if (cpath!=null && cpath.endsWith("/*")) {
path = cpath.substring(0,cpath.length()-2);
recursive = true;
}
@@ -105,7 +105,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
subNode = json.get(subPath); // TODO clean this up. to get the 'key' in a path from the AS we need to use get()
// Map<String,Subsystem> subsystemMap = mapper.readValue(subNode,new TypeReference<Map<String,Subsystem>>() {});
- if (subNode.isArray()) {
+ if (subNode!=null && subNode.isArray()) {
Iterator<JsonNode> iter = subNode.getElements();
// if (subsystemMap==null) {
@@ -139,7 +139,10 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
}
}
else {
+
System.out.println("subnode was no array");
+ if (subNode==null)
+ log.error("subNode was null for " + path + " and type " + context.getResourceType().getName());
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
index e538c94..a7abfe6 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
@@ -67,7 +67,6 @@ public class Operation {
public Operation(String operation, List<PROPERTY_VALUE> address) {
this.operation = operation;
this.address = address;
- additionalProperties = Collections.emptyMap();
}
@@ -76,7 +75,7 @@ public class Operation {
}
@JsonAnySetter
- public void addAdditionalProperty(String key, String value) {
+ public void addAdditionalProperty(String key, Object value) {
if (additionalProperties == null)
additionalProperties = new HashMap<String, Object>();
additionalProperties.put(key,value);
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 258da2c..e3bd676 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
@@ -150,7 +150,11 @@
<c:simple-property name="jvm"/>
<c:simple-property name="deployment" required="false"/> <!-- TODO change structure. Or put below as resource? -->
</resource-configuration>
- <service name="Deployment" class="BaseComponent" discovery="SubsystemDiscovery" createDeletePolicy="create-only"/>
+ <service name="Deployment" class="BaseComponent" discovery="SubsystemDiscovery" createDeletePolicy="create-only">
+ <plugin-configuration>
+ <c:simple-property name="path" default="/deployment/*" readOnly="true"/>
+ </plugin-configuration>
+ </service>
</server>
<server name="Host"
description="Host involved in this domain"
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 5ba843f..9110fbd 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
@@ -84,6 +84,7 @@ public class OperationJsonTest {
props.put("someBool",true);
Operation operation = new Operation("add",address,props);
+ operation.addAdditionalProperty("foo","bar");
ObjectMapper mapper = new ObjectMapper();
@@ -97,8 +98,22 @@ public class OperationJsonTest {
assert op.getOperation().equals(operation.getOperation()) : "Operation is " + op.getOperation();
assert op.getAdditionalProperties().containsKey("someBool") : "Key someBool not found ";
Object someBool = op.getAdditionalProperties().get("someBool");
- assert Boolean.valueOf((String) someBool) : "someBool was not true";
+ assert Boolean.valueOf((Boolean) someBool) : "someBool was not true";
+ }
+
+ public void addPropsTest() throws Exception {
+ List<PROPERTY_VALUE> address=new ArrayList<PROPERTY_VALUE>(2);
+ PROPERTY_VALUE part = new PROPERTY_VALUE("/server-group","newOne");
+ address.add(part);
+
+ Operation operation = new Operation("add",address);
+ operation.addAdditionalProperty("foo","bar");
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String result = mapper.writeValueAsString(operation);
+ System.out.println(result);
}
}
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
new file mode 100644
index 0000000..e477886
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.jackson.JsonNode;
+import org.testng.annotations.Test;
+
+import org.rhq.modules.plugins.jbossas7.json.CompositeOperation;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
+
+/**
+ * Test uploading and deploying to the domain
+ * To use it, domain server must be up and running locally and
+ * the UPLOAD_FILE must point to a valid archive in the resources directory.
+ * @author Heiko W. Rupp
+ */
+@Test
+public class UploadAndDeployTest {
+
+ static final String TEST_WAR = "test.war";
+ private static final String UPLOAD_FILE = "test-simple.war";
+
+ public void testUploadIndividualSteps() throws Exception {
+
+ String bytes_value = prepare();
+
+ System.out.println("sha: " + bytes_value);
+
+ System.out.println();
+ ASConnection connection = new ASConnection("localhost",9990);
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation op = new Operation("add",deploymentsAddress);
+ op.addAdditionalProperty("hash",new PROPERTY_VALUE("BYTES_VALUE",bytes_value));
+ op.addAdditionalProperty("name", TEST_WAR); // this needs to be separate per upload
+ op.addAdditionalProperty("runtime-name", TEST_WAR);
+ System.out.flush();
+ JsonNode ret = connection.execute(op);
+ System.out.println("Add to /deploy done " + ret);
+ System.out.flush();
+
+ assert ret.toString().contains("success") : ret;
+
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group","main-server-group"));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ op.addAdditionalProperty("runtime-name", TEST_WAR);
+ Operation deploy = new Operation("add",serverGroupAddress,"enabled","true");
+ System.out.flush();
+ ret = connection.execute(deploy);
+ System.out.println("Add to server group done: " + ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valied " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "add to sg was no success " + ret.getTextValue();
+
+
+ // Now teat down stuff again
+/*
+
+ Operation undeploy = new Operation("remove",serverGroupAddress);
+ ret = connection.execute(undeploy);
+
+ assert ret.has("outcome") : "Ret not valied " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "remove from sg was no success " + ret.getTextValue();
+
+
+ // remove from domain
+
+ Operation remove = new Operation("remove",deploymentsAddress);
+ ret = connection.execute(remove);
+
+ assert ret.has("outcome") : "Ret not valied " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "remove from domain was no success " + ret.getTextValue();
+
+ System.out.flush();
+
+*/
+ }
+
+ @Test(enabled = false)
+ public void testUploadComposite() throws Exception {
+
+ String bytes_value = prepare();
+
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
+ step1.addAdditionalProperty("name", TEST_WAR);
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group","main-server-group"));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step2 = new Operation("add",serverGroupAddress,"enabled","true");
+
+
+ Operation step3 = new Operation("remove",serverGroupAddress);
+
+ Operation step4 = new Operation("remove",deploymentsAddress);
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+ cop.addStep(step2);
+
+
+ ASConnection connection = new ASConnection("localhost",9990);
+ JsonNode ret = connection.execute(cop);
+ System.out.println(ret);
+ System.out.flush();
+
+ Thread.sleep(1000);
+
+ cop = new CompositeOperation();
+ cop.addStep(step3);
+ cop.addStep(step4);
+ ret = connection.execute(cop);
+
+ System.out.println(ret);
+ System.out.flush();
+
+
+ }
+
+ private String prepare() throws IOException {
+ ASUploadConnection conn = new ASUploadConnection();
+ OutputStream os = conn.getOutputStream("test1.war");
+
+
+
+ InputStream fis = getClass().getClassLoader().getResourceAsStream(UPLOAD_FILE);
+ int b;
+ while ((b = fis.read())!=-1) {
+ os.write(b);
+ }
+ fis.close();
+ JsonNode node = conn.finishUpload();
+ System.out.println(node);
+ assert node.has("outcome") : "No outcome from upload";
+ String outcome = node.get("outcome").getTextValue();
+ assert outcome.equals("success") : "Upload was no success" + outcome;
+
+ JsonNode resultNode = node.get("result");
+ return resultNode.get("BYTES_VALUE").getTextValue();
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/test/resources/test-simple.war b/modules/plugins/jboss-as-7/src/test/resources/test-simple.war
new file mode 100644
index 0000000..bd427b1
Binary files /dev/null and b/modules/plugins/jboss-as-7/src/test/resources/test-simple.war differ
commit 6e262803ae8e328cc397a75d00404ea844f5fb54
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Apr 8 16:34:39 2011 +0200
Add composite operations
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/CompositeOperation.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/CompositeOperation.java
new file mode 100644
index 0000000..98cc214
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/CompositeOperation.java
@@ -0,0 +1,64 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.json;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * A composite operation contains multiple steps of a
+ * task that requires many individual operations to complete
+ * @author Heiko W. Rupp
+ */
+public class CompositeOperation extends Operation {
+
+
+
+ @JsonProperty
+ List<Operation> steps = new ArrayList<Operation>();
+
+ OperationHeaders operationHeaders;
+
+ public CompositeOperation(List<Operation> steps) {
+ super("composite",new ArrayList<PROPERTY_VALUE>());
+ this.steps = steps;
+ }
+
+ public CompositeOperation() {
+ super("composite",new ArrayList<PROPERTY_VALUE>());
+ }
+
+ public void addStep(Operation step) {
+ steps.add(step);
+ }
+
+ public void setOperationHeaders(OperationHeaders headers) {
+ operationHeaders = headers;
+ }
+
+ private class OperationHeaders {
+ @JsonProperty("in-series")
+ List<PROPERTY_VALUE>inSeries = Collections.emptyList();
+ @JsonProperty("rollback-across-groups")
+ boolean rollbackAcrossGroups;
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/CompositeOperationTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/CompositeOperationTest.java
new file mode 100644
index 0000000..dddbe51
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/CompositeOperationTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.testng.annotations.Test;
+
+import org.rhq.modules.plugins.jbossas7.json.CompositeOperation;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.PROPERTY_VALUE;
+
+/**
+ * Test composite operations
+ * @author Heiko W. Rupp
+ */
+@Test
+public class CompositeOperationTest {
+
+ public void serializationTest() throws Exception {
+
+ List<PROPERTY_VALUE> address=new ArrayList<PROPERTY_VALUE>(3);
+ PROPERTY_VALUE part = new PROPERTY_VALUE("subsystem","web");
+ address.add(part);
+ part = new PROPERTY_VALUE("connector","http");
+ address.add(part);
+ part = new PROPERTY_VALUE("profile","default");
+ address.add(part);
+
+ CompositeOperation op = new CompositeOperation();
+
+ Operation step1 = new Operation("add", address);
+ op.addStep(step1);
+
+ Operation step2 = new Operation("deploy", address);
+ op.addStep(step2);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String result = mapper.writeValueAsString(op);
+
+ System.out.println(result);
+
+ assert result.contains("http");
+
+ }
+
+ public void serializationTest2() throws Exception {
+
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ String TEST_WAR = "test.war";
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ String bytes_value = "123";
+ step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
+ step1.addAdditionalProperty("name", TEST_WAR);
+
+ List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>(1);
+ serverGroupAddress.add(new PROPERTY_VALUE("server-group","main-server-group"));
+ serverGroupAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step2 = new Operation("add",serverGroupAddress,"enabled","true");
+
+
+ Operation step3 = new Operation("remove",serverGroupAddress);
+
+ Operation step4 = new Operation("remove",deploymentsAddress);
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+ cop.addStep(step2);
+ cop.addStep(step3);
+ cop.addStep(step4);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ String result = mapper.writeValueAsString(cop);
+ System.out.println(result);
+ System.out.flush();
+
+ JsonNode node = mapper.readTree(result);
+
+ assert node.has("operation");
+ assert !node.get("operation").isNull() : "Operations was null, but should not be " + result;
+ assert node.get("operation").getTextValue().equals("composite") : node;
+
+ }
+}
13 years, 1 month
[rhq] 2 commits - modules/enterprise
by John Sanda
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit cb25817a7462904ef449ffdf8b8c65e4124ede34
Merge: 9c257c5 c6bbaa5
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Apr 8 12:57:46 2011 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 9c257c5733307f8fc05d50b5f28b3186b35978f2
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Apr 8 12:57:06 2011 -0400
Fixing typo/spelling error
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
index 10fc861..20dbeee 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
@@ -392,7 +392,7 @@ public class InstalledPluginsUIBean {
Subject subject = EnterpriseFacesContextUtility.getSubject();
pluginMgr.markPluginsForPurge(subject, getIds(getSelectedAgentPlugins()));
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Preparing to purge agent plugins: " +
- pluginNames + ". This make take a few minutes since all type definitions from the plugins must " +
+ pluginNames + ". This may take a few minutes since all type definitions from the plugins must " +
"first be purged from the system. The plugins will still be visible on this page until they have " +
"been purged.");
} catch (Exception e) {
13 years, 1 month
[rhq] modules/enterprise
by ips
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit c6bbaa53d10eb0b0db5af8c651468169b2564ef0
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Apr 8 09:55:20 2011 -0400
fix two compile errors caused by API changes in ResourceFactoryManagerLocal
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
index 463984e..c72cc59 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventCreateDeleteChildJSON.jsp
@@ -24,8 +24,8 @@
long begin = Long.parseLong(WebUtility.getRequiredRequestParameter(request, "begin"));
ResourceFactoryManagerLocal resourceFactoryManager = LookupUtil.getResourceFactoryManager();
- PageList<CreateResourceHistory> creates = resourceFactoryManager.findCreateChildResourceHistory(resourceId, begin, end, new PageControl(0,100));
- PageList<DeleteResourceHistory> deletes = resourceFactoryManager.findDeleteChildResourceHistory(resourceId, begin, end, new PageControl(0,100));
+ PageList<CreateResourceHistory> creates = resourceFactoryManager.findCreateChildResourceHistory(subject, resourceId, begin, end, new PageControl(0, 100));
+ PageList<DeleteResourceHistory> deletes = resourceFactoryManager.findDeleteChildResourceHistory(subject, resourceId, begin, end, new PageControl(0, 100));
%>
@@ -108,4 +108,4 @@
<%
}
%>
-]}
\ No newline at end of file
+]}
13 years, 1 month