[Building Sakai] Custom POST Entity Broker

Steve Swinsburg steve.swinsburg at gmail.com
Tue Nov 13 13:01:36 PST 2012


Hi Paul,

Would you be interested in contributing your entity provider to the core of Sakai? It would be very useful. If so, just add any relevant files (or ideally a patch) into a Jira. If you assign it to me I can take a look.

cheers,
Steve


On 14/11/2012, at 2:08 AM, Paul Wando Mungai <paulwando at gmail.com> wrote:

> Thanks Aaron,
> 
> The post works perfectly, I can now push files to site resources via the entity broker. 
> 
> 
> On Tue, Nov 13, 2012 at 2:53 PM, Aaron Zeckoski <azeckoski at unicon.net> wrote:
> Not without all of the code, but since it says it cannot find the
> provider that normally means a bad path. In general you should not use
> the batch provider unless you need it and in this case you do not.
> -AZ
> 
> 
> On Tue, Nov 13, 2012 at 7:28 AM, Paul Wando Mungai <paulwando at gmail.com> wrote:
> > Thanks Aaron,
> >
> > Would you know what causes it to throw the error below then?
> >
> > Failure attempting to process reference
> > (\/direct\/addsiteresource\/site\/OCCT1000_2012) for url
> > (\/direct\/addsiteresource\/site\/OCCT1000_2012): Could not parse the
> > incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no entity
> > provider could be found to handle the
> > prefix:org.sakaiproject.entitybroker.exception.EntityException: Could not
> > parse the incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no
> > entity provider could be found to handle the prefix
> >
> >
> >
> > On Tue, Nov 13, 2012 at 1:51 PM, Aaron Zeckoski <azeckoski at unicon.net>
> > wrote:
> >>
> >> In general, you probably don't want to attempt to use batch processing
> >> with POST. Especially when sending a file since you can really only
> >> send one in your request anyway. You should just post directly to the
> >> endpoint:
> >> POST
> >> http://elearn-dev.wits.ac.za/direct/addsiteresource/site/OCCT1000_2012
> >>
> >> -AZ
> >>
> >>
> >> On Tue, Nov 13, 2012 at 6:12 AM, Paul Wando Mungai <paulwando at gmail.com>
> >> wrote:
> >> >
> >> > I write an entity broker that will add resources to sakai site resource.
> >> > This works when using a get. I then converted it to handle post (
> >> > VIEW_NEW
> >> > ). I create a http post request with the necessary parameters appended
> >> > to
> >> > it:
> >> >
> >> > POST
> >> >
> >> > http://elearn-dev.wits.ac.za/direct/batch?_refs=/direct/addsiteresource/site/OCCT1000_2012
> >> > HTTP/1.1
> >> >
> >> > However, I get the error bellow and am not sure of the cause;
> >> >
> >> > Failure attempting to process reference
> >> > (\/direct\/addsiteresource\/site\/OCCT1000_2012) for url
> >> > (\/direct\/addsiteresource\/site\/OCCT1000_2012): Could not parse the
> >> > incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no entity
> >> > provider could be found to handle the
> >> > prefix:org.sakaiproject.entitybroker.exception.EntityException: Could
> >> > not
> >> > parse the incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no
> >> > entity provider could be found to handle the prefix
> >> >
> >> >
> >> > My implementation is as follows:
> >> >
> >> > -----------------------------------------------------------------------------------------------------------------------------------------------------------
> >> > public interface WitsEAddSiteResourceEntityProvider extends
> >> > EntityProvider {
> >> >
> >> >     public final static String ENTITY_PREFIX = "addsiteresource";
> >> > }
> >> >
> >> > -----------------------------------------------------------------------------------------------------------------------------------------------------------
> >> > public class WitsEAddSiteResourceEntityProviderImpl implements
> >> >         WitsEAddSiteResourceEntityProvider, CoreEntityProvider,
> >> > CRUDable,
> >> >         CollectionResolvable, Outputable, Inputable, Describeable,
> >> > ActionsExecutable {
> >> >
> >> >     private ContentHostingService contentHostingService;
> >> >     private SessionManager sessionManager;
> >> >
> >> >
> >> > @Override
> >> >     public String getEntityPrefix() {
> >> >         return ENTITY_PREFIX;
> >> >     }
> >> >
> >> >     /**
> >> >      * site/siteId
> >> >      */
> >> >     @EntityCustomAction(action = "site", viewKey = EntityView.VIEW_NEW)
> >> >     public List<SiteResource> addSiteResource(EntityView view,
> >> > EntityReference ref,
> >> >             String prefix, Search search, OutputStream out,
> >> >             Map<String, Object> params) {
> >> >         //Get site Id
> >> >         String siteId = view.getPathSegment(2); //check if null
> >> >
> >> >         List<SiteResource> siteResources = new
> >> > ArrayList<SiteResource>();
> >> >         //Get post params
> >> >         String userId = params.get("userId").toString(); // check if
> >> > null...
> >> >         .............................
> >> >         return siteResources;
> >> >     }
> >> >
> >> >
> >> > -----------------------------------------------------------------------------------------------------------------------------------------------------------
> >> >
> >> >
> >> > --
> >> > Regards,
> >> > Paul Mungai
> >> >
> >> > "Ability is what youre capable of doing. Motivation determines what you
> >> > do.
> >> > Attitude determines how well you do it" By Lou Holtz, Notre Dame
> >> > Football
> >> > Coach
> >> >
> >> > _______________________________________________
> >> > 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"
> >>
> >>
> >>
> >> --
> >> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
> >
> >
> >
> >
> > --
> > Regards,
> > Paul Mungai
> >
> >
> > "Ability is what youre capable of doing. Motivation determines what you do.
> > Attitude determines how well you do it" By Lou Holtz, Notre Dame Football
> > Coach
> 
> 
> 
> --
> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
> 
> 
> 
> -- 
> Regards,
> Paul Mungai
> 
> "Ability is what youre capable of doing. Motivation determines what you do. Attitude determines how well you do it" By Lou Holtz, Notre Dame Football Coach
> _______________________________________________
> 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/20121114/1fd7219a/attachment.html 


More information about the sakai-dev mailing list