[OFBiz] SVN: r7750 - trunk/framework/service/src/org/ofbiz/service/rmi

jonesde@svn.ofbiz.org jonesde at svn.ofbiz.org
Wed Jun 7 09:20:55 CDT 2006


Author: jonesde
Date: 2006-06-07 09:20:51 -0500 (Wed, 07 Jun 2006)
New Revision: 7750

Added:
   trunk/framework/service/src/org/ofbiz/service/rmi/ExampleRemoteClient.java
Log:
Added ExampleRemoteClient with information about using the Service Engine's RemoteDispatcher

Added: trunk/framework/service/src/org/ofbiz/service/rmi/ExampleRemoteClient.java
===================================================================
--- trunk/framework/service/src/org/ofbiz/service/rmi/ExampleRemoteClient.java	2006-06-07 01:10:43 UTC (rev 7749)
+++ trunk/framework/service/src/org/ofbiz/service/rmi/ExampleRemoteClient.java	2006-06-07 14:20:51 UTC (rev 7750)
@@ -0,0 +1,76 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-2006 The Apache Software Foundation
+ * 
+ * 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.
+ */
+package org.ofbiz.service.rmi;
+
+import java.rmi.Naming;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.ofbiz.service.rmi.RemoteDispatcher;
+import org.ofbiz.service.GenericServiceException;
+
+/** An example of how to remotely access the Service Engine's RemoteDispatcher.
+ * 
+ * The following files from OFBiz need to be on the client's classpath:
+ * cache.properties
+ * debug.properties
+ * jsse.properties
+ * ofbiz-base.jar
+ * ofbiz-service-rmi.jar (copied and renamed from "ofbiz/framework/service/build/lib/ofbiz-service-rmi.raj" from an OFBiz build)
+ * 
+ * The following third-party libraries (can be found in OFBiz) also need to be on the client's classpath:
+ * commons-collections.jar
+ * javolution.jar
+ * jdbm.jar
+ * log4j.jar
+ * 
+ * @author     <a href="mailto:jonesde at ofbiz.org">David E. Jones</a>
+ * @author     <a href="mailto:jaz at ofbiz.org">Andy Zeneski</a>
+ */
+public class ExampleRemoteClient {
+
+    protected final static String RMI_URL = "rmi://localhost:1099/RMIDispatcher"; // change to match the remote server
+    protected RemoteDispatcher rd = null;
+
+    public ExampleRemoteClient() {
+        try {
+            rd = (RemoteDispatcher) Naming.lookup(RMI_URL);
+        } catch (NotBoundException e) {
+            e.printStackTrace();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (RemoteException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public Map runTestService() throws RemoteException, GenericServiceException {
+        Map context = new HashMap();
+        context.put("message", "Remote Service Test");
+        return rd.runSync("testScv", context);
+    }
+
+    public static void main(String[] args) throws Exception {
+        ExampleRemoteClient rm = new ExampleRemoteClient();
+        Map result = rm.runTestService();
+        System.out.println("Service Result Map: " + result);
+    }
+}


Property changes on: trunk/framework/service/src/org/ofbiz/service/rmi/ExampleRemoteClient.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native



More information about the Svn mailing list