servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lh...@apache.org
Subject svn commit: r634253 [1/3] - in /servicemix/smx3/trunk: ./ archetypes/ archetypes/servicemix-archetypes-itests/ archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/ archetypes/servicemix-mail-service-unit/ archetypes/serv...
Date Thu, 06 Mar 2008 12:58:14 GMT
Author: lhein
Date: Thu Mar  6 04:58:09 2008
New Revision: 634253

URL: http://svn.apache.org/viewvc?rev=634253&view=rev
Log:
implemented the new jbi component servicemix-mail
(see SM-1258)

Added:
    servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/MailServiceUnitTest.java
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/pom.xml
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/archetype.xml
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/pom.xml
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/
    servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/pom.xml
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailBootstrap.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailComponent.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailEndpointType.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/package.html
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/security/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/security/CustomSSLSocketFactory.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/security/DummyTrustManager.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/utils/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/utils/MailConnectionConfiguration.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/utils/MailUtils.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/jbi/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/jbi/jboss-service.xml
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/resources/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/resources/
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/resources/smx-logo.png   (with props)
Modified:
    servicemix/smx3/trunk/   (props changed)
    servicemix/smx3/trunk/archetypes/pom.xml
    servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/pom.xml
    servicemix/smx3/trunk/deployables/bindingcomponents/pom.xml
    servicemix/smx3/trunk/distributions/apache-servicemix/pom.xml
    servicemix/smx3/trunk/distributions/apache-servicemix/src/main/release/bin/smx-arch
    servicemix/smx3/trunk/distributions/apache-servicemix/src/main/release/bin/smx-arch.bat
    servicemix/smx3/trunk/pom.xml

Propchange: servicemix/smx3/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Mar  6 04:58:09 2008
@@ -9,3 +9,4 @@
 *.ipr
 *.iml
 velocity.log
+.project

Modified: servicemix/smx3/trunk/archetypes/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/pom.xml?rev=634253&r1=634252&r2=634253&view=diff
==============================================================================
--- servicemix/smx3/trunk/archetypes/pom.xml (original)
+++ servicemix/smx3/trunk/archetypes/pom.xml Thu Mar  6 04:58:09 2008
@@ -60,6 +60,7 @@
         <module>servicemix-cxf-bc-service-unit</module>
         <module>servicemix-cxf-se-service-unit</module>
         <module>servicemix-osworkflow-service-unit</module>
+        <module>servicemix-mail-service-unit</module>
     </modules>
 
     <build>

