当前位置: 首页>>代码示例>>Java>>正文


Java NamingContextExt类代码示例

本文整理汇总了Java中org.omg.CosNaming.NamingContextExt的典型用法代码示例。如果您正苦于以下问题:Java NamingContextExt类的具体用法?Java NamingContextExt怎么用?Java NamingContextExt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NamingContextExt类属于org.omg.CosNaming包,在下文中一共展示了NamingContextExt类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultNameService

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:OrbFunctional.java

示例2: resolveCorbaname

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 *  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;
    }
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:INSURLOperationImpl.java

示例3: getDefaultRootNamingContext

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 *  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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:INSURLOperationImpl.java

示例4: list

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:43,代码来源:GiopNamingServiceURLContext.java

示例5: listBindings

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:42,代码来源:GiopNamingServiceURLContext.java

示例6: list

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:43,代码来源:GiopNamingServiceURLContext.java

示例7: listBindings

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:42,代码来源:GiopNamingServiceURLContext.java

示例8: resolveObject

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:CorbaUtil.java

示例9: run

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
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);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:68,代码来源:Main.java

示例10: start

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:60,代码来源:NamingServiceTransient.java

示例11: start

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:60,代码来源:NamingServiceTransient.java

示例12: run

import org.omg.CosNaming.NamingContextExt; //导入依赖的package包/类
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);
    }
}
 
开发者ID:cfriedt,项目名称:classpath,代码行数:68,代码来源:Main.java


注:本文中的org.omg.CosNaming.NamingContextExt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。