[Building Sakai] Lesson Builder and Assignment 2

Charles Hedrick hedrick at rutgers.edu
Thu Jul 5 12:58:46 PDT 2012


At the moment I don't actually have any dependencies on A2 in the XML. I check whether it's there in the init function. However that init function is at application level, so it can be called before A2 is loaded. 

I just realized that there's a really simple fix:  Do the A2 presence test based on something in the A2 components. The init code we're talking about is in a tool. All the components are loaded before any tool, that should be safe. I'll fix this within the next couple of days.


On Jul 5, 2012, at 1:02 PM, Aaron Zeckoski <azeckoski at unicon.net> wrote:

> In general, spring dependencies are not optional unless you use @Autowired(required=false)
> 
> It's possible to work around it but you have to do it using a pattern like this:
> http://blog.springsource.org/2011/08/09/whats-a-factorybean/
> http://stackoverflow.com/questions/2163182/intentionally-setting-a-spring-bean-to-null
> 
> Or you have to handle the lookups yourself from the AC (sorta like this):
> https://source.sakaiproject.org/svn/entitybroker/trunk/utils/src/java/org/sakaiproject/entitybroker/util/spring/BeanCollectorAutoRegistrar.java
> 
> or like the sakai providers do it.
> 
> We ran into this problem in EB and solved it using some fairly complex manual AC lookups of beans. That's probably going to be your easiest option in the end.
> 
> -AZ
> 
> 
> On Thu, Jul 5, 2012 at 11:52 AM, Charles Hedrick <hedrick at rutgers.edu> wrote:
> This is the result of trying to make things work automatically in too many different configurations. I'm about to conclude that it can't be done, and I'm going to have to ask you to edit opt-applicationContext.xml  to uncomment the specific contrib tools that you're using.
> 
> Unless someone knows of a way to get Spring to set up a reference to a service and have it force a load of that service if possible, but evaluate to null if it's not possible.
> 
> 
> On Jul 5, 2012, at 7:04 AM, Nkululeko Phakela <Nkululeko.Phakela at wits.ac.za> wrote:
> 
>> Hi Aaron,
>> 
>> Thanks for the explanation. We have a situation where we wanted to add Assignments2 also in Lesson Builder. So there was some configuration that needs to be changed. 
>> 
>> I did all that. The steps are documented quickly on this blog: https://elearn.wits.ac.za/blog/2012/07/02/lesson_builder.html
>> 
>> Everything worked fine on the localhost and dev machine. Now on the QA server, we have two nodes, and Lesson Builder is not picking up assignment2 sometimes, and sometimes it does depending on the node you are on. 
>> 
>> I'm trying to get a handle on this problem but I know that each time tomcat starts I see
>>      haveA2 = false. 
>> 
>> I looked at the code and in init method in Lesson Builder there is, 
>> 
>> if(ToolManager.getTool("sakai.assignment2") != null)
>>     haveA2 = true;
>> 
>> 
>> I might be missing something small.
>> 
>> Any help is appreciated.
>> 
>> Kind Regards,
>> Nguni
>> <PastedGraphic-1.tiff>
>> 
>> On 05 Jul 2012, at 12:44 PM, Aaron Zeckoski wrote:
>> 
>>> Servlet containers load web applications (war files) in an unspecified/undefined order. Generally they are not supposed to depend on each other so load order should not matter. In practice, the order is typically alpha or file timestamp based depending on the filesystem.
>>> 
>>> The Sakai component manager load order is controlled by Spring which manages all the services (start, stop, etc.). It manages the complete lifecycle and builds a start order graph based on the inter-service dependencies.
>>> 
>>> I suspect that lessons is checking for classes or something non-service based as a way to detect if a tool exists. This mechanism won't provide any hints to the Spring AC so it won't know to start the lessons component late enough to pick up on the assignments 2 components.
>>> 
>>> -AZ
>>> 
>>> 
>>> 
>>> On Thu, Jul 5, 2012 at 6:07 AM, Nkululeko Phakela <Nkululeko.Phakela at wits.ac.za> wrote:
>>> Hi All,
>>> 
>>> How are wars/components loaded in sakai when starting up sakai? It is not in alphabetical order?
>>> 
>>> I want lesson builder to use assignment 2. However, since lessonbuilder is loaded before assignment2, it says the tool doesn't
>>> exist and cannot be used. How can I make sure that assignment2 is deploy first, then lessonbuilder? 
>>> 
>>> Hope there is a way around this.
>>> 
>>> Kind Regards,
>>> Nguni
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> 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
>> 
>> _______________________________________________
>> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120705/a61a0ff5/attachment.html 


More information about the sakai-dev mailing list