Java Code Examples for org.omg.CosNaming.NamingContextExt

The following are top voted examples for showing how to use org.omg.CosNaming.NamingContextExt. 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: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the default naming service for the case when there no NameService
 * entries.
 */
protected org.omg.CORBA.Object getDefaultNameService()
{
  if (initial_references.containsKey(NAME_SERVICE))
    return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);

  IOR ior = new IOR();
  ior.Id = NamingContextExtHelper.id();
  ior.Internet.host = ns_host;
  ior.Internet.port = ns_port;
  ior.key = NamingServiceTransient.getDefaultKey();

  IorObject iorc = new IorObject(this, ior);
  NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
  initial_references.put(NAME_SERVICE, namer);
  return namer;
}
 
Example 2
Project: jvm-stm   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the default naming service for the case when there no NameService
 * entries.
 */
protected org.omg.CORBA.Object getDefaultNameService()
{
  if (initial_references.containsKey(NAME_SERVICE))
    return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);

  IOR ior = new IOR();
  ior.Id = NamingContextExtHelper.id();
  ior.Internet.host = ns_host;
  ior.Internet.port = ns_port;
  ior.key = NamingServiceTransient.getDefaultKey();

  IorObject iorc = new IorObject(this, ior);
  NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
  initial_references.put(NAME_SERVICE, namer);
  return namer;
}
 
Example 3
Project: JamVM-PH   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the default naming service for the case when there no NameService
 * entries.
 */
protected org.omg.CORBA.Object getDefaultNameService()
{
  if (initial_references.containsKey(NAME_SERVICE))
    return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);

  IOR ior = new IOR();
  ior.Id = NamingContextExtHelper.id();
  ior.Internet.host = ns_host;
  ior.Internet.port = ns_port;
  ior.key = NamingServiceTransient.getDefaultKey();

  IorObject iorc = new IorObject(this, ior);
  NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
  initial_references.put(NAME_SERVICE, namer);
  return namer;
}
 
Example 4
Project: classpath   File: OrbFunctional.java   View source code 6 votes vote down vote up
/**
 * Get the default naming service for the case when there no NameService
 * entries.
 */
protected org.omg.CORBA.Object getDefaultNameService()
{
  if (initial_references.containsKey(NAME_SERVICE))
    return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);

  IOR ior = new IOR();
  ior.Id = NamingContextExtHelper.id();
  ior.Internet.host = ns_host;
  ior.Internet.port = ns_port;
  ior.key = NamingServiceTransient.getDefaultKey();

  IorObject iorc = new IorObject(this, ior);
  NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
  initial_references.put(NAME_SERVICE, namer);
  return namer;
}
 
Example 5
Project: OpenJSharp   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 6
Project: OpenJSharp   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 7
Project: openjdk-jdk10   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 8
Project: openjdk-jdk10   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 9
Project: openjdk9   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 10
Project: openjdk9   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 11
Project: lookaside_java-1.8.0-openjdk   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 12
Project: lookaside_java-1.8.0-openjdk   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 13
Project: jdk8u_corba   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 14
Project: jdk8u_corba   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 15
Project: javify   File: GiopNamingServiceURLContext.java   View source code 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 16
Project: javify   File: GiopNamingServiceURLContext.java   View source code 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 17
Project: jvm-stm   File: GiopNamingServiceURLContext.java   View source code 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 18
Project: jvm-stm   File: GiopNamingServiceURLContext.java   View source code 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 19
Project: infobip-open-jdk-8   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 20
Project: infobip-open-jdk-8   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 21
Project: openjdk-source-code-learn   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 22
Project: openjdk-source-code-learn   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 23
Project: OLD-OpenJDK8   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 24
Project: OLD-OpenJDK8   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 25
Project: JamVM-PH   File: GiopNamingServiceURLContext.java   View source code 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 26
Project: JamVM-PH   File: GiopNamingServiceURLContext.java   View source code 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 27
Project: wso2-axis2   File: CorbaUtil.java   View source code 5 votes vote down vote up
public static org.omg.CORBA.Object resolveObject(AxisService service, org.omg.CORBA_2_3.ORB orb) throws CorbaInvocationException {
    org.omg.CORBA.Object obj;
    try {
        Parameter namingServiceUrl = service.getParameter(NAMING_SERVICE_URL);
        Parameter objectName = service.getParameter(OBJECT_NAME);
        Parameter iorFilePath = service.getParameter(IOR_FILE_PATH);
        Parameter iorString = service.getParameter(IOR_STRING);

        if (namingServiceUrl!=null && objectName!=null) {
            obj = orb.string_to_object(((String) namingServiceUrl.getValue()).trim());
            NamingContextExt nc = NamingContextExtHelper.narrow(obj);
            obj = nc.resolve(nc.to_name(((String) objectName.getValue()).trim()));
        } else if (iorFilePath!=null) {
            FileReader fileReader = new FileReader(((String) iorFilePath.getValue()).trim());
            char[] buf = new char[1000];
            fileReader.read(buf);
            obj = orb.string_to_object((new String(buf)).trim());
            fileReader.close();
        } else if (iorString!=null) {
            obj = orb.string_to_object(((String) iorString.getValue()).trim());
        } else {
            throw new CorbaInvocationException("cannot resolve object");
        }

    } catch (NotFound notFound) {
        throw new CorbaInvocationException("cannot resolve object", notFound);
    } catch (CannotProceed cannotProceed) {
        throw new CorbaInvocationException("cannot resolve object", cannotProceed);
    } catch (InvalidName invalidName) {
        throw new CorbaInvocationException("cannot resolve object", invalidName);
    } catch (IOException e) {
        throw new CorbaInvocationException("cannot resolve object", e);
    }
    return obj;
}
 