Modified: servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/pom.xml?rev=634253&r1=634252&r2=634253&view=diff
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/pom.xml (original)
+++ servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/pom.xml Thu Mar  6 04:58:09 2008
@@ -108,6 +108,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.servicemix.tooling</groupId>
+      <artifactId>servicemix-mail-service-unit</artifactId>
+      <version>${servicemix-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.tooling</groupId>
       <artifactId>servicemix-ode-service-unit</artifactId>
       <version>${servicemix-version}</version>
     </dependency>
@@ -220,6 +225,11 @@
     <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-lwcontainer</artifactId>
+      <version>${servicemix-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-mail</artifactId>
       <version>${servicemix-version}</version>
     </dependency>
     <dependency>

Added: servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/MailServiceUnitTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/MailServiceUnitTest.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/MailServiceUnitTest.java (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-archetypes-itests/src/test/java/org/apache/servicemix/tooling/MailServiceUnitTest.java Thu Mar  6 04:58:09 2008
@@ -0,0 +1,25 @@
+/*
+ * 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.tooling;
+
+public class MailServiceUnitTest extends AbstractArchetypeTest {
+
+    public void testMailServiceUnit() throws Exception {
+        testServiceMixArchetype("mail-service-unit");
+    }
+
+}

Added: servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/pom.xml?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/pom.xml (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/pom.xml Thu Mar  6 04:58:09 2008
@@ -0,0 +1,33 @@
+<?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.servicemix</groupId>
+    <artifactId>archetypes</artifactId>
+    <version>3.3-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.servicemix.tooling</groupId>
+  <artifactId>servicemix-mail-service-unit</artifactId>
+  <name>ServiceMix :: Archetypes :: MailServiceUnit</name>
+
+</project>

Added: servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/archetype.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/archetype.xml?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/archetype.xml (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/META-INF/maven/archetype.xml Thu Mar  6 04:58:09 2008
@@ -0,0 +1,25 @@
+<?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.
+
+-->
+<archetype>
+  <id>servicemix-mail-service-unit</id>
+  <resources>
+    <resource>src/main/resources/xbean.xml</resource>   
+  </resources>  
+</archetype>

Added: servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/pom.xml?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/pom.xml (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/pom.xml Thu Mar  6 04:58:09 2008
@@ -0,0 +1,79 @@
+<?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>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <packaging>jbi-service-unit</packaging>
+  <version>${version}</version>
+  <name>A custom project</name>
+  <url>http://www.myorganization.org</url>
+  @{repositories}
+  <properties>
+    <servicemix-version>@{servicemix-version}</servicemix-version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <version>${servicemix-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-mail</artifactId>
+      <version>${servicemix-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+      <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>jbi-maven-plugin</artifactId>
+        <version>${servicemix-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <type>service-unit</type>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml Thu Mar  6 04:58:09 2008
@@ -0,0 +1,38 @@
+<?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:mail="http://servicemix.apache.org/mail/1.0"
+       xmlns:replaceMe="http://servicemix.apache.org/replaceMe">
+       
+    <mail:poller service="replaceMe:mailService" 
+                 endpoint="pollerEndpoint" 
+                 targetService="replaceMe:mailProcessingService"
+                 period="10000"
+                 debugMode="false"
+                 connection="imap://username@host/INBOX?password=mypass"
+                 deleteProcessedMessages="false"
+                 processOnlyUnseenMessages="true" /> 
+
+    <mail:sender service="replaceMe:mailService" 
+                 endpoint="senderEndpoint"
+                 sender="no-reply@mycompany.com"
+                 debugMode="false" 
+                 connection="smtp://username@host?password=mypass" />                 
+</beans>

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/pom.xml?rev=634253&r1=634252&r2=634253&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/pom.xml (original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/pom.xml Thu Mar  6 04:58:09 2008
@@ -39,6 +39,7 @@
     <module>servicemix-ftp</module>
     <module>servicemix-http</module>
     <module>servicemix-jms</module>
+    <module>servicemix-mail</module>
     <module>servicemix-truezip</module>
     <module>servicemix-xmpp</module>
   </modules>

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/pom.xml?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/pom.xml (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/pom.xml Thu Mar  6 04:58:09 2008
@@ -0,0 +1,144 @@
+<?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.
+-->
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>bindingcomponents</artifactId>
+    <version>3.3-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.servicemix</groupId>
+  <artifactId>servicemix-mail</artifactId>
+  <packaging>jbi-component</packaging>
+  <name>ServiceMix :: Mail</name>
+  <description>A Mail component</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-shared</artifactId>
+      <version>${servicemix-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <version>${servicemix-version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.mail</groupId>
+      <artifactId>mail</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>2.3</version>
+      <scope>test</scope>
+    </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>
+        <version>${servicemix-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <type>binding-component</type>       
+          <component>org.apache.servicemix.mail.MailComponent</component>
+          <bootstrap>org.apache.servicemix.mail.MailBootstrap</bootstrap>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>maven-xbean-plugin</artifactId>
+        <version>${xbean-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>mapping</goal>
+            </goals>
+            <configuration>
+              <namespace>http://servicemix.apache.org/mail/1.0</namespace>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>always</forkMode>
+          <workingDirectory>${basedir}</workingDirectory>
+          <includes>
+            <include>**/*Test.*</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailBootstrap.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailBootstrap.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailBootstrap.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailBootstrap.java Thu Mar  6 04:58:09 2008
@@ -0,0 +1,174 @@
+/*
+ * 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.mail;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Bootstrap;
+import javax.jbi.component.InstallationContext;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * Bootstrap class. This class is useful to perform tasks at installation /
+ * uninstallation time
+ * 
+ * @author lhein
+ */
+public class MailBootstrap implements Bootstrap {
+    protected InstallationContext context;
+    protected ObjectName mbeanName;
+
+    /**
+     * 
+     */
+    public MailBootstrap() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see javax.jbi.component.Bootstrap#getExtensionMBeanName()
+     */
+    public ObjectName getExtensionMBeanName() {
+        return mbeanName;
+    }
+
+    /**
+     * 
+     */
+    protected Object getExtensionMBean() throws Exception {
+        return null;
+    }
+
+    /**
+     * 
+     * @return
+     * @throws Exception
+     */
+    protected ObjectName createExtensionMBeanName() throws Exception {
+        return this.context.getContext().getMBeanNames().createCustomComponentMBeanName("bootstrap");
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.jbi.component.Bootstrap#init(javax.jbi.component.InstallationContext)
+     */
+    public void init(InstallationContext installContext) throws JBIException {
+        try {
+            this.context = installContext;
+            doInit();
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling init", e);
+        }
+    }
+
+    /**
+     * 
+     * @throws Exception
+     */
+    protected void doInit() throws Exception {
+        Object mbean = getExtensionMBean();
+        if (mbean != null) {
+            this.mbeanName = createExtensionMBeanName();
+            MBeanServer server = this.context.getContext().getMBeanServer();
+            if (server == null) {
+                throw new JBIException("null mBeanServer");
+            }
+            if (server.isRegistered(this.mbeanName)) {
+                server.unregisterMBean(this.mbeanName);
+            }
+            server.registerMBean(mbean, this.mbeanName);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.jbi.component.Bootstrap#cleanUp()
+     */
+    public void cleanUp() throws JBIException {
+        try {
+            doCleanUp();
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling cleanUp", e);
+        }
+    }
+
+    /**
+     * 
+     * @throws Exception
+     */
+    protected void doCleanUp() throws Exception {
+        if (this.mbeanName != null) {
+            MBeanServer server = this.context.getContext().getMBeanServer();
+            if (server == null) {
+                throw new JBIException("null mBeanServer");
+            }
+            if (server.isRegistered(this.mbeanName)) {
+                server.unregisterMBean(this.mbeanName);
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.jbi.component.Bootstrap#onInstall()
+     */
+    public void onInstall() throws JBIException {
+        try {
+            doOnInstall();
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling onInstall", e);
+        }
+    }
+
+    /**
+     * 
+     * @throws Exception
+     */
+    protected void doOnInstall() throws Exception {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.jbi.component.Bootstrap#onUninstall()
+     */
+    public void onUninstall() throws JBIException {
+        try {
+            doOnUninstall();
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling onUninstall", e);
+        }
+    }
+
+    /**
+     * 
+     * @throws Exception
+     */
+    protected void doOnUninstall() throws Exception {
+    }
+}

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailComponent.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailComponent.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailComponent.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailComponent.java Thu Mar  6 04:58:09 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.mail;
+
+import java.util.List;
+
+import org.apache.servicemix.common.DefaultComponent;
+
+/**
+ * @org.apache.xbean.XBean element="component" description="Mail Component"
+ * 
+ * @author lhein
+ */
+public class MailComponent extends DefaultComponent {
+    private MailEndpointType[] endpoints;
+
+    /**
+     * 
+     * @return
+     */
+    public MailEndpointType[] getEndpoints() {
+        return endpoints;
+    }
+
+    /**
+     * 
+     * @param endpoints
+     */
+    public void setEndpoints(MailEndpointType[] 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[] {MailPollerEndpoint.class, MailSenderEndpoint.class};
+    }
+}

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailEndpointType.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailEndpointType.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailEndpointType.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailEndpointType.java Thu Mar  6 04:58:09 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.mail;
+
+/**
+ * @author lhein
+ */
+public interface MailEndpointType {
+}

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java Thu Mar  6 04:58:09 2008
@@ -0,0 +1,303 @@
+/*
+ * 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.mail;
+
+import java.util.Properties;
+
+import javax.jbi.JBIException;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.ParseException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.servicemix.common.endpoints.PollingEndpoint;
+
+import org.apache.servicemix.mail.marshaler.AbstractMailMarshaler;
+import org.apache.servicemix.mail.marshaler.DefaultMailMarshaler;
+import org.apache.servicemix.mail.utils.MailConnectionConfiguration;
+import org.apache.servicemix.mail.utils.MailUtils;
+
+/**
+ * This is the polling endpoint for the mail component.
+ * 
+ * @org.apache.xbean.XBean element="poller"
+ * @author lhein
+ */
+public class MailPollerEndpoint extends PollingEndpoint implements MailEndpointType {
+    private static final transient Log LOG = LogFactory.getLog(MailPollerEndpoint.class);
+
+    private AbstractMailMarshaler marshaler = new DefaultMailMarshaler();
+    private String customTrustManagers;
+    private MailConnectionConfiguration config;
+
+    private String connection;
+
+    private int maxFetchSize = 5;
+
+    private boolean processOnlyUnseenMessages;
+    private boolean deleteProcessedMessages;
+    private boolean debugMode;
+
+    /**
+     * default constructor
+     */
+    public MailPollerEndpoint() {
+        this.processOnlyUnseenMessages = true;
+        this.deleteProcessedMessages = false;
+        this.debugMode = false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.endpoints.ConsumerEndpoint#getLocationURI()
+     */
+    @Override
+    public String getLocationURI() {
+        // return a URI that unique identify this endpoint
+        return getService() + "#" + getEndpoint();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.ExchangeProcessor#process(javax.jbi.messaging.MessageExchange)
+     */
+    public void process(MessageExchange arg0) throws Exception {
+        // Do nothing. In our case, this method should never be called
+        // as we only send synchronous InOnly exchange
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.components.util.PollingComponentSupport#poll()
+     */
+    public void poll() throws Exception {
+        LOG.debug("Polling mailfolder " + config.getFolderName() + " at host " + config.getHost() + "...");
+
+        Store store = null;
+        Folder folder = null;
+        Session session = null;
+        try {
+            Properties props = MailUtils.getPropertiesForProtocol(this.config, this.customTrustManagers);
+            props.put("mail.debug", isDebugMode() ? "true" : "false");
+
+            // Get session
+            session = Session.getInstance(props, config.getAuthenticator());
+
+            // debug the session
+            session.setDebug(this.debugMode);
+
+            store = session.getStore(config.getProtocol());
+            store.connect(config.getHost(), config.getUsername(), config.getPassword());
+            folder = store.getFolder(config.getFolderName());
+            if (folder == null || !folder.exists()) {
+                throw new Exception("Folder not found or invalid: " + config.getFolderName());
+            }
+            folder.open(Folder.READ_WRITE);
+
+            int msgCount = 0;
+            // check for max fetch size
+            if (this.maxFetchSize == -1) {
+                // -1 means no restrictions at all - so poll all messages
+                msgCount = folder.getMessageCount();
+            } else {
+                // poll only the set max fetch size
+                msgCount = Math.min(this.maxFetchSize, folder.getMessageCount());
+            }
+
+            for (int i = 1; i <= msgCount; i++) {
+                // get the message
+                MimeMessage mailMsg = (MimeMessage)folder.getMessage(i);
+
+                // check if the message may be processed
+                if (isProcessOnlyUnseenMessages() && mailMsg.isSet(Flags.Flag.SEEN)) {
+                    // this message should not be processed because
+                    // the configuration says to process only unseen messages
+                    LOG.debug("Skipped seen mail: " + mailMsg.getSubject());
+                    continue;
+                }
+
+                // create a inOnly exchange
+                InOnly io = getExchangeFactory().createInOnlyExchange();
+
+                // configure the exchange target
+                configureExchangeTarget(io);
+
+                // create the in message
+                NormalizedMessage normalizedMessage = io.createMessage();
+
+                // now let the marshaller convert the mail into a normalized
+                // message to send to jbi bus
+                marshaler.convertMailToJBI(io, normalizedMessage, mailMsg);
+
+                // then put the in message into the inOnly exchange
+                io.setInMessage(normalizedMessage);
+
+                // and use sendSync to deliver it
+                sendSync(io);
+
+                // now check if delivery succeeded or went wrong
+                if (io.getStatus() == ExchangeStatus.ERROR) {
+                    Exception e = io.getError();
+                    if (e == null) {
+                        e = new JBIException("Unexpected error: " + e.getMessage());
+                    }
+                    throw e;
+                } else {
+                    // then mark the mail as processed (only if no errors)
+                    if (deleteProcessedMessages) {
+                        // processed messages have to be marked as deleted
+                        mailMsg.setFlag(Flags.Flag.DELETED, true);
+                    } else {
+                        // processed messages have to be marked as seen
+                        mailMsg.setFlag(Flags.Flag.SEEN, true);
+                    }
+                }
+            }
+        } finally {
+            // finally clean up and close the folder and store
+            try {
+                if (folder != null) {
+                    folder.close(true);
+                }
+                if (store != null) {
+                    store.close();
+                }
+            } catch (Exception ignored) {
+                logger.debug(ignored);
+            }
+        }
+    }
+
+    /**
+     * @return the deleteProcessedMessages
+     */
+    public boolean isDeleteProcessedMessages() {
+        return this.deleteProcessedMessages;
+    }
+
+    /**
+     * @param deleteProcessedMessages the deleteProcessedMessages to set
+     */
+    public void setDeleteProcessedMessages(boolean deleteProcessedMessages) {
+        this.deleteProcessedMessages = deleteProcessedMessages;
+    }
+
+    /**
+     * @return the marshaler
+     */
+    public AbstractMailMarshaler getMarshaler() {
+        return this.marshaler;
+    }
+
+    /**
+     * @param marshaler the marshaler to set
+     */
+    public void setMarshaler(AbstractMailMarshaler marshaler) {
+        this.marshaler = marshaler;
+    }
+
+    /**
+     * @return the maxFetchSize
+     */
+    public int getMaxFetchSize() {
+        return this.maxFetchSize;
+    }
+
+    /**
+     * @param maxFetchSize the maxFetchSize to set
+     */
+    public void setMaxFetchSize(int maxFetchSize) {
+        this.maxFetchSize = maxFetchSize;
+    }
+
+    /**
+     * @return the processOnlyUnseenMessages
+     */
+    public boolean isProcessOnlyUnseenMessages() {
+        return this.processOnlyUnseenMessages;
+    }
+
+    /**
+     * @param processOnlyUnseenMessages the processOnlyUnseenMessages to set
+     */
+    public void setProcessOnlyUnseenMessages(boolean processOnlyUnseenMessages) {
+        this.processOnlyUnseenMessages = processOnlyUnseenMessages;
+    }
+
+    /**
+     * returns the connection uri used for this poller endpoint
+     * 
+     * @return Returns the connection.
+     */
+    public String getConnection() {
+        return this.connection;
+    }
+
+    /**
+     * sets the connection uri
+     * 
+     * @param connection The connection to set.
+     */
+    public void setConnection(String connection) {
+        this.connection = connection;
+        try {
+            this.config = MailUtils.configure(this.connection);
+        } catch (ParseException ex) {
+            LOG.error("The configured connection uri is invalid", ex);
+        }
+    }
+
+    /**
+     * @return the debugMode
+     */
+    public boolean isDebugMode() {
+        return this.debugMode;
+    }
+
+    /**
+     * @param debugMode the debugMode to set
+     */
+    public void setDebugMode(boolean debugMode) {
+        this.debugMode = debugMode;
+    }
+
+    /**
+     * @return the customTrustManagers
+     */
+    public String getCustomTrustManagers() {
+        return this.customTrustManagers;
+    }
+
+    /**
+     * @param customTrustManagers the customTrustManagers to set
+     */
+    public void setCustomTrustManagers(String customTrustManagers) {
+        this.customTrustManagers = customTrustManagers;
+    }
+}

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java Thu Mar  6 04:58:09 2008
@@ -0,0 +1,248 @@
+/*
+ * 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.mail;
+
+import java.util.Properties;
+
+import javax.jbi.management.DeploymentException;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.ParseException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+
+import org.apache.servicemix.mail.marshaler.AbstractMailMarshaler;
+import org.apache.servicemix.mail.marshaler.DefaultMailMarshaler;
+import org.apache.servicemix.mail.utils.MailConnectionConfiguration;
+import org.apache.servicemix.mail.utils.MailUtils;
+
+/**
+ * this is the sending endpoint for the mail component
+ * 
+ * @org.apache.xbean.XBean element="sender"
+ * @author lhein
+ */
+public class MailSenderEndpoint extends ProviderEndpoint implements MailEndpointType {
+    private static final transient Log LOG = LogFactory.getLog(MailSenderEndpoint.class);
+
+    private AbstractMailMarshaler marshaler = new DefaultMailMarshaler();
+    private MailConnectionConfiguration config;
+    private String customTrustManagers;
+    private String connection;
+    private String sender;
+    private boolean debugMode;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.Endpoint#validate()
+     */
+    public void validate() throws DeploymentException {
+        super.validate();
+
+        if (this.config == null || this.connection == null) {
+            throw new DeploymentException("No valid connection uri provided.");
+        }
+        if (this.sender == null) {
+            this.sender = this.marshaler != null
+                ? this.marshaler.getDefaultSenderForOutgoingMails() : AbstractMailMarshaler.DEFAULT_SENDER;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.endpoints.ProviderEndpoint#processInOnly(javax.jbi.messaging.MessageExchange,
+     *      javax.jbi.messaging.NormalizedMessage)
+     */
+    @Override
+    protected void processInOnly(MessageExchange exchange, NormalizedMessage in) throws Exception {
+        // Exchange is finished
+        if (exchange.getStatus() == ExchangeStatus.DONE) {
+            return;
+        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+            // Exchange has been aborted with an exception
+            return;
+        } else if (exchange.getFault() != null) {
+            // Fault message
+            exchange.setStatus(ExchangeStatus.DONE);
+            getChannel().send(exchange);
+        } else {
+            Session session = null;
+            try {
+                Properties props = MailUtils.getPropertiesForProtocol(this.config, this.customTrustManagers);
+                props.put("mail.debug", isDebugMode() ? "true" : "false");
+
+                // Get session
+                session = Session.getInstance(props, config.getAuthenticator());
+
+                // debug the session
+                session.setDebug(this.debugMode);
+
+                // Define message
+                MimeMessage msg = new MimeMessage(session);
+
+                // let the marshaler to the conversion of message to mail
+                this.marshaler.convertJBIToMail(msg, exchange, in, this.sender);
+
+                // Send message
+                Transport.send(msg);
+            } catch (MessagingException mex) {
+                logger.error("Error sending mail...", mex);
+                throw mex;
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.endpoints.ProviderEndpoint#processInOut(javax.jbi.messaging.MessageExchange,
+     *      javax.jbi.messaging.NormalizedMessage, javax.jbi.messaging.NormalizedMessage)
+     */
+    @Override
+    protected void processInOut(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
+        throws Exception {
+        // Exchange is finished
+        if (exchange.getStatus() == ExchangeStatus.DONE) {
+            return;
+        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+            // Exchange has been aborted with an exception
+            return;
+        } else if (exchange.getFault() != null) {
+            // Fault message
+            exchange.setStatus(ExchangeStatus.DONE);
+            getChannel().send(exchange);
+        } else {
+            Session session = null;
+            try {
+                Properties props = MailUtils.getPropertiesForProtocol(this.config, this.customTrustManagers);
+                props.put("mail.debug", isDebugMode() ? "true" : "false");
+
+                // Get session
+                session = Session.getInstance(props, config.getAuthenticator());
+
+                // debug the session
+                session.setDebug(this.debugMode);
+
+                // Define message
+                MimeMessage msg = new MimeMessage(session);
+
+                // let the marshaler to the conversion of message to mail
+                this.marshaler.convertJBIToMail(msg, exchange, in, this.sender);
+
+                // Send message
+                Transport.send(msg);
+
+                // quit the exchange
+                out.setContent(new StringSource("<ack />"));
+            } catch (MessagingException mex) {
+                logger.error("Error sending mail...", mex);
+                throw mex;
+            }
+        }
+    }
+
+    /**
+     * @return the marshaler
+     */
+    public AbstractMailMarshaler getMarshaler() {
+        return this.marshaler;
+    }
+
+    /**
+     * @param marshaler the marshaler to set
+     */
+    public void setMarshaler(AbstractMailMarshaler marshaler) {
+        this.marshaler = marshaler;
+    }
+
+    /**
+     * @return the sender
+     */
+    public String getSender() {
+        return this.sender;
+    }
+
+    /**
+     * @param sender the sender to set
+     */
+    public void setSender(String sender) {
+        this.sender = sender;
+    }
+
+    /**
+     * returns the connection uri used for this poller endpoint
+     * 
+     * @return Returns the connection.
+     */
+    public String getConnection() {
+        return this.connection;
+    }
+
+    /**
+     * sets the connection uri
+     * 
+     * @param connection The connection to set.
+     */
+    public void setConnection(String connection) {
+        this.connection = connection;
+        try {
+            this.config = MailUtils.configure(this.connection);
+        } catch (ParseException ex) {
+            LOG.error("The configured connection uri is invalid", ex);
+        }
+    }
+
+    /**
+     * @return the debugMode
+     */
+    public boolean isDebugMode() {
+        return this.debugMode;
+    }
+
+    /**
+     * @param debugMode the debugMode to set
+     */
+    public void setDebugMode(boolean debugMode) {
+        this.debugMode = debugMode;
+    }
+
+    /**
+     * @return the customTrustManagers
+     */
+    public String getCustomTrustManagers() {
+        return this.customTrustManagers;
+    }
+
+    /**
+     * @param customTrustManagers the customTrustManagers to set
+     */
+    public void setCustomTrustManagers(String customTrustManagers) {
+        this.customTrustManagers = customTrustManagers;
+    }
+}

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java?rev=634253&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java (added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java Thu Mar  6 04:58:09 2008
@@ -0,0 +1,218 @@
+/*
+ * 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.mail.marshaler;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataSource;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.servicemix.components.util.MarshalerSupport;
+
+/**
+ * this is the abstract super class of all marshalers which want to convert
+ * between normalized messages and mail messages and vice versa.
+ * 
+ * @author lhein
+ */
+public abstract class AbstractMailMarshaler extends MarshalerSupport {
+    /**
+     * ------------------------------------------------------------------------
+     * the mail tags are used for parsing a mime mail for specific tags
+     * ------------------------------------------------------------------------
+     */
+
+    /**
+     * this is the tag for the "To" field of the email
+     */
+    public static final String MAIL_TAG_TO = "To";
+
+    /**
+     * this is the tag for the "Cc" field of the email
+     */
+    public static final String MAIL_TAG_CC = "Cc";
+
+    /**
+     * this is the tag for the "Bcc" field of the email
+     */
+    public static final String MAIL_TAG_BCC = "Bcc";
+
+    /**
+     * this is the tag for the "From" field of the email
+     */
+    public static final String MAIL_TAG_FROM = "From";
+
+    /**
+     * this is the tag for the "Subject" field of the email
+     */
+    public static final String MAIL_TAG_SUBJECT = "Subject";
+
+    /**
+     * this is the tag for the "Reply-To" field of the email
+     */
+    public static final String MAIL_TAG_REPLYTO = "Reply-To";
+
+    /**
+     * this is the tag for the "Date" field of the email
+     */
+    public static final String MAIL_TAG_SENTDATE = "Date";
+
+    /**
+     * ------------------------------------------------------------------------
+     * the email constants are used for transporting specific information in 
+     * message properties
+     * ------------------------------------------------------------------------
+     */
+
+    /**
+     * this tag is used in normalized messages to represent the address the 
+     * mail was sent to OR the address this exchange should be mailed to
+     */
+    public static final String MSG_TAG_TO = "org.apache.servicemix.mail.to";
+
+    /**
+     * this tag is used in normalized messages to represent the CC address the 
+     * mail was sent to OR the CC address this exchange should be mailed to
+     */
+    public static final String MSG_TAG_CC = "org.apache.servicemix.mail.cc";
+
+    /**
+     * this tag is used in normalized messages to represent the BCC address 
+     * this exchange should be mailed to
+     */
+    public static final String MSG_TAG_BCC = "org.apache.servicemix.mail.bcc";
+
+    /**
+     * this tag is used in normalized messages to represent the address the 
+     * mail was received from OR the address this exchange should be sent from
+     */
+    public static final String MSG_TAG_FROM = "org.apache.servicemix.mail.from";
+
+    /**
+     * this tag is used in normalized messages to represent the text portion 
+     * of the mail received OR the text portion of the mail to be sent
+     * if both html and text properties are set, then it will be a multipart
+     * mail message containing both
+     */
+    public static final String MSG_TAG_TEXT = "org.apache.servicemix.mail.text";
+
+    /**
+     * this tag is used in normalized messages to represent the html portion 
+     * of the mail received OR the html portion of the mail to be sent
+     * if both html and text properties are set, then it will be a multipart
+     * mail message containing both 
+     */
+    public static final String MSG_TAG_HTML = "org.apache.servicemix.mail.html";
+
+    /**
+     * this tag is used in normalized messages to represent the subject of the 
+     * mail received OR the subject of the mail to be sent
+     */
+    public static final String MSG_TAG_SUBJECT = "org.apache.servicemix.mail.subject";
+
+    /**
+     * this tag is used in normalized messages to represent the reply-to address
+     * of the mail received OR the reply-to address of the mail to be sent
+     */
+    public static final String MSG_TAG_REPLYTO = "org.apache.servicemix.mail.replyto";
+
+    /**
+     * this tag is used in normalized messages to represent the date when  
+     * the mail was sent
+     */
+    public static final String MSG_TAG_SENTDATE = "org.apache.servicemix.mail.sentdate";
+
+    /**
+     * this tag is used in normalized messages to represent the alternative
+     * content of a multipart/related message type
+     */
+    public static final String MSG_TAG_ALTERNATIVE_CONTENT = "org.apache.servicemix.mail.alternativecontent";
+
+    /**
+     * the default sender address for outgoing mails
+     */
+    public static final String DEFAULT_SENDER = "no-reply@localhost";
+
+    /**
+     * This method is used to convert a mime mail message received via an 
+     * email server into a normalized message which will be sent to the bus.
+     * If you want to specify your own conversion behaviour you have to override
+     * this method with your own logic.
+     * 
+     * @param exchange  the message exchange that will be sent to the bus
+     * @param nmsg      the normalized in-message to be filled by this method
+     * @param mailMsg   the mail message that was received via mail server
+     * @throws javax.mail.MessagingException on any conversion errors
+     */
+    public abstract void convertMailToJBI(MessageExchange exchange, NormalizedMessage nmsg,
+                                          MimeMessage mailMsg) throws javax.mail.MessagingException;
+
+    /**
+     * This method is used to convert a normalized message from the bus into a
+     * mime mail message to be sent to a mail server.
+     * If you want to specify your own conversion behaviour you have to override
+     * this method with your own logic. 
+     * 
+     * @param mimeMessage       the mime mail message to be filled by this method
+     * @param exchange          the message exchange from JBI bus
+     * @param nmsg              the normalized message to transform to mail message
+     * @param configuredSender  the sender configured in the xbean
+     * @throws javax.mail.MessagingException on conversion errors
+     */
+    public abstract void convertJBIToMail(MimeMessage mimeMessage, MessageExchange exchange,
+                                          NormalizedMessage nmsg, String configuredSender) throws javax.mail.MessagingException;
+
+    /**
+     * returns the default sender for outgoing mails
+     * Override this method to deliver your own default sender!
+     * 
+     * @return  the default sender address as string
+     */
+    public String getDefaultSenderForOutgoingMails() {
+        return AbstractMailMarshaler.DEFAULT_SENDER;
+    }
+
+    /**
+     * This helper method extracts all attachments from the normalized message 
+     * into a map of attachments which may be used for filling the attachments
+     * of an outgoing mail
+     * 
+     * @param normalizedMessage     the normalized message with attachments
+     * @return  a map of attachments
+     */
+    protected final Map<String, DataSource> getAttachmentsMapFromNormalizedMessage(
+                                                                                   NormalizedMessage normalizedMessage) {
+        // get attachment from Normalize Message (used for sending)
+        Map<String, DataSource> attachments = new HashMap<String, DataSource>();
+        String oneAttachmentName = "";
+        Set attNames = normalizedMessage.getAttachmentNames();
+        Iterator itAttNames = attNames.iterator();
+        while (itAttNames.hasNext()) {
+            oneAttachmentName = (String)itAttNames.next();
+            DataSource oneAttchmentInputString = normalizedMessage.getAttachment(oneAttachmentName)
+                .getDataSource();
+            attachments.put(oneAttachmentName, oneAttchmentInputString);
+        }
+
+        return attachments;
+    }
+}



Mime
View raw message