sdk.xml revision 5688
5398N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5398N/A<!DOCTYPE stax SYSTEM "/stax.dtd">
5398N/A<!--
5398N/A ! CDDL HEADER START
5398N/A !
5398N/A ! The contents of this file are subject to the terms of the
5398N/A ! Common Development and Distribution License, Version 1.0 only
5398N/A ! (the "License"). You may not use this file except in compliance
5398N/A ! with the License.
5398N/A !
5398N/A ! You can obtain a copy of the license at
5398N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
5398N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
5398N/A ! See the License for the specific language governing permissions
5398N/A ! and limitations under the License.
5398N/A !
5398N/A ! When distributing Covered Code, include this CDDL HEADER in each
5398N/A ! file and include the License file at
5398N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
5398N/A ! add the following below this CDDL HEADER, with the fields enclosed
5398N/A ! by brackets "[]" replaced with your own identifying information:
5398N/A ! Portions Copyright [yyyy] [name of copyright owner]
5398N/A !
5398N/A ! CDDL HEADER END
5398N/A !
5398N/A ! Copyright 2011 ForgeRock AS
5398N/A ! -->
5398N/A<stax>
5398N/A <!-- SDK ldapsearch Function -->
5398N/A <function name="SDKldapSearch">
5398N/A <function-prolog>
5398N/A This function performs an ldapsearch using the SDK java API
5398N/A </function-prolog>
5398N/A <function-map-args>
5398N/A <function-arg-def name="dsInstanceHost" type="optional">
5398N/A <function-arg-description>
5398N/A Directory server hostname or IP address
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="hostname"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsInstancePort" type="optional">
5398N/A <function-arg-description>
5398N/A Directory server port number
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="Port number"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsInstanceDn" type="optional">
5398N/A <function-arg-description>
5398N/A Bind DN
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="DN"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsInstancePswd" type="optional">
5398N/A <function-arg-description>
5398N/A Bind password
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="string"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsScope" type="optional">
5398N/A <function-arg-description>
5398N/A The scope of the search operation
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="string"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsBaseDN" type="optional">
5398N/A <function-arg-description>
5398N/A The baseDN for the search operation
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="dn"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsFilter" type="optional">
5398N/A <function-arg-description>
5398N/A The filter for the search operation
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="filter"/>
5398N/A </function-arg-def>
5398N/A <function-arg-def name="dsAttributes" type="optional">
5398N/A <function-arg-description>
5398N/A Only return these attributes
5398N/A </function-arg-description>
5398N/A <function-arg-property name="type" value="string"/>
5398N/A </function-arg-def>
5398N/A </function-map-args>
5398N/A
5398N/A <sequence>
5398N/A
5398N/A <!-- Build the Command -->
5398N/A <script>
5398N/A from org.forgerock.opendj.ldap import *
5398N/A from org.forgerock.opendj.ldap.responses import *
5398N/A from org.forgerock.opendj.ldif import *
5398N/A
5398N/A myHost=String(dsInstanceHost)
5398N/A myPort=int(dsInstancePort)
5398N/A myBaseDn=String(dsBaseDN)
5398N/A myDn=String(dsInstanceDn)
5398N/A myPassword=String(dsInstancePswd).toCharArray()
5398N/A
5398N/A if dsScope == 'base':
5398N/A myScope = SearchScope.BASE_OBJECT
5398N/A elif dsScope == 'one':
5398N/A myScope = SearchScope.SINGLE_LEVEL
5398N/A elif dsScope == 'sub':
5398N/A myScope = SearchScope.WHOLE_SUBTREE
5398N/A else:
5398N/A myScope = SearchScope.WHOLE_SUBTREE
5398N/A
5398N/A if dsFilter:
5398N/A myFilter = dsFilter
5398N/A else:
5398N/A myFilter = '(objectClass=*)'
5398N/A
5398N/A if dsAttributes:
5398N/A myAttrs = dsAttributes
5398N/A else:
5398N/A myAttrs = []
5398N/A
5398N/A writer = LDIFEntryWriter(System.out)
5398N/A factory = LDAPConnectionFactory(myHost,myPort)
5398N/A connection = None
5398N/A
5398N/A try:
5398N/A try:
5398N/A connection = factory.getConnection()
5398N/A
5398N/A connection.bind(myDn, myPassword)
5398N/A
5398N/A reader = connection.search(myBaseDn, myScope, myFilter, myAttrs)
5398N/A
5398N/A #TODO: handle search result references
5398N/A #TODO: not really a need to use writer to write to stdout
5398N/A while (reader.hasNext()):
5398N/A if not reader.isReference():
5398N/A entry = reader.readEntry()
5398N/A writer.writeComment("Search result entry: %s" % entry.getName().toString())
5398N/A writer.writeEntry(entry)
5398N/A else:
5398N/A ref = reader.readReference()
5398N/A writer.writeComment("Search result reference: %s " % ref.getURIs().toString())
5398N/A
5398N/A writer.flush()
5398N/A
5398N/A except ErrorResultException, e:
5398N/A System.err.println(e.getMessage())
5398N/A System.exit(e.getResult().getResultCode().intValue())
5398N/A
5398N/A except ErrorResultIOException, e:
5398N/A System.err.println(e.getMessage())
5398N/A System.exit(e.getCause().getResult().getResultCode().intValue())
5398N/A
5398N/A except InterruptedException, e:
5398N/A System.err.println(e.getMessage())
5398N/A System.exit(ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue())
5398N/A
5398N/A except IOException, e:
5398N/A System.err.println(e.getMessage())
5398N/A System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue())
5398N/A
5398N/A finally:
5398N/A connection.close()
5398N/A
5398N/A SDKResult = [[0,'%s' % entry.getAllAttributes().toString()]]
5398N/A </script>
5398N/A <message>
5398N/A 'Result = %s' % entry.getAllAttributes().toString()
5398N/A </message>
5398N/A <return>
5398N/A SDKResult
5398N/A </return>
5398N/A </sequence>
5398N/A </function>
5398N/A
<function name="authRate">
<function-prolog>
This function runs ldap authrate tool from OpenDJ SDK
</function-prolog>
<function-map-args>
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="sdkBinPath" type="optional" default="'%s' % SDK_BIN">
<function-arg-description>
Pathname to installation of sdk binaries
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsInstanceHost" type="optional">
<function-arg-description>
Directory server hostname or IP address
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="dsInstancePort" type="optional">
<function-arg-description>
Directory server port number
</function-arg-description>
<function-arg-property name="type" value="Port number"/>
</function-arg-def>
<function-arg-def name="dsInstanceDn" type="optional">
<function-arg-description>
Bind DN
</function-arg-description>
<function-arg-property name="type" value="DN"/>
</function-arg-def>
<function-arg-def name="dsInstancePswd" type="optional">
<function-arg-description>
Bind password
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="extraParams" type="optional">
<function-arg-description>
Optional extra parameters for specific test cases
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0
Wildcard 'noCheck' to not check the RC
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="verbose" type="optional" default="True">
<function-arg-description>
Display (or not) output.
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="knownIssue" type="optional" default="None">
<function-arg-description>
Known issue. Corresponds to an issue number.
</function-arg-description>
</function-arg-def>
</function-map-args>
<sequence>
<!-- Local variables -->
<script>
mylocation=location
</script>
<!-- Build the Command -->
<script>
STAFCmdParamsList=[]
STAFCmdParams=''
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/authrate%s' % (sdkBinPath,fileExt)
</script>
<!-- Set common ldap arguments -->
<call function="'_ldapCommonArgs'" />
<script>
if extraParams:
STAFCmdParamsList.append('%s' % extraParams)
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
<call function="'runCommand'">
{ 'command' : STAFCmd,
'arguments' : STAFCmdParams,
'location' : mylocation,
'name' : 'authrate',
'expectedRC' : expectedRC,
'knownIssue' : knownIssue
}
</call>
<script>
for line in STAXResult[0][1].split('\n'):
print line
</script>
<return>
STAXResult
</return>
</sequence>
</function>
<function name="searchRate">
<function-prolog>
This function runs ldap searchrate tool from OpenDJ SDK
</function-prolog>
<function-map-args>
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="sdkBinPath" type="optional" default="'%s' % SDK_BIN">
<function-arg-description>
Pathname to installation of sdk binaries
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsInstanceHost" type="optional">
<function-arg-description>
Directory server hostname or IP address
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="dsInstancePort" type="optional">
<function-arg-description>
Directory server port number
</function-arg-description>
<function-arg-property name="type" value="Port number"/>
</function-arg-def>
<function-arg-def name="dsInstanceDn" type="optional">
<function-arg-description>
Bind DN
</function-arg-description>
<function-arg-property name="type" value="DN"/>
</function-arg-def>
<function-arg-def name="dsInstancePswd" type="optional">
<function-arg-description>
Bind password
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="extraParams" type="optional">
<function-arg-description>
Optional extra parameters for specific test cases
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0
Wildcard 'noCheck' to not check the RC
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="verbose" type="optional" default="True">
<function-arg-description>
Display (or not) output.
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="knownIssue" type="optional" default="None">
<function-arg-description>
Known issue. Corresponds to an issue number.
</function-arg-description>
</function-arg-def>
<function-arg-def name="dsBaseDN" type="optional">
<function-arg-description>
The baseDN for the search operation
</function-arg-description>
<function-arg-property name="type" value="dn"/>
</function-arg-def>
</function-map-args>
<sequence>
<!-- Local variables -->
<script>
mylocation=location
</script>
<!-- Build the Command -->
<script>
STAFCmdParamsList=[]
STAFCmdParams=''
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/searchrate%s' % (sdkBinPath,fileExt)
</script>
<!-- Set common ldap arguments -->
<call function="'_ldapCommonArgs'" />
<script>
if dsBaseDN:
STAFCmdParamsList.append('-b %s' % dsBaseDN)
if extraParams:
STAFCmdParamsList.append('%s' % extraParams)
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
<call function="'runCommand'">
{ 'command' : STAFCmd,
'arguments' : STAFCmdParams,
'location' : mylocation,
'name' : 'searchrate',
'expectedRC' : expectedRC,
'knownIssue' : knownIssue
}
</call>
<script>
for line in STAXResult[0][1].split('\n'):
print line
</script>
<return>
STAXResult
</return>
</sequence>
</function>
<function name="modRate">
<function-prolog>
This function runs ldap modrate tool from OpenDJ SDK
</function-prolog>
<function-map-args>
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="sdkBinPath" type="optional" default="'%s' % SDK_BIN">
<function-arg-description>
Pathname to installation of sdk binaries
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="dsInstanceHost" type="optional">
<function-arg-description>
Directory server hostname or IP address
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="dsInstancePort" type="optional">
<function-arg-description>
Directory server port number
</function-arg-description>
<function-arg-property name="type" value="Port number"/>
</function-arg-def>
<function-arg-def name="dsInstanceDn" type="optional">
<function-arg-description>
Bind DN
</function-arg-description>
<function-arg-property name="type" value="DN"/>
</function-arg-def>
<function-arg-def name="dsInstancePswd" type="optional">
<function-arg-description>
Bind password
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="extraParams" type="optional">
<function-arg-description>
Optional extra parameters for specific test cases
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0
Wildcard 'noCheck' to not check the RC
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="verbose" type="optional" default="True">
<function-arg-description>
Display (or not) output.
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
<function-arg-def name="knownIssue" type="optional" default="None">
<function-arg-description>
Known issue. Corresponds to an issue number.
</function-arg-description>
</function-arg-def>
<function-arg-def name="dsBaseDN" type="optional">
<function-arg-description>
The baseDN for the operation
</function-arg-description>
<function-arg-property name="type" value="dn"/>
</function-arg-def>
<function-arg-def name="attribute" type="optional">
<function-arg-description>
The attribute to be modified
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="formatString" type="optional">
<function-arg-description>
The attribute value to be modified
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
</function-map-args>
<sequence>
<!-- Local variables -->
<script>
mylocation=location
</script>
<!-- Build the Command -->
<script>
STAFCmdParamsList=[]
STAFCmdParams=''
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/modrate%s' % (sdkBinPath,fileExt)
</script>
<!-- Set common ldap arguments -->
<call function="'_ldapCommonArgs'" />
<script>
if dsBaseDN:
STAFCmdParamsList.append('-b %s' % dsBaseDN)
if extraParams:
STAFCmdParamsList.append('%s' % extraParams)
if attribute:
STAFCmdParamsList.append('%s' % attribute)
if formatString:
STAFCmdParamsList.append(':%s' % formatString)
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
<call function="'runCommand'">
{ 'command' : STAFCmd,
'arguments' : STAFCmdParams,
'location' : mylocation,
'name' : 'modrate',
'expectedRC' : expectedRC,
'knownIssue' : knownIssue
}
</call>
<script>
for line in STAXResult[0][1].split('\n'):
print line
</script>
<return>
STAXResult
</return>
</sequence>
</function>
</stax>