diff options
Diffstat (limited to 'lib/ic/examples/java-client-server')
-rw-r--r-- | lib/ic/examples/java-client-server/ReadMe | 69 | ||||
-rw-r--r-- | lib/ic/examples/java-client-server/client.java | 61 | ||||
-rw-r--r-- | lib/ic/examples/java-client-server/random.idl | 50 | ||||
-rw-r--r-- | lib/ic/examples/java-client-server/server.java | 83 | ||||
-rw-r--r-- | lib/ic/examples/java-client-server/serverImpl.java | 43 |
5 files changed, 0 insertions, 306 deletions
diff --git a/lib/ic/examples/java-client-server/ReadMe b/lib/ic/examples/java-client-server/ReadMe deleted file mode 100644 index 9fde464e09..0000000000 --- a/lib/ic/examples/java-client-server/ReadMe +++ /dev/null @@ -1,69 +0,0 @@ -This is a short description on the use of the java demo, -a client that initiates and uses a random number generator -that lies on a java-server. You will be able to shift the -existing client/server with the ones refered to the other -examples. - -Instructions. - -1) Start erlang - - On the erlang shell type : - -------------------------- - - ic:gen(random,[{be,java}]). ( generates the java code ) - - -2) Modify the "SNode" string on file "server.java" to the server - node name thet suites for your machine. - - -3) Modify the "SNode" string on file "client.java" to the client - node for your machine and the "PNode" string for the server - node ( = the same as the SNode for the "server.java" file ). - - -4) Set and export the CLASSPATH variable to point to the - java classes located in java development kit, the - Otp's classes and the current directory. - Your classpath should look like this : - - .:<OTPROOT>/lib/ic-4.0/priv/ic.jar:<OTPROOT>/lib/jinterface_1.1/priv/OtpErlang.jar - - where : - - <OTPROOT> is the location there OTP is installed - - -5) Start the empd deamon by using the command : - - epmd -daemon - - -6) Compile the generated java code : - - javac rmod/*.java ( compiles all generated java code ) - - javac *.java ( compiles all manually writen java code ) - - -7) Start the java on an terminal window : - - java server ( starts the java-server ) - - -8) Start the client on an terminal window : - - java client ( calls the server ) - - - - - - - - - - - - diff --git a/lib/ic/examples/java-client-server/client.java b/lib/ic/examples/java-client-server/client.java deleted file mode 100644 index 48b5bc4f60..0000000000 --- a/lib/ic/examples/java-client-server/client.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * 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. - * - * %CopyrightEnd% - * - */ -public class client { - - private static java.lang.String SNode = "client"; - private static java.lang.String PNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String Server = "rmod_random_impl"; - - private static rmod._randomStub stub; - - public static void main(String[] args) { - - try { - - stub = new rmod._randomStub(SNode,PNode,Cookie,Server); - int seed1 = 1; - int seed2 = 2; - int seed3 = 3; - double random = 0; - - System.out.print("\nClient initialization...."); - stub.init(seed1,seed2,seed3); - System.out.println("ok\n"); - - - for (int i = 0; i < 10; i++) { - random = stub.produce(); - System.out.println("Random" + i + " = " + random); - } - System.out.println("\nClient terminated.\n"); - - stub.__disconnect(); - - } catch( Exception e) { - System.out.println("Exception :"); - e.printStackTrace(); - } - - } - -} - diff --git a/lib/ic/examples/java-client-server/random.idl b/lib/ic/examples/java-client-server/random.idl deleted file mode 100644 index 7ce302a2e7..0000000000 --- a/lib/ic/examples/java-client-server/random.idl +++ /dev/null @@ -1,50 +0,0 @@ -// ``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. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/java-client-server/server.java b/lib/ic/examples/java-client-server/server.java deleted file mode 100644 index 79618ba8be..0000000000 --- a/lib/ic/examples/java-client-server/server.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * 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. - * - * %CopyrightEnd% - * - */ -public class server { - - private static java.lang.String SNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String RegName = "rmod_random_impl"; - - public static void main(String[] args) { - - - System.out.println("\nServer running.\n"); - boolean serverState = true; - boolean recState = true; - - try { - - com.ericsson.otp.erlang.OtpServer self = new com.ericsson.otp.erlang.OtpServer(SNode, Cookie); - self.publishPort(); - - /* Server loop */ - while(serverState == true) { - - com.ericsson.otp.erlang.OtpConnection connection = self.accept(); - serverImpl srv = new serverImpl(); - com.ericsson.otp.erlang.OtpInputStream request; - com.ericsson.otp.erlang.OtpOutputStream reply; - com.ericsson.otp.erlang.OtpErlangPid client; - - /* Server loop */ - while(recState == true) { - - if (connection.isConnected() == true) - try { - - request = connection.receiveBuf(); - - reply = srv.invoke(request); - - if (reply != null) { - client = srv.__getCallerPid(); - - connection.sendBuf(client,reply); - } - - } catch( Exception e) { - System.out.println("Server terminated.\n\n"); - recState = false; - serverState = false; - } - } - - connection.close(); - } - - } catch( Exception e) { - System.out.println("Initialization exception :"); - e.printStackTrace(); - } - } -} - - - - diff --git a/lib/ic/examples/java-client-server/serverImpl.java b/lib/ic/examples/java-client-server/serverImpl.java deleted file mode 100644 index 336bc7e327..0000000000 --- a/lib/ic/examples/java-client-server/serverImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * 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. - * - * %CopyrightEnd% - * - */ -public class serverImpl extends rmod._randomImplBase { - - java.util.Random random = null; - - - public void init(int seed1, int seed2, int seed3) throws java.lang.Exception { - - random = new java.util.Random(seed1+seed2+seed3); - }; - - - public double produce() throws java.lang.Exception { - - return random.nextDouble(); - } - -} - - - - - - |