Example 28
Project: openjdk-orb   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 29
Project: openjdk-orb   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 30
Project: classpath   File: GiopNamingServiceURLContext.java   View source code 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: classpath   File: GiopNamingServiceURLContext.java   View source code 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: openjdk-icedtea7   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 33
Project: openjdk-icedtea7   File: INSURLOperationImpl.java   View source code 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 34
Project: javify   File: Main.java   View source code 4 votes vote down vote up
private void run(String[] args)
{
  Parser parser = initializeParser();
  parser.parse(args);

  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();
      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      File dataDirectory = new File(directory);
      System.out.println("Persistent data stored at "
                         + dataDirectory.getAbsolutePath());
      dataDirectory.mkdirs();

      // / TODO support more starting modes.
      NamingContextExt namer = new Ext(
                                       new PersistentContext(
                                                             orb,
                                                             dataDirectory,
                                                             cold));

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      System.out.println("GNU Classpath persistent naming service "
                         + "started at " + iorr.Internet.host + ":"
                         + iorr.Internet.port + " key 'NameService'.\n\n"
                         + "Copyright (C) 2008 Free Software Foundation\n"
                         + "This tool comes with ABSOLUTELY NO WARRANTY. "
                         + "This is free software, and you are\nwelcome to "
                         + "redistribute it under conditions, defined in "
                         + "GNU Classpath license.\n\n" + ior);

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (FileNotFoundException e)
    {
      throw new RuntimeException(e);
    }
  finally
    {
      // Restore the default value for allocating ports for the subsequent
      // objects.
      OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
    }
}
 
Example 35
Project: javify   File: NamingServiceTransient.java   View source code 4 votes vote down vote up
/**
 * Start the naming service on the current host at the given port.
 *
 * @param portArgument the port on which the service will be
 * started, or -1 to use the default port, 900
 * @param fileArgument if non-null, store the IOR string of this
 * naming service in a file by this name
 */
public static void start(int portArgument, String fileArgument)
{
  int port = PORT;

  if (portArgument > -1)
    port = portArgument;

  String iorf = fileArgument;
  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();

      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      NamingContextExt namer = new Ext(new TransientContext());

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (Exception e)
    {
      System.err.println("ERROR: " + e);
      e.printStackTrace(System.err);
    }

  // Restore the default value for allocating ports for the subsequent
  // objects.
  OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
}
 
Example 36
Project: jvm-stm   File: Main.java   View source code 4 votes vote down vote up
private void run(String[] args)
{
  Parser parser = initializeParser();
  parser.parse(args);

  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();
      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      File dataDirectory = new File(directory);
      System.out.println("Persistent data stored at "
                         + dataDirectory.getAbsolutePath());
      dataDirectory.mkdirs();

      // / TODO support more starting modes.
      NamingContextExt namer = new Ext(
                                       new PersistentContext(
                                                             orb,
                                                             dataDirectory,
                                                             cold));

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      System.out.println("GNU Classpath persistent naming service "
                         + "started at " + iorr.Internet.host + ":"
                         + iorr.Internet.port + " key 'NameService'.\n\n"
                         + "Copyright (C) 2008 Free Software Foundation\n"
                         + "This tool comes with ABSOLUTELY NO WARRANTY. "
                         + "This is free software, and you are\nwelcome to "
                         + "redistribute it under conditions, defined in "
                         + "GNU Classpath license.\n\n" + ior);

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (FileNotFoundException e)
    {
      throw new RuntimeException(e);
    }
  finally
    {
      // Restore the default value for allocating ports for the subsequent
      // objects.
      OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
    }
}
 
