Java Code Examples for org.omg.CosNaming.NamingContextHelper

The following are top voted examples for showing how to use org.omg.CosNaming.NamingContextHelper. 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: javify   File: ContextContinuation.java   Source Code and License 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 2
Project: jvm-stm   File: ContextContinuation.java   Source Code and License 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 3
Project: JamVM-PH   File: ContextContinuation.java   Source Code and License 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 4
Project: c6231   File: OfficerClient.java   Source Code and License 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 5
Project: classpath   File: ContextContinuation.java   Source Code and License 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 6
Project: OpenJSharp   File: NamingContextImpl.java   Source Code and License 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 7
Project: OpenJSharp   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 8
Project: openjdk-jdk10   File: NamingContextImpl.java   Source Code and License 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 9
Project: openjdk-jdk10   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @return a CORBA.Object reference.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 10
Project: openjdk9   File: NamingContextImpl.java   Source Code and License 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 11
Project: openjdk9   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @return a CORBA.Object reference.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 12
Project: lookaside_java-1.8.0-openjdk   File: NamingContextImpl.java   Source Code and License 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 13
Project: lookaside_java-1.8.0-openjdk   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 14
Project: jdk8u_corba   File: NamingContextImpl.java   Source Code and License 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 15
Project: jdk8u_corba   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 16
Project: javify   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Read the exception from the given CDR stream.
 */
public static CannotProceed read(InputStream istream)
{
  CannotProceed value = new CannotProceed();

  // read and discard the repository ID
  istream.read_string();
  value.cxt = NamingContextHelper.read(istream);
  value.rest_of_name = NameHelper.read(istream);
  return value;
}
 
Example 17
Project: javify   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Create the type code for this exception.
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;

  StructMember[] members = new StructMember[ 2 ];
  TypeCode member;
  member = NamingContextHelper.type();
  members [ 0 ] = new StructMember("cxt", member, null);
  member = NameComponentHelper.type();
  member = orb.create_sequence_tc(0, member);
  member = orb.create_alias_tc(NameHelper.id(), "Name", member);
  members [ 1 ] = new StructMember("rest_of_name", member, null);
  return orb.create_struct_tc(id(), "CannotProceed", members);
}
 
Example 18
Project: javify   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the exception to the CDR output stream.
 */
public static void write(OutputStream ostream, CannotProceed value)
{
  // write the repository ID
  ostream.write_string(id());
  NamingContextHelper.write(ostream, value.cxt);
  NameHelper.write(ostream, value.rest_of_name);
}
 
Example 19
Project: javify   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(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 ListEnumeration(bl, bi, howMany);
}
 
Example 20
Project: javify   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 21
Project: javify   File: ContextContinuation.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 22
Project: javify   File: GiopNamingServiceURLContext.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 23
Project: javify   File: GiopNamingServiceURLContext.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 24
Project: jvm-stm   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Read the exception from the given CDR stream.
 */
public static CannotProceed read(InputStream istream)
{
  CannotProceed value = new CannotProceed();

  // read and discard the repository ID
  istream.read_string();
  value.cxt = NamingContextHelper.read(istream);
  value.rest_of_name = NameHelper.read(istream);
  return value;
}
 
Example 25
Project: jvm-stm   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Create the type code for this exception.
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  
  StructMember[] members = new StructMember[ 2 ];
  TypeCode member;
  member = NamingContextHelper.type();
  members [ 0 ] = new StructMember("cxt", member, null);
  member = NameComponentHelper.type();
  member = orb.create_sequence_tc(0, member);
  member = orb.create_alias_tc(NameHelper.id(), "Name", member);
  members [ 1 ] = new StructMember("rest_of_name", member, null);
  return orb.create_struct_tc(id(), "CannotProceed", members);
}
 
Example 26
Project: jvm-stm   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the exception to the CDR output stream.
 */
public static void write(OutputStream ostream, CannotProceed value)
{
  // write the repository ID
  ostream.write_string(id());
  NamingContextHelper.write(ostream, value.cxt);
  NameHelper.write(ostream, value.rest_of_name);
}
 
