[Building Sakai] How to get siteId from a SAKAI tool
Stephen Swinsburg
s.swinsburg at lancaster.ac.uk
Fri Apr 3 13:06:15 PDT 2009
Hey Luiz,
Looks like you may be using the static cover of ToolManager? What does
your import statement for the ToolManager look like (ie does it have
cover or api in the package)?
I do it this way:
import org.sakaiproject.tool.api.ToolManager;
then
private ToolManager toolManager;
public void setToolManager(ToolManager toolManager) {
this.toolManager = toolManager;
}
public String getCurrentSiteId(){
return toolManager.getCurrentPlacement().getContext();
}
But in my components.xml that is deployed to TOMCAT/components/my-tool/
WEB-INF/components.xml I have it injected:
<bean id="uk.ac.lancs.e_science.mytool.api.SakaiProxy"
class="uk.ac.lancs.e_science.mytool.impl.SakaiProxyImpl">
<property name="toolManager"
ref="org.sakaiproject.tool.api.ToolManager" />
...
</bean>
That should work for any user in my tool. How have you got it all wired?
cheers,
Steve
---
Steve Swinsburg
Portal Systems Developer
Centre for e-Science
Lancaster University
Lancaster
LA1 4YT
email: s.swinsburg at lancaster.ac.uk
phone: +44 (0) 1524 594870
On 03/04/2009, at 7:33 PM, Luiz Antonio Falaguasta Barbosa wrote:
> Ho people,
>
> Please, I need to take siteId to be used in a SAKAI tool.
>
> I've tried in this way:
>
> Placement placement = ToolManager.getCurrentPlacement();
> String siteid = placement.getContext();
>
> and got null for siteId(String siteid = placement.getContext();).
>
> Please, could somebody help me?
>
> Thanks in advance!
>
> Luiz
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090403/b10d8982/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2437 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090403/b10d8982/attachment.bin
More information about the sakai-dev
mailing list