Java Doc for CompoundName.java in  » Apache-Harmony-Java-SE » javax-package » javax » naming » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » javax package » javax.naming 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.naming.CompoundName

CompoundName
public class CompoundName implements Name(Code)
A CompoundName is a series of string elements, and it represents a name in a naming service within a single namespace. Typically these names have a structure which is hierarchical.

A CompoundName has a sequence of zero or more elements delimited by the char specified in the property "jndi.syntax.separator". This property is required except when the direction of the name is "flat" (see jndi.syntax.direction). The property "jndi.syntax.separator2" allows for the specification of an additional separator. A separator string will be treated as normal characters if it is preceded by the escape string or is within quotes.

The property "jndi.syntax.direction" specifies the direction in which the name is read. Permitted values are "right_to_left", "left_to_right" and "flat". A flat name does not have a hierarchical structure. If this property is not specified then the default is "flat". If this property is specified with an invalid value then an IllegalArgumentException should be raised.

Each element can be accessed using its position. The first element is at position 0. The direction of the name is important. When direction is "left_to_right" then the leftmost element is at position 0. Conversely when the direction is "right_to_left" then the rightmost element is at position 0.

There are other properties which affect the syntax of a CompoundName. The following properties are all optional:

  • jndi.syntax.escape - Escape sequence,The escape sequence is used to escape a quote, separator or escape. When preceded itself by the escape sequence it is treated as ordinary characters. When it is followed by chars which are not quote or separator strings then it is treated as ordinary characters
  • jndi.syntax.beginquote - Used as start of quoted string (Defaults to endquote)
  • jndi.syntax.endquote - Used as end of quoted string (Defaults to beginquote)
  • jndi.syntax.beginquote2 - Additionally used as start of quoted string (Defaults to endquote2)
  • jndi.syntax.endquote2 - Additionally used as end of quoted string (Defaults to beginquote2)

When a non-escaped quote appears at the start of an element it must be matched at the end. That element can then be said to be quoted. When an escape sequence appears within a quoted element then it is treated as normal characters unless it precedes an occurrence of the quote in which case it is assumed that the quoted element contains a quote which is escaped.

If the element does not start with a quote, then any quote strings within that element are just normal characters.

  • jndi.syntax.ignorecase - If 'true' then ignore case when name elements are compared. If false or not set then case is important.
  • jndi.syntax.trimblanks - If 'true' then ignore leading & trailing blanks when name elements are compared. If false or not set then blanks are important.

These 2 properties relate to names where the syntax includes attribute/content pairs.

  • jndi.syntax.separator.ava
  • jndi.syntax.separator.typeval
For example the LDAP name, "CN=Mandy Jennings, O=Apache, C=UK". In this example the pair separator jndi.syntax.separator.ava is ',', and the character that separates pairs jndi.syntax.separator.typeval is '='. See RFC1779 for LDAP naming conventions.

The jndi.syntax.separator.ava is not used when manipulating CompoundName. The jndi.syntax.separator is still used to separate elements.

The CompoundName needs to be aware of the jndi.syntax.separator.typeval in case of the instance where a quoted string is used to provide the content of a pair.

Consider the string "CN=$Mandy Jennings, O=Apache, C=UK" with

  • jndi.syntax.direction set to "right_to_left"
  • jndi.syntax.separator set to ","
  • jndi.syntax.separator.typeval set to "="
When no jndi.syntax.beginquote is set then this creates a valid CompoundName with 3 elements.

If jndi.syntax.beginquote is then set to "$" the name becomes invalid as the content part of the pair CN=$Mandy Jennings has a mismatched quote.

The string "CN=$Mandy Jennings$, O=Apache, C=UK" would be fine as the $ quotes round Mandy Jennings now balance.

