Sun Identity Manager Deployment Guide

Writing Custom Adapters

After finishing the preparation work described in Preparing for Adapter Development you are ready to start writing your custom adapter.

This section describes how to write a custom adapter, including:

Process Overview

The following sections provide a high-level overview of the steps you perform to create a custom adapter:

How To Write a Standard Resource Adapter

This section describes the processes to follow when creating a standard adapter or an Active Sync-enabled adapter.


Note –

The steps for writing a standard adapter are slightly different based on which operating system you are using.


ProcedureTo Create a Standard Adapter:

  1. Open a command window and go to the following directory:

    \waveset\idm\adapter\src

  2. Rename the SkeletonStandardResourceAdapter.java skeleton file to a file name of your choice. See Rename the Skeleton File for more information.

  3. Edit the new adapter’s source file as described in Edit the Source File.

  4. Source the file you created previously to set up your environment:

    • For Windows: Source the ws.bat file.

    • For UNIX: Source the ws.sh file.

  5. Type the following command to compile your source files:

    • For Windows: javac -d . -classpath %CLASSPATH% yourfile.java

    • For UNIX: javac -d . -classpath $CLASSPATH yourfile.java

How To Write an Active Sync-Enabled Resource Adapter

This section describes the general steps you follow to create a custom Active Sync-Enabled adapter on the Microsoft Windows operating system.

ProcedureTo Create a Custom Active Sync-Enabled Adapter

  1. Open a command window and change to the following directory:

    \waveset\idm\adapter\src

  2. Rename (or copy) one of the following skeleton files to a file name of your choice. See Rename the Skeleton File for more information.

    • SkeletonStandardAndActiveSyncResourceAdapter.java (for standard and Active Sync-enabled resources)

    • SkeletonActiveSyncResourceAdapter.java (for Active Sync-only resources)

  3. Edit the new adapter’s source file as described in Edit the Source File.

  4. Source the file you created previously to set up your environment:

    • For Windows: Source the ws.bat file.

    • For UNIX: Source the ws.sh file.

  5. Type the following command to compile your source files:

    • For Windows: javac -d . -classpath %CLASSPATH% yourfile.java

    • For UNIX: javac -d . -classpath $CLASSPATH yourfile.java

Rename the Skeleton File

You must rename the skeleton adapter to a name that is appropriate for your new adapter. Perform the following actions:

Edit the Source File

After renaming the skeleton file, you must edit the new adapter’s source code to replace specific text strings and to define default values you want the adapter to support.

ProcedureTo Edit the Source File

  1. Search for, and replace, the following text strings to determine where you must make adapter-specific modifications in the code.

    • change-value-here strings indicate where you must enter a substitution.

    • @todo strings indicates where you must rewrite a method for a particular scenario you are supporting.

  2. Name the resource adapter type.

    This name displays in the New Resources menu in the Identity Manager Administrator interface.

  3. Map the incoming resource attributes to Identity Manager account attributes by replacing default values in the prototypeXML string with your own default values for this adapter type. For example, you might want to delete the RA_GROUPS attribute from your adapter type.

    See Map the Attributes for more information.

  4. Add or delete methods from the skeleton file. In particular, you must add Java code to support join, leave, and move operations, which are not supported in this example file.

    See Write the Adapter Methods for more information.

  5. After editing the adapter file, you can load it into Identity Manager.

Map the Attributes

Generally, you set options for the adapter type by mapping the incoming resource attributes to the standard Identity Manager account attributes or by creating your own custom attributes (called extended schema attributes).

Your resource must define resource attributes and set default values for resource attributes for which it makes sense to have default. The resource does not have to present the prototypeXML object.


Note –

The attributes in SkeletonActiveSyncResourceAdapter are mandatory. Do not delete these attribute definitions when customizing the file.


Mapping Resource Attributes to Standard Account Attributes

To map incoming resource attributes to one of the standard Identity Manager account attributes, use the syntax shown in the following example.


Example 9–3 Mapping a Resource Attribute


