[Building Sakai] Lesson Builder and Assignment 2

Nkululeko Phakela Nkululeko.Phakela at wits.ac.za
Fri Jul 6 07:06:56 PDT 2012


Hi Charles,

Let me try it and see how it goes.

Thanks. :-D

Nguni


On 06 Jul 2012, at 3:49 PM, Charles Hedrick wrote:

> I've just checked something in. Here it is:
> 
> --- opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java      (revision 3905)
> +++ opt-src/java/org/sakaiproject/lessonbuildertool/service/Assignment2Entity.java      (working copy)
> @@ -59,6 +59,7 @@
>  import org.sakaiproject.user.api.User;
>  import org.sakaiproject.user.cover.UserDirectoryService;
>  import org.sakaiproject.component.cover.ServerConfigurationService;             
> +import org.sakaiproject.component.cover.ComponentManager;
>  
>  import org.sakaiproject.memory.api.Cache;
>  import org.sakaiproject.memory.api.CacheRefresher;
> @@ -151,7 +152,8 @@
>  
>  
>      public void init () {
> -       if (ToolManager.getTool("sakai.assignment2") != null)
> +       if (ComponentManager.get("org.sakaiproject.assignment2.service.api.Assignment2Service") != null)
>             haveA2 = true;
>         System.out.println("Assignment2Entity init: haveA2 = " + haveA2);
>  
> It checks the service, which should be set up before any tool,  no matter what order loading is done in.
> 
> Apologies for the oversight. On our systems A2 was always loaded before Lessons.
> 
> 
> On Jul 5, 2012, at 4:09 PM, "Nkululeko Phakela" <Nkululeko.Phakela at wits.ac.za> wrote:
> 
>> Hi Charles,
>> 
>> That wud be awesome if the fix can be done quickly. The dependencies were
>> In optApplicationContext, and the pom.xml in tool. 
>> 
>> Regards,
>> Nguni
>> 
>> Sent from my iPhone 4
>> 
>> On Jul 5, 2012, at 9:58 PM, "Charles Hedrick" <hedrick at rutgers.edu> wrote:
>> 
>>> 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
>>> 
>> 
>> This communication is intended for the addressee only. It is confidential. If you have received this communication in error, please notify us immediately and destroy the original message. You may not copy or disseminate this communication without the permission of the University. Only authorized signatories are competent to enter into agreements on behalf of the University and recipients are thus advised that the content of this message may not be legally binding on the University and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of The University of the Witwatersrand, Johannesburg. All agreements between the University and outsiders are subject to South African Law unless the University agrees in writing to the contrary.
>> 
> 


<html><p><font face = "verdana" size = "0.8" color = "navy">This communication is intended for the addressee only. It is confidential. If you have received this communication in error, please notify us immediately and destroy the original message. You may not copy or disseminate this communication without the permission of the University. Only authorized signatories are competent to enter into agreements on behalf of the University and recipients are thus advised that the content of this message may not be legally binding on the University and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of The University of the Witwatersrand, Johannesburg. All agreements between the University and outsiders are subject to South African Law unless the University agrees in writing to the contrary.</font></p></html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120706/d738abef/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.tiff
Type: image/tiff
Size: 30698 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120706/d738abef/attachment.tiff 


More information about the sakai-dev mailing list