[Building Sakai] Adding an action for a resource type

Jim Eng jimeng at umich.edu
Mon Nov 30 08:21:36 PST 2009


Hi Ofer,

If you want to add an action for an existing resource type, you would  
define an InteractionAction or a ServiceLevelAction in definition for  
that resource type.  If you are working in 2.6 or later, you will need  
to do that in kernel.  In 2.5.x and before, it would be in the content  
package.  The javadocs explain the difference between an  
InteractionAction and a ServiceLevelAction:

http://source.sakaiproject.org/release/2.5.3/apidocs/org/sakaiproject/content/api/InteractionAction.html
http://source.sakaiproject.org/release/2.5.3/apidocs/org/sakaiproject/content/api/ServiceLevelAction.html

The actions on existing types were defined as inner classes within the  
type definitions.  This may not have been the best choice, but since  
they were done this way, adding a new action would probably be  
accomplished most easily by adding another action as an inner class.   
You could look at the source code for the FileUpload type for an  
example of how the actions are defined and added to the type:

https://source.sakaiproject.org/svn/content/branches/sakai_2-5-x/content-impl/impl/src/java/org/sakaiproject/content/types/FileUploadType.java

Notice the statements like this in the constructor for FileUploadType:

actions.put(ResourceToolAction.REVISE_METADATA, new  
FileUploadPropertiesAction());
That adds the "revise properties" action to the type definition.  That  
depends on the code later in the same file that defines the   
FileUploadPropertiesAction class and its constructor.

If you are creating an entirely new type, there are several other  
possibilities you might consider.

HTH.

Jim


On Nov 29, 2009, at 4:56 PM, Ofer Chesler wrote:

> Hi All,
>    I need to add an action for a specific resource type in the  
> resource tool (e.g. special handling for images). What it the right  
> way to do that?
>
> Thank you,
>
> Ofer
>
>
>
> Ofer Chesler
> HOMSYS Ltd.
> Office:
> +972-77-9313001
> Mobile:
> +972-54-7282961
> www.homsys.co.il
> <image001.jpg>
>
>
>
>
> _______________________________________________
> 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/20091130/1a2ed7ea/attachment.html 


More information about the sakai-dev mailing list