diff options
Diffstat (limited to 'lib/orber/examples')
-rw-r--r-- | lib/orber/examples/Makefile | 42 | ||||
-rw-r--r-- | lib/orber/examples/Stack/InitialReferences.idl | 12 | ||||
-rw-r--r-- | lib/orber/examples/Stack/Makefile | 128 | ||||
-rw-r--r-- | lib/orber/examples/Stack/StackClient.cc | 97 | ||||
-rw-r--r-- | lib/orber/examples/Stack/StackClient.java | 73 | ||||
-rw-r--r-- | lib/orber/examples/Stack/StackModule_StackFactory_impl.erl | 41 | ||||
-rw-r--r-- | lib/orber/examples/Stack/StackModule_Stack_impl.erl | 47 | ||||
-rw-r--r-- | lib/orber/examples/Stack/stack.idl | 27 | ||||
-rw-r--r-- | lib/orber/examples/Stack/stack_client.erl | 56 | ||||
-rw-r--r-- | lib/orber/examples/Stack/stack_factory.erl | 38 |
10 files changed, 0 insertions, 561 deletions
diff --git a/lib/orber/examples/Makefile b/lib/orber/examples/Makefile deleted file mode 100644 index bf1ff13707..0000000000 --- a/lib/orber/examples/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-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% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = Stack - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/orber/examples/Stack/InitialReferences.idl b/lib/orber/examples/Stack/InitialReferences.idl deleted file mode 100644 index 7c1dddc7c4..0000000000 --- a/lib/orber/examples/Stack/InitialReferences.idl +++ /dev/null @@ -1,12 +0,0 @@ -typedef string ObjectId; -typedef sequence <ObjectId> ObjectIdList; - -module Orber { -interface InitialReferences { - - Object get(in ObjectId id); - - ObjectIdList list(); - -}; -}; diff --git a/lib/orber/examples/Stack/Makefile b/lib/orber/examples/Stack/Makefile deleted file mode 100644 index 5348c624e3..0000000000 --- a/lib/orber/examples/Stack/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-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% -# -# -include $(ERL_TOP)/make/target.mk - -EBIN= ../../ebin - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -IDL_FILES = \ - stack.idl \ - InitialReferences.idl - -GEN_ERL_MODULES = \ - oe_stack \ - StackModule_Stack \ - StackModule_StackFactory \ - StackModule_EmptyStack - -MODULES= \ - StackModule_Stack_impl \ - StackModule_StackFactory_impl \ - stack_factory \ - stack_client - -GEN_HRL_FILES = \ - oe_stack.hrl \ - StackModule.hrl \ - StackModule_Stack.hrl \ - StackModule_StackFactory.hrl - -HRL_FILES= - -ERL_FILES= $(MODULES:%=%.erl) - -GEN_FILES = $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) - -JAVA_CLASSES = \ - StackClient - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) -CLASS_FILES= $(JAVA_CLASSES:%=%.class) - -TARGET_FILES = \ - $(GEN_ERL_MODULES:%=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -TEST_TARGET_FILES = - -CPP_FILES = StackClient.cc - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber -I$(ERL_TOP)/lib/orber - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -debug opt: $(TARGET_FILES) - -clean: - rm -f $(TARGET_FILES) $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) $(CLASS_FILES) IDL-GENERATED - rm -f errs core *~ - -docs: - -test: $(TEST_TARGET_FILES) - -IDL-GENERATED: stack.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) stack.idl - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/examples/Stack" - $(INSTALL_DATA) $(ERL_FILES) $(JAVA_FILES) $(CPP_FILES) $(IDL_FILES) "$(RELSYSDIR)/examples/Stack" - - -release_docs_spec: - - diff --git a/lib/orber/examples/Stack/StackClient.cc b/lib/orber/examples/Stack/StackClient.cc deleted file mode 100644 index 4d393390c4..0000000000 --- a/lib/orber/examples/Stack/StackClient.cc +++ /dev/null @@ -1,97 +0,0 @@ -/** - * <copyright> - * <year>2000-2007</year> - * <holder>Ericsson AB, All Rights Reserved</holder> - *</copyright> - *<legalnotice> - * 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 AB. - *</legalnotice> - */ -/** - * This module gives an example how it is possible to setup a connection - * Orbix3.0.1 and Orber3.0.2 - */ - - -#define USE_IIOP - -#include <iostream.h> -#include <stdio.h> -#include <fstream.h> -#include <stdlib.h> - -#include "NamingService.hh" -#include "InitialReference.hh" -#include "InitialReferences.hh" -#include "stack.hh" - - -int main(int argc, char** argv) { - - CORBA::Object_ptr nsRef, initRef, objRef; - InitialReference init; - Orber::InitialReferences_var initp; - CosNaming::NamingContext_var Ns; - CosNaming::NameComponent nc; - CosNaming::Name_var name; - StackModule::StackFactory_var stackFac; - StackModule::Stack_var stack; - - if (argc < 3) { - cout << "usage: " << argv[0] << " <hostname>" << " <srvport>" << endl; - exit (-1); - } - - string srvHost = argv[1]; - long srvPort = atoi(argv[2]); - - cout << "Using host: " << srvHost << " Port: " << srvPort << endl; - - try - { - // Create Initial reference (objectkey "INIT"). - const string s = init.stringified_ior(srvHost, srvPort); - initRef = CORBA::Orbix.string_to_object(s); - initp = Orber::InitialReferences::_narrow(initRef); - nsRef = initp->get("NameService"); - Ns = CosNaming::NamingContext::_narrow(nsRef); - - // Create a name component. - name = new CosNaming::Name(1); - name->length(1); - name[0].id = CORBA::string_dup("StackFactory"); - name[0].kind = CORBA::string_dup(""); - - // Look up the Object in the NamingService. - objRef = Ns->resolve(name); - stackFac = StackModule::StackFactory::_narrow(objRef); - stack = stackFac->create_stack(); - - // push & pop - stack->push(8); - stack->push(7); - stack->push(6); - cout << "Stack: " << stack->pop() - << " " << stack->pop() - << " " << stack->pop() << endl; - - } catch(...) { - cerr << "call failed" << endl; - cerr << "Unexpected exception " << endl; - exit(1); - } - cout << "Completed successfully" << endl; - return 0; -} diff --git a/lib/orber/examples/Stack/StackClient.java b/lib/orber/examples/Stack/StackClient.java deleted file mode 100644 index 55e967a330..0000000000 --- a/lib/orber/examples/Stack/StackClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1997-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% - * - */ -/* - * Stack example. - */ - -package StackModule; -import org.omg.CORBA.*; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.ORB.*; - -public class StackClient -{ - public static void main(String args[]) - { - org.omg.CORBA.Object objRef; - StackFactory sfRef = null; - Stack sRef = null; - // The argument can look like - // "corbaname::host:4001/#StackFactory" - String corbaName = new String(args[0]); - try{ - ORB orb = ORB.init(args, null); - - objRef = orb.string_to_object(corbaName); - sfRef = StackFactoryHelper.narrow(objRef); - sRef = sfRef.create_stack(); - - sRef.push(4); - sRef.push(7); - sRef.push(1); - sRef.push(1); - - try{ - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - // The following operation shall - // return an EmptyStack exception - System.out.println(sRef.pop()); - } - catch(EmptyStack es) { - System.out.println("Empty stack"); - }; - - sfRef.destroy_stack(sRef); - } - catch(SystemException se) - { - System.out.println("Unexpected exception: " + se.toString()); - return; - } - } -} diff --git a/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl b/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl deleted file mode 100644 index 76e449971f..0000000000 --- a/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl +++ /dev/null @@ -1,41 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-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% -%% -%% -%%----------------------------------------------------------------- -%% StackModule_StackFactory_impl example file. - --module('StackModule_StackFactory_impl'). --include_lib("orber/include/corba.hrl"). --export([create_stack/1, destroy_stack/2, init/1, terminate/2]). - - -init(_Env) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -create_stack(State) -> - %% Just a create we don't want a link. - {reply, 'StackModule_Stack':oe_create(), State}. - -destroy_stack(State, Stack) -> - {reply, corba:dispose(Stack), State}. diff --git a/lib/orber/examples/Stack/StackModule_Stack_impl.erl b/lib/orber/examples/Stack/StackModule_Stack_impl.erl deleted file mode 100644 index ff4dc90829..0000000000 --- a/lib/orber/examples/Stack/StackModule_Stack_impl.erl +++ /dev/null @@ -1,47 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-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% -%% -%% -%%----------------------------------------------------------------- -%% StackModule_Stack_impl example file. - --module('StackModule_Stack_impl'). --include_lib("orber/include/corba.hrl"). --include("StackModule.hrl"). --export([pop/1, push/2, empty/1, init/1, terminate/2]). - - -init(_Env) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -push(Stack, Val) -> - {reply, ok, [Val | Stack]}. - -pop([Val | Stack]) -> - {reply, Val, Stack}; -pop([]) -> - corba:raise(#'StackModule_EmptyStack'{}). - -empty(_) -> - {reply, ok, []}. - diff --git a/lib/orber/examples/Stack/stack.idl b/lib/orber/examples/Stack/stack.idl deleted file mode 100644 index f21f93917b..0000000000 --- a/lib/orber/examples/Stack/stack.idl +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _STACK_IDL -#define _STACK_IDL - -module StackModule { - - exception EmptyStack {}; - - interface Stack { - - long pop() raises(StackModule::EmptyStack); - - void push(in long value); - - void empty(); - - }; - - interface StackFactory { - - StackModule::Stack create_stack(); - void destroy_stack(in StackModule::Stack s); - - }; - -}; - -#endif diff --git a/lib/orber/examples/Stack/stack_client.erl b/lib/orber/examples/Stack/stack_client.erl deleted file mode 100644 index 6e32195b1b..0000000000 --- a/lib/orber/examples/Stack/stack_client.erl +++ /dev/null @@ -1,56 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-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% -%% -%% -%%----------------------------------------------------------------- -%% stack_client example file. - --module('stack_client'). - --export([run/0]). - - -run() -> - case catch corba:string_to_object("corbaname:rir:/NameService#StackFactory") of - {'EXCEPTION', _E} -> - io:format("The stack factory server is not registered~n",[]); - SF -> - %% Create the stack - SS = 'StackModule_StackFactory':create_stack(SF), - - 'StackModule_Stack':push(SS, 4), - 'StackModule_Stack':push(SS, 7), - 'StackModule_Stack':push(SS, 1), - 'StackModule_Stack':push(SS, 1), - Res = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res]), - Res1 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res1]), - Res2 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res2]), - Res3 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res3]), - - %% Remove the stack - 'StackModule_StackFactory':destroy_stack(SF, SS) - - end. - - diff --git a/lib/orber/examples/Stack/stack_factory.erl b/lib/orber/examples/Stack/stack_factory.erl deleted file mode 100644 index b5b455ae5a..0000000000 --- a/lib/orber/examples/Stack/stack_factory.erl +++ /dev/null @@ -1,38 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-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% -%% -%% -%%----------------------------------------------------------------- -%% stack_factory example file. - --module('stack_factory'). --include_lib("orber/include/corba.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). --include_lib("orber/COSS/CosNaming/lname.hrl"). - --export([start/0]). - -start() -> - SFok = 'StackModule_StackFactory':oe_create(), - NS = corba:resolve_initial_references("NameService"), - NC = lname_component:set_id(lname_component:create(), "StackFactory"), - N = lname:insert_component(lname:create(), 1, NC), - 'CosNaming_NamingContext':bind(NS, N, SFok). - |