Java Code Examples for org.omg.CosNaming.NamingContext

The following are top voted examples for showing how to use org.omg.CosNaming.NamingContext. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 2
Project: OpenJSharp   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 3
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 4
Project: openjdk-jdk10   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 5
Project: openjdk9   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 6
Project: openjdk9   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 7
Project: lookaside_java-1.8.0-openjdk   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 8
Project: lookaside_java-1.8.0-openjdk   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 9
Project: jdk8u_corba   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 10
Project: jdk8u_corba   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 11
Project: javify   File: PersistentContext.java   View source code 6 votes vote down vote up
/**
 * Create a new context and give it a given name (bound it) in the current
 * context. The method benefits from passing the better readable context name.
 *
 * @param a_name the name being given to the new context.
 * @return the newly created context.
 * @throws AlreadyBound if the name is already in use.
 * @throws InvalidName if the name has zero length or otherwise invalid.
 */
public NamingContext bind_new_context(NameComponent[] a_name)
    throws NotFound, AlreadyBound, CannotProceed, InvalidName
{
  if (named_contexts.containsKey(a_name[0])
      || named_objects.containsKey(a_name[0]))
    throw new AlreadyBound();

  NameTransformer transformer = new NameTransformer();

  File ctxFolder = new File(contextFolder,
                            transformer.toString(a_name).replace('/', '.')
                                + ".v" + getNum());

  NamingContext child = new PersistentContext(orb, ctxFolder, true);
  bind_context(a_name, child);
  return child;
}
 
Example 12
Project: javify   File: ContextContinuation.java   View source code 6 votes vote down vote up
/**
 * Creates and returns the enumeration over the name - object bindings that
 * are present the given subcontext. The enumeration elements have the type of
 * {@link Binding}, providing also information about the class of the bound
 * object. The behaviour in the case if the bindings are added or removed
 * later is not defined. The contents of the subcontexts are not included.
 *
 * @param name
 *          the name of the subcontext
 * @return the enumeration over the names, known for the given subcontext.
 * @throws NamingException
 */
