|
|
|
8Àå ÄÚ¹Ù Æ©Å丮¾ó |
||
|
Á¶ ¿ë ÀÏ( tolkien@nownuri.net tolkien@samsung.co.kr )
|
1. ù¹øÂ° ½Ã°£. why corba?
corba = common orb architecture
orb = object request broker
http : web server
htmlÇü½ÄÀ» Áö´Ñ web object
web object¸¦ ´Ù·ç´Â web browser
ftp : ftp server
ftp client
smtp : mta (sendmail)
mua (pine, mutt)
dns : name server (bind)
internet programµé...
irc : irc client/server
2. corba overview
2.1 structure of an object request broker
¡¤designed to integrate a wide variety of object system
¡¤corba objects { intelligent blobs }
{ live anywhere on a network }
{ »çÀüÁö½Ä¾øÀÌ ¼·Î interact }
¡¤client : ¼ºñ½º¸¦ ¿äûÇÏ´Â ½Çü(entity)
¡¤object implementation : ¿äûµÈ ¼ºñ½º¿¡ ´ëÇÑ
Ã¥ÀÓÀ» °¡Áö´Â ½Çü(?)
¡¤orb : object implementationÀÌ ¿äûÀ» ¹Þ¾ÆµéÀÏ ¼ö ÀÖµµ·Ï Áغñ½ÃÄÑ¾ß ÇÏ´Â
¸ðµç mechanismÀ» Ã¥ÀÓÁø´Ù.
¡¤object implementation : ½ÇÁ¦ °´Ã¼¸¦ ¼öÇàÇÏ´Â code¿Í data
¡¤client°üÁ¡¿¡¼ÀÇ interface : °´Ã¼ÀÇ À§Ä¡³ª ¼öÇàµÇ´Â program ¾ð¾î¿¡ µ¶¸³Àû
¡¤¿äû¹æ½Ä : 1. Á¤Àû : idl(interface definition language) stub »ç¿ë
-> operation¿¡ ´ëÇÑ °´Ã¼ÀÇ À¯Çü°ú ÀÌ¿¡ ´ëÇÑ parameter¸¦ Á¤ÀÇ
2. µ¿Àû(dii. dynamic invocation interface)
: interface¸¦ interface repository service¿¡ µî·Ï
-> interface component¸¦ °´Ã¼·Î Ç¥Çö, runtime access Çã¿ë
¡¤ client´Â object reference¸¦ °¡Áö°í ¿äû
¡¤¿äûÀ» À§ÇÑ ¼ö´ÜÀ¸·Î½á dynamic interface¿Í stub interface´Â µ¿ÀÏÇÑ request context¸¦ °¡Áø´Ù. µû¶ó¼, message ¼ö½ÅÀÚ´Â ¾î¶² ¹æ½ÄÀ¸·Î È£ÃâµÇ¾ú´ÂÁö ½Å°æ¾²Áö ¾Ê´Â´Ù. (Åë½Å¼ö´Ü¿¡ µ¶¸³ÀûÀÎ ±¸Çö)
¡¤client´Â language mappingÀ» ÅëÇØ¼ object¿Í orb interface¿¡ Á¢±ÙÇÑ´Ù.
¡¤orb´Â idl skeletonÀ̳ª dynamic skeletonÀ» ÅëÇØ¼,
ÀûÀýÇÑ implementation code¸¦ ã°í,
parameter¸¦ Àü´ÞÇϰí,
object implementationÀ¸·Î Á¦¾î±ÇÀ» ³Ñ±ä´Ù.
skeletonÀº interface³ª object adapter¿¡ ¸í½ÃÀûÀÌ´Ù.
object implementationÀº object adapter¸¦ ÅëÇØ¼, orb·ÎºÎÅÍ ¿©·Á service¸¦ ¹ÞÀ» ¼ö ÀÖ´Ù.
¿äûÀ» ó¸®ÇÑ ´ÙÀ½¿¡ ´Ù½Ã client¿¡ Á¦¾î±Ç°ú °á°ú°ªÀ» µ¹·ÁÁØ´Ù.
¡¤object implementationÀº »ç¿ëÇÒ object adapter¸¦ ¼±ÅÃÇÒ ¼ö ÀÖ´Ù.
ÀÌ ¼±ÅÃÀº object implementationÀÌ »ç¿ëÇÒ serviceÀÇ Á¾·ù¿¡ ±â¹ÝÇÑ´Ù.
¡¤interface´Â omg idl and/or interface repository¿¡ Á¤ÀǵȴÙ.
definitionÀº client stub°ú object implementation skeletonÀ» ¸¸µé±â À§Çؼ ÇÊ¿ä.
¡¤object implementation¿¡ ´ëÇÑ Á¤º¸´Â (o.i¸¦) installÇÒ ¶§ Á¦°øµÇ¸ç,
request¸¦ Àü´ÞÇϴµ¿¾È »ç¿ëÇϱâ À§Çؼ interface repository¿¡ ÀúÀåµÈ´Ù.
7766666666677776
2.1.1 object request broker
°¡. ¸ðµç orb ±¸ÇöÀ» À§ÇÑ µ¿ÀÏÇÑ operation
³ª. ƯÁ¤ object type¿¡ ´ëÇÑ operation
´Ù. ƯÁ¤ styleÀÇ object implementation¿¡ ¸í½ÃÀûÀÎ operation
¡¤ÀûÀýÇÑ interface¸¦ Á¦°øÇÏ´Â ¾î¶²ÇÑ orb±¸Çöµµ ¹Þ¾Æµé¿©Áú ¼ö ÀÖ´Ù.
¡¤¼·Î ´Ù¸¥ orb´Â ¿ÏÀüÈ÷ ´Ù¸£°Ô ±¸ÇöÇÒ ¼ö ÀÖ°í, idl compiler³ª repository, ¿©·¯ object adapter¿Í ÇÔ²² ´Ù¸¥ properties¿Í qualities¸¦ °¡Áø client¿Í object implementation¿¡ ÀÏ·ÃÀÇ service¸¦ Á¦°øÇÒ ¼ö ÀÖ´Ù.
¡¤´Ù¸¥°Ô Ç¥ÇöµÈ object reference³ª invocationÀÇ ´Ù¸¥ ¼ö´ÜÀ» °¡Áö´Â ¿©·¯ orb°¡ °øÁ¸ÇÒ ¼ö ÀÖ´Ù. client´Â ´Ù¸¥ orb¿¡ ÀÇÇØ¼ °ü¸®µÇ´Â µÎ°³ÀÇ object reference¿¡ µ¿½Ã¿¡ accessÇÒ ¼ö ÀÖ´Ù. µÎ°³ÀÇ orb°¡ ÇÔ²² ÀÛ¾÷ÇÒ¶§, orbµéÀº ±×µéÀÇ object reference¸¦ ±¸º°ÇÒ ¼ö ÀÖ¾î¾ß Çϸç, ÀÌ °ÍÀº clientÀÇ Ã¥ÀÓÀÌ ¾Æ´Ï´Ù.
2.1.2 client
2.1.3 object implementation
2.1.4 object reference
¡¤orb³»¿¡¼ object¸¦ ±¸ºÐÇϱâ À§Çؼ ÇÊ¿äÇÑ Á¤º¸
¡¤client¿¡°Ô Àü´ÞµÈ object referenceÀÇ instance´Â client°¡ »ì¾ÆÀÖ´Â µ¿¾È¸¸ È¿·ÂÀ» Áö´Ñ´Ù.
2.1.5 omg interface definition language (idl)
¡¤object¿¡ ´ëÇÑ interface¸¸ ±â¼ú
¡¤interface Á¤ÀÇ
exception declaration
type declaration
variable declaration
operation declaration
¡¤idl·ÎºÎÅÍ Æ¯Á¤ ¾ð¾î(c, c++, java)¿Í object systemÀÇ »óÈ£ mapping¿¡ ´ëÇÑ ¹æ¹ý µµÃâ
2.1.6 mapping of omg idl to programming language
¡¤c, c++, java¿¡¼ idl·Î Á¤ÀÇÇÑ object¸¦ È£ÃâÇϱâ À§ÇÑ ¹æ¹ý ±ÔÁ¤
¡¤idl -> stub/skeletion »ý¼º
2.1.7 client stub
2.1.8 dynamin invocation interface
2.1.9 implementation skeleton
2.1.10 dynamic skeleton interface
2.1.11 object adapter
2.1.12 orb interface
2.1.13 interface repository
2.1.14 implementation repository
2.2. structure of client
2.3 structure of object implementation
2.4 structure of object adapter
2.5 integration of foreign object systems
3. µÎ¹øÂ° ½Ã°£, corba implementation - omniorb, orbacus, mico, orbit, ilu
omniorb2 (http://www.orl.co.uk/omniorb/omniorb.html)
omniorb2 from oracle & olivetti has an explicit linux port.
features a c++ idl, uses iiop and the iiop has been tested
with other orb's, is multi-threaded, has a cos name server.
dii work is in progress but not ready.
note: omniorb on linux appears to be the fastest corba
implementation on the planet (commercial and non-commercial)!
omniorb2 source is gpl'ed.
* a (very old, circa dec 1997) patch for omniorb2 from h.j. lu
that helps omniorb2 compile cleanly under linux/egcs/glibc. this patch
will likely be included in version 2.4.0, so check before applying.
orbacus (http://www.ooc.com/ob.html)
the orbacus (omnibroker) from object oriented concepts, inc. offers
java and c++ idl mappings, as well as iiop, dii, dsi (dynamic
skeleton interface), cos, ir, nested method invocation, dynamic any.
has an idl-to-html converter for documentation.
supports threads. includes naming service gui.
third party tools include a cos trading object service and
a scripting language. supports c++ threads. source code is available.
free for non-commercial use, commercial use requires a license.
full support contracts offered.
mico (http://diamant-atm.vsb.cs.uni-frankfurt.de/~mico/)
mico, the recursively named "mico is corba", implements a c++ idl,
dii, dsi, iiop, ir, a full boa, a name server, support for "any" types,
support for loadable modules. includes a graphical ir browser.
source is gpl'ed. pre-compiled versions are available.
current work focuses on a winnt port.
mico/e is an extension of mico for the eiffel programming language.
jacorb (http://www.inf.fu-berlin.de/~brose/jacorb/)
the jacorb is a corba orb written entirely in java.
provides a java idl compiler, supports threads, iiop, ir,
a coss compliant name service, and an alpha-level implementation
of the coss event service. reported to run well under linux,
and to be more standards-compliant than some of the big-name corba
products. free, under gpl.
orbit (http://www.labs.redhat.com/orbit/)
orbit is a very new, very alpha, very early and premature corba
implementation. but its listed prominently here because of
its significance to the open source scene: it is the orb of choice
for the gnome project. in particular, it is notable and laudable
in its attempts to have very high performance when used locally,
and to have a small footprint. the decision to pursue the development
of orbit came after poor experiences with three of the orb's listed
below. one proved to have an unacceptable licensing restriction
for the gpl'ed gnome project, another proved too fat and slow,
and a third was missing critical "c" language bindings. of course,
your reasons for choosing one package over another will be different
than those driving the gnome decision, and so the rejected packages
shall remain unimpunged.
ilu (ftp://beta.xerox.com/pub/ilu/ilu.html)
the ilu (inter-language unification) orb from xerox.
the latest version includes support for iiop, kernel threads,
encryption, and "any". includes idl compilers for c++, ansi c, python,
java, common lisp and modula-3. ilu also includes a self-contained
implementation of onc rpc, making it possible to use existing
rpc services as ilu objects. ilu also includes a self-contained
implementation of http, allowing corba-based web servers and
browsers to be developed. (highly customized, non-generic web servers
are becoming increasingly popular in embedded and special-purpose
applications.) code is available as freeware. beware of the down-level
code located on the linux sunsite
(http://sunsite.unc.edu/pub/linux/devel/corba/) repository
reference :
linux dce, corba and com guide (http://linas.org/linux/corba.html)
corba for beginners (http://www.omg.org/corba/beginners.html)
4. °£´ÜÇÑ corba ¿¹Á¦ (orbacus manual¿¡¼...)
the "hello world" application
4.1 c++
#include <iostream.h>
int main(int, char*[], char*[])
{
cout << "hello world!" << endl;
return 0
}
4.2 java
public class hello
{
public static void main(string args[])
{
system.out.println("hello world!");
}
}
4.3 corba
4.3.1 the idl code : <a ref="hello.idl">hello.idl</a>
--------------------------------------------
1 // idl
2
3 interface hello
4 {
5 void hello();
6 };
--------------------------------------------
3 hello¶ó´Â interface°¡ Á¤ÀǵǾú´Ù.
idl¿¡¼ÀÇ interface´Â c++ÀÇ class·Î mappingµÈ´Ù.
5 hello interfaceÀÇ operationÀº hello() Çϳª»ÓÀ̰í,
parameter³ª return°ªÀº ¾ø´Ù.
4.3.2 implementing the example in c++
À§¿Í °°Àº ³»¿ëÀÇ hello.idl fileÀ» ¸¸µçÈÄ
idl hello.idl
±×·¯¸é, hello.h, hello.cpp, hello_skel.h, hello_skel.cpp ÀÌ·¸°Ô 4°³ÀÇ fileÀÌ »ý±ä´Ù.
¿©±â¼ hello.* fileµéÀº client/object implementation(server) ¾çÂÊ ´Ù ¾²À̰í,
hello_skel.* fileµéÀº object implementation(server)¿¡¼ ¾²ÀδÙ.
4.3.2.1 implementing the server
serverÂÊÀ» ±¸ÇöÇϱâ À§Çؼ´Â hello interface¸¦ À§ÇÑ ±¸Çö class°¡ ÇÊ¿äÇÏ´Ù.
ÀÌ¿¡ skeleton classÀÎ "hello_skel"À¸·ÎºÎÅÍ ÆÄ»ýµÈ hello_impl class¸¦ ¼±¾ðÇÑ´Ù.
hello_impl classÀÇ definition(<a ref="hello_impl.h">hello_impl.h</a>Àº ´ÙÀ½°ú °°´Ù.
--------------------------------------------
1 // c++
2
3 #ifndef hello_impl_h
4 #define hello_impl_h
5
6 #include <hello_skel.h>
7
8 class hello_impl : public hello_skel
9 {
10 public:
11
12 virtual void hello();
13 };
14
15 #endif
--------------------------------------------
6 hello_impl class´Â skeleton classÀÎ hello_skelÀÇ ÆÄ»ý classÀ̹ǷÎ
"hello_skel.h"À» includeÇÑ´Ù.
8 hello_skel class·ÎºÎÅÍ ÆÄ»ýµÈ hello_impl class
12 ±¸Çö classÀÎ hello_implÀº hello.idl¿¡¼ ¼±¾ðµÈ hello interface¿¡ ´ëÇÑ ¸ðµç
operationÀ» ±¸ÇöÇØ¾ßÇÑ´Ù. ¿©±â´Â hello() Çϳª»ÓÀ̹ǷÎ...
hello_impÀÇ ±¸Çö(<a ref="hello_imp.cpp">hello_impl.cpp</a>)´Â ´ÙÀ½°ú °°´Ù.
--------------------------------------------
1 // c++
2
3 #include <ob/corba.h>
4 #include <hello_impl.h>
5
6 void hello_impl::hello()
7 {
8 cout << "hello world!" << endl;
9 }
--------------------------------------------
3 Ç¥ÁØ corba class¿Í ±âŸ utilitiesµéÀ» »ç¿ëÇϱâ À§Çؼ corba.h¸¦ includeÇÑ´Ù.
6-9 hello operationÀÇ ½ÇÁ¦ ±¸ÇöºÎºÐ
ÀÌÁ¦ serverÀÇ main(<a ref="server.cpp">server.cpp</a>)À» ÁغñÇÑ´Ù.
--------------------------------------------
1 #include <ob/corba.h>
2 #include <hello_impl.h>
3
4 #include <fstream.h>
5
6 int main(int argc, char* argv[], char*[])
7 {
8 //
9 // create orb and boa
10 //
11 corba_orb_var orb = corba_orb_init(argc, argv);
12 corba_boa_var boa = orb -> boa_init(argc, argv);
13
14 //
15 // create implementation object
16 //
17 hello_var p = new hello_impl;
18
19 //
20 // save reference
21 //
22 corba_string_var s = orb -> object_to_string(p);
23 const char* reffile = "hello.ref";
24 ofstream out(reffile);
25 out << s << endl;
26 out.close();
27
28 //
29 // run implementation
30 //
31 boa -> impl_is_ready(corba_implementationdef::_nil());
32 }
--------------------------------------------
1-4 corba Ç¥ÁØ class¿Í utilitiesµé À§ÇÑ <ob/corba.h>,
hello_impl classÀÇ Á¤ÀǸ¦ °¡Áö°í ÀÖ´Â hello_impl.h ¸¦ includeÇÑ´Ù.
11,12 corba program¿¡¼ Á¦ÀÏ ¸ÕÀú ÇÏ´Â °ÍÀÌ orb¿Í boa¸¦ ÃʱâÈÇÏ´Â °ÍÀÌ´Ù.
ÀÌ´Â corba_orb_init, boa_init·Î 󸮵ȴÙ. ¾çÂÊ functionµéÀº programÀÌ ½ÃÀÛÇÒ ¶§
ÁÖ´Â optionÀ» parameter·Î ÃëÇÑ´Ù. ÀÌ parameterµéÀÌ ½ÇÁ¦·Î ¾²ÀÌ´ÂÁö ¿©ºÎ´Â
°¢°¢ corba ±¸Çö¿¡ µû¶ó ´Ù¸£´Ù.
17 hello_implÀÇ instance¸¦ »ý¼ºÇÑ´Ù. hello_var¿Í °°ÀÌ _var typeÀº "¿µ¸®ÇÑ" pointer´Ù.
(º¯¼ö p°¡ scope¸¦ ¹þ¾î³¯ ¶§, new hello_impl ¿¬»ê¿¡ ÀÇÇØ¼ »ý¼ºµÇ¾î p¿¡ ÀÇÇØ °¡¸®ÄÑÁö´Â
object¸¦ ÀÚµ¿À¸·Î ÇØÁ¦(release)ÇÑ´Ù.)
22`26 client°¡ ±¸ÇöµÈ object¿¡ Á¢±Ù°¡´ÉÇϱâ À§Çؼ´Â, server(object implementation)ÀÌ ³»³õÀº
stringÈµÈ object reference¸¦ Àоî¼, ´Ù½Ã string¿¡¼ object reference·Î º¯È¯°¡´ÉÇØ¾ßÇÑ´Ù.
(client´Â ÀÌÈÄ object reference·Î [server¿¡ ÀÖ´Â] object¿Í ´ëȸ¦ ÇÑ´Ù.)
¿¬»ê object_to_string()Àº object reference¸¦ stringÀ¸·Î ¹Ù²Ù¾î ÁÖ´Â ¿¬»êÀÌ´Ù.
¿©±â ¿¹Á¦¿¡¼´Â server°¡ stringÈµÈ object reference¸¦ file¾È¿¡ Àû¾î ³õÀ¸¸é,
À̸¦ client°¡ ÀÐÀ½À¸·Î½á object reference¸¦ ÃëÇÑ´Ù.
object reference¸¦ ³»³õ°í ¾ò´Â ¹æ¹ýÀº Á¦ÇÑÀÌ ¾ø´Ù. (Áï, ´Ù¾çÇÏ´Ù.)
31 ¸¶Áö¸·À¸·Î request¿¡ ÀÀ´äÇϱâ À§Çؼ, server´Â impl_is_ready() functionÀ» ºÎ¸§À¸·Î½á event loop¿¡ ÁøÀÔÇÑ´Ù. orbacus´Â impl_is_ready()ÀÇ ÀÎÀÚ¸¦ ¾Æ¹«°Íµµ ¾²Áö ¾ÊÀ¸¹Ç·Î corba_implementationdef::_nil()À» ÀÌ¿ëÇØ¼ dummy parameter¸¦ ³Ö´Â´Ù.
4.3.2.2 implementing client
client(<a ref="client.cpp">client.cpp</a>)´Â server¿¡ implementaionµÈ object¸¦ È£ÃâÇÏ´Â
°Í¸¸ ÇÑ´Ù. µû¶ó¼, server¿¡ ºñÇØ¼ code°¡ Àû´Ù.
--------------------------------------------
1 // c++
2
3 #include <ob/corba.h>
4 #include <hello.h>
5
6 #include <fstream.h>
7
8 int main(int argc, char* argv[], char*[])
9 {
10 //
11 // create orb
12 //
13 corba_orb_var orb = corba_orb_init(argc, argv);
14
15 //
16 // get "hello" object
17 //
18 const char* reffile = "hello.ref";
19 ifstream in(reffile);
20 char s[1000];
21 in >> s;
22
23 corba_object_var obj = orb -> string_to_object(s);
24 hello_var hello = hello::_narrow(obj);
25
26 hello -> hello();
27 }
28
--------------------------------------------
3-4 server¿Í ´Þ¸® hello_impl.h ¸¦ includeÇÏÁö ¾Ê´Â´Ù.
´ÜÁö hello interface¿¡ ´ëÇÑ Á¤ÀǸ¦ ´ã°í ÀÖ´Â hello.h¸¸ ÇÊ¿äÇÏ´Ù.
13 server¿¡¼¿Í °°ÀÌ orb¸¦ ÃʱâÈÇÑ´Ù. boa ÃʱâÈ´Â ÇÊ¿ä¾ø´Ù.
boa´Â server¿¡¼¸¸ ÇÊ¿äÇÏ´Ù.
18-23 stringÈµÈ object reference¸¦ °¡Á®¿Í¼ corba_object object reference·Î º¯È¯ÇÑ´Ù.
24 _narrow ¿¬»êÀº corba_object typeÀ¸·ÎºÎÅÍ hello object reference¸¦ »ý¼ºÇÑ´Ù.
26 ¸¶Áö¸·À¸·Î hello objectÀÇ hello() ¿¬»êÀ» ½ÇÇàÇÑ´Ù.
serverÂÊ¿¡ "hello, world"¶ó°í ÂïÈú °ÍÀÌ´Ù.
4.3.2.3 compiling and linking : <a ref="makefile">makefile</a>
serverÂÊÀ» compileÇϱâ À§Çؼ´Â hello.o, hello_skel.o, hello_impl.o¸¦
server.o¿Í °°ÀÌ linkÇÏ¸é µÈ´Ù. ¹°·Ð orbacus¿¡¼ Á¦°øÇÏ´Â libraryÀÎ libob.a¸¦ °°ÀÌ ¼¯¾î¾ß ÇÑ´Ù. ^^
clientÂÊÀº hello.o¸¸ client.o¿Í °°ÀÌ linkÇÑ´Ù.
4.3.3 implementing the exmple in java
jidl --package hello hello.idl
·Î hello.java, hellohelper.java, helloholder.java, stubforhello.java, _helloimplbase.java
fileÀÌ hello directory¿¡ »ý¼ºÀÌ µÈ´Ù.
4.3.3.1 implementing the server
hello_impÀÇ ±¸Çö(<a ref="hello_imp.java">hello_impl.java</a>)´Â ´ÙÀ½°ú °°´Ù.
--------------------------------------------
1 // java
2
3 package hello;
4
5 import org.omg.corba.*;
6
7 public class hello_impl extends _helloimplbase
8 {
9 public void hello()
10 {
11 system.out.println("hello world!");
12 }
13 }
--------------------------------------------
7 hello_impl class´Â _helloimplbaes·ÎºÎÅÍ ÆÄ»ýµÇ¾î¾ß ÇÑ´Ù.
ÀÌÁ¦ serverÀÇ main(<a ref="server.java">server.java</a>)À» ÁغñÇÑ´Ù.
--------------------------------------------
1 // java
2
3 package hello;
4
5 import org.omg.corba.*;
6 import java.io.*;
7 import java.util.*;
8
9 public class server
10 {
11 public static void main(string args[])
12 {
13 //
14 // create orb and boa
15 //
16 orb orb = orb.init(args, props);
17 boa boa = ((com.ooc.corba.orb)orb).boa_init(args, props);
18
19 //
20 // create implementation object
21 //
22 hello_impl p = new hello_impl();
23
24 //
25 // save reference
26 //
27 try
28 {
29 string ref = orb.object_to_string(p);
30 string reffile = "hello.ref";
31 fileoutputstream file = new fileoutputstream(reffile);
32 printwriter out = new printwriter(file);
33 out.println(ref);
34 out.flush();
35 file.close();
36 }
37 catch(ioexception ex)
38 {
39 system.err.println("can't write to `" +
40 ex.getmessage() + "'");
41 system.exit(1);
42 }
43
44 //
45 // run implementation
46 //
47 boa.impl_is_ready(null);
48 }
49 }
--------------------------------------------
4.3.3.2 implementing the client
ÀÌÁ¦ clientÀÇ main(<a ref="client.java">client.java</a>).
--------------------------------------------
1 // java
2
3 package hello;
4
5 import org.omg.corba.*;
6 import java.io.*;
7 import java.util.*;
8 import java.awt.*;
9 import java.awt.event.*;
10
11 public class client extends java.applet.applet implements actionlistener
12 {
13 public static void main(string args[])
14 {
15 //
16 // create orb
17 //
18 orb orb = orb.init(args, props);
19
20 //
21 // get "hello" object
22 //
23 string ref = null;
24 try
25 {
26 string reffile = "hello.ref";
27 fileinputstream file = new fileinputstream(reffile);
28 bufferedreader in =
29 new bufferedreader(new inputstreamreader(file));
30 ref = in.readline();
31 file.close();
32 }
33 catch(ioexception ex)
34 {
35 system.err.println("can't read from `" +
36 ex.getmessage() + "'");
37 system.exit(1);
38 }
39
40 org.omg.corba.object obj = orb.string_to_object(ref);
41
42 hello p = hellohelper.narrow(obj);
43
44 p.hello();
45 }
46 }
--------------------------------------------
4.3.3.3 compiling & running
javac *.java hello/*.java ·Î server°Ç client°Ç ÀüºÎ compileÇÏÀÚ.
±×¸®°í, orbacus¿¡¼ Á¦°øÇÏ´Â java class¸¦ classpath¿¡ ³Ö¾îÁÖ¾î¾ß ÇÑ´Ù.
classpath=your_orbacus_directory/lib/ob.jar:$classpath
export classpath
(±×°Í ±ÍÂú´Ù¸é, jdk_directory/lib ¿¡ jar xf ob.jar·Î ÀüºÎ Ç®¾îÁÖ¸é
classpath¸¦ ÁöÁ¤ÇÒ Çʿ䰡 ¾ø¾îÁø´Ù.)
4.4 º¸´Ù º¹ÀâÇÑ corba
À§ ¿¹Á¦´Â ÇÑ server³»¿¡¼ ¹ú¾îÁö´Â °ÍÀ» ±â¼úÇÑ °ÍÀÌ´Ù.
ÇÏÁö¸¸, ½ÇÁ¦ ¾²ÀÌ´Â °ÍÀº ¼·Î ´Ù¸¥ À§Ä¡»ó¿¡¼ object reference¸¦ °¡Á®¿À´Â ¹æ¹ýÀ̶óµçÁö
dii¸¦ »ç¿ëÇÑ ¿¹Á¦µîÀº º¸ÀÌÁö ¾Ê´Â´Ù.
¶Ç, corbaÀÇ basic serverµéÀÎ
the naming service
the property service
the event service
¿¡ ´ëÇÑ ¼³¸íµµ, factory, reactor, policyµî¿¡ ´ëÇÑ ¼³¸íµµ ½ï »©¸Ô¾ú´Ù.
±×¸®°í, ilu³ª mico¿Í ºñ±³µµ ÇÏÁö ¸øÇÑ °ÍÀÌ ¾Æ½¬¿òÀ¸·Î ³²´Â´Ù.
tolkienÀÔ´Ï´Ù.
²¿¶ûÁö. Çϳª. tolkien@nownuri.net ¶Ç´Â tolkien@samsung.co.kr
·ê. copyleft by gpl.