0N/A/*
2362N/A * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.naming;
0N/A
0N/Aimport java.util.Enumeration;
0N/Aimport java.util.Properties;
0N/A
0N/A/**
0N/A * This class represents a compound name -- a name from
0N/A * a hierarchical name space.
0N/A * Each component in a compound name is an atomic name.
0N/A * <p>
0N/A * The components of a compound name are numbered. The indexes of a
0N/A * compound name with N components range from 0 up to, but not including, N.
0N/A * This range may be written as [0,N).
0N/A * The most significant component is at index 0.
0N/A * An empty compound name has no components.
0N/A *<p>
0N/A * <h4>Compound Name Syntax</h4>
0N/A * The syntax of a compound name is specified using a set of properties:
0N/A *<dl>
0N/A * <dt>jndi.syntax.direction
0N/A * <dd>Direction for parsing ("right_to_left", "left_to_right", "flat").
0N/A * If unspecified, defaults to "flat", which means the namespace is flat
0N/A * with no hierarchical structure.
0N/A *
0N/A * <dt>jndi.syntax.separator
0N/A * <dd>Separator between atomic name components.
0N/A * Required unless direction is "flat".
0N/A *
0N/A * <dt>jndi.syntax.ignorecase
0N/A * <dd>If present, "true" means ignore the case when comparing name
0N/A * components. If its value is not "true", or if the property is not
0N/A * present, case is considered when comparing name components.
0N/A *
0N/A * <dt>jndi.syntax.escape
0N/A * <dd>If present, specifies the escape string for overriding separator,
0N/A * escapes and quotes.
0N/A *
0N/A * <dt>jndi.syntax.beginquote
0N/A * <dd>If present, specifies the string delimiting start of a quoted string.
0N/A *
0N/A * <dt>jndi.syntax.endquote
0N/A * <dd>String delimiting end of quoted string.
0N/A * If present, specifies the string delimiting the end of a quoted string.
0N/A * If not present, use syntax.beginquote as end quote.
0N/A * <dt>jndi.syntax.beginquote2
0N/A * <dd>Alternative set of begin/end quotes.
0N/A *
0N/A * <dt>jndi.syntax.endquote2
0N/A * <dd>Alternative set of begin/end quotes.
0N/A *
0N/A * <dt>jndi.syntax.trimblanks
0N/A * <dd>If present, "true" means trim any leading and trailing whitespaces
0N/A * in a name component for comparison purposes. If its value is not
0N/A * "true", or if the property is not present, blanks are significant.
0N/A * <dt>jndi.syntax.separator.ava
0N/A * <dd>If present, specifies the string that separates
0N/A * attribute-value-assertions when specifying multiple attribute/value
0N/A * pairs. (e.g. "," in age=65,gender=male).
0N/A * <dt>jndi.syntax.separator.typeval
0N/A * <dd>If present, specifies the string that separators attribute
0N/A * from value (e.g. "=" in "age=65")
0N/A *</dl>
0N/A * These properties are interpreted according to the following rules:
0N/A *<ol>
0N/A *<li>
0N/A * In a string without quotes or escapes, any instance of the
0N/A * separator delimits two atomic names. Each atomic name is referred
0N/A * to as a <em>component</em>.
0N/A *<li>
0N/A * A separator, quote or escape is escaped if preceded immediately
0N/A * (on the left) by the escape.
0N/A *<li>
0N/A * If there are two sets of quotes, a specific begin-quote must be matched
0N/A * by its corresponding end-quote.
0N/A *<li>
0N/A * A non-escaped begin-quote which precedes a component must be
0N/A * matched by a non-escaped end-quote at the end of the component.
0N/A * A component thus quoted is referred to as a
0N/A * <em>quoted component</em>. It is parsed by
0N/A * removing the being- and end- quotes, and by treating the intervening
0N/A * characters as ordinary characters unless one of the rules involving
0N/A * quoted components listed below applies.
0N/A *<li>
0N/A * Quotes embedded in non-quoted components are treated as ordinary strings
0N/A * and need not be matched.
0N/A *<li>
0N/A * A separator that is escaped or appears between non-escaped
0N/A * quotes is treated as an ordinary string and not a separator.
0N/A *<li>
0N/A * An escape string within a quoted component acts as an escape only when
0N/A * followed by the corresponding end-quote string.
0N/A * This can be used to embed an escaped quote within a quoted component.
0N/A *<li>
0N/A * An escaped escape string is not treated as an escape string.
0N/A *<li>
0N/A * An escape string that does not precede a meta string (quotes or separator)
0N/A * and is not at the end of a component is treated as an ordinary string.
0N/A *<li>
0N/A * A leading separator (the compound name string begins with
0N/A * a separator) denotes a leading empty atomic component (consisting
0N/A * of an empty string).
0N/A * A trailing separator (the compound name string ends with
0N/A * a separator) denotes a trailing empty atomic component.
0N/A * Adjacent separators denote an empty atomic component.
0N/A *</ol>
0N/A * <p>
0N/A * The string form of the compound name follows the syntax described above.
0N/A * When the components of the compound name are turned into their
0N/A * string representation, the reserved syntax rules described above are
0N/A * applied (e.g. embedded separators are escaped or quoted)
0N/A * so that when the same string is parsed, it will yield the same components
0N/A * of the original compound name.
0N/A *<p>
0N/A *<h4>Multithreaded Access</h4>
0N/A * A <tt>CompoundName</tt> instance is not synchronized against concurrent
0N/A * multithreaded access. Multiple threads trying to access and modify a
0N/A * <tt>CompoundName</tt> should lock the object.
0N/A *
0N/A * @author Rosanna Lee
0N/A * @author Scott Seligman
0N/A * @since 1.3
0N/A */
0N/A
0N/Apublic class CompoundName implements Name {
0N/A
0N/A /**
0N/A * Implementation of this compound name.
0N/A * This field is initialized by the constructors and cannot be null.
0N/A * It should be treated as a read-only variable by subclasses.
0N/A */
0N/A protected transient NameImpl impl;
0N/A /**
0N/A * Syntax properties for this compound name.
0N/A * This field is initialized by the constructors and cannot be null.
0N/A * It should be treated as a read-only variable by subclasses.
0N/A * Any necessary changes to mySyntax should be made within constructors
0N/A * and not after the compound name has been instantiated.
0N/A */
0N/A protected transient Properties mySyntax;
0N/A
0N/A /**
0N/A * Constructs a new compound name instance using the components
0N/A * specified in comps and syntax. This protected method is intended to be
0N/A * to be used by subclasses of CompoundName when they override
0N/A * methods such as clone(), getPrefix(), getSuffix().
0N/A *
0N/A * @param comps A non-null enumeration of the components to add.
0N/A * Each element of the enumeration is of class String.
0N/A * The enumeration will be consumed to extract its
0N/A * elements.
0N/A * @param syntax A non-null properties that specify the syntax of
0N/A * this compound name. See class description for
0N/A * contents of properties.
0N/A */
0N/A protected CompoundName(Enumeration<String> comps, Properties syntax) {
0N/A if (syntax == null) {
0N/A throw new NullPointerException();
0N/A }
0N/A mySyntax = syntax;
0N/A impl = new NameImpl(syntax, comps);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new compound name instance by parsing the string n
0N/A * using the syntax specified by the syntax properties supplied.
0N/A *
0N/A * @param n The non-null string to parse.
0N/A * @param syntax A non-null list of properties that specify the syntax of
0N/A * this compound name. See class description for
0N/A * contents of properties.
0N/A * @exception InvalidNameException If 'n' violates the syntax specified
0N/A * by <code>syntax</code>.
0N/A */
0N/A public CompoundName(String n, Properties syntax) throws InvalidNameException {
0N/A if (syntax == null) {
0N/A throw new NullPointerException();
0N/A }
0N/A mySyntax = syntax;
0N/A impl = new NameImpl(syntax, n);
0N/A }
0N/A
0N/A /**
0N/A * Generates the string representation of this compound name, using
0N/A * the syntax rules of the compound name. The syntax rules
0N/A * are described in the class description.
0N/A * An empty component is represented by an empty string.
0N/A *
0N/A * The string representation thus generated can be passed to
0N/A * the CompoundName constructor with the same syntax properties
0N/A * to create a new equivalent compound name.
0N/A *
0N/A * @return A non-null string representation of this compound name.
0N/A */
0N/A public String toString() {
0N/A return (impl.toString());
0N/A }
0N/A
0N/A /**
0N/A * Determines whether obj is syntactically equal to this compound name.
0N/A * If obj is null or not a CompoundName, false is returned.
0N/A * Two compound names are equal if each component in one is "equal"
0N/A * to the corresponding component in the other.
0N/A *<p>
0N/A * Equality is also defined in terms of the syntax of this compound name.
0N/A * The default implementation of CompoundName uses the syntax properties
0N/A * jndi.syntax.ignorecase and jndi.syntax.trimblanks when comparing
0N/A * two components for equality. If case is ignored, two strings
0N/A * with the same sequence of characters but with different cases
0N/A * are considered equal. If blanks are being trimmed, leading and trailing
0N/A * blanks are ignored for the purpose of the comparison.
0N/A *<p>
0N/A * Both compound names must have the same number of components.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of the two compound
0N/A * names are not compared for equality. They might be in the future.
0N/A *
0N/A * @param obj The possibly null object to compare against.
0N/A * @return true if obj is equal to this compound name, false otherwise.
0N/A * @see #compareTo(java.lang.Object obj)
0N/A */
0N/A public boolean equals(Object obj) {
0N/A // %%% check syntax too?
0N/A return (obj != null &&
0N/A obj instanceof CompoundName &&
0N/A impl.equals(((CompoundName)obj).impl));
0N/A }
0N/A
0N/A /**
0N/A * Computes the hash code of this compound name.
0N/A * The hash code is the sum of the hash codes of the "canonicalized"
0N/A * forms of individual components of this compound name.
0N/A * Each component is "canonicalized" according to the
0N/A * compound name's syntax before its hash code is computed.
0N/A * For a case-insensitive name, for example, the uppercased form of
0N/A * a name has the same hash code as its lowercased equivalent.
0N/A *
0N/A * @return An int representing the hash code of this name.
0N/A */
0N/A public int hashCode() {
0N/A return impl.hashCode();
0N/A }
0N/A
0N/A /**
0N/A * Creates a copy of this compound name.
0N/A * Changes to the components of this compound name won't
0N/A * affect the new copy and vice versa.
0N/A * The clone and this compound name share the same syntax.
0N/A *
0N/A * @return A non-null copy of this compound name.
0N/A */
0N/A public Object clone() {
0N/A return (new CompoundName(getAll(), mySyntax));
0N/A }
0N/A
0N/A /**
0N/A * Compares this CompoundName with the specified Object for order.
0N/A * Returns a
0N/A * negative integer, zero, or a positive integer as this Name is less
0N/A * than, equal to, or greater than the given Object.
0N/A * <p>
0N/A * If obj is null or not an instance of CompoundName, ClassCastException
0N/A * is thrown.
0N/A * <p>
0N/A * See equals() for what it means for two compound names to be equal.
0N/A * If two compound names are equal, 0 is returned.
0N/A *<p>
0N/A * Ordering of compound names depend on the syntax of the compound name.
0N/A * By default, they follow lexicographical rules for string comparison
0N/A * with the extension that this applies to all the components in the
0N/A * compound name and that comparison of individual components is
0N/A * affected by the jndi.syntax.ignorecase and jndi.syntax.trimblanks
0N/A * properties, identical to how they affect equals().
0N/A * If this compound name is "lexicographically" lesser than obj,
0N/A * a negative number is returned.
0N/A * If this compound name is "lexicographically" greater than obj,
0N/A * a positive number is returned.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of the two compound
0N/A * names are not compared when checking order. They might be in the future.
0N/A * @param obj The non-null object to compare against.
0N/A * @return a negative integer, zero, or a positive integer as this Name
0N/A * is less than, equal to, or greater than the given Object.
0N/A * @exception ClassCastException if obj is not a CompoundName.
0N/A * @see #equals(java.lang.Object)
0N/A */
0N/A public int compareTo(Object obj) {
0N/A if (!(obj instanceof CompoundName)) {
0N/A throw new ClassCastException("Not a CompoundName");
0N/A }
0N/A return impl.compareTo(((CompoundName)obj).impl);
0N/A }
0N/A
0N/A /**
0N/A * Retrieves the number of components in this compound name.
0N/A *
0N/A * @return The nonnegative number of components in this compound name.
0N/A */
0N/A public int size() {
0N/A return (impl.size());
0N/A }
0N/A
0N/A /**
0N/A * Determines whether this compound name is empty.
0N/A * A compound name is empty if it has zero components.
0N/A *
0N/A * @return true if this compound name is empty, false otherwise.
0N/A */
0N/A public boolean isEmpty() {
0N/A return (impl.isEmpty());
0N/A }
0N/A
0N/A /**
0N/A * Retrieves the components of this compound name as an enumeration
0N/A * of strings.
0N/A * The effects of updates to this compound name on this enumeration
0N/A * is undefined.
0N/A *
0N/A * @return A non-null enumeration of the components of this
0N/A * compound name. Each element of the enumeration is of class String.
0N/A */
0N/A public Enumeration<String> getAll() {
0N/A return (impl.getAll());
0N/A }
0N/A
0N/A /**
0N/A * Retrieves a component of this compound name.
0N/A *
0N/A * @param posn The 0-based index of the component to retrieve.
0N/A * Must be in the range [0,size()).
0N/A * @return The component at index posn.
0N/A * @exception ArrayIndexOutOfBoundsException if posn is outside the
0N/A * specified range.
0N/A */
0N/A public String get(int posn) {
0N/A return (impl.get(posn));
0N/A }
0N/A
0N/A /**
0N/A * Creates a compound name whose components consist of a prefix of the
0N/A * components in this compound name.
0N/A * The result and this compound name share the same syntax.
0N/A * Subsequent changes to
0N/A * this compound name does not affect the name that is returned and
0N/A * vice versa.
0N/A *
0N/A * @param posn The 0-based index of the component at which to stop.
0N/A * Must be in the range [0,size()].
0N/A * @return A compound name consisting of the components at indexes in
0N/A * the range [0,posn).
0N/A * @exception ArrayIndexOutOfBoundsException
0N/A * If posn is outside the specified range.
0N/A */
0N/A public Name getPrefix(int posn) {
0N/A Enumeration comps = impl.getPrefix(posn);
0N/A return (new CompoundName(comps, mySyntax));
0N/A }
0N/A
0N/A /**
0N/A * Creates a compound name whose components consist of a suffix of the
0N/A * components in this compound name.
0N/A * The result and this compound name share the same syntax.
0N/A * Subsequent changes to
0N/A * this compound name does not affect the name that is returned.
0N/A *
0N/A * @param posn The 0-based index of the component at which to start.
0N/A * Must be in the range [0,size()].
0N/A * @return A compound name consisting of the components at indexes in
0N/A * the range [posn,size()). If posn is equal to
0N/A * size(), an empty compound name is returned.
0N/A * @exception ArrayIndexOutOfBoundsException
0N/A * If posn is outside the specified range.
0N/A */
0N/A public Name getSuffix(int posn) {
0N/A Enumeration comps = impl.getSuffix(posn);
0N/A return (new CompoundName(comps, mySyntax));
0N/A }
0N/A
0N/A /**
0N/A * Determines whether a compound name is a prefix of this compound name.
0N/A * A compound name 'n' is a prefix if it is equal to
0N/A * getPrefix(n.size())--in other words, this compound name
0N/A * starts with 'n'.
0N/A * If n is null or not a compound name, false is returned.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of n
0N/A * are not used when doing the comparison. They might be in the future.
0N/A * @param n The possibly null compound name to check.
0N/A * @return true if n is a CompoundName and
0N/A * is a prefix of this compound name, false otherwise.
0N/A */
0N/A public boolean startsWith(Name n) {
0N/A if (n instanceof CompoundName) {
0N/A return (impl.startsWith(n.size(), n.getAll()));
0N/A } else {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Determines whether a compound name is a suffix of this compound name.
0N/A * A compound name 'n' is a suffix if it it is equal to
0N/A * getSuffix(size()-n.size())--in other words, this
0N/A * compound name ends with 'n'.
0N/A * If n is null or not a compound name, false is returned.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of n
0N/A * are not used when doing the comparison. They might be in the future.
0N/A * @param n The possibly null compound name to check.
0N/A * @return true if n is a CompoundName and
0N/A * is a suffix of this compound name, false otherwise.
0N/A */
0N/A public boolean endsWith(Name n) {
0N/A if (n instanceof CompoundName) {
0N/A return (impl.endsWith(n.size(), n.getAll()));
0N/A } else {
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Adds the components of a compound name -- in order -- to the end of
0N/A * this compound name.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of suffix
0N/A * is not used or checked. They might be in the future.
0N/A * @param suffix The non-null components to add.
0N/A * @return The updated CompoundName, not a new one. Cannot be null.
0N/A * @exception InvalidNameException If suffix is not a compound name,
0N/A * or if the addition of the components violates the syntax
0N/A * of this compound name (e.g. exceeding number of components).
0N/A */
0N/A public Name addAll(Name suffix) throws InvalidNameException {
0N/A if (suffix instanceof CompoundName) {
0N/A impl.addAll(suffix.getAll());
0N/A return this;
0N/A } else {
0N/A throw new InvalidNameException("Not a compound name: " +
0N/A suffix.toString());
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Adds the components of a compound name -- in order -- at a specified
0N/A * position within this compound name.
0N/A * Components of this compound name at or after the index of the first
0N/A * new component are shifted up (away from index 0)
0N/A * to accommodate the new components.
0N/A *<p>
0N/A * Implementation note: Currently the syntax properties of suffix
0N/A * is not used or checked. They might be in the future.
0N/A *
0N/A * @param n The non-null components to add.
0N/A * @param posn The index in this name at which to add the new
0N/A * components. Must be in the range [0,size()].
0N/A * @return The updated CompoundName, not a new one. Cannot be null.
0N/A * @exception ArrayIndexOutOfBoundsException
0N/A * If posn is outside the specified range.
0N/A * @exception InvalidNameException If n is not a compound name,
0N/A * or if the addition of the components violates the syntax
0N/A * of this compound name (e.g. exceeding number of components).
0N/A */
0N/A public Name addAll(int posn, Name n) throws InvalidNameException {
0N/A if (n instanceof CompoundName) {
0N/A impl.addAll(posn, n.getAll());
0N/A return this;
0N/A } else {
0N/A throw new InvalidNameException("Not a compound name: " +
0N/A n.toString());
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Adds a single component to the end of this compound name.
0N/A *
0N/A * @param comp The non-null component to add.
0N/A * @return The updated CompoundName, not a new one. Cannot be null.
0N/A * @exception InvalidNameException If adding comp at end of the name
0N/A * would violate the compound name's syntax.
0N/A */
0N/A public Name add(String comp) throws InvalidNameException{
0N/A impl.add(comp);
0N/A return this;
0N/A }
0N/A
0N/A /**
0N/A * Adds a single component at a specified position within this
0N/A * compound name.
0N/A * Components of this compound name at or after the index of the new
0N/A * component are shifted up by one (away from index 0)
0N/A * to accommodate the new component.
0N/A *
0N/A * @param comp The non-null component to add.
0N/A * @param posn The index at which to add the new component.
0N/A * Must be in the range [0,size()].
0N/A * @exception ArrayIndexOutOfBoundsException
0N/A * If posn is outside the specified range.
0N/A * @return The updated CompoundName, not a new one. Cannot be null.
0N/A * @exception InvalidNameException If adding comp at the specified position
0N/A * would violate the compound name's syntax.
0N/A */
0N/A public Name add(int posn, String comp) throws InvalidNameException{
0N/A impl.add(posn, comp);
0N/A return this;
0N/A }
0N/A
0N/A /**
0N/A * Deletes a component from this compound name.
0N/A * The component of this compound name at position 'posn' is removed,
0N/A * and components at indices greater than 'posn'
0N/A * are shifted down (towards index 0) by one.
0N/A *
0N/A * @param posn The index of the component to delete.
0N/A * Must be in the range [0,size()).
0N/A * @return The component removed (a String).
0N/A * @exception ArrayIndexOutOfBoundsException
0N/A * If posn is outside the specified range (includes case where
0N/A * compound name is empty).
0N/A * @exception InvalidNameException If deleting the component
0N/A * would violate the compound name's syntax.
0N/A */
0N/A public Object remove(int posn) throws InvalidNameException {
0N/A return impl.remove(posn);
0N/A }
0N/A
0N/A /**
0N/A * Overridden to avoid implementation dependency.
0N/A * @serialData The syntax <tt>Properties</tt>, followed by
0N/A * the number of components (an <tt>int</tt>), and the individual
0N/A * components (each a <tt>String</tt>).
0N/A */
0N/A private void writeObject(java.io.ObjectOutputStream s)
0N/A throws java.io.IOException {
0N/A s.writeObject(mySyntax);
0N/A s.writeInt(size());
0N/A Enumeration comps = getAll();
0N/A while (comps.hasMoreElements()) {
0N/A s.writeObject(comps.nextElement());
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Overridden to avoid implementation dependency.
0N/A */
0N/A private void readObject(java.io.ObjectInputStream s)
0N/A throws java.io.IOException, ClassNotFoundException {
0N/A mySyntax = (Properties)s.readObject();
0N/A impl = new NameImpl(mySyntax);
0N/A int n = s.readInt(); // number of components
0N/A try {
0N/A while (--n >= 0) {
0N/A add((String)s.readObject());
0N/A }
0N/A } catch (InvalidNameException e) {
0N/A throw (new java.io.StreamCorruptedException("Invalid name"));
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Use serialVersionUID from JNDI 1.1.1 for interoperability
0N/A */
0N/A private static final long serialVersionUID = 3513100557083972036L;
0N/A
0N/A/*
0N/A// For testing
0N/A
0N/A public static void main(String[] args) {
0N/A Properties dotSyntax = new Properties();
0N/A dotSyntax.put("jndi.syntax.direction", "right_to_left");
0N/A dotSyntax.put("jndi.syntax.separator", ".");
0N/A dotSyntax.put("jndi.syntax.ignorecase", "true");
0N/A dotSyntax.put("jndi.syntax.escape", "\\");
0N/A// dotSyntax.put("jndi.syntax.beginquote", "\"");
0N/A// dotSyntax.put("jndi.syntax.beginquote2", "'");
0N/A
0N/A Name first = null;
0N/A try {
0N/A for (int i = 0; i < args.length; i++) {
0N/A Name name;
0N/A Enumeration e;
0N/A System.out.println("Given name: " + args[i]);
0N/A name = new CompoundName(args[i], dotSyntax);
0N/A if (first == null) {
0N/A first = name;
0N/A }
0N/A e = name.getComponents();
0N/A while (e.hasMoreElements()) {
0N/A System.out.println("Element: " + e.nextElement());
0N/A }
0N/A System.out.println("Constructed name: " + name.toString());
0N/A
0N/A System.out.println("Compare " + first.toString() + " with "
0N/A + name.toString() + " = " + first.compareTo(name));
0N/A }
0N/A } catch (Exception ne) {
0N/A ne.printStackTrace();
0N/A }
0N/A }
0N/A*/
0N/A}