public NamingEnumeration listBindings(Name name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  if (name.size() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }
    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 13
Project: jvm-stm   File: PersistentContext.java   View source code 6 votes vote down vote up
/**
 * Create a new context and give it a given name (bound it) in the current
 * context. The method benefits from passing the better readable context name.
 * 
 * @param a_name the name being given to the new context.
 * @return the newly created context.
 * @throws AlreadyBound if the name is already in use.
 * @throws InvalidName if the name has zero length or otherwise invalid.
 */
public NamingContext bind_new_context(NameComponent[] a_name)
    throws NotFound, AlreadyBound, CannotProceed, InvalidName
{
  if (named_contexts.containsKey(a_name[0])
      || named_objects.containsKey(a_name[0]))
    throw new AlreadyBound();

  NameTransformer transformer = new NameTransformer();

  File ctxFolder = new File(contextFolder,
                            transformer.toString(a_name).replace('/', '.')
                                + ".v" + getNum());

  NamingContext child = new PersistentContext(orb, ctxFolder, true);
  bind_context(a_name, child);
  return child;
}
 
Example 14
Project: jvm-stm   File: ContextContinuation.java   View source code 6 votes vote down vote up
/**
 * Creates and returns the enumeration over the name - object bindings that
 * are present the given subcontext. The enumeration elements have the type of
 * {@link Binding}, providing also information about the class of the bound
 * object. The behaviour in the case if the bindings are added or removed
 * later is not defined. The contents of the subcontexts are not included.
 * 
 * @param name
 *          the name of the subcontext
 * @return the enumeration over the names, known for the given subcontext.
 * @throws NamingException
 */
public NamingEnumeration listBindings(Name name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  if (name.size() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }
    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 15
Project: infobip-open-jdk-8   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 16
Project: infobip-open-jdk-8   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 17
Project: openjdk-source-code-learn   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 18
Project: openjdk-source-code-learn   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 19
Project: OLD-OpenJDK8   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 20
Project: OLD-OpenJDK8   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 21
Project: JamVM-PH   File: PersistentContext.java   View source code 6 votes vote down vote up
/**
 * Create a new context and give it a given name (bound it) in the current
 * context. The method benefits from passing the better readable context name.
 * 
 * @param a_name the name being given to the new context.
 * @return the newly created context.
 * @throws AlreadyBound if the name is already in use.
 * @throws InvalidName if the name has zero length or otherwise invalid.
 */
public NamingContext bind_new_context(NameComponent[] a_name)
    throws NotFound, AlreadyBound, CannotProceed, InvalidName
{
  if (named_contexts.containsKey(a_name[0])
      || named_objects.containsKey(a_name[0]))
    throw new AlreadyBound();

  NameTransformer transformer = new NameTransformer();

  File ctxFolder = new File(contextFolder,
                            transformer.toString(a_name).replace('/', '.')
                                + ".v" + getNum());

  NamingContext child = new PersistentContext(orb, ctxFolder, true);
  bind_context(a_name, child);
  return child;
}
 
Example 22
Project: JamVM-PH   File: ContextContinuation.java   View source code 6 votes vote down vote up
/**
 * Creates and returns the enumeration over the name - object bindings that
 * are present the given subcontext. The enumeration elements have the type of
 * {@link Binding}, providing also information about the class of the bound
 * object. The behaviour in the case if the bindings are added or removed
 * later is not defined. The contents of the subcontexts are not included.
 * 
 * @param name
 *          the name of the subcontext
 * @return the enumeration over the names, known for the given subcontext.
 * @throws NamingException
 */
public NamingEnumeration listBindings(Name name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  if (name.size() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }
    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 23
Project: openjdk-orb   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 24
Project: openjdk-orb   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 25
Project: c6231   File: OfficerClient.java   View source code 6 votes vote down vote up
/**
 * Connect to the RMI server
 *
 * @throws RemoteException
 */
public void connect() {
    try {
        // ghetto hardcode the parameters
        ORB orb = ORB.init(new String[]{"-ORBInitialHost", "localhost", "-ORBInitialPort", "8989"}, null);

        org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
        NamingContext ncRef = NamingContextHelper.narrow(objRef);

        NameComponent nc = new NameComponent(station, "");
        NameComponent path[] = {nc};
        instance = StationInterfaceHelper.narrow(ncRef.resolve(path));

        this.log.log("Connected!");
    } catch (Exception ex) {
        log.log(ex.toString() + ex.getMessage());
    }
}
 
Example 26
Project: classpath   File: PersistentContext.java   View source code 6 votes vote down vote up
/**
 * Create a new context and give it a given name (bound it) in the current
 * context. The method benefits from passing the better readable context name.
 *
 * @param a_name the name being given to the new context.
 * @return the newly created context.
 * @throws AlreadyBound if the name is already in use.
 * @throws InvalidName if the name has zero length or otherwise invalid.
 */
public NamingContext bind_new_context(NameComponent[] a_name)
    throws NotFound, AlreadyBound, CannotProceed, InvalidName
{
  if (named_contexts.containsKey(a_name[0])
      || named_objects.containsKey(a_name[0]))
    throw new AlreadyBound();

  NameTransformer transformer = new NameTransformer();

  File ctxFolder = new File(contextFolder,
                            transformer.toString(a_name).replace('/', '.')
                                + ".v" + getNum());

  NamingContext child = new PersistentContext(orb, ctxFolder, true);
  bind_context(a_name, child);
  return child;
}
 
Example 27
Project: classpath   File: ContextContinuation.java   View source code 6 votes vote down vote up
/**
 * Creates and returns the enumeration over the name - object bindings that
 * are present the given subcontext. The enumeration elements have the type of
 * {@link Binding}, providing also information about the class of the bound
 * object. The behaviour in the case if the bindings are added or removed
 * later is not defined. The contents of the subcontexts are not included.
 *
 * @param name
 *          the name of the subcontext
 * @return the enumeration over the names, known for the given subcontext.
 * @throws NamingException
 */
public NamingEnumeration listBindings(Name name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  if (name.size() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve(toGiop(name))));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }
    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 28
Project: openjdk-icedtea7   File: NamingContextImpl.java   View source code 6 votes vote down vote up
/**
 * Create a NamingContext object and return its object reference.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public synchronized NamingContext new_context()
{
    // Create actually creates a new naming context
    lifecycleLogger.fine( "Creating New Naming Context " );
    NamingContextDataStore impl = (NamingContextDataStore)this;
    synchronized (impl) {
        NamingContext nctx = impl.NewContext();
        if( nctx != null ) {
            lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
        } else {
            // If naming context is null, then that must be a serious
            // error.
            lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
        }
        return nctx;
    }
}
 
Example 29
Project: openjdk-icedtea7   File: NameServer.java   View source code 6 votes vote down vote up
protected void run()
{
    try {

        // create the persistent name service
        NameService ns = new NameService(orb, dbDir);

        // add root naming context to initial naming
        NamingContext rootContext = ns.initialNamingContext();
        InitialNameService ins = InitialNameServiceHelper.narrow(
                                 orb.resolve_initial_references(
                                 ORBConstants.INITIAL_NAME_SERVICE_NAME ));
        ins.bind( "NameService", rootContext, true);
        System.out.println(CorbaResourceUtil.getText("pnameserv.success"));

        // wait for invocations
        orb.run();

    } catch (Exception ex) {

        ex.printStackTrace(System.err);
    }
}
 
Example 30
Project: sensors_reading_DS   File: ServiceServant.java   View source code 6 votes vote down vote up
public ServiceServant(NamingContext namingContext, ORB orb) {
	super();

	this.namingContext = namingContext;

	clientUpdater = new ClientUpdater(orb);

	try {
		final Thread clientUpdaterThread = new Thread(clientUpdater);
		clientUpdaterThread.start();
		//clientUpdaterThread.join();
	} catch (Exception e) {
		System.out.println(e.getMessage());
	}

	this.serviceGUI = new ServiceGUI();
	this.serviceGUI.setVisible(true);
}
 
Example 31
Project: OpenJSharp   File: NameServiceStartThread.java   View source code 5 votes vote down vote up
public void run( )
{
    try {
        // start Name Service
        NameService nameService = new NameService(orb, dbDir );
        NamingContext rootContext = nameService.initialNamingContext();
        orb.register_initial_reference(
            ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
    } catch( Exception e ) {
        System.err.println(
            "NameService did not start successfully" );
        e.printStackTrace( );
    }
}
 
Example 32
Project: OpenJSharp   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param obj the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example 33
Project: OpenJSharp   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Create a new NamingContext, bind it in this Naming Context and return
 * its object reference. This is equivalent to using new_context() followed
 * by bind_context() with the supplied name and the object reference for
 * the newly created NamingContext.
 * @param n a sequence of NameComponents which is the name to be unbound.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server, bound to the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 * is already bound under the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see new_context
 * @see bind_context
 */
public  NamingContext bind_new_context(NameComponent[] n)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.AlreadyBound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    NamingContext nc = null;
    NamingContext rnc = null;
    try {
        if (debug)
            dprint("bind_new_context " + nameToString(n));
        // The obvious solution:
        nc = this.new_context();
        this.bind_context(n,nc);
        rnc = nc;
        nc = null;
    } finally {
        try {
            if(nc != null)
                nc.destroy();
        } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
        }
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine ( LogKeywords.NAMING_BIND +
            "New Context Bound To " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
    return rnc;
}
 
Example 34
Project: OpenJSharp   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example 35
Project: openjdk-jdk10   File: NameServiceStartThread.java   View source code 5 votes vote down vote up
public void run( )
{
    try {
        // start Name Service
        NameService nameService = new NameService(orb, dbDir );
        NamingContext rootContext = nameService.initialNamingContext();
        orb.register_initial_reference(
            ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
    } catch( Exception e ) {
        System.err.println(
            "NameService did not start successfully" );
        e.printStackTrace( );
    }
}
 
Example 36
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param nc the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example 37
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Create a new NamingContext, bind it in this Naming Context and return
 * its object reference. This is equivalent to using new_context() followed
 * by bind_context() with the supplied name and the object reference for
 * the newly created NamingContext.
 * @param n a sequence of NameComponents which is the name to be unbound.
 * @return an object reference for a new NamingContext object implemented
 * by this Name Server, bound to the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 * is already bound under the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see new_context
 * @see bind_context
 */
public  NamingContext bind_new_context(NameComponent[] n)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.AlreadyBound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    NamingContext nc = null;
    NamingContext rnc = null;
    try {
        if (debug)
            dprint("bind_new_context " + nameToString(n));
        // The obvious solution:
        nc = this.new_context();
        this.bind_context(n,nc);
        rnc = nc;
        nc = null;
    } finally {
        try {
            if(nc != null)
                nc.destroy();
        } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
        }
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine ( LogKeywords.NAMING_BIND +
            "New Context Bound To " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
    return rnc;
}
 
Example 38
Project: openjdk-jdk10   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example 39
Project: openjdk9   File: NameServiceStartThread.java   View source code 5 votes vote down vote up
public void run( )
{
    try {
        // start Name Service
        NameService nameService = new NameService(orb, dbDir );
        NamingContext rootContext = nameService.initialNamingContext();
        orb.register_initial_reference(
            ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
    } catch( Exception e ) {
        System.err.println(
            "NameService did not start successfully" );
        e.printStackTrace( );
    }
}
 
Example 40
Project: openjdk9   File: NamingContextImpl.java   View source code 5 votes vote down vote up
/**
 * Bind a NamingContext under a name in this NamingContext. If the name
 * contains multiple (n) components, the first n-1 components will be
 * resolved in this NamingContext and the object bound in resulting
 * NamingContext. If a binding under the supplied name already exists it
 * will be unbound first. The NamingContext will participate in recursive
 * resolving.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param nc the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind_context(NameComponent[] n, NamingContext nc)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( nc == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Context cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,nc,true,BindingType.ncontext);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        // This should not happen
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a CORBA Object" );
        throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}