"<AccountAttributeTypes>\n"+ <AccountAttributeType name=’accountId’ mapName=’change-value-here’
mapType=’string’ required=’true’>\n"+ "<AttributeDefinitionRef>\nt"+  <ObjectRef type=’AttributeDefinition’
name=’accountId’/>\n"+ "</AttributeDefinitionRef>\n"+ "</AccountAttributeType>\n"+
 "</AccountAttributeTypes>\n"+

Where:

Table 9–13 <AttributeDefinitionRef> Element Fields

Element Field  

Description  

name

Identifies the Identity Manager account attribute to which the resource attribute is being mapped. (The left column on the resource schema page in the Identity Manager User Interface.) 

mapName

Identifies the name of the incoming resource attribute. When editing the skeleton file, replace change-value-here with the resource attribute name.

mapType

Identifies the incoming attribute type, which can be string, int, or encrypted. 

For more information on mapping resource attributes to account attributes, see Map the Attributes.

Mapping Resource Attributes to Extended Schema Attributes

To map incoming resource attributes to attributes other than a standard Identity Manager attribute, you must create an extended schema attribute. The following example illustrates how to map a resource attribute to an extended schema attribute.


Example 9–4 Mapping a Resource Attribute to an Extended Schema Attribute


<AccountAttributeType name=’HomeDirectory’ type=’string’ mapName=’HomeDirectory’
mapType=’string’>\n"+ </AccountAttributeType>\n"+

You do not have to declare an ObjectRef type. The mapName field identifies the custom account attribute HomeDirectory. You define the mapType field the same as you would when mapping an attribute to a standard account attribute.

Specify the Identity Template

You must use an identity template (or an account DN) to uniquely identify every user and group in your enterprise.

DNs display on the following Identity Manager User interface pages:

For more information about identity templates, see Identity Template.

Write the Adapter Methods

The Identity Manager adapter interface provides general methods that you must customize to suit your particular environment. This section briefly describes:

How to Write Standard Resource Adapter-Specific Methods

Standard resource adapter-specific methods are specific to the resource you are updating to synchronize with Identity Manager.

The body of a resource adapter consists of resource-specific methods. Consequently, the resource adapter provides methods that are only generic placeholders for the specific methods that you will write.

This section describes how the methods used to implement operations are categorized. The information is organized into the following sections:


Note –

When writing a custom adapter


Creating the Prototype Resource

The following table describes the methods used to create a Resource instance.

Table 9–14 Methods Used to Create a Resource Instance

Method 

Description 

staticCreatePrototypeResource

Creates a Resource instance, usually from the predefined prototypeXML string defined in the resource adapter. Because it is a static method, it can be called knowing only the path to the Java class which is the resource adapter.

createPrototypeResource

A local method that can be executed only if you already have an instance of a Java object of the resource adapter class. Typically, the implementation of createPrototypeResource() is to just call the staticCreatePrototypeResource() method.

If extending an existing adapter, you can add resource attributes to specify different default values programmatically based on the super class’s prototype resource. 

Connecting with the Resource

The following methods are responsible for establishing connections and disconnections as an authorized user. All resource adapters must implement these methods.

Checking Connections and Operations

ResourceAdapterBase provides methods that you can use to check the validity of an operation, such as whether the connection to the resource is working, before the adapter attempts the actual operation.

The following table describes methods you can use to verify that your adapter is communicating with the resource and that the authorized account has access.

Table 9–15 Methods Used to Check Communication

Method 

Description  

checkCreateAccount

Checks to see if an account can be created on the resource. The following features can be checked: 

  • Can basic connectivity to the resource be established?

  • Does the account already exist?

  • Do the account attribute values comply with all (if any) resource-specific restrictions or policies that have not been checked at a higher level?

    This method does not check whether the account already exists. It contains the account attribute information needed to create the user account such as account name, password, and user name.

    After confirming that the account can be created, the method closes the connection to the resource.

checkUpdateAccount

Establishes a connection and checks to see if the account can be updated. 

This method receives a user object as input. It contains the account attribute information needed to create the user account such as account name, password, and user name. 

