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