Integarating Custom Resource Adapter
Hi All,
I am trying to develop a custom resource adaptor for a web application. I am using the SkeletonStandardResourceAdapter.java as the starting point and have added after mdofying wrt resource to the list of custom adapters in IDM.
Objective - To create a user in the webApp.
I want to know the following things -
1. where does IDM store data and how does it reference it.
2.How do I map IDM attributes to Resource attributes(I guess it is done thru the prototype XML.) but how does it know which objects and its members to relate to each other.
3.How do we trigger the event to create a user and then take it till the resource.
Thanks in advance
[700 byte] By [
Nupur] at [2007-11-26 10:16:59]

# 1
Please find my response inline.
Chetan Desai
Persistent Systems
> Hi All,
>
> I am trying to develop a custom resource adaptor for
> a web application. I am using the
> SkeletonStandardResourceAdapter.java as the starting
> point and have added after mdofying wrt resource to
> the list of custom adapters in IDM.
>
> Objective - To create a user in the webApp.
>
> I want to know the following things -
> 1. where does IDM store data and how does it
> reference it.
IdM stores all data in the database repository you configure at start-up. All objects are referenced through "name" and/or 'id' attributes.
> 2.How do I map IDM attributes to Resource
> attributes(I guess it is done thru the prototype
> XML.) but how does it know which objects and its
> members to relate to each other.
The resource schema configured for each resource stores the relation between "IdM attributes" and "resource attributes". IdM attributes are part of your end-user form and the provisioning engine makes these attributes available to your resource adapter. It is upto the resource adapter developer to interpret the incoming attributes and use it to set a value on the resource.
> 3.How do we trigger the event to create a user and
> then take it till the resource.
In very simple terms - The event to create a user is triggered when you submit a user form. The user view submitted by the form goes through the configured workflows and reaches the provisioning engine. The provisioning engine/resource adapter manager invokes the appropriate resource adapter methods.
If you are interested in more details, enable tracing for certain Waveset classes and look at the log files it generates.
>
> Thanks in advance
cmd at 2007-7-7 2:11:10 >

# 2
Chetan,
I have added too many questions I guess. Please do let me know the right source to get to the solution if you think this is getting too lengthy. Thanks ..
database repository you configure at start-up
How can I query those tables.
IdM attributes are part of your end-user form and the provisioning engine makes these attributes available to your resource adapter.
Is this the prototypeXML? IDM attribtues as present in this XML are just strings and not objects. How does IDM know where to look for these attributes
It is upto the resource adapter developer to interpret the incoming attributes and use it to set a value on the resource.
Again is it not done thru the prototype xml. Or can I hardcode in each method the relationship between , for example, WSUser.accountid = Resource.userid
The event to create a user is triggered when you submit a user form.
how do I submit a user form
configured workflows
can I use BPE for this. If yes how.
enable tracing for certain Waveset classes
did this change - exception.trace=true
Nupur at 2007-7-7 2:11:10 >

# 3
Nupur,
The questions you have asked are typical newbie questions. You will find answers to most of these questions scattered in the Sun IdM documentation/sample code.
I am sure you will get the big picture once you complete the adapter development :)...
To give you a quick start, I have tried to answer your questions. But do refer to the following links for more info -
http://docs.sun.com/source/819-4484/adapters.html
http://docs.sun.com/app/docs/doc/819-4485
> How can I query those tables.
Typically you don't need to query those tables. But if you want to take a look at them use any SQL client and connect to the "waveset" database. IdM implementers generally make use of the "debug" URL <http://><idmhost:port>/idm/debug to view the IdM configuration files.
> Is this the prototypeXML? IDM attribtues as present in this XML are just strings and not objects. How does IDM know where to look for these attributes
Prototype XML just serves as 'prototype' for the resource schema mapping and resource object instantiation.
IdM attributes in the resource schema are expected to be part of the user view constructed during provisioning.
> Can I hardcode in each method the relationship between , for example, WSUser.accountid = Resource.userid
Hard-coding is usually not recommended. Avoid it if possible.
Typically - the relationship specified in the resource schema map is used for iterating the map of waveset attributes and setting values on the corresponding backend attribute.
> how do I submit a user form
By clicking on the "Save" or "Background Save" button :)
> can I use BPE for this. If yes how
Yes - you will use BPE for a lot of things. Refer to the document on Workflows, Forms and Views
> enable tracing for certain Waveset classes
Open the debug URL - <http://><idmhost:port>/idm/debug -
click on Show Trace and add the classes you want to trace, including your custom adapter.
If you are in the process of learning IdM, enable the options form.trace and xpress.trace in the Waveset.properties file.
Good Luck!
Chetan
cmd at 2007-7-7 2:11:10 >

