Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 597612 Details for
Bug 741682
RfE: Allow to deploy descriptor-only plugins
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Possible patch
BZ_74168_-_allow_to_deploy_descriptor-only__agent__plugins_.patch (text/plain), 11.54 KB, created by
Heiko W. Rupp
on 2012-07-11 15:49:03 UTC
(
hide
)
Description:
Possible patch
Filename:
MIME Type:
Creator:
Heiko W. Rupp
Created:
2012-07-11 15:49:03 UTC
Size:
11.54 KB
patch
obsolete
>Index: modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>ISO-8859-1 >=================================================================== >--- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java (revision db20267b46527836cbe22b9a2138a4b70ee26885) >+++ modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java (revision ) >@@ -127,7 +127,7 @@ > * This just marks the plugin as being needed to be registered. Caller > * must ensure that {@link #registerPlugins()} is called afterwards > * to fully process the detected plugin. >- * >+ * > * @param deploymentInfo information on the newly detected plugin > */ > public void pluginDetected(DeploymentInfo deploymentInfo) throws Exception { >@@ -164,14 +164,14 @@ > > /** > * Determines if this is a plugin we should process. >- * >+ * > * @param di the deployment information of the detected file (which is probably an agent plugin file) > * @return <code>true</code> if the deployment info represents an agent plugin file > */ > private boolean accepts(DeploymentInfo di) { > String urlString = di.url.getFile(); > >- if (!urlString.endsWith(".jar")) { >+ if (!urlString.endsWith(".jar") && !(urlString.endsWith("-rhq-plugin.xml"))) { > return false; > } > >@@ -187,7 +187,7 @@ > > /** > * Registers newly detected plugins and their types. >- * >+ * > * Only call this method when {@link #isReady} is true. This is a no-op if we are not ready. > */ > public void registerPlugins() { >@@ -260,7 +260,8 @@ > */ > private String preprocessPlugin(DeploymentInfo deploymentInfo) throws Exception { > File pluginFile = new File(deploymentInfo.url.getFile()); >+ if (deploymentInfo.url.getFile().endsWith(".jar")) >- ensureDeploymentIsValid(pluginFile); >+ ensureDeploymentIsValid(pluginFile); > PluginDescriptor descriptor = getPluginDescriptor(deploymentInfo); > String pluginName = descriptor.getName(); > boolean initialDeploy = !this.deploymentInfos.containsKey(pluginName); >@@ -557,7 +558,7 @@ > * This returns the name of the plugin file that is represented by the given > * deployment info. This returns just the name of the plugin file, without > * any parent directory information. >- * >+ * > * @param di the deployment info of the plugin file that is deployed > * @return the name of the plugin file > */ >\ No newline at end of file >Index: modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>ISO-8859-1 >=================================================================== >--- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java (revision db20267b46527836cbe22b9a2138a4b70ee26885) >+++ modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java (revision ) >@@ -136,7 +136,7 @@ > /** > * Scans the plugin directory and updates our cache of known plugin files. > * This will purge any old plugins that are deemed obsolete. >- * >+ * > * @return a list of files that appear to be new or updated and should be deployed > */ > List<File> agentPluginScanFilesystem() { >@@ -145,7 +145,7 @@ > // get the current list of plugins deployed on the filesystem > File[] pluginJars = this.agentPluginDeployer.getPluginDir().listFiles(new FilenameFilter() { > public boolean accept(File dir, String name) { >- return name.endsWith(".jar"); >+ return name.endsWith(".jar") || name.endsWith("-rhq-plugin.xml"); > } > }); > >@@ -384,10 +384,10 @@ > log.debug(message); > } > } else { >- //inform on the info level so that it's clear from the logs that the new file >+ //inform on the info level so that it's clear from the logs that the new file > //is going to be used. > log.info(message); >- } >+ } > } > } else { > log.info("Found agent plugin in the DB that we do not yet have: " + name); >Index: modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/AgentPluginDescriptorUtil.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>ISO-8859-1 >=================================================================== >--- modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/AgentPluginDescriptorUtil.java (revision db20267b46527836cbe22b9a2138a4b70ee26885) >+++ modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/AgentPluginDescriptorUtil.java (revision ) >@@ -303,29 +303,50 @@ > > testPluginJarIsReadable(pluginJarFileUrl); > >- JarInputStream jis = null; >- JarEntry descriptorEntry = null; > ValidationEventCollector validationEventCollector = new ValidationEventCollector(); >+ InputStream jis = null; >+ boolean isPluginJar = pluginJarFileUrl.getFile().endsWith(".jar"); >+ boolean isJarlessPlugin = pluginJarFileUrl.getFile().endsWith("-rhq-plugin.xml"); > try { >+ if (isPluginJar) { >+ JarEntry descriptorEntry = null; >+ >+ > jis = new JarInputStream(pluginJarFileUrl.openStream()); >- JarEntry nextEntry = jis.getNextJarEntry(); >+ JarEntry nextEntry = ((JarInputStream)jis).getNextJarEntry(); > while (nextEntry != null && descriptorEntry == null) { > if (PLUGIN_DESCRIPTOR_PATH.equals(nextEntry.getName())) { > descriptorEntry = nextEntry; > } else { >- jis.closeEntry(); >- nextEntry = jis.getNextJarEntry(); >+ ((JarInputStream)jis).closeEntry(); >+ nextEntry = ((JarInputStream)jis).getNextJarEntry(); > } > } >- >- if (descriptorEntry == null) { >- throw new Exception("The plugin descriptor does not exist"); >- } >+ if (descriptorEntry == null) { >+ throw new Exception("The plugin descriptor does not exist"); >+ } > >- return parsePluginDescriptor(jis, validationEventCollector); >+ return parsePluginDescriptor(jis, validationEventCollector); >+ >+ } else >+ if (isJarlessPlugin) { >+ jis = pluginJarFileUrl.openStream(); >+ return parsePluginDescriptor(jis, validationEventCollector); >+ } >+ else { >+ throw new Exception("Unknown type of file " + pluginJarFileUrl.getFile()); >+ } > } catch (Exception e) { >- throw new PluginContainerException("Could not successfully parse the plugin descriptor [" >- + PLUGIN_DESCRIPTOR_PATH + "] found in plugin jar at [" + pluginJarFileUrl + "].", >+ String msg; >+ if (isPluginJar) { >+ msg = "Could not successfully parse the plugin descriptor [" >+ + PLUGIN_DESCRIPTOR_PATH + "] found in plugin jar at [" + pluginJarFileUrl + "]."; >+ } >+ else { >+ msg = "Could not successfully parse the plugin descriptor at [ " + pluginJarFileUrl + "]."; >+ } >+ >+ throw new PluginContainerException(msg, > new WrappedRemotingException(e)); > } finally { > if (jis != null) { >Index: modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>ISO-8859-1 >=================================================================== >--- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java (revision db20267b46527836cbe22b9a2138a4b70ee26885) >+++ modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java (revision ) >@@ -187,7 +187,7 @@ > } > > /** >- * Take the plugins placed in the user directory, and copy them to their apprpriate places >+ * Take the plugins placed in the user directory, and copy them to their appropriate places > * in the server. > */ > private void scanUserDirectory() { >@@ -203,7 +203,7 @@ > > for (File file : listFiles) { > File destinationDirectory; >- if (file.getName().endsWith(".jar")) { >+ if (file.getName().endsWith(".jar") || file.getName().endsWith("-rhq-plugin.xml")) { > try { > if (null == AgentPluginDescriptorUtil.loadPluginDescriptorFromUrl(file.toURI().toURL())) { > throw new NullPointerException("no xml descriptor found in jar"); >@@ -244,7 +244,12 @@ > log.error("Failed to set mtime to [" + new Date(file.lastModified()) + "] on file [" > + realPluginFile + "]."); > } >- log.info("Found plugin jar at [" + file.getAbsolutePath() + "] and placed it at [" >+ String tmp; >+ if (file.getName().endsWith("jar")) >+ tmp = "jar"; >+ else >+ tmp = "descriptor"; >+ log.info("Found plugin " + tmp + " at [" + file.getAbsolutePath() + "] and placed it at [" > + realPluginFile.getAbsolutePath() + "]"); > } > } >Index: modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>ISO-8859-1 >=================================================================== >--- modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java (revision db20267b46527836cbe22b9a2138a4b70ee26885) >+++ modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java (revision ) >@@ -278,9 +278,9 @@ > * of streaming the plugin, the download will fail. When this happens, this method will simply > * attempt to download the plugin again (this time, hopefully, we will remain connected to the > * new server and the download will succeed). >- * >+ * > * @param plugin the plugin to download >- * >+ * > * @throws Exception if, despite our best efforts, the plugin could not be downloaded > */ > private void downloadPluginWithRetries(Plugin plugin) throws Exception { >@@ -398,7 +398,7 @@ > > for (File plugin_file : plugin_files) { > String plugin_filename = plugin_file.getName(); >- if (plugin_filename.endsWith(".jar")) { >+ if (plugin_filename.endsWith(".jar") || plugin_filename.endsWith("-rhq-plugin.xml")) { > Plugin cur_plugin = new Plugin(plugin_filename, plugin_filename); > cur_plugin.setMD5(MessageDigestGenerator.getDigestString(plugin_file)); > plugins.put(plugin_filename, cur_plugin); >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 741682
:
597612
|
597664