Free Support Forum -

Custom connector sample



can you provide a custom connector sample? I cannot make it working since I don’t see a way to implement the custom mechanism if we have no database or filesystem that can be used.

This is what we’re dealing with and please not that we’re asking for such a sample for 4-5 months now. Out integration has stuck at that point.

We’re implementing a custom InputHandler per HTTP session, it works correctly, after implementing some cache, as there is too many calls to getFile method on file opening (~30 - different forum post). Anyway, after months, it seems to finally work! A custom class initializes a connection with the back-end ECM system (Alfresco, Oracle WebCenter, etc) and reads the file and file properties by the ID that is given by a user.
First step is finally implemented.

Now we need to implement a custom connector that will allow us reading the annotations from the ECM system and saving them back to it. In other words ideally we’d like to implement the following method:

getAnnotations(String documentId)
saveAnnotations(String documentId, List annotations)

This is all that ECM system can and should provide. Logged in user is allowed to read the annotations created by any user and save/modify only the ones that he/she owns. ECM system stores each annotation in e.g. XML format. Annotation is related with a document, but cannot contain any document reference in the XML content. Content should contain just the annotation plus the owner, creation date.

Anyway, there might be some way to implement annotation saving and reading. The problem we’re struggling with is how to get to that point. How to implement all the other interfaces: ISessionDao, IUserDao, ISystemInfoDao, IDocumentDao, ICollaboratorDao. From our point of view those are meaningless, and we don’t even know how to mock-up them, as there are too many relations and corelations between all those objects.

Can you share some sample, for start, how to implement a IUser and ISession DAOs? We have/know just the user name and that’s it. We don’t have access to the user database and it’s irrelevat to us anyway. We have an instance per HTTP session, so ISessionDao is also a mistery here. Based on that can you provide us any sample? We get many strange exceptions during our testing and it would be great to modify some working sample rather than exchange posts for the next month.

Thank you,



is there any chance for such a sample?

Thank you,

Hello Mariusz,

Sorry for the delay. We currently are working on this type of sample to provide for you. But it takes some time to implement and check it with some ECM system.


Fair enough. Thank you!

Hello Mariusz,

Good news! Finally we have a sample of the CMIS connector. It shows how entities can be saved in the CMIS repository using standard GroupDocs.Annotation for Java structure or bound to the document guid. So you can use it to implement a solution for your case.

The sample was used with the Alfresco instance. Here is a demo video which shows the behavior of the repository during the annotation manipulations -

You can take the example from here:

Feel free to browse commit history in the “cmis-connector” branch to see more details and get more understanding how it works and how to modify the sample to fit your needs.

Please note. To use this sample with the Alfresco you should define one additional type model to make the Alfresco instance store our custom data. Please, see the attached files.


Thank you. That’s a progress, but… this sample is incomplete. It implements just small part of what I asked for.

1. There is no CMISInputHandler, saving just annotations in the repository makes no sense. Documents should be retrieved from the repository as well. Filesystem cannot be used. Annotations should be related then with a Relation to the document:

2. There is no user session implemented. Currently you assume that only one user will be connected to the repository. Sample URL should accept three parameters: objectId, userName and password and then instantianate the CMIS session per user. That means creating custom handler and connectors per HTTP session and you will notice issues related with that.

3. All other stuff is saved still as XML which will cause issues as we used load balanced servers, so every session may access a different server and thus XML file. Plus simultaneus access will case many issues as well. I expect that volatile data to be populated from the CMIS repository or rather created on the fly. We cannot use filesystem at all. Only the repository can be used which should not store volatile (e.g. session) data or duplicated info about users. User has already a unique name. Also since the connectors/custom input handler will be created per session and there might be 100 users accessing the same document and the same XML files you can imagine all the issues related with that.

4. Annotation still contains the sessionId and userId as integer. We cannot store those volatile parameters. CMIS Object already contains the user/creator name and that should be enough.

5. Replies should be saved with the annotation, as a single object (single XML in the repository) or at least as the same annotation object. Currently it makes no sense as replies are saved in XML and only annotation in the repository. From the ECM/CMIS and user perspective, reply is also an annotation, just related with a different one (related by objectId:string). So all annotations and replies should be saved as separate annotations, same style object.

So my question is whether there is any way to implement it as I described above? That’s the way it should and have to work with any ECM system, e.g. via CMIS.

I appreciate your help so far and I hope we can solve somehow the issues mentioned above.

Thank you!

Mariusz Pala

Hello Mariusz,

Yes, you can implement it. Please note that we provided just a sample. With this sample you can find how to achieve all 5 steps you pointed:
  1. Please see the getSession method in the CMISAnnotationDao, using it you can easily retrieve any objects from the CMIS repository, except it the Alfresco implementation of the InputDataHandler we provided you earlier. As queries are enough to manipulate with annotations I'd not provided the relationship part. If you want you can add the aspect wich will keep document related annotations.
  2. This sample was aimed to show the connection to the CMIS repo, Session question is in progress we will reply to you with it in the appropriate thread.
  3. As I've mentioned this is just the sample not the high-end solution, so you can implement exact those things that your case need. You can easily replace the XML DAOs with such that store data in-memory.
  4. Feel free to remove any of those, as you can see from the commit history first there was binding through the annotationSessionId, now the annotations are bound to the document guid, so you can freely remove session and user ids in the storage but set them only in the DAO implementation to pass the correct entity value to the AnnotationHandler.
  5. You can easily extend the type definition and add there list of replies or "attach" them through the aspect.

As in the code you are working with the CMIS 1.1 then there is no difference what ECM is on the other side. The only thing is that the ECM on that side should be configured to keep custom data (in case of Alfresco - types should be configured correctly).


Hi Ihor,

I asked for the sample, as I’m not able to make that work. I spent a lot of time trying to do that but I get many different unexpected exception on every step. You claim it’s possible, but I cannot confirm that. Custom implementation of every connector besides the annotation causes many issues, thus I ask for a sample in-memory sample. The same sample, just please do that per user session with the three parameters I mentioned. You will see that this is not so simple. Try to get rid of the XML or database and the integer IDs and you will a bunch of exceptions of every step. I could report every single issue I get but it would takes us another 6 months and we don’t have so much time.

So please prepare some in-memory sample that I could work on. At this point I don’t see any way to do that.

Thank you,