[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rhq-commits
Subject:    [rhq] 3 commits - etc/standalone-pc modules/core modules/enterprise
From:       pilhuhn () fedoraproject ! org (Heiko W !  Rupp)
Date:       2012-07-27 15:34:07
Message-ID: 20120727153407.95EAE320E () lists ! fedorahosted ! org
[Download RAW message or body]

 etc/standalone-pc/README.txt                                                         \
|    3   etc/standalone-pc/standalone.bat                                             \
|    9 -  etc/standalone-pc/standalone.sh                                             \
|   12 --  modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java \
|   57 ++++++----  modules/enterprise/agent/src/etc/plugin-validator.sh               \
|    7 +  modules/enterprise/agent/src/etc/standalone-pc.bat                          \
|    9 +  modules/enterprise/agent/src/etc/standalone-pc.sh                           \
|   12 ++  modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java \
|    2   8 files changed, 71 insertions(+), 40 deletions(-)

New commits:
commit c1d8f3211ece139eb08cb3f2ee22747a78f9d821
Author: Heiko W. Rupp <hwr at redhat.com>
Date:   Fri Jul 27 11:24:55 2012 -0400

    Allow to run the plugin validator standalone. If done so, also print warnings and \
errors to stdout/stderr.

diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java \
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
 index da50213..73da44f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
                
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
 @@ -54,15 +54,19 @@ import org.rhq.core.pluginapi.plugin.PluginLifecycleListener;
 public class PluginValidator {
     private static final Log LOG = LogFactory.getLog(PluginValidator.class);
     private static final String PLUGIN_DESCRIPTOR_PATH = "META-INF/rhq-plugin.xml";
+    static boolean interactive = false;
 
     /**
      * If no args are passed in, the current thread's classloader will be used to \
                find the plugins to validate.
      * If one or more argument strings are provided, they will be assumed to be \
                paths to the plugin jars to validate
      * (in which case the thread's classloader will be ignored and not searched for \
                plugins).
      *
+     * If one argument is '-i'. Warnings and Errors will also be printed to stdout \
and stderr, which helps developers +     * to find issues when they run the Plugin \
validator as a standalone tool. +     *
      * The last line this will output will be "!OK!" and exit with an exit code of 0 \
                if everything is OK.
      * The last line this will output will be "!FAILURE!" and exit with an exit code \
                of 1 if one or more plugins failed validation.
-     * 
+     *
      * @param args 0 or more plugin jar file paths
      */
     public static void main(String[] args) {
@@ -72,6 +76,11 @@ public class PluginValidator {
             if (args.length > 0) {
                 finder = new SimplePluginFinder();
                 for (String arg : args) {
+                    if (arg.equals("-i")) {
+                        interactive = true;
+                        continue;
+                    }
+
                     URL jarUrl = new File(arg).toURI().toURL();
                     finder.addUrl(jarUrl);
                     LOG.info("Plugin jar: " + jarUrl);
@@ -109,7 +118,7 @@ public class PluginValidator {
             boolean sizesMatch = (manager.getPlugins().size() == \
finder.findPlugins().size());  if (!sizesMatch) {
                 success = false;
-                LOG.error("Only [" + manager.getPlugins().size() + "] out of [" + \
finder.findPlugins().size() +                errorLog("Only [" + \
manager.getPlugins().size() + "] out of [" + finder.findPlugins().size()  + "] plugin \
descriptors are valid.");  } else {
                 LOG.info("All [" + finder.findPlugins().size() + "] plugin \
descriptors are valid."); @@ -147,47 +156,47 @@ public class PluginValidator {
         String componentClass = metadataManager.getComponentClass(resourceType);
         if (componentClass == null) {
             success = false;
-            LOG.error("Missing component class in resource type [" + \
resourceType.getName() + "] from plugin [" +            errorLog("Missing component \
class in resource type [" + resourceType.getName() + "] from plugin ["  + \
resourceType.getPlugin() + "]");  } else {
             try {
                 Class componentClazz = Class.forName(componentClass, false, \
                pluginEnvironment.getPluginClassLoader());
                 if (!ResourceComponent.class.isAssignableFrom(componentClazz)) {
                     success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
                componentClass + "] for resource type [" + resourceType.getName()
                         + "] from plugin [" + resourceType.getPlugin() + "] does not \
implement "  + ResourceComponent.class);
                 }
                 if (!resourceType.getMetricDefinitions().isEmpty()
                     && !MeasurementFacet.class.isAssignableFrom(componentClazz)) {
                     success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the measurement collection facet but \
defines metrics.");  }
                 if (!resourceType.getOperationDefinitions().isEmpty()
                     && !OperationFacet.class.isAssignableFrom(componentClazz)) {
                     success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the operations facet but defines \
operations.");  }
                 if (resourceType.getBundleType() != null && \
!BundleFacet.class.isAssignableFrom(componentClazz)) {  success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the bundle facet but defines a bundle \
type.");  }
                 if (!resourceType.getPackageTypes().isEmpty() && \
!ContentFacet.class.isAssignableFrom(componentClazz)) {  success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the content management facet but \
defines package types.");  }
                 if (resourceType.getResourceConfigurationDefinition() != null
                     && !ConfigurationFacet.class.isAssignableFrom(componentClazz)) {
                     success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the configuration facet but defines \
resource configuration.");  }
@@ -200,19 +209,19 @@ public class PluginValidator {
                 }
                 if (hasCreatableChild && \
!CreateChildResourceFacet.class.isAssignableFrom(componentClazz)) {  success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support the child creation facet but has \
metadata saying it can.");  }
                 if (resourceType.isDeletable() && \
!DeleteResourceFacet.class.isAssignableFrom(componentClazz)) {  success = false;
-                    LOG.error("Component class [" + componentClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Component class [" + \
componentClass + "] for resource type [" + resourceType.getName()  + "] from plugin \
                [" + resourceType.getPlugin()
                         + "] does not support delete resource facet but has metadata \
saying it can delete children.");  }
             } catch (Exception e) {
                 success = false;
-                LOG.error("Cannot find component class [" + componentClass + "] for \
resource type [" +                errorLog("Cannot find component class [" + \
                componentClass + "] for resource type ["
                     + resourceType.getName() + "] from plugin [" + \
resourceType.getPlugin() + "].");  }
         }
@@ -228,18 +237,18 @@ public class PluginValidator {
                 Class discoveryClazz = Class.forName(discoveryClass, false, \
                pluginEnvironment.getPluginClassLoader());
                 if (!ResourceDiscoveryComponent.class.isAssignableFrom(discoveryClazz)) \
{  success = false;
-                    LOG.error("Discovery class [" + discoveryClass + "] for resource \
type [" + resourceType.getName() +                    errorLog("Discovery class [" + \
                discoveryClass + "] for resource type [" + resourceType.getName()
                         + "] from plugin [" + resourceType.getPlugin() + "] does not \
implement "  + ResourceDiscoveryComponent.class);
                 }
                 if (resourceType.isSupportsManualAdd() && \
                !ManualAddFacet.class.isAssignableFrom(discoveryClazz)) {
-                    LOG.warn("Discovery class [" + discoveryClass + "] for resource \
type [" + resourceType.getName() +                    warnLog("Discovery class [" + \
                discoveryClass + "] for resource type [" + resourceType.getName()
                         + "] from plugin [" + resourceType.getPlugin() + "] does not \
                implement " + ManualAddFacet.class
                         + " - implementing manual-add in discoverResources() is \
deprecated.");  }
             } catch (Exception e) {
                 success = false;
-                LOG.error("Cannot find discovery class [" + discoveryClass + "] for \
resource type [" +                errorLog("Cannot find discovery class [" + \
                discoveryClass + "] for resource type ["
                     + resourceType.getName() + "] from plugin [" + \
resourceType.getPlugin() + "].");  }
         }
@@ -255,12 +264,12 @@ public class PluginValidator {
                 Class overseerClazz = Class.forName(overseerClass, false, \
                pluginEnvironment.getPluginClassLoader());
                 if (!PluginLifecycleListener.class.isAssignableFrom(overseerClazz)) \
{  success = false;
-                    LOG.error("Plugin Lifecycle Listener class [" + overseerClass + \
"] for plugin [" +                    errorLog("Plugin Lifecycle Listener class [" + \
                overseerClass + "] for plugin ["
                         + resourceType.getPlugin() + "] does not implement " + \
PluginLifecycleListener.class);  }
             } catch (Exception e) {
                 success = false;
-                LOG.error("Cannot find Plugin Lifecycle Listener class [" + \
overseerClass + "] for plugin [" +                errorLog("Cannot find Plugin \
Lifecycle Listener class [" + overseerClass + "] for plugin ["  + \
resourceType.getPlugin() + "].");  }
         }
@@ -279,10 +288,22 @@ public class PluginValidator {
                 pluginFinder.addUrl(jarUrl);
                 LOG.info("Found plugin jar: " + jarUrl);
             } else {
-                LOG.warn("Found a plugin descriptor outside of a jar, skipping: " + \
descriptorUrl); +                warnLog("Found a plugin descriptor outside of a jar, \
skipping: " + descriptorUrl);  }
         }
 
         return pluginFinder;
     }
+
+    private static void errorLog(String errorMessage) {
+        LOG.error(errorMessage);
+        if (interactive)
+            System.err.println(errorMessage);
+    }
+
+    private static void warnLog(String warningMessage) {
+        LOG.warn(warningMessage);
+        if (interactive)
+            System.out.println(warningMessage);
+    }
 }
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/etc/plugin-validator.sh \
b/modules/enterprise/agent/src/etc/plugin-validator.sh new file mode 100755
index 0000000..803ff6c
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/plugin-validator.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+for i in lib/*.jar
+do
+  CP=$CP:$i
+done
+java -cp $CP org.rhq.core.pc.plugin.PluginValidator -i $*


commit 3fd82d43b6e74a1fe9c6a7a4e9c017f4882b725d
Author: Heiko W. Rupp <hwr at redhat.com>
Date:   Wed Jul 25 09:39:09 2012 -0400

    Put the standalone container start scripts directly in the agent distro, to make \
it easier to use them for developers.

diff --git a/etc/standalone-pc/README.txt b/etc/standalone-pc/README.txt
index b940187..c71fda7 100644
--- a/etc/standalone-pc/README.txt
+++ b/etc/standalone-pc/README.txt
@@ -8,6 +8,9 @@ alternatively copy an existing agent directory
 Copy the standalone.(sh|bat) script to this agent directory in bin/ next to the
 existing rhq-agent.(sh|bat) scripts
 
+AS OF RHQ 4.5 the scripts are already installed as standalone-pc.(sh|bat) in the
+bin/ directory of the agent.
+
 If you have no plugins in the plugin/ directory, then copy at least the \
rhq-platform-*.jar  to plugins/ (e.g. from the rhq.ear/rhq-ownloads/rhq-plugins) \
directory of the server.  
diff --git a/etc/standalone-pc/standalone.bat b/etc/standalone-pc/standalone.bat
deleted file mode 100644
index c8da8a3..0000000
--- a/etc/standalone-pc/standalone.bat
+++ /dev/null
@@ -1,9 +0,0 @@
- at echo off
-
-rem uncomment below if you want to enable JPDA debugging
-rem set RHQ_AGENT_ADDITIONAL_JAVA_OPTS=-Xdebug -Xnoagent \
                -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n
-
-setlocal
-set RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
-call rhq-agent.bat %*
-endlocal
diff --git a/etc/standalone-pc/standalone.sh b/etc/standalone-pc/standalone.sh
deleted file mode 100755
index d8ffef6..0000000
--- a/etc/standalone-pc/standalone.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-_DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
-RHQ_AGENT_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
-RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
-export RHQ_AGENT_MAINCLASS
-
-# uncomment below if you want to enable JPDA debugging
-#RHQ_AGENT_ADDITIONAL_JAVA_OPTS="-Xdebug -Xnoagent \
                -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n"
-#export RHQ_AGENT_ADDITIONAL_JAVA_OPTS
-
-$RHQ_AGENT_BIN_DIR_PATH/rhq-agent.sh $*
diff --git a/modules/enterprise/agent/src/etc/standalone-pc.bat \
b/modules/enterprise/agent/src/etc/standalone-pc.bat new file mode 100644
index 0000000..c8da8a3
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/standalone-pc.bat
@@ -0,0 +1,9 @@
+ at echo off
+
+rem uncomment below if you want to enable JPDA debugging
+rem set RHQ_AGENT_ADDITIONAL_JAVA_OPTS=-Xdebug -Xnoagent \
-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n +
+setlocal
+set RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
+call rhq-agent.bat %*
+endlocal
diff --git a/modules/enterprise/agent/src/etc/standalone-pc.sh \
b/modules/enterprise/agent/src/etc/standalone-pc.sh new file mode 100755
index 0000000..d8ffef6
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/standalone-pc.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+_DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
+RHQ_AGENT_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
+RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
+export RHQ_AGENT_MAINCLASS
+
+# uncomment below if you want to enable JPDA debugging
+#RHQ_AGENT_ADDITIONAL_JAVA_OPTS="-Xdebug -Xnoagent \
-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n" +#export \
RHQ_AGENT_ADDITIONAL_JAVA_OPTS +
+$RHQ_AGENT_BIN_DIR_PATH/rhq-agent.sh $*


commit 7da515fa212ddf4903984c1b24092523fc4136a0
Author: Heiko W. Rupp <hwr at redhat.com>
Date:   Wed Jul 25 09:23:49 2012 -0400

    Fix a small typo.

diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java \
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
 index c032481..5ee68f4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
                
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
 @@ -58,7 +58,7 @@ public interface AlertHandlerLocal {
     @GZIP
     @GET
     @Path("/")
-    @ApiOperation(value = "List all alerts", multiValueResponse = true, \
responseClass = "List<AlertRest") +    @ApiOperation(value = "List all alerts", \
multiValueResponse = true, responseClass = "List<AlertRest>")  Response listAlerts(
             @ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") \
                int page,
             @ApiParam(value = "Limit to priority", allowableValues = "High, Medium, \
Low, All") @DefaultValue("All") @QueryParam("prio") String prio,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic