[midPoint] Custom .Net Connector
Pavol Mederly
mederly at evolveum.com
Fri Feb 27 23:31:43 CET 2015
Hello Anand,
> The problem i can think of is in java connector we have manifest
> file, is there anything equivalent in .net connector.
The ConnectorServer uses Windows Assembly mechanism to discover the
connectors. I believe this is the code (LocalConnectorInfoManagerImpl in
ApiLocal.cs)
FileInfo[] files = directory.GetFiles("*.Connector.dll");
foreach (FileInfo file in files)
{
Assembly lib = Assembly.LoadFrom(file.ToString());
CollectionUtil.AddAll(_connectorInfo, ProcessAssembly(lib));
}
The ProcessAssembly methods gathers the type information from the
assembly, and looks for ConnectorClassAttribute instances. That's how it
knows that these are ICF Connectors.
---
In order to help you a bit with creating your own connector, I've
prepared a sample (empty) connector for you. Please see the latest
commit to Evolveum/openicf project <https://github.com/Evolveum/openicf>.
The connector is in the connectors\dotnet-sample directory.
For building it I use the following two batch procedures - these are not
part of the commit; please create them manually:
*env.bat* - sets up an environment:
set WIX_HOME=C:\Program Files (x86)\WiX Toolset v3.7
set Path=%Path%;%WIX_HOME%\bin
set OPENICF_HOME=c:\openicf-home
Note that you should have the corresponding software installed (WiX
Toolset in this case).
OPENICF_HOME points to a directory where the installation of
OpenICF/ConnId server is unpacked.
For the building itself I use this one: *b.bat* :
c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
SampleDotNetConnector.sln /p:Configuration=Release /p:ZipRelease=true
After building the connector, I simply unzip the file
*Build\Sample.Connector-1.4.1.20283.zip* into the OPENICF_HOME directory
(c:\openicf-home) and start the connector server.
In midPoint I create the connector host object:
<connectorHost
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
oid="91919191-76e0-59e2-86d6-44cc44cc4400"
version="0">
<name>ICF Connector server on localhost:8759</name>
<hostname>127.0.0.1</hostname>
<port>8759</port>
<sharedSecret>...</sharedSecret>
</connectorHost>
And when I do the discovery operation on this connector host, midPoint
creates new Connector object named "ICF
Org.IdentityConnectors.Sample.SampleConnector v1.4.1.20283 @ICF
Connector server on localhost:8759".
Then I can import a very simple resource definition that uses this
sample connector:
<resource xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
<name>Sample</name>
<connectorRef>
<filter>
<q:equal>
<q:path>c:connectorType</q:path>
<q:value>Org.IdentityConnectors.Sample.SampleConnector</q:value>
</q:equal>
</filter>
</connectorRef>
<connectorConfiguration
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
<icfc:configurationProperties
xmlns:gen780="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/Sample.Connector/Org.IdentityConnectors.Sample.SampleConnector">
<gen780:Username>administrator</gen780:Username>
<gen780:Password><clearValue>secret</clearValue></gen780:Password>
<gen780:Property1>P1</gen780:Property1>
<gen780:Property2>P2</gen780:Property2>
</icfc:configurationProperties>
</connectorConfiguration>
</resource>
Of course, it does nothing, because the sample connector even does not
provide any schema. (I.e. Test connection from midPoint passes first
three steps and fails the fourth, related to connector schema.) The only
indication that something is going on is the diagnostic messages that
the sample connector writes to the console:
Press q to shutdown.
Press t for a thread dump.
Init called.
CheckAlive called
Schema called.
CheckAlive called
Schema called.
CheckAlive called
Schema called.
CheckAlive called
Test called
Anyway, I hope this will allow you to get started developing your own
connector.
Best regards,
Pavol
On 27. 2. 2015 16:41, Anand Kothekar wrote:
> Hi,
>
> I checked the error logs but there was no error.
>
> The problem i can think of is in java connector we have manifest
> file, is there anything equivalent in .net connector.
>
>
>
>
>
>
> Thanks,
> Anand Kothekar
>
> On Fri, Feb 27, 2015 at 8:46 PM, Pavol Mederly <mederly at evolveum.com
> <mailto:mederly at evolveum.com>> wrote:
>
> Hello Anand,
>
> I don't know of any reference document for that.
>
> Have you got any error messages in ConnectorServer log?
>
> Best regards,
> Pavol
>
>
> On 27. 2. 2015 12:45, Anand Kothekar wrote:
>> Hi,
>>
>> I have a requirement to write a custom .net connector, do you
>> have any reference document which i an refer to write it.
>>
>> I have written some c# code and implemented the connector
>> interfaces but when i deploy the connector dll on .net connector
>> server midpoint connector host is not able to discover the
>> connector.
>>
>> So I think I might be missing something, a quick document on this
>> will be a great help.
>>
>>
>> Thanks
>> Anand
>>
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150227/e1b12c77/attachment.htm>
More information about the midPoint
mailing list