比如创建一个服务包SunPortalService.jar,那么里面的内容有
--META-INF
--SunPortalService
--resource.def
--schema.dsml
--SunPortalAccount.xml
--SunPortalService.xml
resource.def定义了Service和Account,详细内容是
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***************************************************************** -->
<!-- Licensed Materials - Property of IBM -->
<!-- -->
<!-- Source File Name = resource.def -->
<!-- -->
<!-- (C) COPYRIGHT IBM Corp. 2003 All Rights Reserved -->
<!-- -->
<!-- US Government Users Restricted Rights - Use, duplication or -->
<!-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
<!-- ***************************************************************** -->
<!-- This document describes the resource definition for an example service. -->
<Resource>
<!-- The system profile contains an overall description and any specific -->
<!-- properties to be used for communications. -->
<SystemProfile>
<Name>SunPortalService</Name>
<Description>Sun Portal Service</Description>
<BehaviorProperties>
<!-- The service provider factory should have the value used to -->
<!-- instantiate the DSMLv2 protocol module.-->
<Property Name = "com.ibm.itim.remoteservices.ResourceProperties.SERVICE_PROVIDER_FACTORY"
Value = "com.ibm.itim.remoteservices.provider.dsml2.DSML2ServiceProviderFactory"/>
</BehaviorProperties>
</SystemProfile>
<!-- Protocol properties add values from the service instance to request messages to the -->
<!-- end point. -->
<ProtocolProperties>
<Property Name = "url" LDAPName = "erurl"/>
<Property Name = "principal"
LDAPName = "erUid" />
<Property Name = "credentials"
LDAPName = "erPassword" />
</ProtocolProperties>
<!-- Defines a profile for the custom account type. -->
<AccountDefinition ClassName = "SunPortalAccount"
Description = "Sun Portal Account">
</AccountDefinition>
<!-- Defines a profile for the custom service type. -->
<ServiceDefinition ServiceProfileName = "SunPortalService"
ServiceClass = "SunPortalService"
AttributeName = "erServiceName"
AccountClass = "SunPortalAccount"
AccountProfileName = "SunPortalAccount"
Description = "Sun Portal Account">
</ServiceDefinition>
</Resource>
schema.dsml是定义Service和Account的LDAP模式,描述对象类所拥有的属性。
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***************************************************************** -->
<!-- Licensed Materials - Property of IBM -->
<!-- -->
<!-- Source File Name = schema.dsml -->
<!-- -->
<!-- (C) COPYRIGHT IBM Corp. 1999, 2002 All Rights Reserved -->
<!-- -->
<!-- US Government Users Restricted Rights - Use, duplication or -->
<!-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- This document is a Directory Service Markup Language (DSML) -->
<!-- description of an example service and account data model. -->
<!-- ***************************************************************** -->
<dsml>
<directory-schema>
<!-- ******************************************************** -->
<!-- attribute definitions -->
<!-- ******************************************************** -->
<!-- ******************************************************** -->
<!-- class definitions -->
<!-- ******************************************************** -->
<class superior="top">
<name>SunPortalService</name>
<description>Sun Portal Service</description>
<object-identifier>cmcc-SunPortalService-oid</object-identifier>
<attribute ref="erservicename" required="true" />
<attribute ref="erurl" required="true" />
<attribute ref="eruid" required="true" />
<attribute ref="erpassword" required="true" />
<attribute ref="ernamingattribute" required="false" />
<attribute ref="namingcontexts" required="true" />
<attribute ref="erCategory" required="false" />
</class>
<class superior="top">
<name>SunPortalAccount</name>
<description>Sun Portal Account</description>
<object-identifier>cmcc-SunPortalAccount-oid</object-identifier>
<attribute ref="eruid" required="true" />
<attribute ref="cn" required="false" />
<attribute ref="erpassword" required="false" />
</class>
</directory-schema>
</dsml>
SunPortalAccount.xml是Account的表单定义文件。
<page>
<body>
<form action="formvalidator0">
<formElement name="data.eruid" label="$eruid" required="true">
<input name="data.eruid" size="50" type="text"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
<formElement name="data.cn" label="$cn" >
<input name="data.cn" size="50" type="text"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
</form>
</body>
</page>
SunPortalService.xml是Service的表单定义文件。
<page>
<body>
<form action="formvalidator0">
<formElement name="data.erservicename" label="$erservicename" required="true">
<input name="data.erservicename" size="50" type="text"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
<formElement name="data.erurl" label="$erurl" required="true">
<input name="data.erurl" size="50" type="text"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
<formElement name="data.eruid" label="$eruid" required="true">
<input name="data.eruid" size="50" type="text"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
<formElement name="data.erpassword" label="$erpassword" required="true">
<input name="data.erpassword" size="50" type="password"/>
<constraint><type>REQUIRED</type><parameter>true</parameter></constraint></formElement>
<formElement name="data.namingcontexts" label="$namingcontexts">
<input name="data.namingcontexts" size="50" type="text"/>
</formElement>
<formElement name="data.erCategory" label="$erCategory">
<input name="data.erCategory" size="50" type="text"/>
</formElement>
<formElement name="data.ernamingattribute" label="$ernamingattribute">
<input name="data.ernamingattribute" size="50" type="text"/>
</formElement>
<formElement name="data.owner" label="$owner">
<searchControl operator="1" type="input" attribute="cn" orgSubTreeSearch="true" category="Person" class="Person">
<comboItem></comboItem>
</searchControl>
</formElement>
<formElement name="data.erprerequisite" label="$erprerequisite">
<searchControl operator="1" type="input" attribute="erservicename" orgSubTreeSearch="true" category="Service" class="DSMLInfo">
<comboItem></comboItem>
</searchControl>
</formElement>
</form>
</body>
</page>