Example 37
Project: jvm-stm   File: NamingServiceTransient.java   View source code 4 votes vote down vote up
/**
 * Start the naming service on the current host at the given port.
 * 
 * @param portArgument the port on which the service will be
 * started, or -1 to use the default port, 900
 * @param fileArgument if non-null, store the IOR string of this
 * naming service in a file by this name
 */
public static void start(int portArgument, String fileArgument)
{
  int port = PORT;

  if (portArgument > -1)
    port = portArgument;

  String iorf = fileArgument;
  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();

      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      NamingContextExt namer = new Ext(new TransientContext());

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (Exception e)
    {
      System.err.println("ERROR: " + e);
      e.printStackTrace(System.err);
    }

  // Restore the default value for allocating ports for the subsequent
  // objects.
  OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
}
 
Example 38
Project: JamVM-PH   File: Main.java   View source code 4 votes vote down vote up
private void run(String[] args)
{
  Parser parser = initializeParser();
  parser.parse(args);

  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();
      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      File dataDirectory = new File(directory);
      System.out.println("Persistent data stored at "
                         + dataDirectory.getAbsolutePath());
      dataDirectory.mkdirs();

      // / TODO support more starting modes.
      NamingContextExt namer = new Ext(
                                       new PersistentContext(
                                                             orb,
                                                             dataDirectory,
                                                             cold));

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      System.out.println("GNU Classpath persistent naming service "
                         + "started at " + iorr.Internet.host + ":"
                         + iorr.Internet.port + " key 'NameService'.\n\n"
                         + "Copyright (C) 2008 Free Software Foundation\n"
                         + "This tool comes with ABSOLUTELY NO WARRANTY. "
                         + "This is free software, and you are\nwelcome to "
                         + "redistribute it under conditions, defined in "
                         + "GNU Classpath license.\n\n" + ior);

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (FileNotFoundException e)
    {
      throw new RuntimeException(e);
    }
  finally
    {
      // Restore the default value for allocating ports for the subsequent
      // objects.
      OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
    }
}
 
Example 39
Project: JamVM-PH   File: NamingServiceTransient.java   View source code 4 votes vote down vote up
/**
 * Start the naming service on the current host at the given port.
 * 
 * @param portArgument the port on which the service will be
 * started, or -1 to use the default port, 900
 * @param fileArgument if non-null, store the IOR string of this
 * naming service in a file by this name
 */
public static void start(int portArgument, String fileArgument)
{
  int port = PORT;

  if (portArgument > -1)
    port = portArgument;

  String iorf = fileArgument;
  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();

      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      NamingContextExt namer = new Ext(new TransientContext());

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (Exception e)
    {
      System.err.println("ERROR: " + e);
      e.printStackTrace(System.err);
    }

  // Restore the default value for allocating ports for the subsequent
  // objects.
  OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
}
 
Example 40
Project: classpath   File: Main.java   View source code 4 votes vote down vote up
private void run(String[] args)
{
  Parser parser = initializeParser();
  parser.parse(args);

  try
    {
      // Create and initialize the ORB
      final OrbFunctional orb = new OrbFunctional();
      OrbFunctional.setPort(port);

      // Create the servant and register it with the ORB
      File dataDirectory = new File(directory);
      System.out.println("Persistent data stored at "
                         + dataDirectory.getAbsolutePath());
      dataDirectory.mkdirs();

      // / TODO support more starting modes.
      NamingContextExt namer = new Ext(
                                       new PersistentContext(
                                                             orb,
                                                             dataDirectory,
                                                             cold));

      // Case with the key "NameService".
      orb.connect(namer, "NameService".getBytes());

      // Storing the IOR reference.
      String ior = orb.object_to_string(namer);
      IOR iorr = IOR.parse(ior);
      if (iorf != null)
        {
          FileOutputStream f = new FileOutputStream(iorf);
          PrintStream p = new PrintStream(f);
          p.print(ior);
          p.close();
        }

      System.out.println("GNU Classpath persistent naming service "
                         + "started at " + iorr.Internet.host + ":"
                         + iorr.Internet.port + " key 'NameService'.\n\n"
                         + "Copyright (C) 2012 Free Software Foundation\n"
                         + "This tool comes with ABSOLUTELY NO WARRANTY. "
                         + "This is free software, and you are\nwelcome to "
                         + "redistribute it under conditions, defined in "
                         + "GNU Classpath license.\n\n" + ior);

      new Thread()
      {
        public void run()
        {
          // Wait for invocations from clients.
          orb.run();
        }
      }.start();
    }
  catch (FileNotFoundException e)
    {
      throw new RuntimeException(e);
    }
  finally
    {
      // Restore the default value for allocating ports for the subsequent
      // objects.
      OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
    }
}