|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.thortech.xl.util.adapters.tcUtilLDAPController
public class tcUtilLDAPController
Class that provides the JNDI Interface to LDAP Director.
Requires that jndi.jar be in the classpath.
Field Summary | |
---|---|
static int |
UAC_HOMEDIR_REQD The home directory is required. |
static int |
UAC_LOCKEDOUT The account is currently locked out. |
static int |
UAC_ORGANIZATIONDISABLE Organization is disabled |
static int |
UAC_PWD_CANTCHANGE The user cannot change the password. |
static int |
UAC_PWD_ENCRYPTED The user can send an encrypted password. |
static int |
UAC_PWD_NOEXPIRE The password for this account will never expire. |
static int |
UAC_PWD_NOTREQD No password is required. |
static int |
UAC_SCRIPT The logon script is executed. |
static int |
UAC_SMARTCARD The user must log on using a smart card. |
Constructor Summary | |
---|---|
tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password) Contructor that sets the primary connection parameters |
|
tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password, boolean pSecure) Contructor that sets the primary connection parameters, and also provides a method to set the security constraint |
|
tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password, java.lang.Boolean pSecure) Creates a new tcUtilLDAPController object. |
Method Summary | |
---|---|
void |
connect(java.lang.String hierarchy) Connects to a directory object. |
boolean |
createObject(java.lang.String name, javax.naming.directory.Attributes pattrs) Method used internally to create any type of object. |
boolean |
deleteObject(java.lang.String name) Internal method that executes the JNDI delete method. |
void |
disconnect() Closes connection to directory server |
javax.naming.directory.Attribute |
getAttributeObject(java.lang.String psProperty, java.lang.String psValue) UTILITY method that returns an Attribute object given an attribute name and an attribute value |
java.util.Hashtable |
getAttributes(java.lang.String hierarchy, java.lang.String name) Returns a hash of the objects attributes and their values. |
javax.naming.directory.Attributes |
getAttributesObject(java.util.Hashtable poProperties) UTILITY method that returns an Attributes object given a hashtable containing attribute name-value pairs |
javax.naming.directory.Attributes |
getAttributesObject(java.util.Vector poProperties) UTILITY method that returns an Attributes object given a vector containing attribute name-value pairs |
java.lang.String |
getAttributeValueBasedOnSearch(java.lang.String hierarchy, java.lang.String distinguishName, java.lang.String ObjectClass, java.lang.String attrname) This method will search in the specified hierarchy using the specified distinguished name and objectclass. |
java.util.Vector |
getAttributeValues(java.lang.String hierarchy, java.lang.String name, java.lang.String attrname) Lists the value(s) of a particular object attribute. |
boolean |
getBitMaskedAttribute(java.lang.String hierarchy, java.lang.String name, java.lang.String attrName, int attrMask) There are many attributes in LDAP that are stored as integers but are actually bit masks (e.g. |
java.lang.String |
getCanonicalName(java.lang.String nameDN) UTILITY method that extracts the canonical name of an object from its Distinguished Name. |
java.lang.String |
getCountryCode(java.lang.String country) Utility that returns the 2-letter code associated with the country specified. |
java.lang.String |
getCountryNum(java.lang.String country) Utility that returns the AD-specific Numeric code associated with the country specified. |
java.util.Hashtable |
getHashtableFromAttributes(javax.naming.directory.Attributes poAttr) returns a hashtable containing all the attributes |
java.util.Hashtable |
getHashtableFromVector(java.util.Vector poVector) UTILITY method that returns a Hashtable object given a vector containing name-value pairs in string array format. |
java.util.Vector |
getHierarchyVector(java.lang.String nameDN, java.util.Vector basehier) UTILITY method that constructs the hierarchy vector for an object from the Relative Distinguished Name of that object. |
java.lang.String |
getParentHierarchyDN(java.lang.String nameDN, java.lang.String basehier) UTILITY method that constructs the hierarchy vector for the parent of an object from the Relative Distinguished Name of that object. |
java.util.Vector |
getParentHierarchyVector(java.lang.String nameDN, java.util.Vector basehier) UTILITY method that constructs the hierarchy vector for the parent of an object from the Relative Distinguished Name of that object. |
java.lang.String |
getPath(java.lang.String hierarchy) Forms the basis of building the hierarchical tree to the LDAP object. |
java.lang.String |
getPathFromVector(java.util.Vector hierarchy) This method will return a string representation of the LDAP hierarchy path which is encapsulated in the Vector. |
java.lang.String |
getRelativeDistinguishedName(java.lang.String nameDN, java.lang.String basehier) UTILITY method that extracts the canonical name of an object from its Distinguished Name. |
java.lang.String |
getRootDSEProperty(java.lang.String attrName) Searches LDAP for the RootDSE object and get the value of a particular property from it |
void |
listEnvironment(java.lang.String hierarchy, java.lang.String filter) Returns a List of Environments |
static void |
main(java.lang.String[] args) |
boolean |
modifyAttributesAdd(java.lang.String name, javax.naming.directory.Attributes pattrs) Internal method that executes the JNDI modifyAttributes method, specifying the mode as "add". "add" means that the attributes are set only if they don't already exist. |
boolean |
modifyAttributesDelete(java.lang.String name, javax.naming.directory.Attributes pattrs) Internal method that executes the JNDI modifyAttributes method, specifying the mode as "delete". "delete" means that the existing name/value pairs get deleted. |
boolean |
modifyAttributesReplace(java.lang.String name, javax.naming.directory.Attributes pattrs) Internal method that executes the JNDI modifyAttributes method, specifying the mode as "replace". "replace" means that the value(s) of the existing attributes get replaced with those specified. |
boolean |
moveObject(java.lang.String source, java.lang.String destination, java.lang.String name) Moves an LDAP object |
java.lang.String |
removePlus(java.lang.String parent, java.lang.String accept) This function replace all the occurences of "+" in the "parent" string with the "accept" string |
static java.lang.String |
removeSpace1(java.lang.String parent, java.lang.String accept) Removes the spaces from the first string |
boolean |
rename(java.lang.String hierarchy, java.lang.String oldname, java.lang.String newname) Internal method that executes the JNDI rename method. |
java.util.Vector |
search(java.lang.String hierarchy, java.lang.String filter) Searches LDAP for the objects fulfilling the criteria specified by the search filter. |
java.util.Vector |
searchResult(java.lang.String orgRDN, java.lang.String filter) Searches LDAP for the objects fulfilling the criteria specified by the search filter. |
java.util.Vector |
searchResult(java.lang.String orgRDN, java.lang.String filter, java.lang.String[] returnAttributes) Searches LDAP for the objects fulfilling the criteria specified by the search filter. |
boolean |
setBitMaskedAttribute(java.lang.String hierarchy, java.lang.String name, java.lang.String attrName, int attrMask, boolean check) There are many attributes in LDAP that are stored as integers but are actually bit masks (e.g. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int UAC_SCRIPT
public static int UAC_ORGANIZATIONDISABLE
public static int UAC_HOMEDIR_REQD
public static int UAC_LOCKEDOUT
public static int UAC_PWD_NOTREQD
public static int UAC_PWD_CANTCHANGE
public static int UAC_PWD_ENCRYPTED
public static int UAC_PWD_NOEXPIRE
public static int UAC_SMARTCARD
Constructor Detail |
---|
public tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password)
server
- The domain or the IP address of the LDAP Server, e.g. w2kaddcd02, thor60.thortech.comrootcon
- The domain root for the LDAP structure, e.g. DC=THORTECH,DC=comprinc
- The Distinguished Name of the Admin User the program will log in as, e.g. CN=Admin,CN=Users,DC=THORDEV,DC=comp_password
- The password of the Admin Userpublic tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password, boolean pSecure) throws java.lang.Exception
server
- The domain or the IP address of the LDAP Server, e.g. w2kaddcd02, thor60.thortech.comrootcon
- The domain root for the LDAP structure, e.g. DC=THORTECH,DC=comprinc
- The Distinguished Name of the Admin User the program will log in as, e.g. CN=Admin,CN=Users,DC=THORDEV,DC=comp_password
- The password of the Admin UserpSecure
- boolean telling whether to use secure connection (SSL) or notjava.lang.Exception
public tcUtilLDAPController(java.lang.String server, java.lang.String rootcon, java.lang.String princ, java.lang.String p_password, java.lang.Boolean pSecure) throws java.lang.Exception
server
- The domain or the IP address of the LDAP Server, e.g. w2kaddcd02, thor60.thortech.comrootcon
- The domain root for the LDAP structure, e.g. DC=THORTECH,DC=comprinc
- The Distinguished Name of the Admin User the program will log in as, e.g. CN=Admin,CN=Users,DC=THORDEV,DC=comp_password
- The password of the Admin UserpSecure
- boolean telling whether to use secure connection (SSL) or notjava.lang.Exception
Method Detail |
---|
public boolean moveObject(java.lang.String source, java.lang.String destination, java.lang.String name) throws java.lang.Exception
source
- Parent heirarchy of the Objects current location, e.g OU=Devel,OU=Engineeringdestination
- Parent heirarchy of the Objects destination location, e.g OU=Devel,OU=Engineeringname
- The name of the object, including the object type, e.g. "cn=Consultant" uses the rename method to specify that the member attributes distinguished name is to be changed. Since this includes the full path, it changes the location alsojava.lang.Exception
tcUtilLDAPController.rename(java.lang.String, java.lang.String, java.lang.String)
public boolean rename(java.lang.String hierarchy, java.lang.String oldname, java.lang.String newname) throws java.lang.Exception
hierarchy
- The hierarchy of the object to connect to (to get permissions), e.g OU=Devel,OU=Engineeringoldname
- The old name of the object, including the object type, e.g. "cn=Consultant"newname
- The new name of the object, including the object type, e.g. "cn=Consultant"java.lang.Exception
tcUtilLDAPController.moveObject(java.lang.String, java.lang.String, java.lang.String)
public java.util.Vector search(java.lang.String hierarchy, java.lang.String filter) throws java.lang.Exception
hierarchy
- The hierarchical structure to the OU to search below, e.g OU=Devel,OU=Engineeringfilter
- Specifies the conditions to search for in the form of a search filter. A search filter is a search query expresed in the form of a logical expression in prefix notation (i.e., the logical operator appears before its arguments). Some examples are:(&(sn=Geisel) (mail=))
(| (& (sn=Geisel) (mail=)) (sn=L))
java.lang.Exception
public java.util.Vector searchResult(java.lang.String orgRDN, java.lang.String filter) throws java.lang.Exception
orgRDN
- the name of the context to searchfilter
- filter criteriajava.lang.Exception
public java.util.Vector searchResult(java.lang.String orgRDN, java.lang.String filter, java.lang.String[] returnAttributes) throws java.lang.Exception
orgRDN
- the name of the context to searchfilter
- Filter CriterionreturnAttributes
- List of attributes to be returnedjava.lang.Exception
public java.lang.String getRootDSEProperty(java.lang.String attrName) throws java.lang.Exception
attrName
- The attribute name to getjava.lang.Exception
public void listEnvironment(java.lang.String hierarchy, java.lang.String filter) throws java.lang.Exception
hierarchy
- The hierarchy of the object to connect to (to get permissions), e.g OU=Devel,OU=Engineeringfilter
- filter criteriajava.lang.Exception
public java.util.Hashtable getAttributes(java.lang.String hierarchy, java.lang.String name) throws java.lang.Exception
hierarchy
- The hierarchy of the object to connect to (to get permissions), e.g OU=Devel,OU=Engineeringname
- The path of the object relative to the connected hierarchy, usually it is just the objects namejava.lang.Exception
public java.util.Vector getAttributeValues(java.lang.String hierarchy, java.lang.String name, java.lang.String attrname) throws java.lang.Exception
hierarchy
- The hierarchy of the object to connect to (to get permissions) e.g OU=Devel,OU=Engineeringname
- The path of the object relative to the connected hierarchy, usually it is just the objects nameattrname
- The name of the attribute (property) whose value(s) needs to be retrieved.java.lang.Exception
public java.lang.String getAttributeValueBasedOnSearch(java.lang.String hierarchy, java.lang.String distinguishName, java.lang.String ObjectClass, java.lang.String attrname) throws java.lang.Exception
hierarchy
- The hierarchy of the object to connect to (to get permissions), e.g OU=Devel,OU=EngineeringdistinguishName
- Distinguishing nameObjectClass
- Object Classattrname
- attribute namejava.lang.Exception
public java.lang.String removePlus(java.lang.String parent, java.lang.String accept)
parent
- The string in whicjh "+" is to be replacedaccept
- The String with which "+" is to be replacedpublic void connect(java.lang.String hierarchy) throws java.lang.Exception
hierarchy
- Object path from object to root context (excluding root context). It must be a String of format "Class Type=Object CN,Class Type=Object CN" where:CN=Dumbo,OU=Leaders,OU=Elephants,DC=thordev,DC=com
CN=Dumbo,OU=Leaders,OU=Elephants
java.lang.Exception
public void disconnect()
public java.lang.String getPath(java.lang.String hierarchy)
hierarchy
- Contains the elements in the tree, deepest one first. The String must be of format "Class Type=Object CN,Class Type=Object CN" where:CN=Dumbo,OU=Leaders,OU=Elephants
public java.lang.String getPathFromVector(java.util.Vector hierarchy)
hierarchy
- The hierarchy of the object to connect to (to get permissions), e.g OU=Devel,OU=Engineeringpublic boolean createObject(java.lang.String name, javax.naming.directory.Attributes pattrs)
name
- The name of the object to be created, e.g. the usernamepattrs
- The various attributes that need to be set, as an Attributes objectpublic boolean modifyAttributesReplace(java.lang.String name, javax.naming.directory.Attributes pattrs)
name
- The RDN path of the object (relative to the connected hierarchy), usually it is just the objects name (e.g. CN= nkaushik)pattrs
- The list of attributes and their values that need to be setpublic boolean modifyAttributesAdd(java.lang.String name, javax.naming.directory.Attributes pattrs)
name
- The RDN path of the object (relative to the connected hierarchy), usually it is just the objects name (e.g. CN= nkaushik)pattrs
- The list of attributes and their values that need to be setpublic boolean modifyAttributesDelete(java.lang.String name, javax.naming.directory.Attributes pattrs)
name
- The RDN path of the object (relative to the connected hierarchy), usually it is just the objects name (e.g. CN= nkaushik)pattrs
- The list of attributes and their values that need to be set. It must contain the name AND the value of the attribute to be deleted.public boolean setBitMaskedAttribute(java.lang.String hierarchy, java.lang.String name, java.lang.String attrName, int attrMask, boolean check) throws java.lang.Exception
hierarchy
- The hierarchy to the LDAP object to connect to (to get permissions)name
- The path of the object relative to the connected hierarchy, usually it is just the objects name and class (e.g. CN= nkaushik)attrName
- The name of the attribute to be setattrMask
- The integer mask to use to locate the bit(s) to be modified. e.g. if we want to change the 5th bit, the mask would be binary 10000, and so attrMask = 16check
- boolean indicating if we want to set the bit(s) (check=True) or unset the bit(s) (check=False)java.lang.Exception
- booleanpublic boolean getBitMaskedAttribute(java.lang.String hierarchy, java.lang.String name, java.lang.String attrName, int attrMask) throws java.lang.Exception
hierarchy
- The hierarchy to the LDAP object to connect to (to get permissions)name
- The path of the object relative to the connected hierarchy, usually it is just the objects name and class (e.g. CN= nkaushik)attrName
- The name of the attribute to be checkedattrMask
- The integer mask to use to locate the bit(s) to be checked. e.g. if we want to see the 5th bit, the mask would be binary 10000, and so attrMask = 16java.lang.Exception
public boolean deleteObject(java.lang.String name)
name
- The RDN path of the object (relative to the connected hierarchy), usually it is just the objects name, e.g CN= nkaushikpublic java.util.Hashtable getHashtableFromVector(java.util.Vector poVector)
poVector
- A vector of string arrays, in which the first element of the array is the key, the second is the valuepublic java.util.Hashtable getHashtableFromAttributes(javax.naming.directory.Attributes poAttr) throws java.lang.Exception
poAttr
- Attributesjava.lang.Exception
public javax.naming.directory.Attributes getAttributesObject(java.util.Hashtable poProperties)
poProperties
- A hashtable in which the keys are the attribute names and the objects are the attribute valuespublic javax.naming.directory.Attributes getAttributesObject(java.util.Vector poProperties)
poProperties
- A vector of string arrays, in which the first element of the array is the attribute name, the second is the attribute valuepublic javax.naming.directory.Attribute getAttributeObject(java.lang.String psProperty, java.lang.String psValue)
psProperty
- The attribute namepsValue
- The attribute valuepublic java.lang.String getCanonicalName(java.lang.String nameDN)
nameDN
- The names of the various LDAP objects in the hierarchy, from parent to root, Important: deepest firstpublic java.lang.String getRelativeDistinguishedName(java.lang.String nameDN, java.lang.String basehier)
nameDN
- The names of the various LDAP objects in the hierarchy, from parent to root, Important: deepest firstbasehier
- The basehier with respect to which the RDN should be givenpublic java.util.Vector getHierarchyVector(java.lang.String nameDN, java.util.Vector basehier)
nameDN
- The names of the various LDAP objects in the hierarchy, from parent to root, Important: deepest firstbasehier
- The hierarchy that the nameDN is relative to, in case it needs to be appended. Can be NULLpublic java.util.Vector getParentHierarchyVector(java.lang.String nameDN, java.util.Vector basehier)
nameDN
- The names of the various LDAP objects in the hierarchy, from parent to root, Important: deepest firstbasehier
- The hierarchy that the nameDN is relative to, in case it needs to be appended. Can be NULLpublic java.lang.String getParentHierarchyDN(java.lang.String nameDN, java.lang.String basehier)
nameDN
- The names of the various LDAP objects in the hierarchy, from parent to root, Important: deepest firstbasehier
- The hierarchy that the nameDN is relative to, in case it needs to be appended. Can be NULLpublic java.lang.String getCountryCode(java.lang.String country)
country
- The name of the country specified in AD terms (United States,...)public java.lang.String getCountryNum(java.lang.String country)
country
- The name of the country specified in AD terms (United States,...)public static java.lang.String removeSpace1(java.lang.String parent, java.lang.String accept)
parent
-accept
-public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |