You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2008/10/17 15:19:25 UTC

svn commit: r705605 - in /servicemix/components/bindings/servicemix-snmp/trunk: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/servicemix/ src/main/java/org/apache/servicemix/snmp/ src/main/java/o...

Author: lhein
Date: Fri Oct 17 06:19:24 2008
New Revision: 705605

URL: http://svn.apache.org/viewvc?rev=705605&view=rev
Log:
SM-1635 - initial release of the servicemix-snmp binding component

Added:
    servicemix/components/bindings/servicemix-snmp/trunk/LICENSE
    servicemix/components/bindings/servicemix-snmp/trunk/NOTICE
    servicemix/components/bindings/servicemix-snmp/trunk/pom.xml   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/
    servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt   (with props)
    servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml   (with props)
Modified:
    servicemix/components/bindings/servicemix-snmp/trunk/   (props changed)

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 17 06:19:24 2008
@@ -0,0 +1 @@
+eclipse-classes

Added: servicemix/components/bindings/servicemix-snmp/trunk/LICENSE
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/LICENSE?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/LICENSE (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/LICENSE Fri Oct 17 06:19:24 2008
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

Added: servicemix/components/bindings/servicemix-snmp/trunk/NOTICE
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/NOTICE?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/NOTICE (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/NOTICE Fri Oct 17 06:19:24 2008
@@ -0,0 +1,9 @@
+   =========================================================================
+   ==  NOTICE file for use with the Apache License, Version 2.0,          ==
+   ==  in this case for the Apache ServiceMix distribution.               ==
+   =========================================================================
+
+   This product contains software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+

Added: servicemix/components/bindings/servicemix-snmp/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/pom.xml?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/pom.xml (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/pom.xml Fri Oct 17 06:19:24 2008
@@ -0,0 +1,178 @@
+<?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/maven-v4_0_0.xsd">
+<!--
+
+    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.
+-->
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>components-pom</artifactId>
+    <version>2-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.servicemix</groupId>
+  <artifactId>servicemix-snmp</artifactId>
+  <version>2008.02-SNAPSHOT</version>
+  <packaging>jbi-component</packaging>
+  
+  <name>ServiceMix :: SNMP</name>
+  <description>A SNMP component</description>
+  
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-snmp/trunk</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-snmp/trunk</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/servicemix/components/bindings/servicemix-snmp/trunk</url>
+  </scm>
+
+  <properties>
+    <previous.releases>3.1.2,3.2,3.2.1</previous.releases>
+    <servicemix-version>3.2.1</servicemix-version>
+    <servicemix-shared-version>2008.02-SNAPSHOT</servicemix-shared-version>
+
+    <servicemix.osgi.import>
+        org.apache.servicemix.common,
+        org.apache.servicemix.common.osgi,
+        org.apache.servicemix.executors.impl,
+        org.apache.xbean.spring.context.v2,
+        org.springframework.beans.factory.xml,
+        *
+    </servicemix.osgi.import>
+    <servicemix.osgi.export>
+        org.apache.servicemix.snmp*;version=${project.version},
+        META-INF.services.org.apache.xbean.spring.http.servicemix.apache.org.snmp
+    </servicemix.osgi.export>
+    <servicemix.osgi.bundles>
+        org.springframework.bundle.spring.core,
+        org.springframework.bundle.spring.beans,
+        org.springframework.bundle.spring.context,
+    </servicemix.osgi.bundles>
+  </properties>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-shared</artifactId>
+      <version>${servicemix-shared-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.specs</groupId>
+      <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.snmp4j</groupId>
+      <artifactId>snmp4j</artifactId>
+      <version>1.8.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jta_1.1_spec</artifactId>
+    </dependency>
+    <!-- for unit/integration testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <version>${servicemix-version}</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-jmx</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>target/generated</directory>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <includes>
+          <include>**/*.properties</include>
+          <include>**/*.x*</include>
+          <include>**/*.wsdl</include>
+          <include>**/*.jks</include>
+          <include>**/*.zip</include>
+          <include>**/*.txt</include>
+          <include>**/*.csv</include>
+          <include>**/*.png</include>
+        </includes>
+      </testResource>
+      <testResource>
+        <directory>src/test/java</directory>
+        <includes>
+          <include>**/*.jar</include>
+          <include>**/*.zip</include>
+        </includes>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>jbi-maven-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <type>binding-component</type>
+          <component>org.apache.servicemix.snmp.SnmpComponent</component>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>maven-xbean-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mapping</goal>
+            </goals>
+            <configuration>
+              <namespace>http://servicemix.apache.org/snmp/1.0</namespace>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>always</forkMode>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java Fri Oct 17 06:19:24 2008
@@ -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.servicemix.snmp;
+
+import java.util.List;
+
+import org.apache.servicemix.common.DefaultComponent;
+
+/**
+ * @org.apache.xbean.XBean element="component" description="SNMP Component"
+ * 
+ * @author lhein
+ */
+public class SnmpComponent extends DefaultComponent {
+    private SnmpEndpointType[] endpoints;
+
+    /**
+     * 
+     * @return
+     */
+    public SnmpEndpointType[] getEndpoints() {
+        return endpoints;
+    }
+
+    /**
+     * 
+     * @param endpoints
+     */
+    public void setEndpoints(SnmpEndpointType[] endpoints) {
+        this.endpoints = endpoints;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#getConfiguredEndpoints()
+     */
+    protected List getConfiguredEndpoints() {
+        return asList(getEndpoints());
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
+     */
+    protected Class[] getEndpointClasses() {
+        return new Class[] {SnmpPollingEndpoint.class};
+    }
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpComponent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java Fri Oct 17 06:19:24 2008
@@ -0,0 +1,23 @@
+/*
+ * 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.servicemix.snmp;
+
+/**
+ * @author lhein
+ */
+public interface SnmpEndpointType {
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpEndpointType.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java Fri Oct 17 06:19:24 2008
@@ -0,0 +1,381 @@
+/*
+ * 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.servicemix.snmp;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+import java.util.Vector;
+
+import javax.jbi.management.DeploymentException;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.common.endpoints.PollingEndpoint;
+import org.apache.servicemix.snmp.marshaler.DefaultSnmpMarshaler;
+import org.apache.servicemix.snmp.marshaler.SnmpMarshalerSupport;
+import org.snmp4j.CommunityTarget;
+import org.snmp4j.PDU;
+import org.snmp4j.Snmp;
+import org.snmp4j.TransportMapping;
+import org.snmp4j.event.ResponseEvent;
+import org.snmp4j.event.ResponseListener;
+import org.snmp4j.mp.MPv3;
+import org.snmp4j.mp.SnmpConstants;
+import org.snmp4j.security.SecurityModels;
+import org.snmp4j.security.SecurityProtocols;
+import org.snmp4j.security.USM;
+import org.snmp4j.smi.Address;
+import org.snmp4j.smi.GenericAddress;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.VariableBinding;
+import org.snmp4j.transport.DefaultUdpTransportMapping;
+import org.springframework.core.io.Resource;
+
+/**
+ * This is the polling endpoint for the snmp component.
+ * 
+ * @org.apache.xbean.XBean element="poller"
+ * @author lhein
+ */
+public class SnmpPollingEndpoint extends PollingEndpoint implements SnmpEndpointType, ResponseListener {
+    private static final transient Log LOG = LogFactory.getLog(SnmpPollingEndpoint.class);
+
+    public static final String DEFAULT_COMMUNITY = "public";
+    public static final int DEFAULT_SNMP_VERSION = SnmpConstants.version1;
+    public static final int DEFAULT_SNMP_RETRIES = 2;
+    public static final int DEFAULT_SNMP_TIMEOUT = 1500;
+
+    private List<OID> objectsOfInterest = new Vector<OID>();
+    private Address targetAddress;
+    private TransportMapping transport;
+    private Snmp snmp;
+    private USM usm;
+    private CommunityTarget target;
+    private PDU pdu;
+
+    private String address;
+    private int retries = DEFAULT_SNMP_RETRIES;
+    private int timeout = DEFAULT_SNMP_TIMEOUT;
+    private int snmpVersion = DEFAULT_SNMP_VERSION;
+    private String snmpCommunity = DEFAULT_COMMUNITY;
+    private Resource file; 
+
+    private SnmpMarshalerSupport marshaler = new DefaultSnmpMarshaler();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.endpoints.ConsumerEndpoint#activate()
+     */
+    @Override
+    public synchronized void activate() throws Exception {
+        super.activate();
+
+        this.targetAddress = GenericAddress.parse(this.address);
+        this.transport = new DefaultUdpTransportMapping();
+        this.snmp = new Snmp(transport);
+        this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
+        SecurityModels.getInstance().addSecurityModel(usm);
+
+        // setting up target
+        target = new CommunityTarget();
+        target.setCommunity(new OctetString(this.snmpCommunity));
+        target.setAddress(targetAddress);
+        target.setRetries(this.retries);
+        target.setTimeout(this.timeout);
+        target.setVersion(this.snmpVersion);
+
+        // creating PDU
+        this.pdu = new PDU();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.endpoints.PollingEndpoint#start()
+     */
+    @Override
+    public synchronized void start() throws Exception {
+        super.start();
+
+        // again listen to the transport
+        this.transport.listen();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.endpoints.PollingEndpoint#stop()
+     */
+    @Override
+    public synchronized void stop() throws Exception {
+        // stop listening to the transport
+        if (this.transport.isListening()) {
+            this.transport.close();
+        }
+
+        super.stop();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.endpoints.ConsumerEndpoint#validate()
+     */
+    @Override
+    public void validate() throws DeploymentException {
+        super.validate();
+
+        // check address not null
+        if (this.address == null) {
+            throw new DeploymentException("The address attribute has to be specified!");
+        }
+
+        // check if address is valid
+        try {
+            if (GenericAddress.parse(this.address) == null) {
+                throw new DeploymentException("The specified address " + address + " is not valid!");
+            }
+        } catch (IllegalArgumentException ex) {
+            throw new DeploymentException("The specified address " + address + " is not valid!");
+        }
+        
+        // check if the oid file is valid
+        if (this.file != null) {
+            if (this.file.exists()) {
+                BufferedReader br = null;
+                try {
+                    br = new BufferedReader(new FileReader(this.file.getFile()));
+                    String line = null;
+                    while ((line = br.readLine()) != null) {
+                        this.objectsOfInterest.add(new OID(line.trim()));
+                        LOG.debug(getEndpoint() + ": Added new OID : " + line.trim());
+                    }                    
+                } catch (IOException ex) {
+                    LOG.error("Error reading contents of file " + file.getFilename(), ex);
+                    throw new DeploymentException("The specified file " + file.getFilename() + " can't be read!");
+                } finally {
+                    if (br != null) {
+                        try {
+                            br.close();
+                        } catch (IOException ex) {
+                            LOG.error("Error closing file " + file.getFilename(), ex);
+                        }
+                    }
+                }
+            } else {
+                // the specified resource file is not existing
+                throw new DeploymentException("The specified file " + file.getFilename() + " does not exists!");
+            }
+        } else {
+            // no file defined - poller would have nothing to do
+            throw new DeploymentException("The file attribute has to be specified!");
+        }     
+        
+        // finally check if the oid vector contains values
+        if (this.objectsOfInterest == null || this.objectsOfInterest.size()<=0) {
+            // the poller would be unemployed
+            throw new DeploymentException("There are no OIDs defined to be polled. Check your OID file.");
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.servicemix.common.endpoints.PollingEndpoint#poll()
+     */
+    @Override
+    public void poll() throws Exception {
+        this.pdu.clear();
+        this.pdu.setType(PDU.GET);
+
+        // prepare the request items
+        for (OID oid : objectsOfInterest) {
+            this.pdu.add(new VariableBinding(oid));
+        }
+
+        // send the request
+        snmp.send(pdu, target, null, this);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.servicemix.common.endpoints.AbstractEndpoint#process(javax
+     * .jbi.messaging.MessageExchange)
+     */
+    @Override
+    public void process(MessageExchange exchange) throws Exception {
+        // only DONE and ERROR states will be received here and this
+        // endpoint is not interested in such messages at all
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.snmp4j.event.ResponseListener#onResponse(org.snmp4j.event.ResponseEvent
+     * )
+     */
+    public void onResponse(ResponseEvent event) {
+        // Always cancel async request when response has been received
+        // otherwise a memory leak is created! Not canceling a request
+        // immediately can be useful when sending a request to a broadcast
+        // address.
+        ((Snmp)event.getSource()).cancel(event.getRequest(), this);
+
+        // check for valid response
+        if (event.getRequest() == null || event.getResponse() == null) {
+            // ignore null requests/responses
+            LOG.debug("Received invalid snmp event. Request: " + event.getRequest() + " / Response: "
+                      + event.getResponse());
+            return;
+        }
+
+        // now prepare the message and send it
+        sendSnmpDataMessage(event.getRequest(), event.getResponse());
+    }
+
+    /**
+     * sends the message to the bus
+     * 
+     * @param request the request PDU
+     * @param response the response PDU
+     */
+    private void sendSnmpDataMessage(PDU request, PDU response) {
+        try {
+            // create a inOnly exchange
+            InOnly io = getExchangeFactory().createInOnlyExchange();
+
+            // configure the exchange target
+            configureExchangeTarget(io);
+
+            // create the in message
+            NormalizedMessage inMsg = io.createMessage();
+
+            // now let the marshaller convert the snmp data into a normalized
+            // message to send to jbi bus
+            this.marshaler.convertToJBI(io, inMsg, request, response);
+
+            // then put the in message into the inOnly exchange
+            io.setInMessage(inMsg);
+
+            // and use send to deliver it
+            getChannel().send(io);
+        } catch (MessagingException ex) {
+            LOG.error("Error while trying to send the snmp event to the jbi bus", ex);
+        }
+    }
+
+    /**
+     * * @return Returns the address.
+     */
+    public String getAddress() {
+        return this.address;
+    }
+
+    /**
+     * @param address The address to set.
+     */
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    /**
+     * @return Returns the retries.
+     */
+    public int getRetries() {
+        return this.retries;
+    }
+
+    /**
+     * @param retries The retries to set.
+     */
+    public void setRetries(int retries) {
+        this.retries = retries;
+    }
+
+    /**
+     * @return Returns the timeout.
+     */
+    public int getTimeout() {
+        return this.timeout;
+    }
+
+    /**
+     * @param timeout The timeout to set.
+     */
+    public void setTimeout(int timeout) {
+        this.timeout = timeout;
+    }
+
+    /**
+     * @return Returns the snmpVersion.
+     */
+    public int getSnmpVersion() {
+        return this.snmpVersion;
+    }
+
+    /**
+     * @param snmpVersion The snmpVersion to set.
+     */
+    public void setSnmpVersion(int snmpVersion) {
+        this.snmpVersion = snmpVersion;
+    }
+
+    /**
+     * @return Returns the snmpCommunity.
+     */
+    public String getSnmpCommunity() {
+        return this.snmpCommunity;
+    }
+
+    /**
+     * @param snmpCommunity The snmpCommunity to set.
+     */
+    public void setSnmpCommunity(String snmpCommunity) {
+        this.snmpCommunity = snmpCommunity;
+    }
+
+    /**
+     * @return Returns the marshaler.
+     */
+    public SnmpMarshalerSupport getMarshaler() {
+        return this.marshaler;
+    }
+
+    /**
+     * @param marshaler The marshaler to set.
+     */
+    public void setMarshaler(SnmpMarshalerSupport marshaler) {
+        this.marshaler = marshaler;
+    }
+
+    /** * @return Returns the file.
+     */
+    public Resource getFile() {
+        return this.file;
+    }
+
+    /**
+     * @param file The file to set.
+     */
+    public void setFile(Resource file) {
+        this.file = file;
+    }
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/SnmpPollingEndpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java Fri Oct 17 06:19:24 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.servicemix.snmp.marshaler;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.snmp4j.PDU;
+import org.snmp4j.smi.VariableBinding;
+
+/**
+ * default marshaler implementation
+ * 
+ * @author lhein
+ */
+public class DefaultSnmpMarshaler implements SnmpMarshalerSupport {
+
+    public static final String SNMP_TAG = "snmp";
+    public static final String ENTRY_TAG = "entry";
+    public static final String OID_TAG = "oid";
+    public static final String VALUE_TAG = "value";
+    
+    private static final String SNMP_TAG_OPEN  = '<' + SNMP_TAG + '>';
+    private static final String SNMP_TAG_CLOSE = "</" + SNMP_TAG + '>';
+    private static final String ENTRY_TAG_OPEN  = '<' + ENTRY_TAG + '>';
+    private static final String ENTRY_TAG_CLOSE = "</" + ENTRY_TAG + '>';
+    private static final String OID_TAG_OPEN  = '<' + OID_TAG + '>';
+    private static final String OID_TAG_CLOSE = "</" + OID_TAG + '>';
+    private static final String VALUE_TAG_OPEN  = '<' + VALUE_TAG + '>';
+    private static final String VALUE_TAG_CLOSE = "</" + VALUE_TAG + '>';
+    
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.snmp.marshaler.SnmpMarshalerSupport#convertToJBI(javax.jbi.messaging.MessageExchange, javax.jbi.messaging.NormalizedMessage, org.snmp4j.PDU, org.snmp4j.PDU)
+     */
+    public void convertToJBI(MessageExchange exchange, NormalizedMessage inMsg, PDU request, PDU response)
+        throws MessagingException {
+        // the output buffer
+        StringBuffer sb = new StringBuffer();
+        
+        // prepare the header
+        sb.append(SNMP_TAG_OPEN);
+                
+        // now loop all variables of the response
+        for (Object o : response.getVariableBindings()) {
+            VariableBinding b = (VariableBinding)o;
+
+            sb.append(ENTRY_TAG_OPEN);
+            sb.append(OID_TAG_OPEN);
+            sb.append(b.getOid().toString());
+            sb.append(OID_TAG_CLOSE);
+            sb.append(VALUE_TAG_OPEN);
+            sb.append(b.getVariable().toString());
+            sb.append(VALUE_TAG_CLOSE);
+            sb.append(ENTRY_TAG_CLOSE);
+        }
+        
+        // prepare the footer
+        sb.append(SNMP_TAG_CLOSE);
+        
+        // now put the buffer to the message content
+        inMsg.setContent(new StringSource(sb.toString()));
+    }
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/DefaultSnmpMarshaler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java Fri Oct 17 06:19:24 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.servicemix.snmp.marshaler;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.snmp4j.PDU;
+
+/**
+ * a marshaler interface for snmp component
+ * 
+ * @author lhein 
+ */
+public interface SnmpMarshalerSupport {
+
+    /**
+     * converts a snmp event message into a jbi normalized message 
+     * 
+     * @param exchange                  the exchange object
+     * @param inMsg                     the normalized message to fill
+     * @param request                   the snmp request
+     * @param response                  the snmp response
+     * @throws MessagingException       on errors
+     */
+    void convertToJBI(MessageExchange exchange, NormalizedMessage inMsg, PDU request, PDU response) throws MessagingException;
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/marshaler/SnmpMarshalerSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html Fri Oct 17 06:19:24 2008
@@ -0,0 +1,27 @@
+<!--
+
+    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.
+
+-->
+<html>
+<head>
+</head>
+<body>
+
+Component for SNMP using the SNMP4J API
+
+</body>
+</html>

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/java/org/apache/servicemix/snmp/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml Fri Oct 17 06:19:24 2008
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- The J2EE application client deployer service
+  -->
+<server>
+    <depends>org.servicemix:service=Deployer</depends>
+</server>
+

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/jbi/jboss-service.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml Fri Oct 17 06:19:24 2008
@@ -0,0 +1,74 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd
+  http://www.springframework.org/schema/osgi-compendium
+  http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+    <bean id="servicemix-snmp" class="org.apache.servicemix.snmp.SnmpComponent">
+        <property name="executorFactory" ref="executorFactory" />
+    </bean>
+
+    <bean id="executorFactory" class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl">
+        <property name="defaultConfig">
+            <bean class="org.apache.servicemix.executors.impl.ExecutorConfig">
+                <property name="corePoolSize" value="${threadPoolCorePoolSize}"/>
+                <property name="maximumPoolSize" value="${threadPoolMaximumPoolSize}"/>
+                <property name="queueSize" value="${threadPoolQueueSize}"/>
+            </bean>
+        </property>
+    </bean>
+
+    <bean id="endpoint-tracker" class="org.apache.servicemix.common.osgi.EndpointTracker">
+        <property name="component" ref="servicemix-snmp" />
+    </bean>
+
+    <osgi:list id="endpoints"
+               interface="org.apache.servicemix.common.osgi.EndpointWrapper"
+               cardinality="0..N">
+        <osgi:listener ref="endpoint-tracker" bind-method="register" unbind-method="unregister" />
+    </osgi:list>
+
+    <osgi:service ref="servicemix-snmp" interface="javax.jbi.component.Component">
+        <osgi:service-properties>
+            <entry key="NAME" value="servicemix-snmp" />
+            <entry key="TYPE" value="binding-component" />
+        </osgi:service-properties>
+    </osgi:service>
+
+    <osgix:property-placeholder persistent-id="servicemix-snmp">
+        <osgix:default-properties>
+            <prop key="threadPoolCorePoolSize">8</prop>
+            <prop key="threadPoolMaximumPoolSize">32</prop>
+            <prop key="threadPoolQueueSize">256</prop>
+        </osgix:default-properties>
+    </osgix:property-placeholder>
+
+</beans>

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/main/resources/META-INF/spring/servicemix-snmp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java Fri Oct 17 06:19:24 2008
@@ -0,0 +1,78 @@
+/*
+ * 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.servicemix.snmp;
+
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.tck.Receiver;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author lhein
+ */
+public class SnmpPollingEndpointTest extends SpringTestSupport {
+
+    private static final long TIMEOUT = 30000;
+    
+    public void testDummy() {
+        // just that maven doesn't complain about non-existing tests
+    }
+    
+    /**
+     * sets up an endpoint and waits 30 seconds for a incoming snmp message
+     * @throws Exception
+     */
+    public void xtestPolling() throws Exception {
+        long waitTime = System.currentTimeMillis();
+        
+        Receiver receiver = (Receiver) getBean("receiver");
+        
+        while (!receiver.getMessageList().hasReceivedMessage()) {
+            try {
+                // wait for a polled state
+                Thread.sleep(2000);
+            } catch (InterruptedException ex) {
+                // ignore
+            }
+            
+            if (System.currentTimeMillis() - waitTime > TIMEOUT) {
+                // don't block the build too long
+                break;
+            }
+        }
+
+        if (receiver.getMessageList().getMessageCount()>0) {
+            NormalizedMessage msg = (NormalizedMessage)receiver.getMessageList().getMessages().get(0);
+            // now check if valid
+            SourceTransformer st = new SourceTransformer();
+            try {
+                st.toDOMDocument(msg);
+            } catch (Exception e) {
+                fail("Unable to parse the snmp poll result.\n" + st.contentToString(msg));
+            }            
+        } else {
+            fail("There wasn'a a response for " + TIMEOUT + " millis...");
+        }            
+    }
+
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        return new ClassPathXmlApplicationContext("spring-polling.xml");
+    }
+}

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/test/java/org/apache/servicemix/snmp/SnmpPollingEndpointTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties Fri Oct 17 06:19:24 2008
@@ -0,0 +1,42 @@
+# 
+# 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.
+#
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=DEBUG, out
+
+log4j.logger.org.springframework=INFO
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.activemq.store.journal=INFO
+log4j.logger.org.activeio.journal=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j-tests.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties Fri Oct 17 06:19:24 2008
@@ -0,0 +1,41 @@
+# 
+# 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.
+#
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, stdout
+
+log4j.logger.org.springframework=INFO
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.apache.servicemix=DEBUG
+
+# CONSOLE appender 
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/servicemix-test.log
+log4j.appender.out.append=true

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt Fri Oct 17 06:19:24 2008
@@ -0,0 +1,4 @@
+1.3.6.1.2.1.1.3.0
+1.3.6.1.2.1.25.3.2.1.5.1
+1.3.6.1.2.1.25.3.5.1.1.1
+1.3.6.1.2.1.43.5.1.1.11.1

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/oids.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml?rev=705605&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml (added)
+++ servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml Fri Oct 17 06:19:24 2008
@@ -0,0 +1,52 @@
+<?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.
+
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0" 
+	   xmlns:snmp="http://servicemix.apache.org/snmp/1.0"
+       xmlns:test="urn:test">
+
+  <sm:container id="jbi" embedded="true" createMBeanServer="false">
+    
+    <sm:activationSpecs>
+
+      <sm:activationSpec id="poller">
+      	<sm:component>
+            <snmp:component>
+            	<snmp:endpoints>
+                <snmp:poller service="test:poller"
+                             endpoint="poller"
+                             targetService="test:receiver"
+                             address="udp:127.0.0.1/161"
+                             file="classpath:oids.txt"
+                             period="1000" />
+            	</snmp:endpoints>
+            </snmp:component>
+        </sm:component>
+      </sm:activationSpec>
+      
+      <sm:activationSpec id="receiver" service="test:receiver">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+      
+    </sm:activationSpecs>
+  </sm:container>
+
+</beans>

Propchange: servicemix/components/bindings/servicemix-snmp/trunk/src/test/resources/spring-polling.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain