Ejemplo n.º 1
0
  /**
   * This operation creates a stringified name from the array of Name components.
   *
   * @param n Name of the object
   *     <p>
   * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not
   *     identify a binding.
   *     <p>
   */
  public String to_string(org.omg.CosNaming.NameComponent[] n)
      throws org.omg.CosNaming.NamingContextPackage.InvalidName {
    // Name valid?
    if ((n == null) || (n.length == 0)) {
      throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore) this;

    String theStringifiedName = insImpl.convertToString(n);

    if (theStringifiedName == null) {
      throw new InvalidName();
    }

    return theStringifiedName;
  }
Ejemplo n.º 2
0
  /**
   * This operation resolves the Stringified name into the object reference.
   *
   * @param sn Stringified Name of the object
   *     <p>
   * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates there is no object
   *     reference for the given name.
   *     <p>
   * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the given
   *     compound name is incorrect
   *     <p>
   * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not
   *     identify a binding.
   *     <p>
   * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates the name is already
   *     bound.
   *     <p>
   */
  public org.omg.CORBA.Object resolve_str(String sn)
      throws org.omg.CosNaming.NamingContextPackage.NotFound,
          org.omg.CosNaming.NamingContextPackage.CannotProceed,
          org.omg.CosNaming.NamingContextPackage.InvalidName {
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if ((sn == null) || (sn.length() == 0)) {
      throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore) this;
    org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn);

    if ((theNameComponents == null) || (theNameComponents.length == 0)) {
      throw new InvalidName();
    }
    theObject = resolve(theNameComponents);
    return theObject;
  }
Ejemplo n.º 3
0
 /**
  * This operation creates a URL based "iiopname://" format name from the Stringified Name of the
  * object.
  *
  * @param addr internet based address of the host machine where Name Service is running
  *     <p>
  * @param sn Stringified Name of the object
  *     <p>
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not
  *     identify a binding.
  *     <p>
  * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress Indicates the internet based
  *     address of the host machine is incorrect
  *     <p>
  */
 public String to_url(String addr, String sn)
     throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
         org.omg.CosNaming.NamingContextPackage.InvalidName {
   // Name valid?
   if ((sn == null) || (sn.length() == 0)) {
     throw new InvalidName();
   }
   if (addr == null) {
     throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
   }
   NamingContextDataStore impl = (NamingContextDataStore) this;
   String urlBasedAddress = null;
   urlBasedAddress = insImpl.createURLBasedAddress(addr, sn);
   // Extra check to see that corba name url created is valid as per
   // INS spec grammer.
   try {
     INSURLHandler.getINSURLHandler().parseURL(urlBasedAddress);
   } catch (BAD_PARAM e) {
     throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
   }
   return urlBasedAddress;
 }
Ejemplo n.º 4
0
 /**
  * This operation converts a Stringified Name into an equivalent array of Name Components.
  *
  * @param sn Stringified Name of the object
  *     <p>
  * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not
  *     identify a binding.
  *     <p>
  */
 public org.omg.CosNaming.NameComponent[] to_name(String sn)
     throws org.omg.CosNaming.NamingContextPackage.InvalidName {
   // Name valid?
   if ((sn == null) || (sn.length() == 0)) {
     throw new InvalidName();
   }
   NamingContextDataStore impl = (NamingContextDataStore) this;
   org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn);
   if ((theNameComponents == null) || (theNameComponents.length == 0)) {
     throw new InvalidName();
   }
   for (int i = 0; i < theNameComponents.length; i++) {
     // If there is a name component whose id and kind null or
     // zero length string, then an invalid name exception needs to be
     // raised.
     if (((theNameComponents[i].id == null) || (theNameComponents[i].id.length() == 0))
         && ((theNameComponents[i].kind == null) || (theNameComponents[i].kind.length() == 0))) {
       throw new InvalidName();
     }
   }
   return theNameComponents;
 }