# 4
Typically - the relationship specified in the resource schema map is used for iterating the map of waveset attributes and setting values on the corresponding backend attribute.
This is what I cannot understand .. How is the mapping happening ...
"<AccountAttributeType name='accountId'\n" +
" mapName='resourceaccountid'\n" +
" mapType='string'\n" +
" required='true'>\n" +
"<AttributeDefinitionRef>\n" +
how does idm know where to look for 'resourceaccountid'. How is this mapping happening ....
Nupur at 2007-7-7 2:11:10 >

# 5
The mapping just serves as a translation mechanism and instructs the resource adapter that - the value of the IdM attribute "accountId" maps to the resource attribute "resourceaccountid".
IdM need not bother about looking for the 'resourceaccountid' attribute.
It is only responsible for supplying the value of the accountId attribute to your resource adapter class.
cmd at 2007-7-7 2:11:10 >

# 6
This mapping is the key. If this is not there then we'll HAVE TO do hard coding ... If IDM is not using this mapping then Resource adapter will use it. But how ......
Will u please check this forum topic tomorrow also .. I am just few days old on IDM . I would like to read a lil and then ask more educated questions ..Thanks for ur help ..
Nupur at 2007-7-7 2:11:10 >

# 7
The mapping tells IDM which values to provide to the ResourceAdapter.
Using
" <AccountAttributeType name='accountId'\n" +
" mapName='resourceaccountid'\n" +
" mapType='string'\n" +
" required='true'>\n" +
" <AttributeDefinitionRef>\n" +
IDM will provide the accountId in the WSUser object. It is up to the resource adapter to take that value and store it in resourceaccountid. However, hardcoding is not a good idea.... as an admin could edit the schema map to map some other attribute to resourceaccountid.
So normally, in the resource adapter, you would get a list of attributes from WSUser and find their mapped names
_resource.getAccountAttributeType(attrName).getMapName()
and decide on what action to take based on the mapName.
If this sounds too confusing.... you could decompile the DatabaseTableAdapter or any other adapter class.... and go through the code to see how it works :)
# 8
This is what I understand , tell me if I am wrong -
prototypeXML is not mandatory.
it can be created from UI anytime - Where is the resulting XML ?
The resulting XML is just used as a property file, which is not responsible for doing anything.
Can you also tell me when are these adapter class methods called from the UI. For example -
startconnection
realcreate
# 9
I tried doing this AccountAttributeType attrs[] = _resource.getAccountAttributeTypes();but I am getting _resource as null .. I called staticCreatePrototypeResource() before this .. but still null .. where does the _resource gets its value from..
# 10
_resource is a protected member of the ResourceAdapterBase class and it is usually set in the constructor. check your constructor code. if it doesn't resolve your problem, post your code snippet or drop me an email at cmmdesai [at] yahoo.com
cmd at 2007-7-7 2:11:10 >

# 11
I have it in the constructor super(res,cache)...But when is this constructor called when I create user from the Account tab in the IDM GUI. and when is the realCreate called..
# 12
Verify your constructor and staticCreatePrototypeResource methods. If they are ok, you should have a valid instance in your _resource variable.
# 13
but these constructors need to be called by IDM while initializing the resource .. in the logs I can see staticCreatePrototypeResource being called and only cosutomResourceAdapter() being called... which is the constructor wiht no parameters..... Though the constructors wiht parameters need to be called for initializing _resource like u have ..
So my question is .. does the IDM only call the default blank constructor and we need to make sure that we call the other one .. but then that would amt to creating a new obj which will not be the same that IDm will be refering ... ?
Nupur at 2007-7-7 2:11:10 >
