<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
|
<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
! Copyright 2008 Sun Microsystems, Inc.
|
! -->
|
<stax>
|
|
|
<!-- ************************************************************ -->
|
<function name="writeTopology" scope="local">
|
<function-map-args>
|
<function-arg-def name="instances" type="required">
|
<function-arg-description>
|
instance object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="suffix" type="required">
|
<function-arg-description>
|
suffix object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="scheduler" type="required">
|
<function-arg-description>
|
scheduler object
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!--========== Write node =========-->
|
<script>
|
LOG_MAIN_FD.write('<topology>\n')
|
</script>
|
|
<!-- Write instances informations -->
|
<call function="'writeInstances'">
|
{
|
'instanceList' : instances,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
|
<!-- Write SUFFIX informations -->
|
<call function="'writeSuffix'">
|
{
|
'suffix' : suffix,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
|
<!-- Write SCHEDULER informations -->
|
<call function="'writeScheduler'">
|
{
|
'scheduler' : scheduler,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
|
<!--========== close node =========-->
|
<script>
|
LOG_MAIN_FD.write('</topology>\n')
|
</script>
|
|
|
</sequence>
|
</function>
|
|
|
<!-- ************************************************************ -->
|
<function name="writeInstances" scope="local">
|
|
<function-map-args>
|
<function-arg-def name="instanceList" type="required">
|
<function-arg-description>
|
List of instances class to write in xml report file
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="fileFd" type="required">
|
<function-arg-description>
|
file descriptor of the output file
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<call function="'writeStartTag'">
|
{
|
'nodeName' : 'instances',
|
'fileFd' : fileFd
|
}
|
</call>
|
<iterate var="a" in="instanceList">
|
<sequence>
|
<script>
|
try:
|
str = '\n <id>%s</id>\n' % a.getId()
|
except AttributeError:
|
str = '\n <id>ERROR_id_not_found</id>\n'
|
try:
|
str = '%s <host>%s</host>\n' % (str,a.getHost())
|
except AttributeError:
|
str = '\n <host>ERROR_host_not_found</host>\n'
|
try:
|
str = '%s <installDir>%s</installDir>\n' % \
|
(str,a.getInstallDir())
|
except AttributeError:
|
str = '%s <installDir>ERROR_id_not_found' % str
|
str = '%s</installDir>\n' % str
|
|
str = '%s <port>\n' % str
|
|
try:
|
str = '%s <ldap>%s</ldap>\n' % (str,a.getLDAPPort())
|
except AttributeError:
|
str = '%s <ldap>ERROR_ldap_not_found</ldap>\n' % str
|
try:
|
str = '%s <ldaps>%s</ldaps>\n' % (str,a.getLDAPSPort())
|
except AttributeError:
|
str = '%s <ldaps>ERROR_ldaps_not_found</ldaps>\n' % \
|
str
|
try:
|
str = '%s <jmx>%s</jmx>\n' % (str,a.getJMXPort())
|
except AttributeError:
|
str = '%s <jmx>ERROR_jmx_not_found</jmx>\n' % str
|
try:
|
str = '%s <replicationServer>%s</replicationServer>\n'%\
|
(str,a.getREPLPort())
|
except AttributeError:
|
str = '%s <replicationServerp>' % str
|
str = '%sERROR_replicationServer_not_found' % str
|
str = '%s</replicationServer>\n' % str
|
|
str = '%s </port>\n' % str
|
|
try:
|
str = '%s <buildId>%s</buildId>\n' % \
|
(str,a.getBuildId())
|
except AttributeError:
|
str = '%s <buildId>ERROR_buildId_not_found' % str
|
str = '%s </buildId>\n' % str
|
try:
|
str = '%s <jvm>%s</jvm>\n' % \
|
(str,a.getJavaVersion())
|
except AttributeError:
|
str = '%s <jvm>ERROR_jvm_not_found</jvm>\n' % str
|
try:
|
str = '%s <os>%s</os>\n' % \
|
(str,a.getOs())
|
except AttributeError:
|
str = '%s <os>ERROR_os_not_found</os>\n' % str
|
try:
|
str = '%s <synchroDate>%s</synchroDate>\n' % \
|
(str,a.getSynchroDate())
|
except AttributeError:
|
str = '%s <synchroDate>ERROR_synchroDate_not_found' % str
|
str = '%s </synchroDate>\n' % str
|
</script>
|
|
<call function="'writeTag'">
|
{
|
'tagName' : 'instance',
|
'tagAttr' : [['name',a.getName()],['product',a.getProduct()]] ,
|
'fileFd' : fileFd ,
|
'content' : str
|
}
|
</call>
|
|
</sequence>
|
</iterate>
|
<call function="'writeEndTag'">
|
{
|
'nodeName' : 'instances',
|
'fileFd' : fileFd
|
}
|
</call>
|
</sequence>
|
</function>
|
|
|
<!-- ************************************************************ -->
|
<function name="writeScheduler" scope="local">
|
|
<function-map-args>
|
<function-arg-def name="scheduler" type="required">
|
<function-arg-description>
|
scheduler object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="fileFd" type="required">
|
<function-arg-description>
|
file descriptor of the output file
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<call function="'writeStartTag'">
|
{
|
'nodeName' : 'schedulerParser',
|
'fileFd' : fileFd
|
}
|
</call>
|
<if expr="scheduler == []">
|
<message log="1">'topology.xml : ERROR NO SCHEDULER DEFINED'</message>
|
<else>
|
<iterate var="module" in="scheduler">
|
<sequence>
|
|
<script>
|
msgClients = ''
|
clients = module.getClients()
|
for client in clients:
|
str1 = 'id=\"%s\"' % client.getId()
|
str1 = '%s name=\"%s\"' % (str1,client.getName())
|
str1 = '%s host=\"%s\"' % (str1,client.getHost())
|
str1 = '%s start=\"%s\"' % (str1,client.getStart())
|
str1 = '%s stop=\"%s\"' % (str1,client.getStop())
|
str1 = '%s dependency=\"%s\"' % (str1,client.getDependency())
|
|
msgClients = '%s<client %s > %s </client>\n' % \
|
(msgClients,str1,client.getParams())
|
</script>
|
|
<call function="'writeTag'">
|
{
|
'tagName' : 'module',
|
'tagAttr' : [['name',module.getName()],['enabled',module.getEnabled()]],
|
'fileFd' : fileFd ,
|
'content' : msgClients
|
}
|
</call>
|
|
</sequence>
|
</iterate>
|
</else>
|
</if>
|
<call function="'writeEndTag'">
|
{
|
'nodeName' : 'schedulerParser',
|
'fileFd' : fileFd
|
}
|
</call>
|
</sequence>
|
</function>
|
|
|
<!-- ************************************************************ -->
|
<function name="writeSuffix" scope="local">
|
|
<function-map-args>
|
<function-arg-def name="suffix" type="required">
|
<function-arg-description>
|
suffix object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="fileFd" type="required">
|
<function-arg-description>
|
file descriptor of the output file
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<!-- Write Suffix informations -->
|
<script>
|
sys.path.append("%s/phases/parser" % TESTS_DIR )
|
from parser import *
|
|
# SUFFIX TOPOLOGY
|
topoMsg = ''
|
topology = suffix.getTopology()
|
if topology == '':
|
topology = 'ERROR:cant find topology'
|
|
topoMsg = '%s\n<topology>' % topoMsg
|
for topoInstance in topology:
|
instance = topoInstance.getInstanceRef()
|
topoMsg = '%s\n <instance name=\"%s\"' % \
|
(topoMsg,instance.getName())
|
topoMsg = '%s initRule=\"%s\"></instance>' % \
|
(topoMsg,topoInstance.getInitRule())
|
|
topoMsg = '%s\n</topology>\n' % topoMsg
|
|
# SUFFIX DATA
|
# Get ldif file if specified in conf.xml
|
suffixDataForXml = suffix.getLdifFile()
|
nbOfEntries = 'unknown'
|
# if ldif file is not specified in conf.xml, get the tree data
|
if suffixDataForXml == NOT_DEFINED:
|
root = suffix.getTree()
|
suffixDataForXml = getSuffixDataForXML(suffix.getSuffixDn(),root)
|
nbOfEntries = suffix.getNbOfEntries()
|
</script>
|
<call function="'writeStartTag'">
|
{
|
'nodeName' : 'suffixes',
|
'fileFd' : fileFd
|
}
|
</call>
|
<call function="'writeTag'">
|
{
|
'tagName' : 'suffix',
|
'tagAttr' : [['name',suffix.getSuffixDn()]] ,
|
'fileFd' : LOG_MAIN_FD ,
|
'content' : '\n %s \
|
<numberOfEntries>%s</numberOfEntries>\n \
|
%s \n \
|
' % (topoMsg,nbOfEntries,suffixDataForXml)
|
}
|
</call>
|
<call function="'writeEndTag'">
|
{
|
'nodeName' : 'suffixes',
|
'fileFd' : fileFd
|
}
|
</call>
|
|
</sequence>
|
</function>
|
|
|
|
</stax>
|