modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 9 +-- modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java | 18 ++++++ modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl | 28 ++++++++++ modules/enterprise/server/plugins/alert-operations/token2confluence.xsl | 22 ------- 4 files changed, 50 insertions(+), 27 deletions(-)
New commits: commit d882f2088e1f27d64376550e1b984cf33fcd2923 Author: Heiko W. Rupp hwr@redhat.com Date: Tue Mar 2 15:04:05 2010 +0100
Prevent NPE
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java index e5684d2..c3eda0e 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java @@ -2129,7 +2129,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage resourceId = parent.getId(); } parent = getParentResource(resourceId); - int parentId = parent.getId(); + if (parent==null) + break; if (parent.getResourceType().getCategory().equals(ResourceCategory.PLATFORM)){ resource = parent; parent = null; @@ -2177,7 +2178,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
//we can't assume the ordering of the provided results and the disambiguation query results //will be the same. - + //this list contains the resulting reports in the same order as the original results List<MutableDisambiguationReport<T>> reports = new ArrayList<MutableDisambiguationReport<T>>(results.size());
@@ -2267,7 +2268,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage String parentName = (String) parentsResult[2 * i + 2]; parents.add(new ResourceParentFlyweight(parentId, parentName)); } - + //update all the reports that correspond to this resourceId for(MutableDisambiguationReport<T> report : reportsByResourceId.get(resourceId)) { report.typeName = typeName; @@ -2282,7 +2283,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage for (MutableDisambiguationReport<T> report : reports) { resolution.add(report.getReport()); } - + return new ResourceNamesDisambiguationResult<T>(resolution, typeResolutionNeeded, parentResolutionNeeded, pluginResolutionNeeded); }
commit 53f788862170e0bd8e837d4da6996d3fdff796da Author: Heiko W. Rupp hwr@redhat.com Date: Tue Mar 2 11:40:09 2010 +0100
Move to a better place in the file hierarchy
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl new file mode 100644 index 0000000..1d1a2d9 --- /dev/null +++ b/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl @@ -0,0 +1,28 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22%3E + + <xsl:output method="text" indent="no" xml:space="default"/> + <xsl:strip-space elements="*"/> + + <xsl:template match="/"> +h2. Tokens for alert-operations sender + +Those tokens can be used in operation definition properties like +'tokenclass.token' e.g. "alert.id" or "resource.name" + <xsl:apply-templates /> + </xsl:template> + + <xsl:template match="tokenClass"> +h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/> + <xsl:apply-templates > + <xsl:sort select="@name"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="token"> +* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_xsl:text/ + </xsl:template> + + <xsl:template match="fullName"/> + <xsl:template match="descr"/> + +</xsl:stylesheet> \ No newline at end of file diff --git a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl deleted file mode 100644 index 1d1a2d9..0000000 --- a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl +++ /dev/null @@ -1,28 +0,0 @@ -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22%3E - - <xsl:output method="text" indent="no" xml:space="default"/> - <xsl:strip-space elements="*"/> - - <xsl:template match="/"> -h2. Tokens for alert-operations sender - -Those tokens can be used in operation definition properties like -'tokenclass.token' e.g. "alert.id" or "resource.name" - <xsl:apply-templates /> - </xsl:template> - - <xsl:template match="tokenClass"> -h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/> - <xsl:apply-templates > - <xsl:sort select="@name"/> - </xsl:apply-templates> - </xsl:template> - - <xsl:template match="token"> -* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_xsl:text/ - </xsl:template> - - <xsl:template match="fullName"/> - <xsl:template match="descr"/> - -</xsl:stylesheet> \ No newline at end of file
commit 00727947b1936074c04a13d0d6c4d34ab1233e60 Author: Heiko W. Rupp hwr@redhat.com Date: Tue Mar 2 11:39:41 2010 +0100
Add an option to specify an output file.
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java index 7b2d7ff..a51f2fb 100644 --- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java +++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java @@ -18,6 +18,11 @@ */ package org.rhq.enterprise.server.plugins.alertOperations;
+import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; import java.util.EnumSet; import java.util.Set;
@@ -35,9 +40,20 @@ public class PrintTokens {
public static void main(String[] args) throws Exception {
+ OutputStream out; + if (args.length==0) + out = new BufferedOutputStream(System.out); + else { + File file = new File(args[0]); + System.err.println("writing to " + file.getAbsolutePath()); + out = new BufferedOutputStream(new FileOutputStream(file)); + } + String text = createTokenDescription();
- System.out.println(text); + out.write(text.getBytes()); + out.flush(); + out.close(); }
/**
commit ada3ff33262675a7fd00298f078608aae0559a2e Author: Heiko W. Rupp hwr@redhat.com Date: Tue Mar 2 10:03:24 2010 +0100
Optimization of the style sheet
diff --git a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl index 8a2b14f..1d1a2d9 100644 --- a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl +++ b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl @@ -1,19 +1,25 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22%3E
<xsl:output method="text" indent="no" xml:space="default"/> + <xsl:strip-space elements="*"/>
<xsl:template match="/"> h2. Tokens for alert-operations sender + +Those tokens can be used in operation definition properties like +'tokenclass.token' e.g. "alert.id" or "resource.name" <xsl:apply-templates /> </xsl:template>
<xsl:template match="tokenClass"> -h3. *<xsl:value-of select="@name"/>*: <xsl:value-of select="@description"/> - xsl:apply-templates/ +h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/> + <xsl:apply-templates > + <xsl:sort select="@name"/> + </xsl:apply-templates> </xsl:template>
<xsl:template match="token"> -* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_ +* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_xsl:text/ </xsl:template>
<xsl:template match="fullName"/>