Overview#

Be sure the DirXML Script namespace definitions are set within the policy where using the Java call.

Shows a DirXML Example and XPATH Example for working with DirXML Calling Custom Java Functions.

You will also need to place the Java jar files in the correct location.

Calling Java From DirXML#

An example where we show how we did UUID Generation in DirXML Calling Java Example from a driver.

An example where we show how we used our Unique Value Finder tool from a driver

DirXML 3.01 and Earlier#

Each of the following headings defines an XML namespace for an external Java method. Add it as an attribute on your policy or XSLT template.

One or more examples of how to use the available methods follow each XML namespace.

xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor"#

		<actions>
			<do-set-local-variable name="userMembershipList">
				<arg-node-set>
					<token-xpath expression='query:readObject($srcQueryProcessor, "", @src-dn, "User", "Group Membership")'/>
				</arg-node-set>
			</do-set-local-variable>
		</actions>

xmlns:date="http://www.novell.com/nxsl/java/java.util.Date"#

		<actions>
			<do-set-local-variable name="timestamp">
				<arg-object>
					<token-xpath expression="date:new()"/>
				</arg-object>
			</do-set-local-variable>
			<do-set-local-variable name="timestamp">
				<arg-string>
					<token-xpath expression="round(date:getTime($timestamp) div 1000)"/>
				</arg-string>
			</do-set-local-variable>
		</actions>

xmlns:jconvCase="http://www.novell.com/nxsl/java/convCase"#

This calls out to a custom Java class. You can view the ConvCase.Java Source Code.
	<xsl:variable name="jconvCaseInstance" select="jconvCase:new()"/>
	<xsl:value-of select="jconvCase:toTitleCase($jconvCaseInstance,$toconvert)"/>

xmlns:jstring="http://www.novell.com/nxsl/java/java.lang.String"#

	<xsl:value-of select="jstring:toLowerCase($toconvert)"/>
	<xsl:value-of select="jstring:toUpperCase($toconvert)"/>
	<xsl:variable name="dn" select="jstring:new($src-dn)"/>
	<xsl:variable name="index" select="jstring:lastIndexOf($dn,'\')"/>
	<xsl:if test="$index != -1">
		<xsl:value-of select="jstring:substring($dn,$index + 1)"/>
	</xsl:if>

xmlns:ncs="http://www.novell.com/nxsl/java/com.novell.ncs.dirxml.utilities.Utils"#

	<!-- The ncs:getTimeString() function is a simple java function in the DirXMLNCUtils.jar file -->
	<!-- The function returns the system time in the following format yyyymmddhhmmss -->
	<!-- When the NDS timestamp is used, it must be converted from NDS time to a string -->
	<!-- NDS timestamps are stored as the number of seconds since 1/1/1970 followed by a # then a replica number -->
	<!-- The # and replica number are stripped out by the substring-before XSLT function -->
	<xsl:value-of select="ncs:getTimeString()"/>
	<!-- Here we simply write a message to the DSTrace screen or log if it's running -->
	<xsl:message>
logentry=<xsl:value-of select="ncs:writeLog($logfile,$logmessage)"/>
	</xsl:message>

More Information#

There might be more information for this subject on one of the following:

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-29) was last changed on 03-Aug-2016 12:30 by jim