Example 27
Project: jvm-stm   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(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 ListEnumeration(bl, bi, howMany);
}
 
Example 28
Project: jvm-stm   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 29
Project: jvm-stm   File: ContextContinuation.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 30
Project: jvm-stm   File: GiopNamingServiceURLContext.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;
  
  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 31
Project: jvm-stm   File: GiopNamingServiceURLContext.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;
  
  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 32
Project: infobip-open-jdk-8   File: NamingContextImpl.java   Source Code and License 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 33
Project: infobip-open-jdk-8   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 34
Project: openjdk-source-code-learn   File: NamingContextImpl.java   Source Code and License 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-source-code-learn   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 36
Project: OLD-OpenJDK8   File: NamingContextImpl.java   Source Code and License 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 37
Project: OLD-OpenJDK8   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 38
Project: JamVM-PH   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Read the exception from the given CDR stream.
 */
public static CannotProceed read(InputStream istream)
{
  CannotProceed value = new CannotProceed();

  // read and discard the repository ID
  istream.read_string();
  value.cxt = NamingContextHelper.read(istream);
  value.rest_of_name = NameHelper.read(istream);
  return value;
}
 
Example 39
Project: JamVM-PH   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Create the type code for this exception.
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  
  StructMember[] members = new StructMember[ 2 ];
  TypeCode member;
  member = NamingContextHelper.type();
  members [ 0 ] = new StructMember("cxt", member, null);
  member = NameComponentHelper.type();
  member = orb.create_sequence_tc(0, member);
  member = orb.create_alias_tc(NameHelper.id(), "Name", member);
  members [ 1 ] = new StructMember("rest_of_name", member, null);
  return orb.create_struct_tc(id(), "CannotProceed", members);
}
 
Example 40
Project: JamVM-PH   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the exception to the CDR output stream.
 */
public static void write(OutputStream ostream, CannotProceed value)
{
  // write the repository ID
  ostream.write_string(id());
  NamingContextHelper.write(ostream, value.cxt);
  NameHelper.write(ostream, value.rest_of_name);
}
 
Example 41
Project: JamVM-PH   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(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 ListEnumeration(bl, bi, howMany);
}
 
Example 42
Project: JamVM-PH   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 43
Project: JamVM-PH   File: ContextContinuation.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 44
Project: JamVM-PH   File: GiopNamingServiceURLContext.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;
  
  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 45
Project: JamVM-PH   File: GiopNamingServiceURLContext.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;
  
  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 46
Project: openjdk-orb   File: NamingContextImpl.java   Source Code and License 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 47
Project: openjdk-orb   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 48
Project: classpath   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Read the exception from the given CDR stream.
 */
public static CannotProceed read(InputStream istream)
{
  CannotProceed value = new CannotProceed();

  // read and discard the repository ID
  istream.read_string();
  value.cxt = NamingContextHelper.read(istream);
  value.rest_of_name = NameHelper.read(istream);
  return value;
}
 
Example 49
Project: classpath   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Create the type code for this exception.
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;

  StructMember[] members = new StructMember[ 2 ];
  TypeCode member;
  member = NamingContextHelper.type();
  members [ 0 ] = new StructMember("cxt", member, null);
  member = NameComponentHelper.type();
  member = orb.create_sequence_tc(0, member);
  member = orb.create_alias_tc(NameHelper.id(), "Name", member);
  members [ 1 ] = new StructMember("rest_of_name", member, null);
  return orb.create_struct_tc(id(), "CannotProceed", members);
}
 
Example 50
Project: classpath   File: CannotProceedHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the exception to the CDR output stream.
 */
public static void write(OutputStream ostream, CannotProceed value)
{
  // write the repository ID
  ostream.write_string(id());
  NamingContextHelper.write(ostream, value.cxt);
  NameHelper.write(ostream, value.rest_of_name);
}
 
Example 51
Project: classpath   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(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 ListEnumeration(bl, bi, howMany);
}
 