A CompoundName may be empty. An empty CompoundName has no elements. Elements may also be empty.

 Some Examples:
 ==============
 Consider the following compound name from the file system namespace:
 "home/jenningm-abc/.profile" 
 jndi.syntax.separator is set to '/' as in the UNIX filesystem.
 This name has 3 elements:
 home jenningm-abc and .profile
 The direction should be left_to_right as in the UNIX filesystem
 The element at position 0 would be home.
 Consider if jndi.syntax.separator had been set to '-' then this name 
 would have 2 elements:
 home/jenningm and abc/.profile
 If the direction was right_to_left then the element at position 0
 would be abc/.profile.
 Consider the name "<ab<cd>ef>" where jndi.syntax.beginquote is <
 and jndi.syntax.endquote is >. This will give rise to an 
 InvalidNameException because a close quote was encountered before
 the end of an element. The same is also true for "<abcd>ef>".
 If the name was "ab<cd>ef" then this would be valid and there would
 be one element ab<cd>ef.
 However if the name was "<abcdef>" there would be one element abcdef.
 An empty
 
 CompoundName
 
 is the name "" and has no elements.
 When jndi.syntax.beginquote is set to " and beginquote2 is set to '
 the behaviour is similar to CompositeName - 
 The name "\"abcd" gives an InvalidNameException as there is no closing quote.
 The name "'\"abcd'" gives one element of value "abcd.
 The name "\\abcd" gives one element of value \abcd. 
 Assuming:
 jndi.syntax.separator is "/"
 jndi.syntax.direction is "left_to_right"
 then
 "" is empty. It has no elements.
 "/" has one empty element.
 "//" has 2 empty elements.
 "/a/" has 3 elements the middle one is set to a.
 "///" has 3 empty elements.
 "//a/" has 4 elements, the last but one is set to a.
 Assuming the only properties set are: 
 jndi.syntax.separator is "/"
 jndi.syntax.direction is "left_to_right"
 then the String
 "\"" has one element with the value "
 "\\\"" has one element with the value \"
 "\\\"'" has one element with the value \"'
 Assuming the only properties set are:
 jndi.syntax.separator is "/"
 jndi.syntax.direction is "left_to_right"
 jndi.syntax.beginquote is "\""
 then the String
 "\"" is invalid because of no closing quote
 "\\\"" has one element with the value \"
 "\\\"'" has one element with the value \"'
 Assuming the only properties set are:
 jndi.syntax.separator is "/"
 jndi.syntax.direction is "left_to_right"
 jndi.syntax.beginquote is "\""
 jndi.syntax.beginquote2 is "\'"
 then the String
 "\"" is invalid because of no closing quote
 "\\\"" has one element with the value \"
 "\\\"'" has one element with the value \"'
 "'\\" is invalid because of no closing quote
 


Field Summary
protected transient  javax.naming.NameImplimpl
    
protected transient  PropertiesmySyntax
    

Constructor Summary
protected  CompoundName(Enumeration<String> elements, Properties props)
     Constructs a CompoundName with supplied Enumeration and Properties
Parameters:
  elements - an enumeration of name elements, cannot be null
Parameters:
  props - the properties, cannot be null but may be empty.
public  CompoundName(String s, Properties props)
     Constructs a CompoundName with supplied String and Properties, taking the supplied s and breaking it down into its elements.

Method Summary
public  Nameadd(String element)
    
public  Nameadd(int index, String element)
     Insert an element within this CompoundName at the specified index.
public  NameaddAll(Name name)
    
public  NameaddAll(int index, Name name)
    
public  Objectclone()
    
public  intcompareTo(Object o)
     Compare this CompoundName with the one supplied as a param.

See the definition of the equals() method to see how the direction, ignorecase and trimblanks properties affect the comparison of a CompoundName.

public  booleanendsWith(Name name)
    
public  booleanequals(Object o)
     Check if the supplied object o is equal to this CompoundName.

The supplied Object o may be null but that will cause false to be returned.

The supplied Object o may be something other than a CompoundName but that will cause false to be returned.

To be equal the supplied CompoundName must have the same number of elements and each element must match the corresponding element of this CompoundName.

public  Stringget(int index)
    
public  Enumeration<String>getAll()
    
public  NamegetPrefix(int index)
    
public  NamegetSuffix(int index)
    
public  inthashCode()
     Calculate the hashcode of this CompoundName by summing the hashcodes of all of its elements.
public  booleanisEmpty()
    
public  Objectremove(int index)
     Delete an element from this CompoundName.
public  intsize()
    
public  booleanstartsWith(Name name)
    
public  StringtoString()
     Gets the string representation of this CompoundName.

This is generated by concatenating the elements together with the separator string added as the separator between each of them.


Field Detail
impl
protected transient javax.naming.NameImpl impl(Code)



mySyntax
protected transient Properties mySyntax(Code)




