This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static io.netty.channel.ChannelHandler.Sharable; | |
| import io.netty.channel.ChannelHandlerContext; | |
| import io.netty.channel.SimpleChannelInboundHandler; | |
| import org.rhq.metrics.netty.collectd.events.Event; | |
| @Sharable | |
| public class MyCollectdEventHandler extends SimpleChannelInboundHandler<Event> { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| group = new NioEventLoopGroup(); | |
| bootstrap = new Bootstrap(); | |
| bootstrap.group(group).channel(NioDatagramChannel.class).handler(new ChannelInitializer<Channel>() { | |
| @Override | |
| protected void initChannel(Channel channel) throws Exception { | |
| ChannelPipeline pipeline = channel.pipeline(); | |
| pipeline.addLast(new CollectdPartsDecoder()); // Add CollectdPartsDecoder first | |
| pipeline.addLast(new CollectdEventsDecoder()); // Then CollectdEventsDecoder | |
| pipeline.addLast(new MyCollectdEventHandler()); // Consume events in your own handler | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.rhq.metrics.netty</groupId> | |
| <artifactId>netty-collectd</artifactId> | |
| <version>0.1-SNAPSHOT</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <plugin | |
| name="MyappMBeansPlugin" | |
| displayName="Myapp MBeans Plugin" | |
| package="com.myapp.services.plugin" | |
| xmlns="urn:xmlns:rhq-plugin" | |
| xmlns:c="urn:xmlns:rhq-configuration"> | |
| <depends plugin="JBossAS7" useClasses="true"/> | |
| <service name="Myapp Services" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>mbeans-on-as7-plugin</groupId> | |
| <artifactId>mbeans-on-as7-plugin</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <packaging>rhq-agent-plugin</packaging> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <depends plugin="JBossAS7" useClasses="true"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A simple function to create a new bundle version from a zip file containing | |
| * the bundle. | |
| * | |
| * @param pathToBundleZipFile the path to the bundle on the local file system | |
| * | |
| * @return an instance of BundleVersion class describing what's been created on | |
| * the RHQ server. | |
| */ | |
| function createBundleVersion(pathToBundleZipFile) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String uploadContent(String filename) { | |
| if (remoteClient == null) { | |
| throw new IllegalStateException("The uploadContent method requires a connection to the RHQ server."); | |
| } | |
| ContentUploader contentUploader = new ContentUploader(remoteClient.getProxy(ContentManagerRemote.class)); | |
| return contentUploader.upload(filename); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Creates a temporary file for fragmented content upload. | |
| * | |
| * @return a temporary file handle | |
| */ | |
| String createTemporaryContentHandle(); | |
| /** | |
| * Saves the fragment in the temporary file denoted by <code>temporaryContentHandle</code>. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var contentHandle = scriptUtil.uploadContent(pathName); | |
| ResourceFactoryManager.createPackageBackedResourceViaContentHandle( | |
| parentResourceId, | |
| applicationTypeId, | |
| packageName, | |
| pluginConfiguration, | |
| packageName, | |
| version, | |
| null, // architectureId |