Example 52
Project: classpath   File: ContextContinuation.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 53
Project: classpath   File: ContextContinuation.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

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

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 54
Project: classpath   File: GiopNamingServiceURLContext.java   Source Code and License 5 votes vote down vote up
/**
 * Creates and returns the enumeration over the name bindings that are present
 * the given subcontext. The enumeration elements have the type of
 * {@link NameClassPair}, 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 list(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListEnumeration(bl, bi, howMany);
}
 
Example 55
Project: classpath   File: GiopNamingServiceURLContext.java   Source Code and License 5 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(String name) throws NamingException
{
  BindingIteratorHolder bi = new BindingIteratorHolder();
  BindingListHolder bl = new BindingListHolder();

  NamingContext subcontext;

  String [] n = split(name);
  NamingContextExt service = getService(n[0]);

  if (n[1].length() == 0)
    subcontext = service;
  else
    {
      try
        {
          subcontext = (NamingContextHelper.narrow(service.resolve_str(n[1])));
        }
      catch (Exception e)
        {
          throw new NamingException(e.toString());
        }

    }

  subcontext.list(howMany, bl, bi);

  return new ListBindingsEnumeration(bl, bi, howMany, subcontext);
}
 
Example 56
Project: openjdk-icedtea7   File: NamingContextImpl.java   Source Code and License 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 57
Project: openjdk-icedtea7   File: NameService.java   Source Code and License 5 votes vote down vote up
/**
 * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
 * @param Object Key as String
 * @returns reference an CORBA.Object.
 */
org.omg.CORBA.Object getObjectReferenceFromKey( String key )
{
    org.omg.CORBA.Object theObject = null;
    try
    {
            theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
    }
    catch (Exception e )
    {
            theObject = null;
    }
    return theObject;
}
 
Example 58
Project: sensors_reading_DS   File: ServiceMain.java   Source Code and License 5 votes vote down vote up
public static void main(String args[]) {
	try {

		System.out.println("Initializing Service...");

		// Create and initialize the ORB
		ORB orb = ORB.init(args, null);

		// Get a reference from rootpoa & Activate the POAManager
		POA rootpoa = POAHelper.narrow(orb
				.resolve_initial_references(Names.ROOT_POA));
		rootpoa.the_POAManager().activate();

		// get the root naming context
		org.omg.CORBA.Object objRef = orb
				.resolve_initial_references(Names.NAME_SERVICE);
		NamingContext namingContext = NamingContextHelper.narrow(objRef);

		// Create instance of a Service Servant
		ServiceServant serviceServant = new ServiceServant(namingContext, orb);

		// Register it with the ORB and get the reference to servant
		org.omg.CORBA.Object serviceServantCORBA = rootpoa
				.servant_to_reference(serviceServant);

		// Bind the reference to the Naming Service
		NameComponent[] servicePath = { new NameComponent(
				Names.SERVICE_NAME_CONTEXT, "Object") };
		namingContext.rebind(servicePath, serviceServantCORBA);

		System.out.println("Service initialized");

		// Run orb to keep it alive and safe from the garbage collector
		orb.run();

	} catch (Exception e) {
		System.err.println("Error: " + e);
		e.printStackTrace(System.out);
	}
}
 
Example 59
Project: OpenJSharp   File: NameService.java   Source Code and License 4 votes vote down vote up
/**
 * Create NameService which starts the Root Naming Context in Persistent CosNaming
 * @param orb an ORB object.
 * @param logDir a File
 * @exception java.lang.Exception a Java exception.
 */
