Skip to content

Instantly share code, notes, and snippets.

@jsanda
Created November 18, 2010 14:35
Show Gist options
  • Save jsanda/705047 to your computer and use it in GitHub Desktop.
Save jsanda/705047 to your computer and use it in GitHub Desktop.
(ns rhq.plugin
(:require [rhq.config :as config])
(:import [org.rhq.core.pluginapi.inventory
ResourceDiscoveryComponent ResourceDiscoveryContext ClassLoaderFacet
DiscoveredResourceDetails ResourceComponent ResourceContext]
[org.rhq.core.domain.measurement AvailabilityType])
(:gen-class
:name rhq.plugin.PluginComponent
:implements [org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent
org.rhq.core.pluginapi.inventory.ResourceComponent]))
(defn update-classpath []
(add-classpath
(.toURL (java.io.File. (System/getProperty "clojure.src.dir")))))
;(def get-plugin-ns [plugin-config] nil)
(defn load-plugin [] (require (symbol "rhq.clj.test" :reload-all)))
(defn ^java.util.Set -discoverResources [this ^ResourceDiscoveryContext context]
;(update-classpath)
(let [plugin (alias 'plugin (load-plugin))]
('plugin/discover)
(.println System/out "DISCOVER")
(set [])))
(defn ^AvailabilityType -getAvailability [this] nil)
(defn -start [this ^ResourceContext context]
(.println System/out "STARTING PLUGIN")
(print "STARTING PLUGIN"))
(defn -stop [this] nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment