[Building Sakai] Sakai 2.9 Entity Providers
Paul Wando Mungai
paulwando at gmail.com
Tue Jun 25 05:30:01 PDT 2013
Thanks Aaron,
Seems I need to package the module differently as follows:
webservice/pack (home to components.xml)
webservice/impl (home to source files - the entityprovider classes)
On Tue, Jun 25, 2013 at 2:18 PM, Aaron Zeckoski <azeckoski at unicon.net>wrote:
> Take a look at this component only project here as an example:
>
> https://source.sakaiproject.org/svn/msub/unicon.net/tincanapi-provider/trunk
>
> In the pack you will see the xml file is properly deployed to
> WEB-INF/components.xml after building with maven.
>
> Follow the way the POM files are setup for that project (as far as the
> build part is concerned).
> -AZ
>
>
> On Tue, Jun 25, 2013 at 8:02 AM, Paul Wando Mungai <paulwando at gmail.com>
> wrote:
> > When I uncomment it, components.xml gets copied in WEB-INF/classes
> instead
> > of WEB-INF
> >
> >
> > On Tue, Jun 25, 2013 at 1:59 PM, Aaron Zeckoski <azeckoski at unicon.net>
> > wrote:
> >>
> >> Paul,
> >> The issue is that you have commented out this part (the build resource
> >> definition) in the pom.xml file:
> >>
> >> <build>
> >> <sourceDirectory>src/java</sourceDirectory>
> >> <resources>
> >> <resource>
> >> <directory>${basedir}/src/webapps/WEB-INF/</directory>
> >> <includes>
> >> <include>*.xml</include>
> >> </includes>
> >> </resource>
> >> </resources>
> >> <finalName>witse-entity-provider</finalName>
> >> </build>
> >>
> >> As a result, you component is not getting the spring xml file included
> >> as part of it when it is built so you spring beans are not starting up
> >> (which includes your provider). Sakai looks for that components.xml
> >> file in that location when starting a component up. If it is not there
> >> then there is not a failure, but your service won't be handled by
> >> spring without it.
> >>
> >> -AZ
> >>
> >>
> >> On Fri, Jun 21, 2013 at 8:19 AM, Aaron Zeckoski <azeckoski at unicon.net>
> >> wrote:
> >> > Paul,
> >> > Is there somewhere I can try your code out?
> >> > AutoRegister only works when something is a component but since that
> >> > would appear to be the case I am guessing something else is going on.
> >> > -AZ
> >> >
> >> >
> >> > On Fri, Jun 21, 2013 at 8:09 AM, Paul Wando Mungai <
> paulwando at gmail.com>
> >> > wrote:
> >> >> I have written the following provider (which was working well in
> 2.8),
> >> >> however, it doesnt seem to be registered. No errors are thrown. It
> >> >> module
> >> >> gets deployed correctly in tomcat/components.
> >> >>
> >> >> ------------------------------------------------/Code starts
> >> >> here/----------------------------------------------------
> >> >>
> >> >> public class WitsEAddToolsToSiteEntityProviderImpl extends
> >> >> AbstractEntityProvider implements CoreEntityProvider,
> >> >> AutoRegisterEntityProvider, ActionsExecutable, RESTful {
> >> >>
> >> >> private SiteService siteService;
> >> >> public final static String ENTITY_PREFIX = "addsitetools";
> >> >> //private CourseCreatorUtils courseCreatorUtils;
> >> >> private UserDirectoryService userDirectoryService;
> >> >> private ToolManager toolManager;
> >> >> private static ResourceLoader rb = new
> >> >> ResourceLoader("addsitetools");
> >> >> private EntityBrokerManager entityBrokerManager;
> >> >>
> >> >>
> >> >> @Autowired
> >> >> public void setSiteService(SiteService siteService) {
> >> >> this.siteService = siteService;
> >> >> }
> >> >>
> >> >> public void setEntityBrokerManager(EntityBrokerManager
> >> >> entityBrokerManager) {
> >> >> this.entityBrokerManager = entityBrokerManager;
> >> >> }
> >> >>
> >> >> @Autowired
> >> >> public void setUserDirectoryService(UserDirectoryService
> >> >> userDirectoryService) {
> >> >> this.userDirectoryService = userDirectoryService;
> >> >> }
> >> >>
> >> >> @Autowired
> >> >> public void setToolManager(ToolManager toolManager){
> >> >> this.toolManager = toolManager;
> >> >> }
> >> >> /*
> >> >> @Autowired
> >> >> public void setCourseCreatorUtils(CourseCreatorUtils
> >> >> courseCreatorUtils){
> >> >> this.courseCreatorUtils = new CourseCreatorUtils(siteService,
> >> >> userDirectoryService, toolManager);
> >> >>
> >> >> }*/
> >> >>
> >> >> @Override
> >> >> public String getEntityPrefix() {
> >> >> return ENTITY_PREFIX;
> >> >> }
> >> >>
> >> >> @Override
> >> >> public boolean entityExists(String string) {
> >> >> return true;
> >> >> }
> >> >>
> >> >> @Override
> >> >> public String createEntity(EntityReference er, Object o,
> >> >> Map<String,
> >> >> Object> map) {
> >> >> //return "addsitetools create entity";
> >> >> return null;
> >> >> }
> >> >>
> >> >> @Override
> >> >> public Object getSampleEntity() {
> >> >> return "addsitetools sample entity";
> >> >> }
> >> >>
> >> >> @Override
> >> >> public void updateEntity(EntityReference er, Object o,
> Map<String,
> >> >> Object> map) {
> >> >> System.out.println("addsitetools entity updated");
> >> >> }
> >> >>
> >> >> @Override
> >> >> public Object getEntity(EntityReference er) {
> >> >> return "addsitetools entity";
> >> >> }
> >> >>
> >> >> @Override
> >> >> public void deleteEntity(EntityReference er, Map<String, Object>
> >> >> map) {
> >> >> System.out.println("addsitetools entity deleted");
> >> >> }
> >> >>
> >> >> /**
> >> >> * site/siteId
> >> >> */
> >> >> @EntityCustomAction(action = "site", viewKey =
> >> >> EntityView.VIEW_LIST)
> >> >> public List<SiteTool> addSiteTools(EntityView view, Map<String,
> >> >> Object>
> >> >> params) {
> >> >>
> >> >> //get siteId
> >> >> String siteId = view.getPathSegment(2);
> >> >>
> >> >> List<SiteTool> siteTools =
> >> >> courseCreatorUtils.addSiteTools(siteId);
> >> >>
> >> >> return siteTools;
> >> >> }
> >> >>
> >> >> @Override
> >> >> public String[] getHandledOutputFormats() {
> >> >> return new String[]{Formats.XML, Formats.JSON, Formats.FORM};
> >> >> }
> >> >>
> >> >> @Override
> >> >> public String[] getHandledInputFormats() {
> >> >> return new String[]{Formats.HTML, Formats.XML, Formats.JSON};
> >> >> }
> >> >>
> >> >> @Override
> >> >> public List<?> getEntities(EntityReference er, Search search) {
> >> >> return null;
> >> >> }
> >> >> }
> >> >>
> >> >> ------------------------------------------------/Code ends
> >> >> here/----------------------------------------------------
> >> >> --
> >> >> 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
> >>
> >>
> >>
> >> --
> >> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
> >
> >
> >
> >
> > --
> > Regards,
> > Paul Mungai
> >
> > Twitter: PaulMungaiW
> > LinkedIn: http://za.linkedin.com/pub/paul-mungai/b/388/512
> > Blog: http://pmungai.wordpress.com
> >
> >
> > "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
Twitter: PaulMungaiW
LinkedIn: http://za.linkedin.com/pub/paul-mungai/b/388/512
Blog: http://pmungai.wordpress.com
"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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130625/393e38ae/attachment.html
More information about the sakai-dev
mailing list