Skip to content

Commit

Permalink
Add Ganglia component
Browse files Browse the repository at this point in the history
  • Loading branch information
dpocock committed Feb 19, 2015
1 parent c7cb9d3 commit 234480d
Show file tree
Hide file tree
Showing 14 changed files with 911 additions and 1 deletion.
1 change: 1 addition & 0 deletions apache-camel/src/main/descriptors/common-bin.xml
Expand Up @@ -73,6 +73,7 @@
<include>org.apache.camel:camel-freemarker</include>
<include>org.apache.camel:camel-ftp</include>
<include>org.apache.camel:camel-gae</include>
<include>org.apache.camel:camel-ganglia</include>
<include>org.apache.camel:camel-geocoder</include>
<include>org.apache.camel:camel-github</include>
<include>org.apache.camel:camel-google-calendar</include>
Expand Down
85 changes: 85 additions & 0 deletions components/camel-ganglia/pom.xml
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
<version>2.15-SNAPSHOT</version>
</parent>

<artifactId>camel-ganglia</artifactId>
<packaging>bundle</packaging>
<name>Camel :: Ganglia</name>
<description>Camel Ganglia support</description>

<properties>
<camel.osgi.export.pkg>
org.apache.camel.component.ganglia.*
</camel.osgi.export.pkg>
<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=ganglia</camel.osgi.export.service>
</properties>

<repositories>
<repository>
<id>jboss.fs</id>
<name>JBoss FuseSource Public Release Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/fs-public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>

<dependencies>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>

<dependency>
<groupId>info.ganglia.gmetric4j</groupId>
<artifactId>gmetric4j</artifactId>
<version>${gmetric4j-version}</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,62 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.ganglia;

import java.net.URI;
import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.ObjectHelper;

/**
* @version
*/
public class GangliaComponent extends UriEndpointComponent {

private GangliaConfiguration configuration;

public GangliaComponent() {
super(GangliaEndpoint.class);
configuration = new GangliaConfiguration();
}

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
URI url = new URI(uri);

// must use copy as each endpoint can have different options
ObjectHelper.notNull(configuration, "configuration");
GangliaConfiguration config = configuration.copy();
config.configure(url);
setProperties(config, parameters);

GangliaEndpoint endpoint = new GangliaEndpoint(uri, this);
endpoint.setConfiguration(config);
setProperties(endpoint, parameters);

return endpoint;
}

public GangliaConfiguration getConfiguration() {
return configuration;
}

public void setConfiguration(GangliaConfiguration configuration) {
this.configuration = configuration;
}
}

0 comments on commit 234480d

Please sign in to comment.