public NameService(ORB orb, File logDir)
    throws Exception
{
    theorb = orb;

    // Moved this to the creation of the ORB that is passed into this
    // constructor.
    //
    // This is required for creating Persistent Servants under this ORB
    // Right now the Persistent NameService and ORBD are launched together
    // Find out a better way of doing this, Since ORBD is an important
    // process which should not be killed because of some external process
    // orb.setPersistentServerId( (int) 1000 );

    // get and activate the root naming POA
    POA rootPOA = (POA)orb.resolve_initial_references(
        ORBConstants.ROOT_POA_NAME ) ;
    rootPOA.the_POAManager().activate();

    // create a new POA for persistent Naming Contexts
    // With Non-Retain policy, So that every time Servant Manager
    // will be contacted when the reference is made for the context
    // The id assignment is made by the NameServer, The Naming Context
    // id's will be in the format NC<Index>
    int i=0;
    Policy[] poaPolicy = new Policy[4];
    poaPolicy[i++] = rootPOA.create_lifespan_policy(
                     LifespanPolicyValue.PERSISTENT);
    poaPolicy[i++] = rootPOA.create_request_processing_policy(
                     RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
    poaPolicy[i++] = rootPOA.create_id_assignment_policy(
                     IdAssignmentPolicyValue.USER_ID);
    poaPolicy[i++] = rootPOA.create_servant_retention_policy(
                     ServantRetentionPolicyValue.NON_RETAIN);


    nsPOA = rootPOA.create_POA("NameService", null, poaPolicy);
    nsPOA.the_POAManager().activate( );

    // create and set the servant manager
    contextMgr = new
        ServantManagerImpl(orb, logDir, this );

    // The RootObject key will be NC0
    String rootKey = contextMgr.getRootObjectKey( );
    // initialize the root Naming Context
    NamingContextImpl nc =
            new NamingContextImpl( orb, rootKey, this, contextMgr );
    nc = contextMgr.addContext( rootKey, nc );
    nc.setServantManagerImpl( contextMgr );
    nc.setORB( orb );
    nc.setRootNameService( this );

    nsPOA.set_servant_manager(contextMgr);
    rootContext = NamingContextHelper.narrow(
    nsPOA.create_reference_with_id( rootKey.getBytes( ),
    NamingContextHelper.id( ) ) );
}
 
Example 60
Project: openjdk-jdk10   File: NameService.java   Source Code and License 4 votes vote down vote up
/**
 * Create NameService which starts the Root Naming Context in Persistent CosNaming
 * @param orb an ORB object.
 * @param logDir a File
 * @exception java.lang.Exception a Java exception.
 */
public NameService(ORB orb, File logDir)
    throws Exception
{
    theorb = orb;

    // Moved this to the creation of the ORB that is passed into this
    // constructor.
    //
    // This is required for creating Persistent Servants under this ORB
    // Right now the Persistent NameService and ORBD are launched together
    // Find out a better way of doing this, Since ORBD is an important
    // process which should not be killed because of some external process
    // orb.setPersistentServerId( (int) 1000 );

    // get and activate the root naming POA
    POA rootPOA = (POA)orb.resolve_initial_references(
        ORBConstants.ROOT_POA_NAME ) ;
    rootPOA.the_POAManager().activate();

    // create a new POA for persistent Naming Contexts
    // With Non-Retain policy, So that every time Servant Manager
    // will be contacted when the reference is made for the context
    // The id assignment is made by the NameServer, The Naming Context
    // id's will be in the format NC<Index>
    int i=0;
    Policy[] poaPolicy = new Policy[4];
    poaPolicy[i++] = rootPOA.create_lifespan_policy(
                     LifespanPolicyValue.PERSISTENT);
    poaPolicy[i++] = rootPOA.create_request_processing_policy(
                     RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
    poaPolicy[i++] = rootPOA.create_id_assignment_policy(
                     IdAssignmentPolicyValue.USER_ID);
    poaPolicy[i++] = rootPOA.create_servant_retention_policy(
                     ServantRetentionPolicyValue.NON_RETAIN);


    nsPOA = rootPOA.create_POA("NameService", null, poaPolicy);
    nsPOA.the_POAManager().activate( );

    // create and set the servant manager
    contextMgr = new
        ServantManagerImpl(orb, logDir, this );

    // The RootObject key will be NC0
    String rootKey = contextMgr.getRootObjectKey( );
    // initialize the root Naming Context
    NamingContextImpl nc =
            new NamingContextImpl( orb, rootKey, this, contextMgr );
    nc = contextMgr.addContext( rootKey, nc );
    nc.setServantManagerImpl( contextMgr );
    nc.setORB( orb );
    nc.setRootNameService( this );

    nsPOA.set_servant_manager(contextMgr);
    rootContext = NamingContextHelper.narrow(
    nsPOA.create_reference_with_id( rootKey.getBytes( ),
    NamingContextHelper.id( ) ) );
}