modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java | 2
modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java | 47
++++++++--
modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl | 12
++
3 files changed, 52 insertions(+), 9 deletions(-)
New commits:
commit f7be27b6647ae745914ffa08435058e4fef00dc7
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Sep 29 12:56:25 2010 -0400
add support for generating the runs-inside element within a server or service element
diff --git
a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java
b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java
index 69587d0..be39d9d 100644
--- a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java
+++ b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java
@@ -308,7 +308,7 @@ public class PluginGen {
}
/**
- * Translate a packgage into a filesystem path
+ * Translate a package into a filesystem path
* @param pkg Package in standard notation like com.acme.plugins
* @param separator File separator
* @return a path suitable to pass to File
diff --git a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
index a657f42..bc1fc64 100644
--- a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
+++ b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -71,14 +71,14 @@ public class Props {
private boolean deleteChildren;
/** Use externals chars in the plugin jar ? */
private boolean usesExternalJarsInPlugin;
- /** Does it support manuall add of children ? */
+ /** Does it support manual add of children ? */
private boolean manualAddOfResourceType;
/** Does it use the PluginLifecycleListener api ? */
private boolean usePluginLifecycleListenerApi;
/** Depends on JMX plugin ? */
private boolean dependsOnJmxPlugin;
/** What version of RHQ should this plugin's pom use ? */
- private String rhqVersion = "1.4.0-SNAPSHOT";
+ private String rhqVersion = "3.0.0";
/** Embedded children */
private Set<Props> children = new HashSet<Props>();
@@ -91,6 +91,8 @@ public class Props {
private Set<OperationProps> operations = new
LinkedHashSet<OperationProps>();;
+ private Set<TypeKey> runsInsides = new LinkedHashSet<TypeKey>();;
+
private String pluginName;
private String pluginDescription;
@@ -326,7 +328,15 @@ public class Props {
this.pluginDescription = pluginDescription;
}
- public void populateMetrics(List<Class> classes) {
+ public Set<TypeKey> getRunsInsides() {
+ return runsInsides;
+ }
+
+ public void setRunsInsides(Set<TypeKey> runsInsides) {
+ this.runsInsides = runsInsides;
+ }
+
+ public void populateMetrics(List<Class> classes) {
for (Class<?> clazz : classes) {
Metric metricAnnot = clazz.getAnnotation(Metric.class);
if (metricAnnot != null) {
@@ -372,10 +382,37 @@ public class Props {
sb.append(", children=").append(children);
sb.append(", simpleProps=").append(simpleProps);
sb.append(", templates=").append(templates);
+ sb.append(", runsInsides=").append(runsInsides);
sb.append('}');
return sb.toString();
}
+ public static class TypeKey {
+ private String name;
+ private String pluginName;
+
+ public TypeKey(String name, String pluginName) {
+ this.name = name;
+ this.pluginName = pluginName;
+ }
+
+ public String getPluginName() {
+ return pluginName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ return "TypeKey{" +
+ "name='" + name + '\'' +
+ ", pluginName='" + pluginName + '\'' +
+ '}';
+ }
+ }
+
public static class SimpleProperty {
private final String name;
private String description;
@@ -431,7 +468,6 @@ public class Props {
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
-
}
public static class Template {
@@ -519,7 +555,6 @@ public class Props {
public String getProperty() {
return property;
}
-
}
public static class OperationProps {
diff --git a/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
b/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
index 0343787..b650f7a 100644
--- a/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
+++ b/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
@@ -1,7 +1,7 @@
<#--
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
platform/server/service. It is called by descriptor.ftl
-->
-name="${props.name}" <#-- TODO separate out plugin name and service name
-->
+name="${props.name}"
discovery="${props.discoveryClass}"
class="${props.componentClass}"
<#if props.singleton>singleton="true"</#if>
@@ -32,6 +32,14 @@ name="${props.name}" <#-- TODO separate out plugin name
and service name -->
<#if props.createChildren &&
props.deleteChildren>createDeletePolicy="both"<#elseif
props.createChildren &&
!props.deleteChildren>createDeletePolicy="create-only"<#elseif
!props.createChildren &&
props.deleteChildren>createDeletePolicy="delete-only"<#else > <#--
Dont mention it, as 'neither' is default --></#if>
+ <#if props.runsInsides?has_content>
+ <runs-inside>
+ <#list props.runsInsides as typeKey>
+ <parent-resource-type name="${typeKey.name}"
plugin="${typeKey.pluginName}"/>
+ </#list>
+ </runs-inside>
+ </#if>
+
<#if props.simpleProps?has_content>
<plugin-configuration>
<#list props.simpleProps as simpleProps>