Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Cyber Angels

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 193 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

tnameserv



SYNOPSIS

       tnameserv -ORBInitialPort port_number


DESCRIPTION

       The CORBA COS (Common Object Services) Naming Service pro­
       vides a tree-like directory  for  object  references  much
       like  a  filesystem  provides  a  directory  structure for
       files.  The Naming Service provided with  Java  IDL  is  a
       simple implementation of the COS Naming Service specifica­
       tion.

       Object references are stored in the namespace by name  and
       each  object reference-name pair is called a name binding.
       Name bindings may  be  organized  under  naming  contexts.
       Naming contexts are themselves name bindings and serve the
       same organizational function as a  file  system  subdirec­
       tory.   All  bindings  are stored under the initial naming
       context.  The initial naming context is the  only  persis­
       tent  binding  in the namespace; the rest of the namespace
       is lost if the Java IDL  name  server  process  halts  and
       restarts.

       For  an  applet  or application to use COS naming, its ORB
       must know the name and port of a  host  running  a  naming
       service  or  have  access  to a stringified initial naming
       context for that name  server.   The  naming  service  can
       either  be the Java IDL name server or another COS-compli­
       ant name service.


USAGE

   Starting the Java IDL Name Server
       You must start the Java IDL name server before an applica­
       tion or applet that uses its naming service.  Installation
       of the Java IDL product creates a script  named  tnameserv
       that  starts  the  Java  IDL  name server.  Start the name
       server so it runs in the background.

       If you do not specify otherwise, the Java IDL name  server
       listens  on  port  900  for the bootstrap protocol used to
       implement   the   ORB   resolve_initial_references()   and
       list_initial_references()  methods.   Specify  a different
       port, for example, 1050, as follows:

              example% tnameserv -ORBInitialPort 1050

       Clients of the name server must be made aware of  the  new
       port number.  Do this by setting the org.omg.CORBA.ORBIni­
       tialPort property to the new port number when creating the
       ORB object.

   Stopping the Java IDL Name Server
       To stop the Java IDL name server, use the relevant operat­
                      \
                       \
               calendar   schedule

       In this example, "plans" is an object reference and  "per­
       sonal" is a naming context that contains two object refer­
       ences: "calendar" and "schedule".

       import java.util.Properties;
       import org.omg.CORBA.*;
       import org.omg.CosNaming.*;

       public class NameClient
       {
          public static void main(String args[])
          {
             try {

       In the above section, Starting the Java IDL  Name  Server,
       the  nameserver  was  started on port 1050.  The following
       code ensures that the client program is aware of this port
       number.

               Properties props = new Properties();
               props.put("org.omg.CORBA.ORBInitialPort", "1050");
               ORB orb = ORB.init(args, props);

       The  following code obtains the initial naming context and
       assigns it to ctx.  The second  line  copies  ctx  into  a
       dummy  object  reference,  objref,  that we will attach to
       various names and add into the namespace.

               NamingContext ctx = NamingContextHelper.narrow
                   (orb.resolve_initial_references("NameService"));
               NamingContext objref = ctx;

       The following code creates a name "plans" of  type  "text"
       and  binds  it  to our dummy object reference.  "plans" is
       then added under the initial naming context using  rebind.
       The  rebind  method allows us to run this program over and
       over again without getting the  exceptions  we  would  get
       from using bind.

               NameComponent nc1 = new NameComponent("plans", "text");
               NameComponent[] name1 = {nc1};
               ctx.rebind(name1, objref);
               System.out.println("plans rebind sucessful!");

       The  following  code creates a naming context called "Per­
       sonal" of type "directory".  The resulting  object  refer­
       ence,  ctx2, is bound to the name and added under the ini­
       tial naming context.

               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);
           }
         }
       }

   Sample Client: Browsing the Namespace
       The following sample program illustrates how to browse the
       namespace.

       import java.util.Properties;
       import org.omg.CORBA.*;
       import org.omg.CosNaming.*;

       public class NameClientList
       {
          public static void main(String args[])
          {
             try {

       In  the  above section, Starting the Java IDL Name Server,
       the nameserver was started on port  1050.   The  following
       code ensures that the client program is aware of this port
       number.

               Properties props = new Properties();
               props.put("org.omg.CORBA.ORBInitialPort", "1050");
               ORB orb = ORB.init(args, props);

       The following code obtains the initial naming context.

               NamingContext nc = NamingContextHelper.narrow
                  (orb.resolve_initial_references("NameService"));

       The list method lists the bindings in the naming  context.
       In  this case, up to 1000 bindings from the initial naming
       context will be returned  in  the  BindingListHolder;  any
       remaining  bindings  are  returned  in  the  BindingItera­
       torHolder.

               BindingListHolder bl = new BindingListHolder();
               BindingIteratorHolder blIt= new BindingIteratorHolder();
               nc.list(1000, bl, blIt);

       The following code gets the array of bindings out  of  the
                   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);
              }
          }
       }


SEE ALSO

       kill(1)

                           13 June 2000              tnameserv(1)
  

There are several different ways to navigate the tutorial.


Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can get all the latest Site and Linux news by checking out our news page.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.06 Seconds