The user object specifies the account attributes that have been added or modified. Only these attributes are checked. 

checkDeleteAccount

Checks to see if an account exists and can deleted. The following features can be checked: 

  • Can basic connectivity to the resource be established?

  • Does the account already exist?

  • Do the account attribute values comply with all (if any) resource-specific restrictions or policies that haven’t been checked at a higher level?

    This method does not check whether the account already exists. It receives a user object as input. It contains the account attribute information needed to delete the user account such as account name, password, and user name.

    After checking to see if the account can be deleted, the method closes the connection to the resource

Defining Features

The getFeatures() method specifies which features are supported by an adapter. The features can be categorized as follows:

The ResourceAdapterBase class defines a base implementation of the getFeatures() method. The Enabled in Base? column in the following tables indicates whether the feature is defined as enabled in the base implementation in ResourceAdapterBase.

Table 9–16 General Features

Feature Name

Enabled in Base? 

Comments

ACTIONS

No 

Indicates whether before and after actions are supported. To enable, override the supportsActions method with a true value.

RESOURCE_PASSWORD_CHANGE

No 

Indicates whether the resource adapter supports password changes. To enable, override the supportsResourceAccount method.

Table 9–17 Account Features

Feature Name

Enabled in Base? 

Comments

ACCOUNT_CASE_INSENSITIVE_IDS

Yes 

Indicates whether user account names are case-insensitive. Override the supportsCaseInsensitiveAccountIds method with a false value to make account IDs case-sensitive.

ACCOUNT_CREATE

Yes 

Indicates whether accounts can be created. Use the remove operation to disable this feature. 

ACCOUNT_DELETE

Yes 

Indicates whether accounts can be deleted. Use the remove operation to disable this feature. 

ACCOUNT_DISABLE

No 

Indicates whether accounts can be disabled on the resource. Override the supportsAccountDisable method with a true value to enable this feature.

ACCOUNT_EXCLUDE

No 

Determines whether administrative accounts can be excluded from Identity Manager. Override the supportsExcludedAccounts method with a true value to enable this feature.

ACCOUNT_ENABLE

No 

Indicates whether accounts can be enabled on the resource. Override the supportsAccountDisable method with a true value if accounts can be enabled on the resource.

ACCOUNT_EXPIRE_PASSWORD

Yes 

Enabled if the expirePassword Identity Manager User attribute is present in the schema map for the adapter. Use the remove operation to disable this feature. 

ACCOUNT_GUID

No 

If a GUID is present on the resource, use the put operation to enable this feature. 

ACCOUNT_ITERATOR

Yes 

Indicates whether the adapter uses an account iterator. Use the remove operation to disable this feature. 

ACCOUNT_LIST

Yes 

Indicates whether the adapter can list accounts. Use the remove operation to disable this feature. 

ACCOUNT_LOGIN

Yes 

Indicates whether a user can login to an account. Use the remove operation if logins can be disabled. 

ACCOUNT_PASSWORD

Yes 

Indicates whether an account requires a password. Use the remove operation if passwords can be disabled. 

ACCOUNT_RENAME

No 

Indicates whether an account can be renamed. Use the put operation to enable this feature. 

ACCOUNT_REPORTS_DISABLED

No 

Indicates whether the resource reports if an account is disabled. Use the put operation to enable this feature. 

ACCOUNT_UNLOCK

No 

Indicates whether an account can be unlocked. Use the put operation if accounts can be unlocked. 

ACCOUNT_UPDATE

Yes 

Indicates whether an account can be modified. Use the remove operation if accounts cannot be updated. 

ACCOUNT_USER_PASSWORD_ON_CHANGE

No 

Indicates whether the user’s current password must be specified when changing the password. Use the put operations if the user’s current password is required. 

Table 9–18 Group Features

Feature Name

Enabled in Base? 

Comments

GROUP_CREATE,GROUP_DELETE, GROUP_UPDATE

No 

Indicates whether groups can be created, deleted, or updated. Use the put operation to if these features are supported on the resource. 

Table 9–19 Organizational Unit Features