Constructor Detail
CompoundName
protected CompoundName(Enumeration<String> elements, Properties props)(Code)
Constructs a CompoundName with supplied Enumeration and Properties
Parameters:
  elements - an enumeration of name elements, cannot be null
Parameters:
  props - the properties, cannot be null but may be empty. If empty, thedirection defaults to flat and no other properties arerequired.



CompoundName
public CompoundName(String s, Properties props) throws InvalidNameException(Code)
Constructs a CompoundName with supplied String and Properties, taking the supplied s and breaking it down into its elements.
Parameters:
  s - a string containing the full compound name
Parameters:
  props - the properties, cannot be null but may be empty for a flatname
throws:
  InvalidNameException - thrown if the supplied String s is invalid
throws:
  NullPointerException - thrown if the supplied String s is null




Method Detail
add
public Name add(String element) throws InvalidNameException(Code)



add
public Name add(int index, String element) throws InvalidNameException(Code)
Insert an element within this CompoundName at the specified index. this CompoundName.
Parameters:
  element - the String to insert
Parameters:
  index - the index of the element to insert - must be greater than orequal to 0 and less than size().
throws:
  ArrayIndexOutOfBoundsException - thrown when the index is invalid.
throws:
  InvalidNameException - thrown if the insertion of the element results in thisCompoundName becoming invalid.



addAll
public Name addAll(Name name) throws InvalidNameException(Code)



addAll
public Name addAll(int index, Name name) throws InvalidNameException(Code)



clone
public Object clone()(Code)



compareTo
public int compareTo(Object o)(Code)
Compare this CompoundName with the one supplied as a param.

See the definition of the equals() method to see how the direction, ignorecase and trimblanks properties affect the comparison of a CompoundName. Other than that the comparison is the same as that for a CompositeName.

a negative number means this is less than the supplied Objecto. a positive number means this is greater thanthe supplied Object o. zero means the two objectsare equal.
Parameters:
  o - the object to compare - cannot be null.
throws:
  ClassCastException - when o is not a compatible class that can becompared or if the object to compare o isnull.



endsWith
public boolean endsWith(Name name)(Code)



equals
public boolean equals(Object o)(Code)
Check if the supplied object o is equal to this CompoundName.

The supplied Object o may be null but that will cause false to be returned.

The supplied Object o may be something other than a CompoundName but that will cause false to be returned.

To be equal the supplied CompoundName must have the same number of elements and each element must match the corresponding element of this CompoundName. The properties jndi.syntax.ignorecase and jndi.syntax.trimblanks need to be considered if they have been set.

The properties associated with the CompoundName must be taken into account but do not have to match. For example "home/jenningm-abc/.profile" with a direction of left to right is equal to ".profile/jenningm-abc/home" with a direction of right to left.


Parameters:
  o - the object to be compared true if supplied object o is equals to thisCompoundName, false otherwise



get
public String get(int index)(Code)



getAll
public Enumeration<String> getAll()(Code)



getPrefix
public Name getPrefix(int index)(Code)



getSuffix
public Name getSuffix(int index)(Code)



hashCode
public int hashCode()(Code)
Calculate the hashcode of this CompoundName by summing the hashcodes of all of its elements.

If jndi.syntax.trimblanks is set to true then remove any leading and trailing blanks from the elements before calculating the hashcode.

If jndi.syntax.ignorecase is set to true then use the lowercase version of the element to calculate its hashcode.

the hashcode of this object.



isEmpty
public boolean isEmpty()(Code)



remove
public Object remove(int index) throws InvalidNameException(Code)
Delete an element from this CompoundName. the deleted element
Parameters:
  index - the index of the element to delete - must be greater than orequal to 0 and less than size().
throws:
  ArrayIndexOutOfBoundsException - thrown when the index is invalid.
throws:
  InvalidNameException - thrown if the deletion of the element results in thisCompoundName becoming invalid.



size
public int size()(Code)



startsWith
public boolean startsWith(Name name)(Code)



toString
public String toString()(Code)
Gets the string representation of this CompoundName.

This is generated by concatenating the elements together with the separator string added as the separator between each of them. It may be necessary to add quotes and escape string to preserve the meaning. The resulting string should produce an equivalent CompoundName when used to create a new instance.

the string representation of this CompoundName.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.