Copyright (C) 2000-2012 |
Manpages tnameservSection: User Commands (1)Updated: 2000 ǯ 7 ·î 28 Æü Index Return to Main Contents ̾Á°tnameserv - Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤Îµ¯Æ°¥¹¥¯¥ê¥×¥È·Á¼°tnameserv -ORBInitialPort port_numberµ¡Ç½ÀâÌÀCORBA ¤Î COS (Common Object Services) ¥Í¡¼¥à¥µ¡¼¥Ó¥¹ ¤Ï¡¢¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥Ç¥£¥ì¥¯¥È¥ê ¹½Â¤¤òÄ󶡤·¤Æ¤¤¤ë¤Î¤ÈƱ¤¸¤è¤¦¤Ë¡¢¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤ËÂФ·¤Æ¥Ä¥ê¡¼¹½Â¤¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òÄ󶡤· ¤Þ¤¹¡£Java IDL ¤Î¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤Ï¡¢ COS ¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤Î»ÅÍͤòñ½ã¤Ê·Á¤Ç¼ÂÁõ¤·¤¿¤â¤Î¤Ç¤¹¡£¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤Ï̾Á°¶õ´Ö¤Ë̾Á°¤Ç³ÊǼ¤µ¤ì¡¢¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤È̾Á°¤ÎÁȤϡ¢ ¤½¤ì¤¾¤ì¡Ö¥Í¡¼¥à¥Ð¥¤¥ó¥Ç¥£¥ó¥°¡×¤È¸Æ¤Ð¤ì¤Þ¤¹¡£¥Í¡¼¥à¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤Ï¡Ö¥Í¡¼¥ß ¥ó¥°¥³¥ó¥Æ¥¥¹¥È¡×¤ËÁȤ߹þ¤à¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤Ï¤½¤ì¼«ÂÎ ¤¬¥Í¡¼¥à¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤Ç¤¢¤ê¡¢¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤ÈƱ¤¸ÊÔÀ®µ¡ ǽ¤ò»ý¤Á¤Þ¤¹¡£¤¹¤Ù¤Æ¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤Ï¡Ö½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¡×¤Ë³ÊǼ¤µ ¤ì¤Þ¤¹¡£Ì¾Á°¶õ´Ö¤Ë¤ª¤¤¤Æ¡¢½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤ÏÍ£°ì¤Î»ý³Ū¥Ð¥¤¥ó ¥Ç¥£¥ó¥°¤Ç¤¹¡£¤½¤ì°Ê³°¤Î¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤Ï¡¢Java IDL ¤Î¥Í¡¼¥à¥µ¡¼¥Ð¥×¥í¥»¥¹¤¬Ää»ß¤·¡¢ºÆµ¯Æ°¤µ¤ì¤ë¤È¼º¤ï¤ì¤Þ¤¹¡£ ¥¢¥×¥ì¥Ã¥È¤Þ¤¿¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é COS ¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤ò»ÈÍѤ¹¤ë¤¿¤á¤Ë¤Ï¡¢¤½¤Î ORB ¤Ï¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤¬Æ°ºî¤·¤Æ¤¤¤ë¥Û¥¹¥È¤Î̾Á°¤È¥Ý¡¼¥È¤òÃΤäƤ¤¤ë¤«¡¢¤½¤Î¥Í¡¼¥à¥µ¡¼¥Ð¤Î ʸ»úÎ󲽤µ¤ì¤¿½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤Ï¡¢Java IDL ¤Î¥Í¡¼¥à¥µ¡¼¥Ð¤Ç¤â¤½¤Î¾¤Î COS ½àµò¤Î¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£ »ÈÍÑÊýË¡Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤Îµ¯Æ°Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤Ï¡¢¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤ò»ÈÍѤ¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Þ¤¿¤Ï¥¢¥×¥ì¥Ã¥È¤è¤êÁ°¤Ë µ¯Æ°¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£Java IDL À½Éʤò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤È¡¢Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤òµ¯Æ°¤¹¤ë¥¹¥¯¥ê¥×¥È (tnameserv) ¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç Æ°ºî¤¹¤ë¤è¤¦¤Ë¡¢¥Í¡¼¥à¥µ¡¼¥Ð¤òµ¯Æ°¤·¤Æ¤¯¤À¤µ¤¤¡£Æä˻ØÄꤷ¤Ê¤¤¾ì¹ç¡¢Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤Ï¡¢ ORB ¤Î resolve_initial_references() ¥á¥½¥Ã¥É¤È list_initial_references() ¥á¥½¥Ã¥É¤Î¼ÂÁõ¤Ë»ÈÍѤ¹¤ë¥Ö¡¼¥È¥¹¥È¥é¥Ã¥×¥×¥í¥È¥³¥ë¤ËÂФ·¤Æ¥Ý¡¼¥È 900 ¤ÇÂÔµ¡¤·¤Þ¤¹¡£ ¤Û¤«¤Î¥Ý¡¼¥È ( 1050 ¤Ê¤É) ¤ò»ØÄꤹ¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
¥Í¡¼¥à¥µ¡¼¥Ð¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ë¤Ï¡¢¿·¤·¤¤¥Ý¡¼¥ÈÈÖ¹æ¤òÃΤ餻¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢ ORB ¥ª¥Ö¥¸¥§¥¯¥È¤ÎºîÀ®»þ¤Ë org.omg.CORBA.ORBInitialPort ¥×¥í¥Ñ¥Æ¥£¤Ë¿·¤·¤¤¥Ý¡¼¥ÈÈÖ¹æ¤òÀßÄꤷ¤Þ¤¹¡£ Java IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤ÎÄä»ßJava IDL ¥Í¡¼¥à¥µ¡¼¥Ð¤òÄä»ß¤¹¤ë¤Ë¤Ï¡¢ kill(1) ¤Ê¤É¤Î¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¤Î¥³¥Þ¥ó¥É¤ò»È¤¤¤Þ¤¹¡£¤Ê¤ª¡¢¥Í¡¼¥à¥µ¡¼¥Ð¤ò½ªÎ»¤µ¤»¤ë¤È¡¢ Java IDL ¥Í¡¼¥à¥µ¡¼¥Ó¥¹¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë̾Á°¤Ï¼º¤ï¤ì¤Þ¤¹¡£¥µ¥ó¥×¥ë¥¯¥é¥¤¥¢¥ó¥È: ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÄɲðʲ¼¤Ë¼¨¤¹¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï¡¢Ì¾Á°¤ò̾Á°¶õ´Ö¤ËÄɲ乤ëÊýË¡¤ò¼¨¤¹¤â¤Î¤Ç¤¹¡£ ¤³¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï¡¢¤³¤Î¤Þ¤Þ¤Î¾õÂ֤Ǵ°Á´¤ËÆ°ºî¤¹¤ë¥Í¡¼¥à¥µ¡¼¥Ð¥¯¥é¥¤¥¢¥ó¥È¤Ç¡¢ ¼¡¤Î¤è¤¦¤Êñ½ã¤Ê¥Ä¥ê¡¼¤òºîÀ®¤¹¤ë¤â¤Î¤Ç¤¹¡£½é´ü ¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È / \ / \ plans Personal /\ / \ calendar schedule¤³¤ÎÎã¤Ç¡¢ plans ¤Ï¥ª¥Ö¥¸¥§¥¯¥È»²¾È¡¢ Personal ¤Ï calendar ¤È schedule ¤Î 2 ¤Ä ¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤¬´Þ¤Þ¤ì¤ë¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤Ç¤¹¡£ import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClient { public static void main(String args[]) { try {Á°½Ò¤Î¡Ö JavaIDL¥Í¡¼¥à¥µ¡¼¥Ð¤Îµ¯Æ° ¡×¤Ç¤Ï¡¢¥Í¡¼¥à¥µ¡¼¥Ð¤Ï¥Ý¡¼¥È 1050 ¤ò»ÈÍѤ·¤Æµ¯Æ°¤·¤Þ¤·¤¿¡£¼¡¤Î¥³¡¼¥É¤Ç¡¢¤³¤Î¥Ý¡¼¥È ÈÖ¹æ¤ò¥¯¥é¥¤¥¢¥ó¥È¥×¥í¥°¥é¥à¤ËÃΤ餻¤Þ¤¹¡£ Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props);¼¡¤Î¥³¡¼¥É¤Ç¤Ï¡¢½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤ò¼èÆÀ¤·¡¢¤½¤ì¤ò ctx ¤ËÂåÆþ¤·¤Þ¤¹¡£2 ¹ÔÌܤǤϡ¢ ctx ¤ò¥À¥ß¡¼¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È objref ¤Ë¥³¥Ô¡¼¤·¤Þ¤¹¡£¤³¤Î objref ¤Ë¤Ï¡¢¤¢¤È¤Ç¤µ¤Þ¤¶¤Þ¤Ê̾Á°¤ò³ä¤êÅö¤Æ¤Æ̾Á°¶õ´Ö¤ËÄɲä·¤Þ¤¹¡£ NamingContext ctx = NamingContextHelper.narrow (orb.resolve_initial_references("NameService")); NamingContext objref = ctx;¼¡¤Î¥³¡¼¥É¤Ç¤Ï¡¢text ·¿¤Î̾Á°¡Öplans¡×¤òºîÀ®¤·¡¢¤½¤ì¤ò¥À¥ß¡¼¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤Ë¥Ð¥¤¥ó¥É¤·¤Þ¤¹¡£ ¤½¤Î¸å¡¢ rebind ¤ò»ÈÍѤ·¤Æ½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤Î²¼¤Ë¡Öplans¡×¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£ rebind ¥á¥½¥Ã¥É¤ò»ÈÍѤ¹¤ì¤Ð¡¢ bind ¤ò»ÈÍѤ·¤¿¾ì¹ç¤ËȯÀ¸¤¹¤ëÎã³°¤òȯÀ¸¤µ¤»¤º¤Ë¡¢¤³¤Î¥×¥í¥°¥é¥à¤ò²¿Å٤ⷫ¤êÊÖ¤·¼Â¹Ô¤Ç¤¤Þ¤¹¡£ NameComponent nc1 = new NameComponent("plans", "text"); NameComponent[] name1 = {nc1}; ctx.rebind(name1, objref); System.out.println("plans rebind sucessful!");¼¡¤Î¥³¡¼¥É¤Ç¤Ï¡¢directory ·¿¤Î¡ÖPersonal¡×¤È¤¤¤¦¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤òºîÀ®¤·¤Þ¤¹¡£ ¤½¤Î·ë²ÌÆÀ¤é¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È»²¾È ctx2 ¤ò¤³¤Î̾Á°¤Ë¥Ð¥¤¥ó¥É¤·¡¢½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤ËÄɲä·¤Þ¤¹¡£ NameComponent nc2 = new NameComponent("Personal", "directory"); NameComponent[] name2 = {nc2}; NamingContext ctx2 = ctx.bind_new_context(name2); System.out.println("new naming context added..");»Ä¤ê¤Î¥³¡¼¥É¤Ç¤Ï¡¢¥À¥ß¡¼¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤ò¡Öschedule¡×¤È¡Öcalendar¡×¤È¤¤¤¦Ì¾Á°¤Ç¥Í¡¼¥ß ¥ó¥°¥³¥ó¥Æ¥¥¹¥È¡ÖPersonal¡× (ctx2) ¤Ë¥Ð¥¤¥ó¥É¤·¤Þ¤¹¡£ NameComponent nc3 = new NameComponent("schedule", "text"); NameComponent[] name3 = {nc3}; ctx2.rebind(name3, objref); System.out.println("schedule rebind sucessful!"); NameComponent nc4 = new NameComponent("calender", "text"); NameComponent[] name4 = {nc4}; ctx2.rebind(name4, objref); System.out.println("calender rebind sucessful!"); } catch (Exception e) { e.printStackTrace(System.err); } } } ¥µ¥ó¥×¥ë¥¯¥é¥¤¥¢¥ó¥È: ̾Á°¶õ´Ö¤Î¥Ö¥é¥¦¥º¼¡¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ç¤Ï¡¢Ì¾Á°¶õ´Ö¤ò¥Ö¥é¥¦¥º¤¹¤ëÊýË¡¤ò¼¨¤·¤Þ¤¹¡£import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClientList { public static void main(String args[]) { try {Á°½Ò¤Î¡Ö JavaIDL¥Í¡¼¥à¥µ¡¼¥Ð¤Îµ¯Æ° ¡×¤Ç¡¢¥Í¡¼¥à¥µ¡¼¥Ð¤Ï¥Ý¡¼¥È 1050 ¤ò»ÈÍѤ·¤Æµ¯Æ°¤·¤Þ¤·¤¿¡£¼¡¤Î¥³¡¼¥É¤Ç¡¢¤³¤Î¥Ý¡¼¥ÈÈÖ¹æ¤ò¥¯¥é¥¤¥¢¥ó¥È¥×¥í¥°¥é¥à¤ËÃΤ餻¤Þ¤¹¡£ Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props);¼¡¤Î¥³¡¼¥É¤Ç¤Ï¡¢½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£ NamingContext nc = NamingContextHelper.narrow (orb.resolve_initial_references("NameService"));list ¥á¥½¥Ã¥É¤Ï¡¢¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤ËÄɲ䵤ì¤Æ¤¤¤ë¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò¥ê¥¹¥È¤·¤Þ¤¹¡£ ¤³¤Î¾ì¹ç¡¢ºÇÂç 1000 ¸Ä¤Þ¤Ç¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤¬½é´ü¥Í¡¼¥ß¥ó¥°¥³¥ó¥Æ¥¥¹¥È¤«¤é BindingListHolder ¤ËÊÖ¤µ¤ì¤Þ¤¹¡£»Ä¤ê¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤Ï¡¢ BindingIteratorHolder ¤ËÊÖ¤µ¤ì¤Þ¤¹¡£ BindingListHolder bl = new BindingListHolder(); BindingIteratorHolder blIt= new BindingIteratorHolder(); nc.list(1000, bl, blIt);¼¡¤Î¥³¡¼¥É¤Ç¤Ï¡¢ÊÖ¤µ¤ì¤¿ BindingListHolder ¤«¤é¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ÎÇÛÎó¤ò¼èÆÀ¤·¤Þ¤¹¡£¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤¬¤Ê¤¤¾ì¹ç¤Ï¡¢¥×¥í¥°¥é¥à¤Ï½ªÎ»¤·¤Þ¤¹¡£ Binding bindings[] = bl.value; if (bindings.length == 0) return;»Ä¤ê¤Î¥³¡¼¥É¤Ç¤Ï¡¢¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ËÂФ·¤Æ¥ë¡¼¥×½èÍý¤ò¹Ô¤¤¡¢Ì¾Á°¤ò½ÐÎϤ·¤Þ¤¹¡£ for (int i=0; i < bindings.length; i++) { // get the object reference for each binding org.omg.CORBA.Object obj = nc.resolve (bindings[i].binding_name); String objStr = orb.object_to_string(obj); int lastIx = bindings[i].binding_name.length-1; // check to see if this is a naming context if (bindings[i].binding_type == BindingType.ncontext) { System.out.println ("Context: " + bindings[i].binding_name[lastIx].id); } else { System.out.println ("Object: " + bindings[i].binding_name[lastIx].id); } } } catch (Exception e) { e.printStackTrace(System.err); } } } ´ØÏ¢¹àÌÜkill(1)
IndexThis document was created by man2html, using the manual pages. Time: 10:33:49 GMT, November 12, 2024 |