Feature Name

Enabled in Base? 

Comments

ORGUNIT_CREATEORGUNIT_DELETEORGUNIT_UPDATE

No 

Indicates whether organizational units can be created, deleted, or updated. Use the put operation to if these features are supported on the resource. 

If your custom adapter overrides the ResourceAdapterBase implementation of the getFeatures method, add code similar to the following:


public GenericObject getFeatures() {
GenericObject genObj = super.getFeatures();
genObj.put(Features.ACCOUNT_RENAME, Features.ACCOUNT_RENAME);
genObj.remove(Features.ACCOUNT_UPDATE, Features.ACCOUNT_UPDATE);
.. other features supported by this Resource Adapter …
return genObj;
}

To disable a feature by overriding a different method (such as supportsActions) add code similar to the following:


public boolean supportsActions() {
   return true;
}

The following tables describe the methods used to create, delete, and update accounts on Resources.

Table 9–20 Creating Accounts on the Resource

Method  

Description  

realCreate()

Creates the account on the resource. 

Receives a user object as input, and contains the account attribute information needed to create the user account (such as account name, password, and user name) 

Table 9–21 Deleting Accounts on the Resource

Method  

Description 

realDelete()

Deletes one or more accounts on the resource. 

Receives a user object or list of user objects as input. By default, this method creates a connection, calls realDelete, closes the connection for each user object in the list.

Table 9–22 Updating Accounts on the Resource

Method 

Description  

realUpdate()

Updates a subset of the account attributes. 

By default, this method creates a connection, calls realUpdate, and closes the connection for each user object in the list.

NOTE: User account attributes from the resource are merged with any new changes from Identity Manager.

Table 9–23 Getting User Information

Method  

Description  

getUser()

Retrieves information from the resource about user attributes. 

Receives a user object as input (typically with only an account identity set), and returns a new user object with values set for any attribute defined in resource schema map. 

You can use list methods to establish processes that adapters use to retrieve user information from the resource.

Table 9–24 List Methods

Method 

Description 

getAccountIterator()

Used to discover or import all the users from a resource. 

Implements the Account Iterator interface to iterate over all users of a resource. 

listAllObjects ()

Given a resource object type (such as accountID or group), returns a list of that type from the resource.

Implement this method to generate lists that are used by the resource, such as a list of resource groups or distribution lists. 

This method is called from the user form (not called by provisioning engine). 

Best Practice

When writing an AccountIterator interface implementation for a custom adapter, try to do the following:

The following example shows code for retrieving information from a resource and converting that information into information that Identity Manager can work with.

Resource Adapters: Retrieving Information on a Resource


public WSUser getUser(WSUser user)
 throws WavesetException {
    String identity = getIdentity(user);
     WSUser newUser = null;
    try {
         startConnection();
        Map attributes = fetchUser(user);
         if (attributes != null) {
             newUser = makeWavesetUser(attributes);
         }
     } finally {
         stopConnection();
     }
     return newUser;
 }
Table 9–25 Enable and Disable Methods

Method 

Description 

supportsAccountDisable()

Returns true or false depending on whether the resource supports native account disable.

realEnable()

Implements native calls that are needed to enable the user account on the resource. 

realDisable()

Implements native calls that are needed to disable the user account on the resource. 

Disabling User Accounts

You can disable an account by using the disable utilities supported by the resource or the account disable utility provided by Identity Manager.


Note –

Use native disable utilities whenever possible.


Enabling Pass-Through Authentication for Resource Types

Use the following general steps to enable pass-through authentication in a resource type:

ProcedureTo Enable Pass-Through Authentication on a Resource Type

  1. Ensure that the adapter’s getFeatures() method returns ResourceAdapter.ACCOUNT_LOGIN as a supported feature.

    • If your custom adapter overrides the ResourceAdapterBase implementation, add the following code.


      public GenericObject getFeatures() {
      GenericObject genObj = super.getFeatures();
      genObj.put(Features.ACCOUNT_RENAME, Features.ACCOUNT_RENAME);
      .. other features supported by this Resource Adapter …
      return genObj;
      }
    • If your custom adapter does not override the getFeatures() implementation in the ResourceAdapterBase class, it will inherit the getFeatures() implementation that is exported for ACCOUNT_LOGIN by default.

  2. Add the <LoginConfigEntry> element to the adapter’s prototypeXML.

  3. Implement the adapter’s authenticate() method.

    The authenticate() method authenticates the user against the resource by using the authentication property name/value pairs provided in the loginInfo map. If authentication succeeds, be sure that the authenticated unique ID is returned in the WavesetResult by adding a result as follows:


    result.addResult(Constants.AUTHENTICATED_IDENTITY, accountID);

    If authentication succeeded, but the user’s password was expired, then in addition to the identity added above, also add the password expired indicator to the result to be returned. This will ensure that the user will be forced to change their password on at least resource upon next login to Identity Manager.


    result.addResult(Constants.RESOURCE_PASSWORD_EXPIRED, new Boolean(true));

    If authentication fails (because the user name or password is invalid), then:


    throw new WavesetException("Authentication failed for " + uid + ".");

How to Write Active Sync-Enabled Adapter Methods

Active Sync-specific methods provide the mechanism for updating Identity Manager, which is the primary purpose of your Active Sync-enabled adapter adapter. These methods are based on pulling information from the authoritative resource. In addition, you use these methods to start, stop, and schedule the adapter.

The methods you are going to write in this section of the adapter are based on generic methods supplied with the skeleton adapter file. You must edit some of these methods, which are categorized by task.

The following sections describe general guidelines for creating Active Sync-enabled adapter methods:

Initializing and Scheduling the Adapter

You initialize and schedule the adapter by implementing the init() and poll() methods.

The init() method is called when the adapter manager loads the adapter. There are two methods for loading the adapter:

In the initialization process, the adapter can perform its own initialization. Typically, this involves initializing logging (with the ActiveSyncUtil class), and any adapter-specific initialization such as registering with a resource to receive update events.

If an exception is thrown, the adapter is shut down and unloaded.

Polling the Resource

All of the adapter’s work is performed by the poll() method. Scheduling the adapter requires setting up a poll() method to search for and retrieve changed information on the resource.

This method is the main method of the Active Sync-enabled adapter. The adapter manager calls the poll() method to poll the remote resource for changes. The call then converts the changes into IAPI calls and posts them back to a server. This method is called on its own thread and can block for as long as needed.

It should call its ActiveSyncUtil instance’s isStopRequested method and return when true. Check isStopRequested as part of the loop condition when looping through changes.

To configure defaults for polling, you can set the polling-related resource attributes in the adapter file. Setting these polling-related attributes provides administrators with a means to later use the Identity Manager interface to set the start time and date for the poll interval and the length of the interval.

Scheduling Parameters

You use the following scheduling parameters in Active Sync-enabled adapters:

See Table 9–6 for a description of these parameters.

Scheduling Parameters in the prototypeXML

The scheduling parameters are present in the string constant ActiveSync. ACTIVE_SYNC_STD_RES_ATTRS_XML, along with all other general Active Sync-related resource attributes.

The following table describes the usage of scheduling parameters using some sample polling scenarios.

Table 9–26 Sample Polling Scenarios

Polling Scenario  

Parameters  

Daily at 2 A.M. 

Interval = day, count =1, start_time=0200

Four times daily 

Interval=hour, count=6.

Poll once every two weeks on Thursday at 5 P.M 

Interval = week, count=2, start date = 20020705 (a Thursday), time = 17:00.

Storing and Retrieving Adapter Attributes

Most Active Sync-enabled adapters are also standard adapters, where a single Java class both extends ResourceAdapterBase (or AgentResourceAdapter) and implements the Active Sync interface.

The following example shows how to retrieve the attribute and pass the update through to the base.


Example 9–5 Attribute Retrieval and Update


