Forum LAMS for Tech-Heads - General Forum: Re: Advice on how to communicate with an external tool


 
Search: 

6: Re: Advice on how to communicate with an external tool
In response to 1 11/03/08 07:27 PM
[ Reply | Forward ]
Hi Daniel,

you don't need a direct DB access to get user list from a tool.

If you want a list of learners and teachers that will participate in a lesson, you'll need the LessonService. Most of the tools didn't need access to its functionality, but if you take a look at SubmitFiles tool from HEAD, you'll see that LessonService was injected into tool's service in order to get a list of monitoring teachers. I guess there is no method that allows you to get a list of learners, but if it's really needed, we can implement it and add it to the service.

A tool itself knows only about the learners that actually reached it. The moment a lesson is started, a new instance of tool content is created. If there is no grouping, a tool session that will hold the whole class is created. But if there is grouping like Choose in Monitor, learners will be divided into several sessions. There is no way to learn to what session a learner will be assigned to before he/she will reach the tool. In fact, sometimes sessions are created the moment a learner reaches the tool.

In order to get user info from a tool service, usually there are methods like (based on SubmitFiles tool service):
getUsersBySession(Long sessionID)
getSessionsByContentID(Long toolContentID)
getSessionUser(Long sessionID, Integer userID)

Parameters are provided by the progress engine, so just check the code for examples how to use those methods. Then you can add your own method that will create a XML file that can be read by your external application.

So, when you write: "when the teacher starts a lesson the server writes a file with the info on what the users and groups" - when a lesson is started, you can get a list of learners that MIGHT (but might not, if there is branching) get to your tool. There is no way you can tell what groups they will be in at this moment.
Once a learner gets to the tool, you can get the data using tool's service.

If you have any questions, just let us know.

Posted by Marcin Cieslak

7: Re: Re: Advice on how to communicate with an external tool
In response to 6 11/28/08 03:21 PM
[ Reply | Forward ]
Hi Marcin,

thanks for the info, theres just a few things im not so clear about....

If i understand it correctly, what i should do is to get the users in each session to interact via skype. the groups that the teacher has created will actually be the sessions. So, everytime an user is assigned to a session, the tool should update the file with the info about the users.

In order to do this, i have to use the method getSessionsByContentID(Long toolContentID) to get the sessions and then getUsersBySession(Long sessionID) to get the users for each session. But the first method needs the toolcontentid of the tool...where can i get that? that would have to be outside the tool right?

Im basing my new tool on the shareresources one...does that mean id have to implement the methods mentioned earlier on my new tool?

Theres a method called getSkypeForLamsItemsBySessionId()...
what is an "item"?

thanks a lot.

Posted by Daniel Romero

8: Advice on how to communicate with an external tool
In response to 7 12/03/08 11:31 PM
[ Reply | Forward ]
Hi Daniel,
I'm sorry for replying so late.
"If i understand it correctly..." - yes, that's pretty much it. Just remember that it's not always the teacher that creates the groups. In LAMS 2.2 users are able to choose a group they want to participate in.

When a user enteres an activity, the Tool Content ID is provided from LAMS progress engine. If you take a look at start() method in LearningAction in Shared Resources Tool, you will see that that Tool Session ID is extracted from HTTP request and put back as an attribute. Having Tool Session ID you can get Tool Content ID using for example getResourceBySessionId() method in ResourceService.

In your case it might be a good idea to add some code in that start() method that will export the ID to some file that would be later read by your external program. Having this value you can call tool service or database itself to get user data for particular group.

I'm not sure what do you mean when you ask for "item". What does your method do? I'm guessing, though, that "item" is a term used in Shared Resources Tool - it means a single URL or file that is shared among learners. In Q&A tool it would be questions, in Forum it would be topics. I hope I'm guessing right what do you have in mind...

Let us know how it goes.

Thanks

Posted by Marcin Cieslak

9: Re: Advice on how to communicate with an external tool
In response to 8 12/09/08 02:54 PM
[ Reply | Forward ]
Hi Marcin,

Thank you very much for the tips, they`ve been really helpfull. The thing is, that i cant find the method getResourceBySessionId() anywhere in the workspace...maybe its cause im using ver 2.1...

Do you know another way to get the toolcontentid ??

thanks a lot

Posted by Daniel Romero

10: Re: Re: Advice on how to communicate with an external tool
In response to 9 12/09/08 06:24 PM
[ Reply | Forward ]
The method you mention for Shared Resources Tool is in it's service class org.lamsfoundation.lams.tool.rsrc.service.IResourceService and its implementation in org.lamsfoundation.lams.tool.rsrc.service.ResourceServiceImpl. If you were using our ToolBuilder, the name "Resource" most probably has been changed to something else (for example "Skype", if your tool is named so). Still, this method should be available even in version 2.1 - I've checked.

You may also get Tool Content ID when a lesson is created. The original Learning Design is copied and tools get new ID.
You can observe it LamsCoreToolService where the method notifyToolToCopyContent() is called which then calls newInstance() method in Resource class (or any other tool's main class). You could get the Content ID then, but there is a catch: this method newInstance() is called in several other occasions like importing and exporting the tool. It might be tricky to detect which situation occurs at the particular moment. So I think it's better to extract this parameter when coping with LearningAction - it's always somewhere there (as a request parameter or in session map).

Good luck!

Posted by Marcin Cieslak

11: Re: Re: Re: Advice on how to communicate with an external tool
In response to 10 12/10/08 06:12 PM
[ Reply | Forward ]
youre right, im sorry i dont know what happened...i think maybe when i did the search i had the shared resources project closed and didnt notice...thats embarrassing :S thanks a lot!

Posted by Daniel Romero

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum