Author: asankha
Date: Mon Nov 27 20:29:07 2006
New Revision: 479892

URL: http://svn.apache.org/viewvc?view=rev&rev=479892
Log:
add missing mtom sample service
bundle JMS api (28k) as else it will require user setup to run sample clients 
due to dependency

Added:
    incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/build.xml
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/services.xml
    incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/
    
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/MTOMSampleService.java
Modified:
    incubator/synapse/trunk/java/pom.xml

Added: 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/build.xml?view=auto&rev=479892
==============================================================================
--- 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/build.xml
 (added)
+++ 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/build.xml
 Mon Nov 27 20:29:07 2006
@@ -0,0 +1,70 @@
+<!--
+  ~  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 default="build-service">
+
+    <property name="synapse.home" value="../../../.."/>
+    <property name="lib" value="${synapse.home}/lib"/>
+    <property name="temp.dir" value="temp"/>
+    <property name="classes" value="${temp.dir}/classes"/>
+    <property name="src" value="src"/>
+    <property name="services" value="../../repository/services"/>
+
+    <path id="synapse.class.path">
+        <pathelement path="${java.class.path}"/>
+        <fileset dir="${synapse.home}">
+            <include name="lib/*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="init" depends="clean">
+        <mkdir dir="${temp.dir}"/>
+        <mkdir dir="${classes}"/>
+        <mkdir dir="${services}"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${temp.dir}"/>
+    </target>
+
+    <target name="compile-all" depends="init">
+        <javac debug="on" destdir="${classes}">
+            <src path="${src}"/>
+            <classpath refid="synapse.class.path"/>
+        </javac>
+    </target>
+
+    <target name="build-service" depends="compile-all">
+        <property name="SSQ.dir" value="${temp.dir}/MTOMSampleService"/>
+        <mkdir dir="${SSQ.dir}"/>
+
+        <mkdir dir="${SSQ.dir}/META-INF"/>
+        <copy file="conf/services.xml" 
tofile="${SSQ.dir}/META-INF/services.xml"/>
+        <copy toDir="${SSQ.dir}">
+            <fileset dir="${classes}">
+                <include name="**/*.class"/>
+            </fileset>
+        </copy>
+
+        <jar destfile="${services}/MTOMSampleService.aar">
+            <fileset dir="${SSQ.dir}"/>
+        </jar>
+    </target>
+
+</project>
\ No newline at end of file

Added: 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/services.xml
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/services.xml?view=auto&rev=479892
==============================================================================
--- 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/services.xml
 (added)
+++ 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/conf/services.xml
 Mon Nov 27 20:29:07 2006
@@ -0,0 +1,30 @@
+<!--
+  ~  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.
+  -->
+
+<serviceGroup>
+<service name="MTOMSampleService">
+       <messageReceivers>
+               <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"; 
+                               
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
+               <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"; 
+                               
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
+               </messageReceivers>
+               <parameter locked="false" 
name="ServiceClass">samples.services.MTOMSampleService</parameter>
+</service>
+</serviceGroup>
\ No newline at end of file

Added: 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/MTOMSampleService.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/MTOMSampleService.java?view=auto&rev=479892
==============================================================================
--- 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/MTOMSampleService.java
 (added)
+++ 
incubator/synapse/trunk/java/modules/samples/services/MTOMSampleService/src/samples/services/MTOMSampleService.java
 Mon Nov 27 20:29:07 2006
@@ -0,0 +1,51 @@
+/*
+ *  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 samples.services;
+
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMElement;
+
+import javax.activation.DataHandler;
+import java.io.*;
+
+public class MTOMSampleService {
+
+    private static final int BUFFER = 2048;
+
+    public void uploadFileUsingMTOM(OMElement element) throws Exception {
+
+        OMText binaryNode = (OMText) element.getFirstOMChild();
+        DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler();
+        InputStream is = dataHandler.getInputStream();
+
+        File tempFile = File.createTempFile("mtom-", ".jpg");
+        FileOutputStream fos = new FileOutputStream(tempFile);
+        BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
+
+        byte data[] = new byte[BUFFER];
+        int count;
+        while ((count = is.read(data, 0, BUFFER)) != -1) {
+            dest.write(data, 0, count);
+        }
+
+        dest.flush();
+        dest.close();
+        System.out.println("Wrote to file : " + tempFile.getAbsolutePath());
+    }
+}

Modified: incubator/synapse/trunk/java/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/pom.xml?view=diff&rev=479892&r1=479891&r2=479892
==============================================================================
--- incubator/synapse/trunk/java/pom.xml (original)
+++ incubator/synapse/trunk/java/pom.xml Mon Nov 27 20:29:07 2006
@@ -392,7 +392,6 @@
             <groupId>geronimo-spec</groupId>
             <artifactId>geronimo-spec-jms</artifactId>
             <version>${geronimo.spec.jms.version}</version>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>annogen</groupId>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to