I'm trying to implement an ImportAddOn for a Session AddOn, which inherits from BaseSessionAddOn2.
Based on the SqlAddon I'm gone straight forward and implemented a Configurator Class (implement ISession) for the persistence with the properties and the static serializers, the Connectioneditor (implement ISessionEditorUserControl) to Interact with User.
I'm getting in trouble during implementing the Import Method an Importer Class (ISessionImportAddOn):
The Import Method “public ISession Import(string currentGroup, ImportItem items)”
Definition of BaseSessionAddOn2 is: public abstract class BaseSessionAddOn2 : BaseSessionAddOn, ISessionAddOn2, ISessionAddOn, IAddOn .
ISession isn’t used on any SessionAddon class and so won’t call at runtime.
How to find a common denominator? Maybe a new ISessionAddon is nessesary?
If so, this newly to defined interface can maybe also make it possible to iterate any kind of defined template Sessions for an ImportAddon and create subConnections on importing AddOn Sessions.
An ImportAddon with these features is the base of continue the implementation a SAPLogon Addon: a SapLogon is a collection of SAP System Connections on a windows/unix host. This similar to RDM with a lot of RDP Connections.
<em>edited by oki on 9/29/2010</em>
I think that you are right, it's not possible for now to import a session addon directly. We are working on a new version of the SDK with more features. I think that your point might be an interesting feature to add.
I read you post a second time and I have some point. ISession is not used in BaseSessionAddOn because it's implemented in the object Connection. Do an export of an exsiting session that you will have created manually and you will be able to see the structure.
After that, from this XML, I think that you might be able to import a session add on.
this would be a way, but will break as soon as you change something on your internal implementation.
If you just change something on the fingerprint this would crash the AddOn and users would say that the Addon / RDM is buggy.-> this could be dangerous in gain future opportunities with this product.
I prefer a clear interface which not depends on a specific version of rdm.
Here is how you can do an import. I did to import an item into a SQLServer session add-on type:
// Create the addon specific configuration
SQLServerConfiguration configuration = new SQLServerConfiguration();
configuration.Server = server.Host;
ISession addOnSession = AddOnServices.CreateSession(importItem.Name, server.Host, ConnectionKind.AddOn);
// Guid of the Addon
addOnSession.SetProperty(null, "ConnectionSubType", new Guid("85C04A4D-17D8-4997-A0B2-09C7C49C50F7"));
// Version of the AddOn
addOnSession.SetProperty("AddOn", "AddOnVersion", "220.127.116.11");
addOnSession.SetProperty("AddOn", "Properties", configuration.ToXml());
addOnSession.Group = currentGroup;
addOnSession.SetCredentials(server.User, server.Pass, string.Empty);
<em>edited by dhervieux on 11/5/2010</em>