public Object getAttributeValue(String name) throws WavesetException {
return getResource().getResourceAttributeVal(name); }
public void setAttributeValue(String name, Object value) throws WavesetException {
getResource().setResourceAttributeVal(name,value);

Updating the Identity Manager Repository

When an update is received, the adapter uses the IAPI classes, notably IAPIFactory to:

Mapping the Changes to the Identity Manager Object

Using the Active Sync event parameter configurator for the resource, IAPIFactory.getIAPI constructs an IAPI object, either IAPIUser or IAPIProcess from a map of changed attributes. If an exclusion rule (iapi_create, iapi_delete, or iapi_update) is configured for the resource, IAPIFactory checks if the account is excluded. If a non-null object is created and returned by the Factory, the adapter can modify the IAPI object (for example, by adding a logger), then submits it.

When the object is submitted, the form associated with the resource is expanded with the object view before the view is checked in. For more information about forms and views, see Deployment Reference.

In SkeletonActiveSyncResourceAdapter, this process is handled in the buildEvent and processUpdates methods.

Shutting Down the Adapter

No system requirements are associated with adapter shutdown. Identity Manager calls the shutdown method, which is an opportunity for your adapter to cleanup any objects still in use from the polling loop.

Configure the Adapter to Support Pass-Through Authentication

Identity Manager uses pass-through authentication to grant users and administrators access through one or more different passwords. Identity Manager manages pass-through authentication through the implementation of:

You configure a custom adapter to support pass-through authentication by

When configuring a custom resource adapter to support an interactive login, you must enable the adapter to request additional information from a user during log in and after that user submits the initial login page.

The adapter authenticate() method controls whether the login becomes interactive. The authenticate() method’s return values trigger the interactive login so the authenticate() is called again with the results of the next login page until the authenticate() method decides the login

To be interactive, the adapter must return a WavesetResult that

Each ResultItem corresponds to a field in the form. ResultItems must have the Constants.CONTINUE_AUTHENTICATION_ATTR type with values in the following format:

label|attrName|displayType|prompt|’isId

Where

The following ResultItem types are also “round-tripped” and returned in the loginInfo HashMap on the next authenticate() call:

Define the Resource Object Components

This section describes how to define the following resource object components:

Defining Resource Object Classes

Object classes are handled differently for LDAP-based resource objects than for other resource objects.

LDAP-Based Resource Objects

LDAP-based resource objects can consist of more than one LDAP object class, where each object class is an extension of its parent object class. However, within LDAP, the complete set of these object classes is viewed and managed as a single object type within LDAP.

To manage this type of resource object within Identity Manager, include the XML element <ObjectClasses> within the <ObjectType> definition. The <ObjectClasses> element allows you to define the set of object classes that is associated with this <ObjectType> as well as the relationship of classes to each other.

Non-LDAP-Based Resource Objects

For non-LDAP-based resource objects, you can use the <ObjectType> to represent information other than the resource object type name.

In the following example, the primary attribute defines the object class to be used when creating and updating an object of this type. In this case, inetorgperson is the object class that is defined as the primary one because it is a subclass of the other listed object classes. The operator attribute specifies whether the list of object classes should be treated as one (logical AND) or treated as unique classes (logical OR) when listing or getting an object of this type. In this case, Identity Manager performs an AND operation on these object classes prior to any list or get requests for this object type.


Example 9–6 Using inetorgperson Object Class


<ObjectClasses primary=’inetorgperson’ operator=’AND’>\n"+
<ObjectClass name=’person’/>\n"+ <ObjectClass name=’organizationalPerson’/>\n"+
<ObjectClass name=’inetorgperson’/>\n"+ </ObjectClasses>\n"+

In the next example, all requests to create and/or update resource objects of this type are done using the groupOfUniqueNames object class. All list and get requests will query for all objects whose object class is either groupOfNames or groupOfUniqueNames.


Example 9–7 Using groupOfUniqueNames Object Class


<ObjectClasses primary=’groupOfUniqueNames’ operator=’OR’>\n"+
<ObjectClass name=’groupOfNames’/>\n"+ <ObjectClass name=’groupOfUniqueNames’/>\n"+
</ObjectClasses>\n"+

In this example, only one object class is defined so all create, get, list, and update operations are performed using object class organizationalUnit.


Example 9–8 Using organizationalUnit Object Class


<ObjectClasses operator=’AND’>\n"+ <ObjectClass name=’organizationalUnit’/>\n"+ </ObjectClasses>\n"+

Because there is only one object class, you can exclude the <ObjectClasses> section. If you exclude the <ObjectClasses> section, the object class defaults to the <ObjectType> name attribute value. However, if you want the object type name to differ from the resource object class name, you must include the <ObjectClasses> section with the single <ObjectClass> entry.

Defining Resource ObjectTypes

Resource Object types uniquely define a specific type of resource, and you define object types in the adapter’s prototypeXML string.

The XML <ObjectTypes> element is a container within the adapter’s prototypeXML string that contains one or more object type definitions to be managed on that resource. This <ObjectTypes> element fully describes the resource-specific object to Identity Manager, including the following:

The following table describes the supported attributes of the <ObjectType> element.

Table 9–27 Supported <ObjectType> Element Attributes

Attribute 

Description 

name

Defines the name by which this object type is displayed and referred to within Identity Manager (required). 

icon

Defines the name of the .gif file to display in the Identity Manager interface for objects of this type. You must install this .gif file in idm/applet/images for use by Identity Manager.

container

Defines whether this type of resource object can contain other resource objects of the same type or of a different type. 

  • If true, this resource object type can contain other resource objects.

  • If false, this resource object type cannot contain other resource objects.

The following example shows ObjectType definitions:


Example 9–9 Example ObjectType Definitions


static final String prototypeXml =
"<Resource name=’Skeleton’ class= ’com.waveset.adapter.sample.SkeletonStandardResourceAdapter’
typeString=’Skeleton of a resource adapter’ typeDisplayString=’"+Messages.RESTYPE_SKELETON+"’>\n"+
  " <ObjectTypes>\n"+ 
  " <ObjectType name=’Group’ icon=’group’>\n"+ 
… other content defined below will go here … 
  " </ObjectType>\n"+ 
  " <ObjectType name=’Role’ icon=’ldap_role’>\n"+ 
… other content defined below will go here … 
  " </ObjectType>\n"+ 
  " <ObjectType name=’Organization’ icon=’folder_with_org’ container=’true’>\n"+ 
… other content defined below will go here … 
  "</ObjectType>\n"+ 
" </ObjectTypes>\n”+

Defining Resource Object Features

The <ObjectFeatures> section specifies a list of one or more features supported by this object type, where each object feature is directly tied to the implementation of the associated object type method in the resource adapter.

Each ObjectFeature definition must contain the name attribute, which specifies a feature name. The create and update features can specify a form attribute, which defines the resource form used to process create and update features. If you do not specify a form attribute, Identity Manager processes the create and update features with the same form used by all resources of a given type.

The following table describes the object feature mappings.

Table 9–28 Object Feature Mappings

Object Feature 

Method 

Supports Form Attribute? 

create 

createObject

Yes 

delete 

deleteObject

No 

find 

listObjects

No 

list 

listObjects

No 

rename 

updateObject

No 

saveas 

createObject

No 

update 

updateObject

Yes 

view 

getObject

No 

In the following example, the <ObjectFeatures> section includes all supported object features. Your resource adapter can support all of these features or just a subset of features. The more object features your adapter supports, the richer the object management function within Identity Manager.


Example 9–10 <ObjectFeatures> Section Including all Supported Object Features


 <ObjectFeatures>\n"+
   <ObjectFeature name=’create’ form=’My Create Position Form’/>
   <ObjectFeature name=’update’ form=’My Update Position Form’/>
   <ObjectFeature name=’create’/>\n"+
   <ObjectFeature name=’delete’/>\n"+
   <ObjectFeature name=’rename’/>\n"+
   <ObjectFeature name=’saveas’/>\n"+
   <ObjectFeature name=’find’/>\n"+
   <ObjectFeature name=’list’/>\n"+
   <ObjectFeature name=’view’/>\n"+
</ObjectFeatures>\n"+

Defining Resource Object Attributes

The <ObjectAttributes> section specifies the set of attributes to be managed and queried in Identity Manager. Each <ObjectAttribute> element name should be the same as the native resource attribute name. Unlike user attributes in Identity Manager, no attribute mapping is specified. Use only the native attribute names.

The following table describes attributes that are required for <ObjectAttributes>.

Table 9–29 Required Attributes for <ObjectAttributes>

Attribute 

Description 

idAttr

The value of this attribute should be the resource object attribute name that uniquely identifies this object within the resource’s object namespace (for example, dn, uid)

displayNameAttr

The value of this attribute should be the resource object attribute name whose value is the name you want displayed when objects of this type are viewed within Identity Manager (for example, cn, samAccountName).

descriptionAttr

(Optional) This value of this attribute should be the resource object attribute name whose value you want displayed in the Description column of the Resources page. 

The following example shows an <ObjectAttributes> section defined in an <ObjectType>.


Example 9–11 <ObjectAttributes> Section Defined in an <ObjectType>


<ObjectAttributes idAttr=’dn’ displayNameAttr=’cn’ descriptionAttr=
       ’description’>\n"+
    <ObjectAttribute name=’cn’ type=’string’/>\n"+
    <ObjectAttribute name=’description’ type=’string’/>\n"+
    <ObjectAttribute name=’owner’ type=’distinguishedname’
namingAttr=’cn’/>\n"+
    <ObjectAttribute name=’uniqueMember’ type=’dn’ namingAttr=’cn’ />\n"+
 </ObjectAttributes>\n"+

The following table describes the <ObjectAttribute> attributes.

Table 9–30 <ObjectAttribute> Attributes

Attribute 

Description 

name

Identifies the resource object type attribute name (required) 

type

Identifies the type of object. Valid types include string or distinguishedname / ”dn’ (defaults to string)

namingAttr

If object type is distinguishedname or dn, this value specifies the attribute whose value should be used to display an instance of this object type referred to by the dn within Identity Manager


Note –

The methods in the resource adapter object type implementation are responsible for coercing all string values into the appropriate type based on the resource attribute name.


Defining Resource Forms

You must provide the following resource forms:

You can also assign an optional form that processes incoming data before storing it in Identity Manager. This resource form is a mechanism that transforms incoming data from the schema map and applies the transformed data to the User view. The sample form also performs actions, such as enabling and disabling an account, that are based on specific incoming data values such as employee status.

The following table describes attributes contained in the top-level namespace.


Note –

All values are strings unless otherwise specified.


Table 9–31 Top-Level Namespace Attributes

Attribute 

Description 

<objectType>.resourceType

Identity Manager resource type name (for example, LDAP, Active Directory) 

<objectType>.resourceName

Identity Manager resource name 

<objectType>.resourceId

Identity Manager resource ID 

<objectType>.objectType

Resource-specific object type (for example, Group)

<objectType>.objectName

Name of resource object (for example, cn or samAccountName)

<objectType>.objectId

Fully qualified name of resource object (for example, dn)

<objectType>.requestor

ID of user requesting view 

<objectType>.attributes

Resource object attribute name/value pairs (object) 

<objectType>.organization

Identity Manager member organization 

<objectType>.attrsToGet

List of object type specific attributes to return when requesting an object through checkoutView or getView (list)

<objectType>.searchContex

Context used to search for non-fully qualified names in form input 

<objectType>.searchAttributes

List of resource object type-specific attribute names that will be used to search within the specified searchContext for names input to the form (list).

<objectType>.searchTimeLimit

Maximum time spent searching where <objectType> is the lowercase name of a resource specific object type. For example, group, organizationalunit, organization.

<objectType>.attributes<resource attribute name>

Used to get or set the value of specified resource attribute (for example, <objectType>.attributes.cn, where cn is the resource attribute name). When resource attributes are distinguished names, the name returned when getting the value is the value of the namingAttr specified in the <ObjectAttribute> section of the <ObjectType> description.