Index: lams_build/3rdParty.userlibraries =================================================================== diff -u -r3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf) +++ lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,118 +1,108 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_build/build.xml =================================================================== diff -u -r61490db201940453a368af6852d58c9efc7d8d73 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/build.xml (.../build.xml) (revision 61490db201940453a368af6852d58c9efc7d8d73) +++ lams_build/build.xml (.../build.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -118,34 +118,30 @@ - - - - - + - + @@ -188,9 +184,11 @@ - + - + + + @@ -317,7 +315,33 @@ + + + + + + + + + + + + + + + + + + + + + - + @@ -404,38 +428,41 @@ - + - - - + + + + - - + + + + + + + + + - - - - - - + - - - + @@ -472,12 +499,12 @@ Deploying Library Activities - + - + @@ -521,68 +548,72 @@ - + - - + + + + + + + + + - - - - + + + + + - - - - + + + + + + - - - - - - - - - - + + + - - - + - - - - - - - + + + + + + + + + - + - - - - - - - - + + + + + + + + + + + @@ -598,9 +629,9 @@ - - - + + + Index: lams_build/conf/j2ee/application_5.xsd =================================================================== diff -u --- lams_build/conf/j2ee/application_5.xsd (revision 0) +++ lams_build/conf/j2ee/application_5.xsd (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,341 @@ + + + + + @(#)application_5.xsds 1.17 08/05/05 + + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + ... + + + The instance documents may indicate the published version of + the schema using the xsi:schemaLocation attribute for Java EE + namespace with the following location: + + http://java.sun.com/xml/ns/javaee/application_5.xsd + + ]]> + + + + + + + The following conventions apply to all Java EE + deployment descriptor elements unless indicated otherwise. + + - In elements that specify a pathname to a file within the + same JAR file, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the JAR file's namespace. Absolute filenames (i.e., those + starting with "/") also specify names in the root of the + JAR file's namespace. In general, relative names are + preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + The application element is the root element of a Java EE + application deployment descriptor. + + + + + + + + + The context-root element content must be unique + in the ear. + + + + + + + + + + + + The security-role-name element content + must be unique in the ear. + + + + + + + + + + + + + + + + The applicationType defines the structure of the + application. + + + + + + + + + + + The application deployment descriptor must have one + module element for each Java EE module in the + application package. A module element is defined + by moduleType definition. + + + + + + + + + + The library-directory element specifies the pathname + of a directory within the application package, relative + to the top level of the application package. All files + named "*.jar" in this directory must be made available + in the class path of all components included in this + application package. If this element isn't specified, + the directory named "lib" is searched. An empty element + may be used to disable searching. + + + + + + + + + + The required value for the version is 5. + + + + + + + + + + + + + + + The moduleType defines a single Java EE module and contains a + connector, ejb, java, or web element, which indicates the + module type and contains a path to the module file, and an + optional alt-dd element, which specifies an optional URI to + the post-assembly version of the deployment descriptor. + + + + + + + + + + + The connector element specifies the URI of a + resource adapter archive file, relative to the + top level of the application package. + + + + + + + + + The ejb element specifies the URI of an ejb-jar, + relative to the top level of the application + package. + + + + + + + + + The java element specifies the URI of a java + application client module, relative to the top + level of the application package. + + + + + + + + + + + The alt-dd element specifies an optional URI to the + post-assembly version of the deployment descriptor + file for a particular Java EE module. The URI must + specify the full pathname of the deployment + descriptor file relative to the application's root + directory. If alt-dd is not specified, the deployer + must read the deployment descriptor from the default + location and file name required by the respective + component specification. + + + + + + + + + + + + + + + The webType defines the web-uri and context-root of + a web application module. + + + + + + + + + The web-uri element specifies the URI of a web + application file, relative to the top level of the + application package. + + + + + + + + + + The context-root element specifies the context root + of a web application. + + + + + + + + + + Index: lams_build/conf/j2ee/lams.application.xml =================================================================== diff -u -r3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/j2ee/lams.application.xml (.../lams.application.xml) (revision 3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf) +++ lams_build/conf/j2ee/lams.application.xml (.../lams.application.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,41 +1,11 @@ - - - LAMS - - Learning Activity Management System - - - - - - Student - LEARNER - - - Student - TEACHER - - - Can create/modify a learning design - AUTHOR - - - - Can running and monitoring a learning session - MONITOR - - - - Can add/remove users to the system, set up classes of users for sessions - ADMIN - - - - Can add/remove users to the system, set up classes of users for sessions - SYSADMIN - + + LAMS + @@ -73,192 +43,54 @@ /lams/www - lams-gradebook.war /lams/gradebook - - - - tk-autopatch-1.2.0-b2-cvs.jar - - - tk-discovery-1.0.0.jar - - - axis.jar - - - axis-ant.jar - - - cglib_jboss404GA.jar - - - dom4j-1.5.2.jar - - - hibernate3.jar - - - jstl.jar - - - commons-beanutils.jar - - - commons-codec-1.3.jar - - - commons-collections.jar - - - commons-digester.jar - - - commons-discovery-0.2.jar - - - commons-fileupload.jar - - - commons-io-1.4.jar - - - commons-lang-2.0.jar - - - commons-logging.jar - - - commons-validator.jar - - - FCKeditor-2.4.1.jar - - - poi-2.5.1-final-20040804.jar - - - standard.jar - - - jaxrpc.jar - - - jdom.jar - - - jfreechart-1.0.1.jar - - - jcommon-1.0.0.jar - - - gnujaxp.jar - - - log4j-1.2.13.jar - - - slf4j-api-1.5.2.jar - - - slf4j-log4j12-1.5.2.jar - - - mysql-connector-java-5.0.8-bin.jar - - - odmg-3.0.jar - - - antlr.jar - - - jakarta-oro.jar - - - struts.jar - - - struts-el.jar - - - wddx.jar - - - quartz.jar - - - saaj.jar - - - smack.jar - - - smackx.jar - - - spring.jar - - - concurrent-1.3.4.jar - - - - jmock-2004-03-19.jar - - - joda-time-0.98.jar - - - stax-1.1.1-dev.jar - - - stax-api-1.0.jar - - - wsdl4j-1.5.1.jar - - - xml-writer-0.2.jar - - - xom-1.0b3.jar - - - xpp3-1.1.3.4d_b4_min.jar - - - xstream-1.1.jar - - - transform.jar - - - translate.jar - - - JabberHTTPBind-1.1.1.jar - - - lucene-core-2.4.0.jar - - - lucene-snowball-2.4.0.jar - - - jxl.jar - - - opencsv-1.8.jar - - - - - + + + + Student + LEARNER + + + Student + TEACHER + + + + Can create/modify a learning design + AUTHOR + + + + Can running and monitoring a learning session + MONITOR + + + + Can add/remove users to the system, set up classes of users for sessions + ADMIN + + + + Can add/remove users to the system, set up classes of users for sessions + SYSADMIN + + + + . + + \ No newline at end of file Index: lams_build/conf/j2ee/rams.application.xml =================================================================== diff -u -r3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/j2ee/rams.application.xml (.../rams.application.xml) (revision 3cae36fc3c73c4ce595adc48b7ef2f8ac166daaf) +++ lams_build/conf/j2ee/rams.application.xml (.../rams.application.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,67 +1,37 @@ - - - RAMS - - Research Activity Management System - - - - - - Student - LEARNER - - - Student - TEACHER - - - Can create/modify a learning design - AUTHOR - - - - Can running and monitoring a learning session - MONITOR - - - - Can add/remove users to the system, set up classes of users for sessions - ADMIN - - - - Can add/remove users to the system, set up classes of users for sessions - SYSADMIN - + + LAMS + lams-central.war - /rams + /lams lams-admin.war - /rams/admin + /lams/admin lams-monitoring.war - /rams/monitoring + /lams/monitoring lams-learning.war - /rams/learning + /lams/learning @@ -70,7 +40,7 @@ lams-www.war - /rams/www + /lams/www @@ -80,185 +50,47 @@ + + + + Student + LEARNER + + + Student + TEACHER + - - - tk-autopatch-1.2.0-b2-cvs.jar - - - tk-discovery-1.0.0.jar - - - axis.jar - - - axis-ant.jar - - - cglib_jboss404GA.jar - - - dom4j-1.5.2.jar - - - hibernate3.jar - - - jstl.jar - - - commons-beanutils.jar - - - commons-codec-1.3.jar - - - commons-collections.jar - - - commons-digester.jar - - - commons-discovery-0.2.jar - - - commons-fileupload.jar - - - commons-io-1.4.jar - - - commons-lang-2.0.jar - - - commons-logging.jar - - - commons-validator.jar - - - FCKeditor-2.4.1.jar - - - poi-2.5.1-final-20040804.jar - - - standard.jar - - - jaxrpc.jar - - - jdom.jar - - - jfreechart-1.0.1.jar - - - jcommon-1.0.0.jar - - - gnujaxp.jar - - - log4j-1.2.13.jar - - - slf4j-api-1.5.2.jar - - - slf4j-log4j12-1.5.2.jar - - - mysql-connector-java-5.0.8-bin.jar - - - odmg-3.0.jar - - - antlr.jar - - - jakarta-oro.jar - - - struts.jar - - - struts-el.jar - - - wddx.jar - - - quartz.jar - - - saaj.jar - - - smack.jar - - - smackx.jar - - - spring.jar - - - concurrent-1.3.4.jar - - - - jmock-2004-03-19.jar - - - joda-time-0.98.jar - - - stax-1.1.1-dev.jar - - - stax-api-1.0.jar - - - wsdl4j-1.5.1.jar - - - xml-writer-0.2.jar - - - xom-1.0b3.jar - - - xpp3-1.1.3.4d_b4_min.jar - - - xstream-1.1.jar - - - transform.jar - - - translate.jar - - - JabberHTTPBind-1.1.1.jar - - - lucene-core-2.4.0.jar - - - lucene-snowball-2.4.0.jar - - - jxl.jar - - - opencsv-1.8.jar - - - - - - + + Can create/modify a learning design + AUTHOR + + + + Can running and monitoring a learning session + MONITOR + + + + Can add/remove users to the system, set up classes of users for sessions + ADMIN + + + + Can add/remove users to the system, set up classes of users for sessions + SYSADMIN + + + + . + + \ No newline at end of file Index: lams_build/conf/unix/jboss/bootstrap.slim.xml =================================================================== diff -u --- lams_build/conf/unix/jboss/bootstrap.slim.xml (revision 0) +++ lams_build/conf/unix/jboss/bootstrap.slim.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,18 @@ + + + + + + bootstrap/vfs.xml + bootstrap/classloader.xml + bootstrap/aop.xml + bootstrap/jmx.xml + bootstrap/deployers.xml + bootstrap/profile.xml + + Index: lams_build/conf/unix/jboss/jboss-log4j.xml =================================================================== diff -u --- lams_build/conf/unix/jboss/jboss-log4j.xml (revision 0) +++ lams_build/conf/unix/jboss/jboss-log4j.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_build/conf/unix/jboss/jboss-service.xml =================================================================== diff -u -rca703c3af4ec65382ddb6e3144f7ea342741277b -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/unix/jboss/jboss-service.xml (.../jboss-service.xml) (revision ca703c3af4ec65382ddb6e3144f7ea342741277b) +++ lams_build/conf/unix/jboss/jboss-service.xml (.../jboss-service.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,4 +1,5 @@ + @@ -7,46 +8,37 @@ - - + + + - - + - - jboss.system:service=MainDeployer - jboss.system:service=ServiceDeployer - jboss.j2ee:service=EARDeployer - jboss.ejb:service=EJBDeployer - jboss.jca:service=RARDeployer - jboss.jca:service=ConnectionFactoryDeployer - jboss.web:service=WebServer - jboss:service=Mail - jboss.mq:service=DestinationManager - jboss:service=Naming - jboss:service=TransactionManager - jboss:service=ClientUserTransaction - jboss:service=CorbaORB + + + + + - + - + @@ -74,150 +66,185 @@ run - - - resource:log4j.xml + xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml"> + resource:jboss-log4j.xml true 60 + + + DEBUG - + - - java.rmi.server.RMIClassLoaderSpi - org.jboss.system.JBossRMIClassLoader - - - - - - - - + + + + + java.rmi.server.RMIClassLoaderSpi + org.jboss.system.JBossRMIClassLoader + + - 8083 - + + ${jboss.bind.address} + + + + + + ${java.rmi.server.hostname} + true - ${jboss.bind.address} - ${jboss.bind.address} + + false + + + jboss.system:service=ThreadPool + + + + false + - 1099 + + + jboss:service=Naming + Port + + + + RMI service bind address. Empty == all addresses + --> ${jboss.bind.address} - 1098 + + + jboss:service=Naming + RmiPort + + + --> ${jboss.bind.address} jboss.system:service=ThreadPool + + jboss:service=NamingBeanImpl - + + name="jboss:service=JNDIView" + xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml"> + + jboss:service=HAJNDI - - jboss.security:service=XMLLoginConfig - - - login-config.xml - - + + true org.jboss.security.plugins.JaasSecurityManager anonymous - 0 + 0 60 - - - - - - - - - - - - - 300 - - true - jboss:service=XidFactory - - - - - - jboss:service=invoker,type=jrmp - jboss:service=ClientUserTransaction - UserTransactionSessionFactory - org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory - - - org.jboss.proxy.ClientMethodInterceptor - org.jboss.invocation.InvokerInterceptor - - - jboss:service=invoker,type=jrmp - - - - - jboss:service=invoker,type=jrmp - jboss:service=ClientUserTransaction - - org.jboss.tm.usertx.interfaces.UserTransactionSession - - - org.jboss.proxy.ClientMethodInterceptor - org.jboss.invocation.InvokerInterceptor - - - jboss:service=invoker,type=jrmp - - - - - - - - - - - 4444 - ${jboss.bind.address} - - jboss:service=TransactionManager + false - - - jboss:service=TransactionManager - - - - 1 - 300 - 300 - 60000 - ${jboss.bind.address} - 4445 - ${jboss.bind.address} - 0 - false - - jboss:service=TransactionManager - - @@ -356,102 +293,4 @@ - - - - - - - - - jboss.system:service=MainDeployer - - - org.jboss.deployment.DeploymentSorter - - - - - - #,%,\,,.,_$ - - #,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh - - .make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags - - - - 5000 - - true - - - - deploy/ - - - - - True - - - Index: lams_build/conf/unix/jboss/login-config.xml =================================================================== diff -u -rff699ca7b093afca3634544000aef419b70a1f27 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/unix/jboss/login-config.xml (.../login-config.xml) (revision ff699ca7b093afca3634544000aef419b70a1f27) +++ lams_build/conf/unix/jboss/login-config.xml (.../login-config.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -38,31 +38,7 @@ - - - - - guest - java:/DefaultDS - SELECT PASSWD FROM JMS_USERS WHERE USERID=? - SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=? - - - - - @@ -168,4 +144,3 @@ - Index: lams_build/conf/unix/jboss/service/lams-cache-jboss-beans.xml =================================================================== diff -u --- lams_build/conf/unix/jboss/service/lams-cache-jboss-beans.xml (revision 0) +++ lams_build/conf/unix/jboss/service/lams-cache-jboss-beans.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + udp + + + + TreeCache-Cluster + + + + READ_COMMITTED + + + + LOCAL + + + + 15000 + + + + 20000 + + + + 15000 + + + + true + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + @org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=LamsCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true) + + + + + + + + + + \ No newline at end of file Index: lams_build/conf/unix/jboss/service/mysql-ds.xml =================================================================== diff -u -r45038917ee3f1c3dca8fe9693ad3927d61be7bff -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/unix/jboss/service/mysql-ds.xml (.../mysql-ds.xml) (revision 45038917ee3f1c3dca8fe9693ad3927d61be7bff) +++ lams_build/conf/unix/jboss/service/mysql-ds.xml (.../mysql-ds.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -24,5 +24,5 @@ 0 5 - - + + \ No newline at end of file Index: lams_build/conf/unix/jboss/service/treecache.xml =================================================================== diff -u --- lams_build/conf/unix/jboss/service/treecache.xml (revision 0) +++ lams_build/conf/unix/jboss/service/treecache.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + jboss:service=Naming + jboss:service=TransactionManager + + + + org.jboss.cache.transaction.JBossTransactionManagerLookup + + + + READ_COMMITTED + + + LOCAL + + + TreeCache-Cluster + + + + + + + + + + + + + + + + + + + + + + + + 5000 + + + 10000 + + + 15000 + + + + 5 + + org.jboss.cache.eviction.LRUPolicy + + + 5000 + 1000 + + + 200 + 900 + + + + + + + Index: lams_build/conf/windows/jboss/bootstrap.slim.xml =================================================================== diff -u --- lams_build/conf/windows/jboss/bootstrap.slim.xml (revision 0) +++ lams_build/conf/windows/jboss/bootstrap.slim.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,18 @@ + + + + + + bootstrap/vfs.xml + bootstrap/classloader.xml + bootstrap/aop.xml + bootstrap/jmx.xml + bootstrap/deployers.xml + bootstrap/profile.xml + + Index: lams_build/conf/windows/jboss/jboss-log4j.xml =================================================================== diff -u --- lams_build/conf/windows/jboss/jboss-log4j.xml (revision 0) +++ lams_build/conf/windows/jboss/jboss-log4j.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_build/conf/windows/jboss/jboss-service.xml =================================================================== diff -u -rca703c3af4ec65382ddb6e3144f7ea342741277b -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/windows/jboss/jboss-service.xml (.../jboss-service.xml) (revision ca703c3af4ec65382ddb6e3144f7ea342741277b) +++ lams_build/conf/windows/jboss/jboss-service.xml (.../jboss-service.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,4 +1,5 @@ + @@ -7,46 +8,37 @@ - - + + + - - + - - jboss.system:service=MainDeployer - jboss.system:service=ServiceDeployer - jboss.j2ee:service=EARDeployer - jboss.ejb:service=EJBDeployer - jboss.jca:service=RARDeployer - jboss.jca:service=ConnectionFactoryDeployer - jboss.web:service=WebServer - jboss:service=Mail - jboss.mq:service=DestinationManager - jboss:service=Naming - jboss:service=TransactionManager - jboss:service=ClientUserTransaction - jboss:service=CorbaORB + + + + + - + - + @@ -74,150 +66,185 @@ run - - - resource:log4j.xml + xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml"> + resource:jboss-log4j.xml true 60 + + + DEBUG - + - - java.rmi.server.RMIClassLoaderSpi - org.jboss.system.JBossRMIClassLoader - - - - - - - - + + + + + java.rmi.server.RMIClassLoaderSpi + org.jboss.system.JBossRMIClassLoader + + - 8083 - + + ${jboss.bind.address} + + + + + + ${java.rmi.server.hostname} + true - ${jboss.bind.address} - ${jboss.bind.address} + + false + + + jboss.system:service=ThreadPool + + + + false + - 1099 + + + jboss:service=Naming + Port + + + + RMI service bind address. Empty == all addresses + --> ${jboss.bind.address} - 1098 + + + jboss:service=Naming + RmiPort + + + --> ${jboss.bind.address} jboss.system:service=ThreadPool + + jboss:service=NamingBeanImpl - + + name="jboss:service=JNDIView" + xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml"> + + jboss:service=HAJNDI - - jboss.security:service=XMLLoginConfig - - - login-config.xml - - + + true org.jboss.security.plugins.JaasSecurityManager anonymous - 0 + 0 60 - - - - - - - - - - - - - 300 - - true - jboss:service=XidFactory - - - - - - jboss:service=invoker,type=jrmp - jboss:service=ClientUserTransaction - UserTransactionSessionFactory - org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory - - - org.jboss.proxy.ClientMethodInterceptor - org.jboss.invocation.InvokerInterceptor - - - jboss:service=invoker,type=jrmp - - - - - jboss:service=invoker,type=jrmp - jboss:service=ClientUserTransaction - - org.jboss.tm.usertx.interfaces.UserTransactionSession - - - org.jboss.proxy.ClientMethodInterceptor - org.jboss.invocation.InvokerInterceptor - - - jboss:service=invoker,type=jrmp - - - - - - - - - - - 4444 - ${jboss.bind.address} - - jboss:service=TransactionManager + false - - - jboss:service=TransactionManager - - - - 1 - 300 - 300 - 60000 - ${jboss.bind.address} - 4445 - ${jboss.bind.address} - 0 - false - - jboss:service=TransactionManager - - @@ -356,102 +293,4 @@ - - - - - - - - - jboss.system:service=MainDeployer - - - org.jboss.deployment.DeploymentSorter - - - - - - #,%,\,,.,_$ - - #,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh - - .make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags - - - - 5000 - - true - - - - deploy/ - - - - - True - - - Index: lams_build/conf/windows/jboss/login-config.xml =================================================================== diff -u -raa7e502bb28fa1df94980fadea3876a83e842ae4 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/conf/windows/jboss/login-config.xml (.../login-config.xml) (revision aa7e502bb28fa1df94980fadea3876a83e842ae4) +++ lams_build/conf/windows/jboss/login-config.xml (.../login-config.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -38,31 +38,7 @@ - - - - - guest - java:/DefaultDS - SELECT PASSWD FROM JMS_USERS WHERE USERID=? - SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=? - - - - - Index: lams_build/conf/windows/jboss/service/lams-cache-jboss-beans.xml =================================================================== diff -u --- lams_build/conf/windows/jboss/service/lams-cache-jboss-beans.xml (revision 0) +++ lams_build/conf/windows/jboss/service/lams-cache-jboss-beans.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + udp + + + + TreeCache-Cluster + + + + READ_COMMITTED + + + + LOCAL + + + + 15000 + + + + 20000 + + + + 15000 + + + + true + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + @org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=LamsCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true) + + + + + + + + + + \ No newline at end of file Index: lams_build/conf/windows/jboss/service/treecache.xml =================================================================== diff -u --- lams_build/conf/windows/jboss/service/treecache.xml (revision 0) +++ lams_build/conf/windows/jboss/service/treecache.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + jboss:service=Naming + jboss:service=TransactionManager + + + + org.jboss.cache.transaction.JBossTransactionManagerLookup + + + + READ_COMMITTED + + + LOCAL + + + TreeCache-Cluster + + + + + + + + + + + + + + + + + + + + + + + + 5000 + + + 10000 + + + 15000 + + + + 5 + + org.jboss.cache.eviction.LRUPolicy + + + 5000 + 1000 + + + 200 + 900 + + + + + + + Index: lams_build/deploy-tool/lib/lams-tool-deploy.jar =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/catalina/catalina.jar =================================================================== diff -u -rf3cf0162e6ac8fba3b3b7abd0e6363f3577a9c01 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/hibernate/src/hibernate-src.zip =================================================================== diff -u -radcebba79c4323ab088625f400d0570618555803 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/jboss/hibernate-jbosscache2.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/jboss/jbosscache-core.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/jboss/jgroups-all.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/lams/lams-gradebook.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/lams/lams-learning.jar =================================================================== diff -u -r42aa5319fbd33938828764c43dd0ab1ca80e2416 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/quartz/quartz.jar =================================================================== diff -u -rd5e8d7001b9fb1f67ee7216ac92ea3d9012165dd -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/spring/jboss-spring-int-deployers.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/spring/jboss-spring-int-vfs.jar =================================================================== diff -u Binary files differ Index: lams_build/lib/spring/spring.jar =================================================================== diff -u -r655660c5319e6bd2a212fe2a1d6619a5ff6d81d3 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/lib/spring/src/spring-framework-1.2.8-src.zip =================================================================== diff -u -rb26dcd9709981a1f986ead18b97e4019e1cff2d5 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_build/librarypackages/chatscribe/language/lams/ApplicationResources_ja_JP.properties =================================================================== diff -u -re978ae9cb40427ac4a4875f1c7c5f9fd2b6e6f18 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/librarypackages/chatscribe/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision e978ae9cb40427ac4a4875f1c7c5f9fd2b6e6f18) +++ lams_build/librarypackages/chatscribe/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -2,13 +2,13 @@ #language code: ja #locale code: JP - # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Fri Apr 11 02:00:35 BST 2008 + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu Jun 18 01:41:37 CST 2009 #=================== labels for Chat & Scribe =================# -activity.title =\u30c1\u30e3\u30c3\u30c8\u3068\u307e\u3068\u3081 -activity.description =\u30c1\u30e3\u30c3\u30c8\u3068\u66f8\u8a18\u3092\u7d50\u5408\u3057\u305f\u3082\u306e\u3067\u3059 +activity.description =\u30c1\u30e3\u30c3\u30c8\u3068\u307e\u3068\u3081\u3092\u7d71\u5408\u3057\u305f\u3082\u306e\u3067\u3059 activity.helptext =\u4e0a\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u30c1\u30e3\u30c3\u30c8\u30a8\u30ea\u30a2\u3001\u4e0b\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u307e\u3068\u3081\u30a8\u30ea\u30a2\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u5b66\u7fd2\u8005\u304c\u30b0\u30eb\u30fc\u30d7\u3067\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u5229\u7528\u3067\u304d\u307e\u3059\u3002 +activity.title =\u30c1\u30e3\u30c3\u30c8\u3068\u307e\u3068\u3081 #======= End labels: Exported 3 labels for ja JP ===== Index: lams_build/librarypackages/forumscribe/language/lams/ApplicationResources_ja_JP.properties =================================================================== diff -u -re43552eb705a10ca8c983ebb83e48527e1f0a61c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/librarypackages/forumscribe/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision e43552eb705a10ca8c983ebb83e48527e1f0a61c) +++ lams_build/librarypackages/forumscribe/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -2,12 +2,12 @@ #language code: ja #locale code: JP - # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Fri Apr 11 02:31:35 BST 2008 + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu Jun 18 01:43:57 CST 2009 #=================== labels for Forum & Scribe =================# activity.title =\u30d5\u30a9\u30fc\u30e9\u30e0\u3068\u307e\u3068\u3081 -activity.description =\u30d5\u30a9\u30fc\u30e9\u30e0\u3068\u307e\u3068\u3081\u3092\u7d50\u5408\u3057\u305f\u3082\u306e\u3067\u3059 +activity.description =\u30c1\u30e3\u30c3\u30c8\u3068\u307e\u3068\u3081\u3092\u7d71\u5408\u3057\u307e\u3059 activity.helptext =\u4e0a\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u30d5\u30a9\u30fc\u30e9\u30e0\u30a8\u30ea\u30a2\u3001\u4e0b\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u307e\u3068\u3081\u30a8\u30ea\u30a2\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u5b66\u7fd2\u8005\u304c\u30b0\u30eb\u30fc\u30d7\u3067\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u5229\u7528\u3067\u304d\u307e\u3059\u3002 Index: lams_build/librarypackages/shareresourcesforum/language/lams/ApplicationResources_ja_JP.properties =================================================================== diff -u -re43552eb705a10ca8c983ebb83e48527e1f0a61c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/librarypackages/shareresourcesforum/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision e43552eb705a10ca8c983ebb83e48527e1f0a61c) +++ lams_build/librarypackages/shareresourcesforum/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -2,13 +2,13 @@ #language code: ja #locale code: JP - # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Fri Apr 11 02:21:49 BST 2008 + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu Jun 18 01:39:42 CST 2009 #=================== labels for Resources and Forum =================# -activity.title =\u8cc7\u6599\u3068\u30d5\u30a9\u30fc\u30e9\u30e0 activity.description =\u5171\u6709\u8cc7\u6599\u3068\u30d5\u30a9\u30fc\u30e9\u30e0\u3092\u7d50\u5408\u3057\u305f\u3082\u306e\u3067\u3059 activity.helptext =\u4e0a\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u5171\u6709\u8cc7\u6599\u30a8\u30ea\u30a2\u3001\u4e0b\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u30d5\u30a9\u30fc\u30e9\u30e0\u30a8\u30ea\u30a2\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u5171\u6709\u3057\u305f\u8cc7\u6599\u3092\u898b\u306a\u304c\u3089\u30c7\u30a3\u30b9\u30ab\u30c3\u30b7\u30e7\u30f3\u3059\u308b\u305f\u3081\u306b\u5229\u7528\u3067\u304d\u307e\u3059\u3002 +activity.title =\u8cc7\u6599\u3068\u30d5\u30a9\u30fc\u30e9\u30e0 #======= End labels: Exported 3 labels for ja JP ===== Index: lams_build/unix.properties =================================================================== diff -u -r3fb2e94e5bf784ac542c2028a22cbf83a23a8cbd -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/unix.properties (.../unix.properties) (revision 3fb2e94e5bf784ac542c2028a22cbf83a23a8cbd) +++ lams_build/unix.properties (.../unix.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -28,12 +28,12 @@ contentrepository.directory=/var/opt/${conf.application}/repository #JBoss deploy directory (Unix) -jboss.home=/usr/local/jboss-4.0.2/ +jboss.home=/usr/local/jboss-5/ jboss.server=${jboss.home}server/ jboss.server.instance=${jboss.server}default jboss.server.instance.lib=${jboss.server.instance}/lib jboss.ear.deploy=${jboss.server.instance}/deploy/ +jboss.ear.deployers=${jboss.server.instance}/deployers/ jboss.deploy=${jboss.ear.deploy}/${conf.application}.ear - -j2eelibs=${jboss.server.instance}/lib \ No newline at end of file +j2eelibs=${jboss.home}/common/lib \ No newline at end of file Index: lams_build/windows.properties =================================================================== diff -u -r3fb2e94e5bf784ac542c2028a22cbf83a23a8cbd -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_build/windows.properties (.../windows.properties) (revision 3fb2e94e5bf784ac542c2028a22cbf83a23a8cbd) +++ lams_build/windows.properties (.../windows.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -26,12 +26,12 @@ contentrepository.directory=C:/${conf.application}/repository #JBoss deploy directory (Windows) -jboss.home=D:/jboss-4.0.2/ +jboss.home=D:/jboss-5/ jboss.server=${jboss.home}server/ jboss.server.instance=${jboss.server}default jboss.server.instance.lib=${jboss.server.instance}/lib jboss.ear.deploy=${jboss.server.instance}/deploy/ +jboss.ear.deployers=${jboss.server.instance}/deployers/ jboss.deploy=${jboss.ear.deploy}/${conf.application}.ear -j2eelibs=${jboss.server.instance}/lib - +j2eelibs=${jboss.home}/common/lib \ No newline at end of file Index: lams_central/conf/flashxml/lams/learner/ja_JP_dictionary.xml =================================================================== diff -u -ref180f48b9c48c352c7fad27e85dd14f2aca43a4 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_central/conf/flashxml/lams/learner/ja_JP_dictionary.xml (.../ja_JP_dictionary.xml) (revision ef180f48b9c48c352c7fad27e85dd14f2aca43a4) +++ lams_central/conf/flashxml/lams/learner/ja_JP_dictionary.xml (.../ja_JP_dictionary.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1 +1 @@ -
getDictionary3sys_error_msg_startシステムエラーが発生しました:Common System error message starting linesys_error_msg_finish続行するためにはこの Web ブラウザを再起動する必要があるかもしれません。このエラーの問題解決を助けるために、以下の情報を保存しますか?Common System error message finish paragraphsys_errorシステムエラーSystem Error alert window titleal_alert警告Generic title for Alert windowal_cancelキャンセルCancel on alert dialogal_confirm確認To Confirm title for LFErroral_okOKOK on alert dialogal_validation_act_unreachedまだそのアクティビティに到達していないため、開けません。Alert message when clicking on an unreached activity in the progess bar.hd_resume_tooltip現在のアクティビティにジャンプします。tool tip message for resume buttonhd_exit_tooltip学習者用システムを終了し、Web ブラウザのウィンドウを閉じますtool tip message for exit buttonln_export_tooltipこのレッスンの進捗をエクスポートしますtool tip message for export buttoncompleted_act_tooltipダブルクリックで、この完了したアクティビティをチェックしますtool tip message for completed activity iconcurrent_act_tooltipダブルクリックで、現在のアクティビティに参加しますtool tip message for current activity iconal_doubleclick_todoactivityまだこのアクティビティに到達していませんalert message when user double click on the todo activity in the sequence in learner progresssp_view_lblすべて表示Label for View All buttonsp_save_lbl保存Label for Save buttonsp_view_tooltipノートブックの項目をすべて表示しますtool tip message for view all buttonsp_save_tooltipあなたのノートブックの項目を保存しますtool tip message for save buttonsp_title_lblタイトルLabel for title field of scratchpad (notebook)sp_panel_lblノートブックLabel for panel title of scratchpad (notebook)al_timeout警告!読み込みが終了するまで進捗データを適用することはできません。OK をクリックすると読み込みを続行しますAlert message for timeout error when loading learning design.al_send送信Send button label on the system error dialoghd_resume_lbl再開Label for Resume buttonhd_exit_lbl終了Label for Exit buttonln_export_btnエクスポートLabel for Export buttonschedule_gate_tooltipこのゲートは {0} に開きます。Tooltip for schedule gate in learner progress barpermission_gate_tooltip先生がゲートを開くまで、ゲートを通過することはできません。Tooltip for permission gate in learner progress barsynchronise_gate_tooltipすべての学習者がここに到達するとゲートが開きます。Tooltip for synchronise gate in learner progress barnot_attempted_act_tooltipこのアクティビティにアクセスするには、その前にあるアクティビティを完了する必要があります。Tooltip for not yet attempted activities in the learner progress bar \ No newline at end of file +
getDictionary3sys_error_msg_startシステムエラーが発生しました:sys_error_msg_finish続行するためにはこの Web ブラウザを再起動する必要があるかもしれません。このエラーの問題解決を助けるために、以下の情報を保存しますか?sys_errorシステムエラーal_alert警告al_cancelキャンセルal_confirm確認al_okOKal_validation_act_unreachedまだそのアクティビティに到達していないため、開けません。hd_resume_tooltip現在のアクティビティにジャンプします。hd_exit_tooltip学習者用システムを終了し、Web ブラウザのウィンドウを閉じますln_export_tooltipこのレッスンの進捗をエクスポートしますcompleted_act_tooltipダブルクリックで、この完了したアクティビティをチェックしますcurrent_act_tooltipダブルクリックで、現在のアクティビティに参加しますal_doubleclick_todoactivityまだこのアクティビティに到達していませんsp_view_lblすべて表示sp_save_lbl保存sp_view_tooltipノートブックの項目をすべて表示しますsp_save_tooltipあなたのノートブックの項目を保存しますsp_title_lblタイトルsp_panel_lblノートブックal_timeout警告!読み込みが終了するまで進捗データを適用することはできません。OK をクリックすると読み込みを続行しますal_send送信hd_resume_lbl再開hd_exit_lbl終了ln_export_btnエクスポートpres_panel_lbl出席pres_dataproviderloading_lbl出席の読み込み中...support_acts_titleサポート・アクティビティsupport_act_tooltipダブルクリックで、現在のサポート・アクティビティに参加しますal_act_reached_max最大選択枠アクティビティ数に達しました。schedule_gate_tooltipこのゲートは {0} に開きます。permission_gate_tooltip先生がゲートを開くまで、ゲートを通過することはできません。synchronise_gate_tooltipすべての学習者がここに到達するとゲートが開きます。not_attempted_act_tooltipこのアクティビティにアクセスするには、その前にあるアクティビティを完了する必要があります。pres_colnamelearners_lbl学習者 \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_central/src/java/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml (.../authoringApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml (.../authoringApplicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -80,6 +80,12 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED,readOnly Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -r70a60f2862830ca6bd07e2b1252af3d79e4939af -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 70a60f2862830ca6bd07e2b1252af3d79e4939af) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1056,13 +1056,13 @@ * java.lang.Integer) */ private LearningDesign copyLearningDesignToolContent(LearningDesign design, LearningDesign originalLearningDesign, - Integer copyType) throws LearningDesignException { + Integer copyType, String customCSV) throws LearningDesignException { for (Iterator i = design.getActivities().iterator(); i.hasNext();) { Activity currentActivity = (Activity) i.next(); if (currentActivity.isToolActivity()) { copyActivityToolContent(currentActivity, design.getCopyTypeID(), originalLearningDesign - .getLearningDesignId(), null); + .getLearningDesignId(), customCSV); } } @@ -1631,7 +1631,17 @@ user); if (extractor.getMode().intValue() == 1) { - copyLearningDesignToolContent(design, design, design.getCopyTypeID()); + + // adding the customCSV to the call if it is present + String customCSV = null; + if (table.containsKey(WDDXTAGS.CUSTOM_CSV)){ + customCSV = WDDXProcessor.convertToString(table, WDDXTAGS.CUSTOM_CSV); + } + + copyLearningDesignToolContent(design, design, design.getCopyTypeID(), customCSV); + + + } return design.getLearningDesignId(); Index: lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java =================================================================== diff -u -r4f33380083bd35fd6d0851de9def290c62ffc3c9 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 4f33380083bd35fd6d0851de9def290c62ffc3c9) +++ lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -577,8 +577,9 @@ getMonitoringService().startLesson(lesson.getLessonId(), userDto.getUserID()); String newPath = mapping.findForward(PedagogicalPlannerAction.FORWARD_PREVIEW).getPath(); newPath = newPath + PedagogicalPlannerAction.CHAR_AMPERSAND + AttributeNames.PARAM_LESSON_ID - + PedagogicalPlannerAction.CHAR_EQUALS + lesson.getLessonId() + PedagogicalPlannerAction.CHAR_AMPERSAND - + AttributeNames.PARAM_MODE + PedagogicalPlannerAction.CHAR_EQUALS + "preview"; + + PedagogicalPlannerAction.CHAR_EQUALS + lesson.getLessonId() + + PedagogicalPlannerAction.CHAR_AMPERSAND + AttributeNames.PARAM_MODE + + PedagogicalPlannerAction.CHAR_EQUALS + "preview"; return new ActionForward(newPath, true); } Index: lams_central/src/java/org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_central/src/java/org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml (.../workspaceApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_central/src/java/org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml (.../workspaceApplicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -38,7 +38,9 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED - PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED,readOnly Index: lams_central/web/lams_authoring.swf =================================================================== diff -u -rff4a320a1090e53f7230a679055388a73ce06793 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 Binary files differ Index: lams_common/.classpath =================================================================== diff -u -r406cdd685f03fa39a0ea0c85bde60f7b268bc05d -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/.classpath (.../.classpath) (revision 406cdd685f03fa39a0ea0c85bde60f7b268bc05d) +++ lams_common/.classpath (.../.classpath) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -5,11 +5,18 @@ - - - - + + + + + + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml =================================================================== diff -u -rb47e590fe328a0e131c9fa34d1e24633904a42f9 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml (.../ExtServerOrgMap.hbm.xml) (revision b47e590fe328a0e131c9fa34d1e24633904a42f9) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml (.../ExtServerOrgMap.hbm.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -127,6 +127,20 @@ + + @hibernate.property + column="server_url" + length="255" + not-null="false" + + + + + + + + + @hibernate.class + table="lams_ext_server_tool_map" + + + + + @hibernate.id + generator-class="native" + type="java.lang.Long" + column="uid" + + + + true + + + + + + + + + + @hibernate.many-to-one + not-null="true" + @hibernate.column name="tool_id" + + + + + + + + @hibernate.many-to-one + not-null="true" + @hibernate.column name="ext_server_org_map_id" + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/Tool.hbm.xml =================================================================== diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/Tool.hbm.xml (.../Tool.hbm.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/Tool.hbm.xml (.../Tool.hbm.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -445,6 +445,17 @@ class="org.lamsfoundation.lams.learningdesign.Activity" /> + + + + + + Index: lams_common/conf/language/lams/ApplicationResources_ja_JP.properties =================================================================== diff -u -r063e7b6d6e0c516f5ef5c570c543b5fe956f6986 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/conf/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 063e7b6d6e0c516f5ef5c570c543b5fe956f6986) +++ lams_common/conf/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -2,15 +2,14 @@ #language code: ja #locale code: JP - # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Jul 08 08:51:02 BST 2008 + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu Jun 18 01:38:49 CST 2009 #=================== labels for LAMS Common =================# validation.error.sequenceActivityMustHaveFirstActivity =\u5206\u5c90\u306f\u6700\u521d\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3067\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002 validation.error.groupedBranchingMustHaveAGrouping =\u30b0\u30eb\u30fc\u30d7\u578b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u3001\u30b0\u30eb\u30fc\u30d7\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5f8c\u3067\u5b9a\u7fa9\u3059\u308b\u8a2d\u5b9a\u306b\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u5c11\u306a\u304f\u3068\u3082\u4e00\u3064\u306e\u30b0\u30eb\u30fc\u30d7\u304c\u5fc5\u8981\u3067\u3059\u3002 validation.error.groupedBranchingMustHaveBranchForGroup =\u30b0\u30eb\u30fc\u30d7\u578b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306b\u542b\u307e\u308c\u308b\u3059\u3079\u3066\u306e\u30b0\u30eb\u30fc\u30d7\u304c\u5206\u5c90\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 validation.error.toolBranchingConditionInvalid =\u554f\u984c\u304c\u3042\u308b\u304b\u3001\u6bd4\u8f03\u5024\u3092\u5931\u3063\u3066\u3044\u308b\u72b6\u614b\u3067\u3059\u3002 -validation.error.toolBranchingMustHaveAnInputToolActivity =\u30c4\u30fc\u30eb\u51fa\u529b\u4f9d\u5b58\u578b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u5165\u529b\u30c4\u30fc\u30eb\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 error.possibly.incompatible.version =Zip \u30d5\u30a1\u30a4\u30eb\u306f\u3053\u306e LAMS \u3068\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u4e92\u63db\u6027\u304c\u78ba\u8a8d\u3067\u304d\u307e\u305b\u3093\u3002\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306e LAMS \u3067\u51fa\u529b\u3055\u308c\u305f\u3082\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002Zip \u30d5\u30a1\u30a4\u30eb\u306e\u5bfe\u5fdc\u30d0\u30fc\u30b8\u30e7\u30f3\u306f {0}\u3001\u3053\u306e LAMS \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f {1} \u3067\u3059\u3002\u30a4\u30f3\u30dd\u30fc\u30c8\u306b\u5931\u6557\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 validation.error.group.count.mismatch =\u30b0\u30eb\u30fc\u30d7\u304c\u672c\u6765\u306e\u6570\u3088\u308a\u591a\u304f\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002 runsequences.folder.name ={0} \u5b9f\u884c\u30b7\u30fc\u30b1\u30f3\u30b9 @@ -33,12 +32,10 @@ theme.service.setTheme.noSuchTheme =\u305d\u306e\u3088\u3046\u306a\u30c6\u30fc\u30de\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 theme.service.setTheme.noSuchUser =\u305d\u306e\u3088\u3046\u306a\u30e6\u30fc\u30b6\u30fc\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 audit.change.entry =\u30e6\u30fc\u30b6\u30fc {0} \u306e\u30c6\u30ad\u30b9\u30c8\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\u3002\u5909\u66f4\u524d: {1} \u5909\u66f4\u5f8c: {2} -audit.hide.entry =\u30e6\u30fc\u30b6\u30fc {0} \u306e\u30a8\u30f3\u30c8\u30ea\u3092\u975e\u8868\u793a\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002\u30a8\u30f3\u30c8\u30ea: {1} audit.show.entry =\u30e6\u30fc\u30b6\u30fc {0} \u306e\u30a8\u30f3\u30c8\u30ea\u3092\u8868\u793a\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002\u30a8\u30f3\u30c8\u30ea: {1} group.name.prefix =\u30b0\u30eb\u30fc\u30d7 imported.permission.gate.title =\u627f\u8a8d\u30b2\u30fc\u30c8 imported.synchronise.gate.title =\u540c\u671f\u30b2\u30fc\u30c8 -msg.import.file.format =\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u3001LAMS 2 \u4ee5\u964d\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f Zip \u30d5\u30a1\u30a4\u30eb\u304b\u3001LAMS 1.0.2 \u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f LAS \u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 error.import.validation =\u691c\u8a3c\u30a8\u30e9\u30fc: error.import.matching.tool.not.found =\u7f72\u540d {0} \u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u3001\u691c\u8a3c\u30c4\u30fc\u30eb\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u305f\u3081\u306b\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3057\u305f\u3002 error.import.tool.service.fail =\u30c4\u30fc\u30eb {0} \u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u539f\u56e0\u306f {1} \u3067\u3059\u3002 @@ -47,8 +44,20 @@ audit.user.password.change =\u4ee5\u4e0b\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5909\u66f4\u3057\u307e\u3057\u305f: {0} audit.user.create =\u4ee5\u4e0b\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u30e6\u30fc\u30b6\u30fc\u540d: {0} / \u6c0f\u540d: {1} validation.error.branching.must.have.a.branch =\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u3001\u5c11\u306a\u304f\u3068\u3082\u4e00\u3064\u306e\u5206\u5c90\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -validation.error.toolBranchingMustHaveDefaultBranch =\u30c4\u30fc\u30eb\u51fa\u529b\u4f9d\u5b58\u578b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5206\u5c90\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +validation.error.FloatingActivity =\u30b5\u30dd\u30fc\u30c8\u30fb\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u7d44\u307f\u8fbc\u3080\u5834\u5408\u3001\u305d\u306e\u30b3\u30f3\u30c6\u30ca\u5185\u306b\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u306e\u30b5\u30dd\u30fc\u30c8\u30fb\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u304c\u5fc5\u8981\u3067\u3059\u3002 +validation.error.FloatingActivity.maximum =\u6700\u5927 {0} \u306e\u30b5\u30dd\u30fc\u30c8\u30fb\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u304c\u4f7f\u3048\u307e\u3059\u3002\u3044\u304f\u3064\u304b\u30b5\u30dd\u30fc\u30c8\u30fb\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +validation.error.first.activity =\u305d\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u306f\u3001\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u304c\u5fc5\u8981\u3067\u3059\u3002 +mail.resend.abandon.body1 =LAMS \u304b\u3089\u5b66\u7fd2\u8005\u3078\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u518d\u9001\u4fe1\u3057\u307e\u3057\u305f\u304c\u3001\u4e2d\u65ad\u3057\u307e\u3057\u305f\u3002\u4ee5\u4e0b\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u5185\u5bb9\u3067\u3059: +validation.error.conditionGateMustHaveACondition =\u30b2\u30fc\u30c8\u306b\u306f\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u306e\u6761\u4ef6\u304c\u5fc5\u8981\u3067\u3059\u3002 +audit.hide.entry =\u30e6\u30fc\u30b6\u30fc {0} \u306e\u30a8\u30f3\u30c8\u30ea\u3092\u975e\u8868\u793a\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002\u30a8\u30f3\u30c8\u30ea: {1} +validation.error.conditionGateMustHaveAnInputToolActivity =\u30b2\u30fc\u30c8\u306e\u6761\u4ef6\u306f\u5165\u529b\u30c4\u30fc\u30eb\u304c\u5fc5\u8981\u3067\u3059\u3002 validation.error.toolBranchingMustHaveACondition =\u5b66\u7fd2\u8005\u306e\u6d3b\u52d5\u7d50\u679c\u30d9\u30fc\u30b9\u306e\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u3001\u5c11\u306a\u304f\u3068\u30821\u3064\u306e\u6761\u4ef6\u3092\u5099\u3048\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +mail.resend.abandon.body2 =\u30e6\u30fc\u30b6\u30fc\u540d +msg.import.file.format =\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u3001LAMS 2 \u4ee5\u964d\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f Zip \u30d5\u30a1\u30a4\u30eb\u304b\u3001LAMS 1.0.2 \u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f LAS \u30d5\u30a1\u30a4\u30eb\u3067\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002\u4f7f\u7528\u3057\u3066\u3044\u308b IMS \u30e9\u30fc\u30cb\u30f3\u30b0\u30fb\u30c7\u30b6\u30a4\u30f3\u304b\u3089\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u306f\u30a4\u30f3\u30dd\u30fc\u30c8\u3067\u304d\u307e\u305b\u3093\u3002 +public.folder.name =\u5171\u6709\u30d5\u30a9\u30eb\u30c0 +validation.error.toolBranchingMustHaveAnInputToolActivity =\u5b66\u7fd2\u8005\u306e\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u306b\u3088\u308b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u5165\u529b\u30c4\u30fc\u30eb\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +validation.error.toolBranchingMustHaveDefaultBranch =\u5b66\u7fd2\u8005\u306e\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u306b\u3088\u308b\u5206\u5c90\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5206\u5c90\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +mail.resend.abandon.subject =LAMS: \u30e1\u30c3\u30bb\u30fc\u30b8\u914d\u4fe1\u306b\u5931\u6557\u3057\u307e\u3057\u305f -#======= End labels: Exported 43 labels for ja JP ===== +#======= End labels: Exported 52 labels for ja JP ===== Index: lams_common/db/sql/create_integration_tables.sql =================================================================== diff -u -r23de7ee39d556bf805740c7bf5678b1ddc4bbc57 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/create_integration_tables.sql (.../create_integration_tables.sql) (revision 23de7ee39d556bf805740c7bf5678b1ddc4bbc57) +++ lams_common/db/sql/create_integration_tables.sql (.../create_integration_tables.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -10,6 +10,7 @@ `serverdesc` text, `prefix` varchar(11) NOT NULL, `userinfo_url` text NOT NULL, + `server_url` varchar(255) DEFAULT NULL, `timeout_url` text NOT NULL, `disabled` bit(1) NOT NULL, `orgid` bigint(20), @@ -51,4 +52,18 @@ KEY `ext_server_org_map_id` (`ext_server_org_map_id`), CONSTRAINT `lams_ext_user_userid_map_fk1` FOREIGN KEY (`ext_server_org_map_id`) REFERENCES `lams_ext_server_org_map` (`sid`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `lams_ext_user_userid_map_fk` FOREIGN KEY (`user_id`) REFERENCES `lams_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE -) TYPE=InnoDB; \ No newline at end of file +) TYPE=InnoDB; + +-- +-- Table structure for table `lams_ext_server_tool_map` +-- +DROP TABLE IF EXISTS lams_ext_server_tool_map; +CREATE TABLE lams_ext_server_tool_map ( + uid BIGINT(20) NOT NULL auto_increment, + tool_id BIGINT(20) NOT NULL, + ext_server_org_map_id int(11) NOT NULL, + PRIMARY KEY (uid), + UNIQUE KEY unique_adapter_map (ext_server_org_map_id, tool_id), + CONSTRAINT lams_ext_server_tool_map_fk1 FOREIGN KEY (ext_server_org_map_id) REFERENCES lams_ext_server_org_map (sid) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT lams_ext_server_tool_map_fk2 FOREIGN KEY (tool_id) REFERENCES lams_tool (tool_id) ON DELETE CASCADE ON UPDATE CASCADE +) TYPE=InnoDB; Index: lams_common/db/sql/insert_lams_unix_config_data.sql =================================================================== diff -u -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/insert_lams_unix_config_data.sql (.../insert_lams_unix_config_data.sql) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) +++ lams_common/db/sql/insert_lams_unix_config_data.sql (.../insert_lams_unix_config_data.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -5,7 +5,7 @@ values ('ServerURLContextPath','lams/', 'config.server.url.context.path', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('Version','2.3', 'config.version', 'config.header.system', 'STRING', 1); +values ('Version','2.3.1', 'config.version', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('TempDir','/var/opt/lams/temp', 'config.temp.dir', 'config.header.system', 'STRING', 1); @@ -14,7 +14,7 @@ values ('DumpDir','/var/opt/lams/dump', 'config.dump.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('EARDir','/usr/local/jboss-4.0.2/server/default/deploy/lams.ear/', 'config.ear.dir', 'config.header.system', 'STRING', 1); +values ('EARDir','/usr/local/jboss-5/server/default/deploy/lams.ear/', 'config.ear.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('SMTPServer','', 'config.smtp.server', 'config.header.email', 'STRING', 0); @@ -50,16 +50,16 @@ values ('AuthoringActivitiesColour', 'true', 'config.authoring.activities.colour', 'config.header.look.feel', 'BOOLEAN', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('AuthoringClientVersion','2.3.0.@datetimestamp@', 'config.authoring.client.version', 'config.header.versions', 'STRING', 1); +values ('AuthoringClientVersion','2.3.1.@datetimestamp@', 'config.authoring.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('MonitorClientVersion','2.3.0.@datetimestamp@', 'config.monitor.client.version', 'config.header.versions', 'STRING', 1); +values ('MonitorClientVersion','2.3.1.@datetimestamp@', 'config.monitor.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('LearnerClientVersion','2.3.0.@datetimestamp@', 'config.learner.client.version', 'config.header.versions', 'STRING', 1); +values ('LearnerClientVersion','2.3.1.@datetimestamp@', 'config.learner.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('ServerVersionNumber','2.3.0.@datetimestamp@', 'config.server.version.number', 'config.header.versions', 'STRING', 1); +values ('ServerVersionNumber','2.3.1.@datetimestamp@', 'config.server.version.number', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('ServerLanguage','en_AU', 'config.server.language', 'config.header.look.feel', 'STRING', 1); @@ -68,7 +68,7 @@ values ('ServerPageDirection','LTR', 'config.server.page.direction', 'config.header.look.feel', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('DictionaryDateCreated','2008-12-05', 'config.dictionary.date.created', 'config.header.versions', 'STRING', 1); +values ('DictionaryDateCreated','2009-06-19', 'config.dictionary.date.created', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('HelpURL','http://wiki.lamsfoundation.org/display/lamsdocs/', 'config.help.url', 'config.header.system', 'STRING', 1); Index: lams_common/db/sql/insert_lams_windows_config_data.sql =================================================================== diff -u -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/insert_lams_windows_config_data.sql (.../insert_lams_windows_config_data.sql) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) +++ lams_common/db/sql/insert_lams_windows_config_data.sql (.../insert_lams_windows_config_data.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -14,7 +14,7 @@ values ('DumpDir','C:/lams/dump', 'config.dump.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('EARDir','D:/jboss-4.0.2/server/default/deploy/lams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); +values ('EARDir','D:/jboss-5/server/default/deploy/lams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('SMTPServer','', 'config.smtp.server', 'config.header.email', 'STRING', 0); @@ -50,16 +50,16 @@ values ('AuthoringActivitiesColour', 'true', 'config.authoring.activities.colour', 'config.header.look.feel', 'BOOLEAN', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('AuthoringClientVersion','2.3.0.@datetimestamp@', 'config.authoring.client.version', 'config.header.versions', 'STRING', 1); +values ('AuthoringClientVersion','2.3.1.@datetimestamp@', 'config.authoring.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('MonitorClientVersion','2.3.0.@datetimestamp@', 'config.monitor.client.version', 'config.header.versions', 'STRING', 1); +values ('MonitorClientVersion','2.3.1.@datetimestamp@', 'config.monitor.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('LearnerClientVersion','2.3.0.@datetimestamp@', 'config.learner.client.version', 'config.header.versions', 'STRING', 1); +values ('LearnerClientVersion','2.3.1.@datetimestamp@', 'config.learner.client.version', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('ServerVersionNumber','2.3.0.@datetimestamp@', 'config.server.version.number', 'config.header.versions', 'STRING', 1); +values ('ServerVersionNumber','2.3.1.@datetimestamp@', 'config.server.version.number', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('ServerLanguage','en_AU', 'config.server.language', 'config.header.look.feel', 'STRING', 1); @@ -68,7 +68,7 @@ values ('ServerPageDirection','LTR', 'config.server.page.direction', 'config.header.look.feel', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('DictionaryDateCreated','2008-12-05', 'config.dictionary.date.created', 'config.header.versions', 'STRING', 1); +values ('DictionaryDateCreated','2009-06-19', 'config.dictionary.date.created', 'config.header.versions', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('HelpURL','http://wiki.lamsfoundation.org/display/lamsdocs/', 'config.help.url', 'config.header.system', 'STRING', 1); Index: lams_common/db/sql/insert_rams_unix_config_data.sql =================================================================== diff -u -ref3c00cf90e298143398acf37cbb263e80692eef -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/insert_rams_unix_config_data.sql (.../insert_rams_unix_config_data.sql) (revision ef3c00cf90e298143398acf37cbb263e80692eef) +++ lams_common/db/sql/insert_rams_unix_config_data.sql (.../insert_rams_unix_config_data.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -14,7 +14,7 @@ values ('DumpDir','/var/opt/rams/dump', 'config.dump.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('EARDir','/usr/local/jboss-4.0.2/server/default/deploy/rams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); +values ('EARDir','/usr/local/jboss-5/server/default/deploy/rams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('SMTPServer','', 'config.smtp.server', 'config.header.email', 'STRING', 0); Index: lams_common/db/sql/insert_rams_windows_config_data.sql =================================================================== diff -u -ref3c00cf90e298143398acf37cbb263e80692eef -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/insert_rams_windows_config_data.sql (.../insert_rams_windows_config_data.sql) (revision ef3c00cf90e298143398acf37cbb263e80692eef) +++ lams_common/db/sql/insert_rams_windows_config_data.sql (.../insert_rams_windows_config_data.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -14,7 +14,7 @@ values ('DumpDir','C:/rams/dump', 'config.dump.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) -values ('EARDir','C:/jboss-4.0.2/server/default/deploy/rams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); +values ('EARDir','C:/jboss-5/server/default/deploy/rams.ear', 'config.ear.dir', 'config.header.system', 'STRING', 1); insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('SMTPServer','', 'config.smtp.server', 'config.header.email', 'STRING', 0); Index: lams_common/db/sql/insert_types_data.sql =================================================================== diff -u -rf71e4310ff66180ae03a07970a9af602f7d66852 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision f71e4310ff66180ae03a07970a9af602f7d66852) +++ lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -306,7 +306,7 @@ -- external server mapping to a lams organisation INSERT INTO lams_ext_server_org_map VALUES - (1,'moodle','moodle','moodle','moodle','mdl','http://localhost/moodle/mod/lamstwo/userinfo.php?ts=%timestamp%&un=%username%&hs=%hash%','http://dummy','\0',7); + (1,'moodle','moodle','moodle','moodle','mdl','http://localhost/moodle/mod/lamstwo/userinfo.php?ts=%timestamp%&un=%username%&hs=%hash%', '', 'http://dummy','\0',7); -- initialise db version INSERT INTO patches VALUES ('lams', 17, NOW(), 'F'); \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml (.../applicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_common/src/java/org/lamsfoundation/lams/applicationContext.xml (.../applicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -20,8 +20,22 @@ 20 1800 50 - org.jboss.hibernate.cache.DeployedTreeCacheProvider - jboss.cache:service=TreeCache + org.hibernate.transaction.JBossTransactionManagerLookup + true + org.hibernate.cache.jbc2.SharedJBossCacheRegionFactory + + @@ -34,14 +48,14 @@ java:jdbc/lams-ds - + - - - - - - + "autodetectTransactionManager" defaults to true so we don't need to include it. + But remember all application servers do not have the same JNDI name for their transaction manager! + --> + + + \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml =================================================================== diff -u -r8176135403562bdf207f9477805d0e092915312a -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml (.../beanRefContext.xml) (revision 8176135403562bdf207f9477805d0e092915312a) +++ lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml (.../beanRefContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -28,19 +28,51 @@ classpath*:org/lamsfoundation/lams/tool/**/*pplicationContext.xml collects all application context files from all deployed lams tools. + JBoss 5.1.0.CR1 had bugs when it comes ot Ant-style pattern resolution, like the one above. + Fortunatelly, a quick reaction from JBoss developers brought a solution, + the new class, VFSClassPathXmlApplicationContext, which is currently used. + If new application context file is used in development and its beans need to be added to shared context, just add it to the end (or wherever it is suitable) of the list. --> + + class="org.jboss.spring.factory.VFSClassPathXmlApplicationContext"> /org/lamsfoundation/lams/applicationContext.xml /org/lamsfoundation/lams/toolApplicationContext.xml /org/lamsfoundation/lams/contentrepository/applicationContext.xml /org/lamsfoundation/lams/lesson/lessonApplicationContext.xml /org/lamsfoundation/lams/learning/learningApplicationContext.xml - classpath*:org/lamsfoundation/lams/tool/**/*pplicationContext.xml + + classpath*:org/lamsfoundation/lams/tool/**/*pplicationContext.xml + + + /org/lamsfoundation/lams/authoring/authoringApplicationContext.xml /org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml /org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml Index: lams_common/src/java/org/lamsfoundation/lams/cache/CacheDebugListener.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/cache/CacheDebugListener.java (.../CacheDebugListener.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_common/src/java/org/lamsfoundation/lams/cache/CacheDebugListener.java (.../CacheDebugListener.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -24,52 +24,79 @@ package org.lamsfoundation.lams.cache; import org.apache.log4j.Logger; +import org.jboss.cache.Cache; import org.jboss.cache.Fqn; -import org.jboss.cache.TreeCache; -import org.jboss.cache.TreeCacheListener; +import org.jboss.cache.notifications.annotation.CacheListener; +import org.jboss.cache.notifications.annotation.CacheStarted; +import org.jboss.cache.notifications.annotation.CacheStopped; +import org.jboss.cache.notifications.annotation.NodeCreated; +import org.jboss.cache.notifications.annotation.NodeEvicted; +import org.jboss.cache.notifications.annotation.NodeLoaded; +import org.jboss.cache.notifications.annotation.NodeModified; +import org.jboss.cache.notifications.annotation.NodeRemoved; +import org.jboss.cache.notifications.annotation.NodeVisited; +import org.jboss.cache.notifications.annotation.ViewChanged; -/** Log the addition/removal/eviction of items from the JBOSS cache. - * Turn on and off using UseCacheDebugListener entry in lams.xml +/** + * Log the addition/removal/eviction of items from the JBOSS cache. Turn on and off using UseCacheDebugListener entry in + * lams.xml * * @author Fiona Malikoff */ -public class CacheDebugListener implements TreeCacheListener { - protected Logger log = Logger.getLogger(CacheManager.class); - private String cacheNameString = "Cache unknown: "; +@CacheListener +public class CacheDebugListener { - private void logMessage(String message) { - log.info(cacheNameString+message); - } - - public void cacheStarted(TreeCache cache) { - cacheNameString = "Cache "+cache.getName()+": "; - logMessage("started"); - } - - public void cacheStopped(TreeCache cache) { - logMessage("stopped"); - } - - public void nodeCreated(Fqn fqn) { - logMessage("node created "+fqn); - } - public void nodeEvicted(Fqn fqn) { - logMessage("node evicted "+fqn); - } - public void nodeLoaded(Fqn fqn) { - logMessage("node loaded "+fqn); - } - public void nodeModified(Fqn fqn) { - logMessage("node modified "+fqn); - } - public void nodeRemoved(Fqn fqn) { - logMessage("node removed "+fqn); - } - public void nodeVisited(Fqn fqn) { - logMessage("node visited "+fqn); - } - public void viewChange(org.jgroups.View new_view){ - logMessage("view changed "); - } -} + protected Logger log = Logger.getLogger(CacheManager.class); + private String cacheNameString = "Cache unknown: "; + + private void logMessage(String message) { + log.info(cacheNameString + message); + } + + @CacheStarted + public void cacheStarted(Cache cache) { + cacheNameString = "Cache " + cache.getVersion() + ": "; + logMessage("started"); + } + + @CacheStopped + public void cacheStopped(Cache cache) { + logMessage("stopped"); + } + + @NodeCreated + public void nodeCreated(Fqn fqn) { + logMessage("node created " + fqn); + } + + @NodeEvicted + public void nodeEvicted(Fqn fqn) { + logMessage("node evicted " + fqn); + } + + @NodeLoaded + public void nodeLoaded(Fqn fqn) { + logMessage("node loaded " + fqn); + } + + @NodeModified + public void nodeModified(Fqn fqn) { + logMessage("node modified " + fqn); + } + + @NodeRemoved + public void nodeRemoved(Fqn fqn) { + logMessage("node removed " + fqn); + } + + @NodeVisited + public void nodeVisited(Fqn fqn) { + logMessage("node visited " + fqn); + } + + @ViewChanged + public void viewChange(org.jgroups.View new_view) { + logMessage("view changed "); + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/cache/CacheManager.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/cache/CacheManager.java (.../CacheManager.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_common/src/java/org/lamsfoundation/lams/cache/CacheManager.java (.../CacheManager.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -29,14 +29,15 @@ import java.util.TreeMap; import javax.management.MBeanServer; +import javax.management.MBeanServerInvocationHandler; +import javax.management.ObjectName; import org.apache.log4j.Logger; +import org.jboss.cache.Cache; import org.jboss.cache.CacheException; import org.jboss.cache.Fqn; -import org.jboss.cache.TreeCacheListener; -import org.jboss.cache.TreeCacheMBean; -import org.jboss.mx.util.MBeanProxyExt; -import org.jboss.mx.util.MBeanServerLocator; +import org.jboss.cache.jmx.CacheJmxWrapperMBean; +import org.jboss.mx.remoting.JMXUtil; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; @@ -45,202 +46,241 @@ */ public class CacheManager implements ICacheManager { - protected Logger log = Logger.getLogger(CacheManager.class); - private String DEFAULT_CACHE_OBJECT_NAME="jboss.cache:service=TreeCache"; - - /* Spring configured variables */ - private String cacheObjectName = null; - - /* There is one cache across the whole system, so it should be safe to - * use a static cache bean. Do not use this attribute directly - always - * get it via getCache(). */ - private TreeCacheMBean treeCache = null; - private TreeCacheListener listener = null; - - /** Get the tree cache. - *

- * If necessary, gets it via the MBean. If gets via MBean, then - * also sets up the cache listener at the same time, if required. */ - private TreeCacheMBean getCache() { - if ( treeCache == null ) { - - try { - if ( cacheObjectName == null ) - cacheObjectName = DEFAULT_CACHE_OBJECT_NAME; - MBeanServer server=MBeanServerLocator.locate(); - treeCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, cacheObjectName, server); - - if ( Configuration.getAsBoolean(ConfigurationKeys.USE_CACHE_DEBUG_LISTENER) ) { - if ( listener != null ) - treeCache.removeTreeCacheListener(listener); - listener = new CacheDebugListener(); - treeCache.addTreeCacheListener(listener); - log.info("Added tree cache listener."); - } - } catch (Exception e) { - log.error("Unable to access the JBOSS cache mbean "+cacheObjectName+". Cache not available.",e); - } + protected Logger log = Logger.getLogger(CacheManager.class); + private String DEFAULT_CACHE_OBJECT_NAME = "jboss.cache:service=TreeCache"; + + /* Spring configured variables */ + private String cacheObjectName = null; + + /* + * There is one cache across the whole system, so it should be safe to use a static cache bean. Do not use this + * attribute directly - always get it via getCache(). + */ + private Cache cache = null; + private Object listener = null; + + /** + * Get the tree cache. + *

+ * If necessary, gets it via the MBean. If gets via MBean, then also sets up the cache listener at the same time, if + * required. + */ + private Cache getCache() { + if (cache == null) { + + try { + if (cacheObjectName == null) { + cacheObjectName = DEFAULT_CACHE_OBJECT_NAME; } - return treeCache; + /* + * When migrating to JBoss 5, the way the Cache is accessed had to be changed. Also, currently Cache is + * not exposed by JMX, so it is also unavailable for Cache Manager. Trying to retrieve it causes an + * error. This will be fixed in the future. + */ + MBeanServer server = JMXUtil.getMBeanServer(); + CacheJmxWrapperMBean wrapper = (CacheJmxWrapperMBean) MBeanServerInvocationHandler.newProxyInstance( + server, ObjectName.getInstance(cacheObjectName), CacheJmxWrapperMBean.class, false); + cache = wrapper.getCache(); + + // cache = (Cache) server.getObjectInstance(ObjectName.getInstance(cacheObjectName)); + // cache = (Cache) server.createMBean(Cache.class.getName(), ); + + if (Configuration.getAsBoolean(ConfigurationKeys.USE_CACHE_DEBUG_LISTENER)) { + if (listener != null) { + cache.removeCacheListener(listener); + } + listener = new CacheDebugListener(); + cache.addCacheListener(listener); + log.info("Added tree cache listener."); + } + } catch (Exception e) { + log.error("Unable to access the JBOSS cache mbean " + cacheObjectName + ". Cache not available.", e); + } } - - /** Get the String[] version of the objects class name. */ - public String[] getPartsFromClass(Class clasz) { - return clasz.getName().split("\\."); + return cache; + } + + /** Get the String[] version of the objects class name. */ + public String[] getPartsFromClass(Class clasz) { + return clasz.getName().split("\\."); + } + + /** + * Get the Fqn for this object, based on the class name. The Fqn is used as the part of the key to the cached + * object. + */ + private Fqn getFqn(Class clasz) { + return Fqn.fromElements(getPartsFromClass(clasz)); + } + + /** + * Get the Fqn for this object, based on classNameParts. The Fqn is used as the part of the key to the cached + * object. + */ + private Fqn getFqn(String[] classNameParts) { + return Fqn.fromElements(classNameParts); + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.cache.ICacheManager#getItem(java.lang.String[], java.lang.Object) + */ + public Object getItem(String[] classNameParts, Object key) { + if (key == null || classNameParts == null) { + return null; } - /** Get the Fqn for this object, based on the class name. The Fqn is used as the part of the key to the cached object. */ - private Fqn getFqn(Class clasz) { - return new Fqn(getPartsFromClass(clasz)); + return getItem(getFqn(classNameParts), key); + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.cache.ICacheManager#getItem(java.lang.Class, java.lang.Object) + */ + public Object getItem(Class clasz, Object key) { + if (key == null || clasz == null) { + return null; } - - /** Get the Fqn for this object, based on classNameParts. The Fqn is used as the part of the key to the cached object. */ - private Fqn getFqn(String[] classNameParts) { - return new Fqn(classNameParts); - } - /* (non-Javadoc) - * @see org.lamsfoundation.lams.cache.ICacheManager#getItem(java.lang.String[], java.lang.Object) - */ - public Object getItem(String[] classNameParts, Object key){ - if ( key == null || classNameParts == null ) - return null; + return getItem(getFqn(clasz), key); + } - return getItem(getFqn(classNameParts),key); + /** Does the "real" get from the cache. Key and fqn must not be null or an exception may be thrown. */ + private Object getItem(Fqn fqn, Object key) { + Cache cache = getCache(); + if (cache == null) { + log.warn("Unable to get item with fqn " + fqn + " key " + key + " as we can't get the JBOSS Cache mbean."); + return null; } - - /* (non-Javadoc) - * @see org.lamsfoundation.lams.cache.ICacheManager#getItem(java.lang.Class, java.lang.Object) - */ - public Object getItem(Class clasz, Object key) { - if ( key == null || clasz == null ) - return null; - return getItem(getFqn(clasz), key); + Object obj = null; + try { + obj = cache.get(fqn, key); + if (obj != null) { + log.debug("Retrieved object from cache fqn " + fqn + " key " + key); + } + } catch (CacheException e) { + log.error("JBOSS Cache exception occured getting object from cache. fqn " + fqn + " key " + key, e); } - - /** Does the "real" get from the cache. Key and fqn must not be null or an exception may be thrown. */ - private Object getItem(Fqn fqn, Object key) { - TreeCacheMBean cache = getCache(); - if (cache==null) { - log.warn("Unable to get item with fqn "+fqn+" key "+key+" as we can't get the JBOSS Cache mbean."); - return null; - } - - Object obj = null; - try { - obj = (Object) cache.get(fqn, key); - if ( obj != null ) { - log.debug("Retrieved object from cache fqn "+fqn+" key "+key); - } - } catch (CacheException e) { - log.error("JBOSS Cache exception occured getting object from cache. fqn "+fqn+" key "+key, e); - } - return obj; + return obj; + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.cache.ICacheManager#addItem(java.lang.String[], java.lang.Object, java.lang.Object) + */ + public void addItem(String[] classNameParts, Object key, Object item) { + if (item != null && key != null && classNameParts != null) { + addItem(getFqn(classNameParts), key, item); } + } - /* (non-Javadoc) - * @see org.lamsfoundation.lams.cache.ICacheManager#addItem(java.lang.String[], java.lang.Object, java.lang.Object) - */ - public void addItem(String[] classNameParts, Object key, Object item){ - if ( item != null && key != null && classNameParts != null ) - addItem(getFqn(classNameParts), key, item); + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.cache.ICacheManager#addItem(java.lang.Class, java.lang.Object, java.lang.Object) + */ + public void addItem(Class clasz, Object key, Object item) { + if (item != null && key != null && clasz != null) { + addItem(getFqn(clasz), key, item); } - - /* (non-Javadoc) - * @see org.lamsfoundation.lams.cache.ICacheManager#addItem(java.lang.Class, java.lang.Object, java.lang.Object) - */ - public void addItem(Class clasz, Object key, Object item){ - if ( item != null && key != null && clasz != null ) - addItem(getFqn(clasz),key,item); - } + } - /** Does the "real" put in the cache. Key, fqn and item must not be null or an exception may be thrown. */ - private void addItem(Fqn fqn, Object key, Object item){ - TreeCacheMBean cache = getCache(); - if (cache==null) { - log.warn("Unable to get cache item with fqn "+fqn+" key "+key+" as we can't get the JBOSS Cache mbean."); - return; - } - - try { - cache.put(fqn, key, item); - } catch (CacheException e) { - log.error("JBOSS Cache exception occured putting object in cache. fqn "+fqn+" key "+key,e); - } + /** Does the "real" put in the cache. Key, fqn and item must not be null or an exception may be thrown. */ + private void addItem(Fqn fqn, Object key, Object item) { + Cache cache = getCache(); + if (cache == null) { + log.warn("Unable to get cache item with fqn " + fqn + " key " + key + + " as we can't get the JBOSS Cache mbean."); + return; } - public Map getCachedItems() { - TreeCacheMBean cache = getCache(); - Map allChildNames = new TreeMap(); - if (cache==null) { - log.warn("Unable to get cache items as we can't get the JBOSS Cache mbean."); - } else { - addChildren("/", cache, allChildNames); - } - return allChildNames; + try { + cache.put(fqn, key, item); + } catch (CacheException e) { + log.error("JBOSS Cache exception occured putting object in cache. fqn " + fqn + " key " + key, e); } + } - /* Recursively add all the child nodes to the map. This is where the format of FQNs is important - - * this code will hardcode in "/" between each step. */ - private void addChildren(String node, TreeCacheMBean cache, Map allChildNames ) { - try { - Set childNames = cache.getChildrenNames(node); - if ( childNames != null ) { - allChildNames.put(node, childNames); - Iterator iter = childNames.iterator(); - while ( iter.hasNext() ) { - String childNode = (String) iter.next(); - if ( node.endsWith("/") ) { - addChildren(node+childNode,cache,allChildNames); - } else { - addChildren(node+"/"+childNode,cache,allChildNames); - } - } - } - } catch (CacheException e) { - log.error("JBOSS Cache exception occured getting child names from cache",e); - } + public Map getCachedItems() { + Cache cache = getCache(); + Map allChildNames = new TreeMap(); + if (cache == null) { + log.warn("Unable to get cache items as we can't get the JBOSS Cache mbean."); + } else { + addChildren("/", cache, allChildNames); } + return allChildNames; + } - /** Clear all the nodes in the cache with the given key. - * Works on nodes starting with /org, /com and /net */ - public void clearCache(String node) { - TreeCacheMBean cache = getCache(); - if (cache==null) { - log.warn("Unable to clear cache node "+node+" as we can't get the JBOSS Cache mbean."); - } else { - try { - cache.remove(node); - } catch (CacheException e) { - log.error("JBOSS Cache exception occured getting child names from cache",e); - } + /* + * Recursively add all the child nodes to the map. This is where the format of FQNs is important - this code will + * hardcode in "/" between each step. + */ + private void addChildren(String node, Cache cache, Map allChildNames) { + try { + Set childNames = cache.getChildrenNames(node); + if (childNames != null) { + allChildNames.put(node, childNames); + Iterator iter = childNames.iterator(); + while (iter.hasNext()) { + String childNode = (String) iter.next(); + if (node.endsWith("/")) { + addChildren(node + childNode, cache, allChildNames); + } else { + addChildren(node + "/" + childNode, cache, allChildNames); + } } + } + } catch (CacheException e) { + log.error("JBOSS Cache exception occured getting child names from cache", e); } - - /** Remove a particular item from the cache. */ - public void removeItem(String[] classNameParts, Object key) { - TreeCacheMBean cache = getCache(); - if (cache==null) { - log.warn("Unable to remove cache item "+classNameParts+":"+key+"as we can't get the JBOSS Cache mbean."); - } else { - try { - cache.remove(getFqn(classNameParts), key); - } catch (CacheException e) { - log.error("JBOSS Cache exception occured getting child names from cache",e); - } - } - } + } - /* **** Spring initialisation methods */ - - public String getCacheObjectName() { - return cacheObjectName; + /** + * Clear all the nodes in the cache with the given key. Works on nodes starting with /org, /com and /net + */ + public void clearCache(String node) { + Cache cache = getCache(); + + if (cache == null) { + log.warn("Unable to clear cache node " + node + " as we can't get the JBOSS Cache mbean."); + } else { + try { + cache.removeNode(node); + } catch (CacheException e) { + log.error("JBOSS Cache exception occured getting child names from cache", e); + } } + } - public void setCacheObjectName(String cacheObjectName) { - this.cacheObjectName = cacheObjectName; + /** Remove a particular item from the cache. */ + public void removeItem(String[] classNameParts, Object key) { + Cache cache = getCache(); + if (cache == null) { + log.warn("Unable to remove cache item " + classNameParts + ":" + key + + "as we can't get the JBOSS Cache mbean."); + } else { + try { + cache.remove(getFqn(classNameParts), key); + } catch (CacheException e) { + log.error("JBOSS Cache exception occured getting child names from cache", e); + } } - + } + + /* **** Spring initialisation methods */ + + public String getCacheObjectName() { + return cacheObjectName; + } + + public void setCacheObjectName(String cacheObjectName) { + this.cacheObjectName = cacheObjectName; + } + } Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml =================================================================== diff -u -r72e01661ffe932634adbe4b229d9ee44d6928a45 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 72e01661ffe932634adbe4b229d9ee44d6928a45) +++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -85,6 +85,7 @@ classpath:org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml classpath:org/lamsfoundation/lams/integration/ExtCourseClassMap.hbm.xml classpath:org/lamsfoundation/lams/integration/ExtUserUseridMap.hbm.xml + classpath:org/lamsfoundation/lams/integration/ExtServerToolAdapterMap.hbm.xml classpath:org/lamsfoundation/lams/planner/PedagogicalPlannerSequenceNode.hbm.xml @@ -100,12 +101,188 @@ classpath:org/lamsfoundation/lams/contentrepository/CrWorkspace.hbm.xml classpath:org/lamsfoundation/lams/contentrepository/CrWorkspaceCredential.hbm.xml - - - classpath*:org/lamsfoundation/lams/tool/**/*.hbm.xml - classpath*:org/lamsfoundation/lams/tool/**/model/*.hbm.xml - classpath*:org/lamsfoundation/lams/tool/**/persistence/*.hbm.xml - classpath*:org/lamsfoundation/lams/tool/**/pojos/*.hbm.xml + + + classpath*:org/lamsfoundation/lams/tool/**/**/*.hbm.xml + + @@ -414,7 +591,7 @@ - + 0 AND (NOW()- e.subscriptions.lastOperationTime >= e.subscriptions.periodicity))"; + protected static final String GET_EVENTS_TO_RESEND_QUERY = "SELECT DISTINCT e FROM " + Event.class.getName() + + " AS e LEFT JOIN FETCH e.subscriptions AS s WHERE e.failTime IS NOT NULL OR " + + "(s.periodicity > 0 AND (NOW()- s.lastOperationTime >= s.periodicity))"; - public Event getEvent(String scope, String name, Long sessionId) throws InvalidParameterException { - List events = getHibernateTemplate().find(EventDAOHibernate.GET_EVENT_QUERY, - new Object[] { scope, name, sessionId }); - if (events.size() > 1) { - throw new InvalidParameterException("Two events with the same parameters exist in the database."); - } - if (events.size() == 0) { - return null; - } - return events.get(0); + public Event getEvent(String scope, String name, Long sessionId) throws InvalidParameterException { + List events = getHibernateTemplate().find(EventDAOHibernate.GET_EVENT_QUERY, + new Object[] { scope, name, sessionId }); + if (events.size() > 1) { + throw new InvalidParameterException("Two events with the same parameters exist in the database."); } - - public List getEventsToResend() { - return getHibernateTemplate().find(EventDAOHibernate.GET_EVENTS_TO_RESEND_QUERY); + if (events.size() == 0) { + return null; } + return events.get(0); + } - public void deleteEvent(Event event) { - getHibernateTemplate().delete(event); - } + public List getEventsToResend() { + return getHibernateTemplate().find(EventDAOHibernate.GET_EVENTS_TO_RESEND_QUERY); + } - public void saveEvent(Event event) { - getHibernateTemplate().saveOrUpdate(event); - } + public void deleteEvent(Event event) { + getHibernateTemplate().delete(event); + } + + public void saveEvent(Event event) { + getHibernateTemplate().saveOrUpdate(event); + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerOrgMap.java =================================================================== diff -u -r4c1e4458a7199b33675cde0a4d816c3194585469 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerOrgMap.java (.../ExtServerOrgMap.java) (revision 4c1e4458a7199b33675cde0a4d816c3194585469) +++ lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerOrgMap.java (.../ExtServerOrgMap.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -5,17 +5,15 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.lamsfoundation.lams.usermanagement.Organisation; - -/** - * @hibernate.class - * table="lams_ext_server_org_map" - * -*/ +/** + * @hibernate.class table="lams_ext_server_org_map" + * + */ public class ExtServerOrgMap implements Serializable, Comparable { - private static final long serialVersionUID = 337894825609071182L; + private static final long serialVersionUID = 337894825609071182L; - /** identifier field */ + /** identifier field */ private Integer sid; /** persistent field */ @@ -27,14 +25,17 @@ /** persistent field */ private String servername; - /** nullable persistent field */ + /** persistent field */ private String serverdesc; /** persistent field */ private String prefix; /** persistent field */ private String userinfoUrl; + + /** persistent field */ + private String serverUrl; /** persistent field */ private String timeoutUrl; @@ -52,238 +53,214 @@ private Set extUserUseridMaps; /** full constructor */ - public ExtServerOrgMap(String serverid, String serverkey, String servername, String serverdesc, String prefix, String userinfoUrl, String timeoutUrl, Boolean disabled, Organisation organisation, Set extCourseClassMaps, Set extUserUseridMaps) { - this.serverid = serverid; - this.serverkey = serverkey; - this.servername = servername; - this.serverdesc = serverdesc; - this.prefix = prefix; - this.userinfoUrl = userinfoUrl; - this.timeoutUrl = timeoutUrl; - this.disabled = disabled; - this.organisation = organisation; - this.extCourseClassMaps = extCourseClassMaps; - this.extUserUseridMaps = extUserUseridMaps; + public ExtServerOrgMap(String serverid, String serverkey, String servername, String serverdesc, String prefix, + String userinfoUrl, String serverUrl, String timeoutUrl, Boolean disabled, Organisation organisation, Set extCourseClassMaps, + Set extUserUseridMaps) { + this.serverid = serverid; + this.serverkey = serverkey; + this.servername = servername; + this.serverdesc = serverdesc; + this.prefix = prefix; + this.userinfoUrl = userinfoUrl; + this.serverUrl = serverUrl; + this.timeoutUrl = timeoutUrl; + this.disabled = disabled; + this.organisation = organisation; + this.extCourseClassMaps = extCourseClassMaps; + this.extUserUseridMaps = extUserUseridMaps; } /** default constructor */ public ExtServerOrgMap() { } /** minimal constructor */ - public ExtServerOrgMap(String serverid, String serverkey, String servername, String prefix, String userinfoUrl, String timeoutUrl, Boolean disabled, Organisation organisation, Set extCourseClassMaps, Set extUserUseridMaps) { - this.serverid = serverid; - this.serverkey = serverkey; - this.servername = servername; - this.prefix = prefix; - this.userinfoUrl = userinfoUrl; - this.timeoutUrl = timeoutUrl; - this.disabled = disabled; - this.organisation = organisation; - this.extCourseClassMaps = extCourseClassMaps; - this.extUserUseridMaps = extUserUseridMaps; + public ExtServerOrgMap(String serverid, String serverkey, String servername, String prefix, String userinfoUrl, + String timeoutUrl, Boolean disabled, Organisation organisation, Set extCourseClassMaps, + Set extUserUseridMaps) { + this.serverid = serverid; + this.serverkey = serverkey; + this.servername = servername; + this.prefix = prefix; + this.userinfoUrl = userinfoUrl; + this.timeoutUrl = timeoutUrl; + this.disabled = disabled; + this.organisation = organisation; + this.extCourseClassMaps = extCourseClassMaps; + this.extUserUseridMaps = extUserUseridMaps; } - /** - * @hibernate.id - * generator-class="native" - * type="java.lang.Integer" - * column="sid" - * + /** + * @hibernate.id generator-class="native" type="java.lang.Integer" + * column="sid" + * */ public Integer getSid() { - return this.sid; + return this.sid; } public void setSid(Integer sid) { - this.sid = sid; + this.sid = sid; } - /** - * @hibernate.property - * column="serverid" - * unique="true" - * length="255" - * not-null="true" - * + /** + * @hibernate.property column="serverid" unique="true" length="255" + * not-null="true" + * */ public String getServerid() { - return this.serverid; + return this.serverid; } public void setServerid(String serverid) { - this.serverid = serverid; + this.serverid = serverid; } - /** - * @hibernate.property - * column="serverkey" - * length="65535" - * not-null="true" - * + /** + * @hibernate.property column="serverkey" length="65535" not-null="true" + * */ public String getServerkey() { - return this.serverkey; + return this.serverkey; } public void setServerkey(String serverkey) { - this.serverkey = serverkey; + this.serverkey = serverkey; } - /** - * @hibernate.property - * column="servername" - * length="255" - * not-null="true" - * + /** + * @hibernate.property column="servername" length="255" not-null="true" + * */ public String getServername() { - return this.servername; + return this.servername; } public void setServername(String servername) { - this.servername = servername; + this.servername = servername; } - /** - * @hibernate.property - * column="serverdesc" - * length="65535" - * + /** + * @hibernate.property column="serverdesc" length="65535" + * */ public String getServerdesc() { - return this.serverdesc; + return this.serverdesc; } public void setServerdesc(String serverdesc) { - this.serverdesc = serverdesc; + this.serverdesc = serverdesc; } - /** - * @hibernate.property - * column="prefix" - * unique="true" - * length="11" - * not-null="true" - * + /** + * @hibernate.property column="prefix" unique="true" length="11" + * not-null="true" + * */ public String getPrefix() { - return this.prefix; + return this.prefix; } public void setPrefix(String prefix) { - this.prefix = prefix; + this.prefix = prefix; } - /** - * @hibernate.property - * column="userinfo_url" - * length="65535" - * not-null="true" - * + /** + * @hibernate.property column="userinfo_url" length="65535" not-null="true" + * */ public String getUserinfoUrl() { - return this.userinfoUrl; + return this.userinfoUrl; } - + public void setUserinfoUrl(String userinfoUrl) { - this.userinfoUrl = userinfoUrl; + this.userinfoUrl = userinfoUrl; } + + /** + * @hibernate.property column="server_url" length="255" not-null="false" + * + */ + public String getServerUrl() { + return this.serverUrl; + } - /** - * @hibernate.property - * column="timeout_url" - * length="65535" - * not-null="true" - * + public void setServerUrl(String serverUrl) { + this.serverUrl = serverUrl; + } + + /** + * @hibernate.property column="timeout_url" length="65535" not-null="true" + * */ public String getTimeoutUrl() { - return this.timeoutUrl; + return this.timeoutUrl; } public void setTimeoutUrl(String timeoutUrl) { - this.timeoutUrl = timeoutUrl; + this.timeoutUrl = timeoutUrl; } - /** - * @hibernate.property - * column="disabled" - * length="1" - * not-null="true" - * + /** + * @hibernate.property column="disabled" length="1" not-null="true" + * */ public Boolean getDisabled() { - return this.disabled; + return this.disabled; } public void setDisabled(Boolean disabled) { - this.disabled = disabled; + this.disabled = disabled; } - /** - * @hibernate.many-to-one - * not-null="true" - * @hibernate.column name="orgid" - * lazy="true" - * + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="orgid" lazy="true" + * */ public Organisation getOrganisation() { - return this.organisation; + return this.organisation; } public void setOrganisation(Organisation organisation) { - this.organisation = organisation; + this.organisation = organisation; } - /** - * @hibernate.set - * lazy="true" - * inverse="true" - * cascade="none" - * @hibernate.collection-key - * column="ext_server_org_map_id" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.integration.ExtCourseClassMap" - * + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="ext_server_org_map_id" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.integration.ExtCourseClassMap" + * */ public Set getExtCourseClassMaps() { - return this.extCourseClassMaps; + return this.extCourseClassMaps; } public void setExtCourseClassMaps(Set extCourseClassMaps) { - this.extCourseClassMaps = extCourseClassMaps; + this.extCourseClassMaps = extCourseClassMaps; } - /** - * @hibernate.set - * lazy="true" - * inverse="true" - * cascade="none" - * @hibernate.collection-key - * column="ext_server_org_map_id" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.integration.ExtUserUseridMap" - * + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="ext_server_org_map_id" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.integration.ExtUserUseridMap" + * */ public Set getExtUserUseridMaps() { - return this.extUserUseridMaps; + return this.extUserUseridMaps; } public void setExtUserUseridMaps(Set extUserUseridMaps) { - this.extUserUseridMaps = extUserUseridMaps; + this.extUserUseridMaps = extUserUseridMaps; } public String toString() { - return new ToStringBuilder(this) - .append("sid", getSid()) - .append("serverid", getServerid()) - .append("serverkey", getServerkey()) - .append("servername", getServername()) - .toString(); + return new ToStringBuilder(this).append("sid", getSid()).append("serverid", getServerid()).append("serverkey", + getServerkey()).append("servername", getServername()).toString(); } - public int compareTo(Object o) { - return serverid.compareToIgnoreCase(((ExtServerOrgMap)o).getServerid()); - } + public int compareTo(Object o) { + return serverid.compareToIgnoreCase(((ExtServerOrgMap) o).getServerid()); + } } Index: lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerToolAdapterMap.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerToolAdapterMap.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/integration/ExtServerToolAdapterMap.java (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,84 @@ +/**************************************************************** + * Copyright (C) 2008 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.integration; + +import org.lamsfoundation.lams.tool.Tool; + +/** + * Maps a tool adapter to multiple integrated server instances + * + * @hibernate.class table="lams_ext_server_tool_map" + */ +public class ExtServerToolAdapterMap { + + private Long uid; + private Tool tool; + private ExtServerOrgMap extServer; + + public ExtServerToolAdapterMap() { + } + + public ExtServerToolAdapterMap(Tool tool, ExtServerOrgMap extServer) { + this.tool = tool; + this.extServer = extServer; + } + + public Tool getTool() { + return tool; + } + + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="tool_id" + * + */ + public void setTool(Tool tool) { + this.tool = tool; + } + + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="ext_server_org_map_id" + * + */ + public ExtServerOrgMap getExtServer() { + return extServer; + } + + public void setExtServer(ExtServerOrgMap extServer) { + this.extServer = extServer; + } +} Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java =================================================================== diff -u -rc2a96caab480d04c02dc7a90e719fc0bb9af6a50 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision c2a96caab480d04c02dc7a90e719fc0bb9af6a50) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -27,6 +27,7 @@ import org.lamsfoundation.lams.integration.ExtCourseClassMap; import org.lamsfoundation.lams.integration.ExtServerOrgMap; +import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.integration.ExtUserUseridMap; import org.lamsfoundation.lams.integration.UserInfoFetchException; @@ -77,4 +78,12 @@ void saveExtServerOrgMap(ExtServerOrgMap map); String hash(ExtServerOrgMap serverMap, String extUsername, String timestamp); + + List getMappedServers(String toolSig); + + ExtServerToolAdapterMap getMappedServer(String serverId, String toolSig); + + void saveExtServerToolAdapterMap(ExtServerToolAdapterMap map); + + void deleteExtServerToolAdapterMap(ExtServerToolAdapterMap map); } Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java =================================================================== diff -u -rc2a96caab480d04c02dc7a90e719fc0bb9af6a50 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision c2a96caab480d04c02dc7a90e719fc0bb9af6a50) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -43,6 +43,7 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.integration.ExtCourseClassMap; import org.lamsfoundation.lams.integration.ExtServerOrgMap; +import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.integration.ExtUserUseridMap; import org.lamsfoundation.lams.integration.UserInfoFetchException; import org.lamsfoundation.lams.integration.security.RandomPasswordGenerator; @@ -63,338 +64,344 @@ *

* View Source *

- * + * * @author Fei Yang */ -public class IntegrationService implements IIntegrationService{ - - private static Logger log = Logger.getLogger(IntegrationService.class); - - private IUserManagementService service; - - public IUserManagementService getService() { - return service; +public class IntegrationService implements IIntegrationService { + + private static Logger log = Logger.getLogger(IntegrationService.class); + + private IUserManagementService service; + + public IUserManagementService getService() { + return service; + } + + public void setService(IUserManagementService service) { + this.service = service; + } + + public ExtServerOrgMap getExtServerOrgMap(String serverId) { + List list = service.findByProperty(ExtServerOrgMap.class, "serverid", serverId); + if (list == null || list.size() == 0) { + return null; + } else { + return (ExtServerOrgMap) list.get(0); } + } - public void setService(IUserManagementService service) { - this.service = service; + // wrapper method for compatibility with original integration modules + public ExtCourseClassMap getExtCourseClassMap(ExtServerOrgMap serverMap, ExtUserUseridMap userMap, + String extCourseId, String countryIsoCode, String langIsoCode, String prettyCourseName) { + + // Set the pretty course name if available, otherwise maintain the extCourseId + String courseName = ""; + if (prettyCourseName != null) { + courseName = prettyCourseName; + } else { + courseName = extCourseId; } - public ExtServerOrgMap getExtServerOrgMap(String serverId) { - List list = service.findByProperty(ExtServerOrgMap.class, "serverid", serverId); - if(list==null || list.size()==0){ - return null; - }else{ - return (ExtServerOrgMap)list.get(0); - } + return getExtCourseClassMap(serverMap, userMap, extCourseId, courseName, countryIsoCode, langIsoCode, service + .getRootOrganisation().getOrganisationId().toString(), true, true); + } + + // newer method which accepts course name, a parent org id, a flag for whether user should get + // 'teacher' roles, and a flag for whether to use a prefix in the org's name + public ExtCourseClassMap getExtCourseClassMap(ExtServerOrgMap serverMap, ExtUserUseridMap userMap, + String extCourseId, String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, + Boolean isTeacher, Boolean prefix) { + Map properties = new HashMap(); + properties.put("courseid", extCourseId); + properties.put("extServerOrgMap.sid", serverMap.getSid()); + List list = service.findByProperties(ExtCourseClassMap.class, properties); + if (list == null || list.size() == 0) { + return createExtCourseClassMap(serverMap, userMap.getUser(), extCourseId, extCourseName, countryIsoCode, + langIsoCode, parentOrgId, isTeacher, prefix); + } else { + ExtCourseClassMap map = (ExtCourseClassMap) list.get(0); + User user = userMap.getUser(); + Organisation org = map.getOrganisation(); + + // update external course name if if has changed + if (extCourseName != null && !org.getName().equals(buildName(serverMap.getPrefix(), extCourseName))) { + org.setName(buildName(serverMap.getPrefix(), extCourseName)); + service.updateOrganisationandWorkspaceNames(org); + } + if (service.getUserOrganisation(user.getUserId(), org.getOrganisationId()) == null) { + addMemberships(user, org, isTeacher); + } + return map; } - - // wrapper method for compatibility with original integration modules - public ExtCourseClassMap getExtCourseClassMap(ExtServerOrgMap serverMap, ExtUserUseridMap userMap, - String extCourseId, String countryIsoCode, String langIsoCode, String prettyCourseName){ - - // Set the pretty course name if available, otherwise maintain the extCourseId - String courseName = ""; - if (prettyCourseName != null) - { - courseName = prettyCourseName; - } - else - { - courseName = extCourseId; - } - - return getExtCourseClassMap(serverMap, userMap, - extCourseId, courseName, countryIsoCode, langIsoCode, - service.getRootOrganisation().getOrganisationId().toString(), true, true); + } + + private void addMemberships(User user, Organisation org, Boolean isTeacher) { + UserOrganisation uo = new UserOrganisation(user, org); + service.save(uo); + Integer[] roles; + if (isTeacher) { + roles = new Integer[] { Role.ROLE_AUTHOR, Role.ROLE_MONITOR, Role.ROLE_LEARNER }; + } else { + roles = new Integer[] { Role.ROLE_LEARNER }; } - - // newer method which accepts course name, a parent org id, a flag for whether user should get - // 'teacher' roles, and a flag for whether to use a prefix in the org's name - public ExtCourseClassMap getExtCourseClassMap(ExtServerOrgMap serverMap, ExtUserUseridMap userMap, - String extCourseId, String extCourseName, String countryIsoCode, String langIsoCode, - String parentOrgId, Boolean isTeacher, Boolean prefix){ - Map properties = new HashMap(); - properties.put("courseid", extCourseId); - properties.put("extServerOrgMap.sid", serverMap.getSid()); - List list = service.findByProperties(ExtCourseClassMap.class, properties); - if(list==null || list.size()==0){ - return createExtCourseClassMap(serverMap, userMap.getUser(), - extCourseId, extCourseName, countryIsoCode, langIsoCode, parentOrgId, isTeacher, prefix); - }else{ - ExtCourseClassMap map = (ExtCourseClassMap)list.get(0); - User user = userMap.getUser(); - Organisation org = map.getOrganisation(); - - // update external course name if if has changed - if (extCourseName != null && !org.getName().equals(buildName(serverMap.getPrefix(), extCourseName))) - { - org.setName(buildName(serverMap.getPrefix(), extCourseName)); - service.updateOrganisationandWorkspaceNames(org); - } - if(service.getUserOrganisation(user.getUserId(), org.getOrganisationId())==null){ - addMemberships(user, org, isTeacher); - } - return map; - } + for (Integer roleId : roles) { + UserOrganisationRole uor = new UserOrganisationRole(uo, (Role) service.findById(Role.class, roleId)); + service.save(uor); + uo.addUserOrganisationRole(uor); } - - private void addMemberships(User user, Organisation org, Boolean isTeacher){ - UserOrganisation uo = new UserOrganisation(user,org); - service.save(uo); - Integer[] roles; - if (isTeacher) { - roles = new Integer[] { Role.ROLE_AUTHOR, Role.ROLE_MONITOR, Role.ROLE_LEARNER }; - } else { - roles = new Integer[] { Role.ROLE_LEARNER }; - } - for(Integer roleId:roles){ - UserOrganisationRole uor = new UserOrganisationRole(uo,(Role)service.findById(Role.class,roleId)); - service.save(uor); - uo.addUserOrganisationRole(uor); - } - user.addUserOrganisation(uo); - service.save(user); + user.addUserOrganisation(uo); + service.save(user); + } + + public ExtUserUseridMap getExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername) + throws UserInfoFetchException { + Map properties = new HashMap(); + properties.put("extServerOrgMap.sid", serverMap.getSid()); + properties.put("extUsername", extUsername); + List list = service.findByProperties(ExtUserUseridMap.class, properties); + if (list == null || list.size() == 0) { + return createExtUserUseridMap(serverMap, extUsername); + } else { + return (ExtUserUseridMap) list.get(0); } + } - public ExtUserUseridMap getExtUserUseridMap( - ExtServerOrgMap serverMap, - String extUsername) - throws UserInfoFetchException - { - Map properties = new HashMap(); - properties.put("extServerOrgMap.sid", serverMap.getSid()); - properties.put("extUsername", extUsername); - List list = service.findByProperties(ExtUserUseridMap.class, properties); - if(list==null || list.size()==0){ - return createExtUserUseridMap(serverMap, extUsername); - }else{ - return (ExtUserUseridMap)list.get(0); - } + public ExtUserUseridMap getExistingExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername) + throws UserInfoFetchException { + Map properties = new HashMap(); + properties.put("extServerOrgMap.sid", serverMap.getSid()); + properties.put("extUsername", extUsername); + List list = service.findByProperties(ExtUserUseridMap.class, properties); + if (list == null || list.size() == 0) { + return null; + } else { + return (ExtUserUseridMap) list.get(0); } - - public ExtUserUseridMap getExistingExtUserUseridMap( - ExtServerOrgMap serverMap, - String extUsername) - throws UserInfoFetchException - { - Map properties = new HashMap(); - properties.put("extServerOrgMap.sid", serverMap.getSid()); - properties.put("extUsername", extUsername); - List list = service.findByProperties(ExtUserUseridMap.class, properties); - if(list==null || list.size()==0){ - return null; - }else{ - return (ExtUserUseridMap)list.get(0); - } + } + + public ExtUserUseridMap getImplicitExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername, String password, + String firstName, String lastName, String email) throws UserInfoFetchException { + Map properties = new HashMap(); + properties.put("extServerOrgMap.sid", serverMap.getSid()); + properties.put("extUsername", extUsername); + List list = service.findByProperties(ExtUserUseridMap.class, properties); + if (list == null || list.size() == 0) { + String[] defaultLangCountry = LanguageUtil.getDefaultLangCountry(); + String[] userData = { "", firstName, lastName, "", "", "", "", "", "", "", "", email, + defaultLangCountry[1], defaultLangCountry[0] }; + return createExtUserUseridMap(serverMap, extUsername, password, userData, false); + } else { + return (ExtUserUseridMap) list.get(0); } - - public ExtUserUseridMap getImplicitExtUserUseridMap( - ExtServerOrgMap serverMap, - String extUsername, - String password, - String firstName, - String lastName, - String email) - throws UserInfoFetchException - { - Map properties = new HashMap(); - properties.put("extServerOrgMap.sid", serverMap.getSid()); - properties.put("extUsername", extUsername); - List list = service.findByProperties(ExtUserUseridMap.class, properties); - if(list==null || list.size()==0){ - String[] defaultLangCountry = LanguageUtil.getDefaultLangCountry(); - String[] userData = { "",firstName,lastName,"","","","","","","","",email,defaultLangCountry[1],defaultLangCountry[0] }; - return createExtUserUseridMap(serverMap, extUsername, password, userData, false); - }else{ - return (ExtUserUseridMap)list.get(0); - } + } + + public ExtUserUseridMap getImplicitExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername, + String firstName, String lastName, String language, String country, String email) + throws UserInfoFetchException { + Map properties = new HashMap(); + properties.put("extServerOrgMap.sid", serverMap.getSid()); + properties.put("extUsername", extUsername); + List list = service.findByProperties(ExtUserUseridMap.class, properties); + if (list == null || list.size() == 0) { + return createImplicitExtUserUseridMap(serverMap, extUsername, firstName, lastName, language, country, email); + } else { + return (ExtUserUseridMap) list.get(0); } - - public ExtUserUseridMap getImplicitExtUserUseridMap( - ExtServerOrgMap serverMap, - String extUsername, - String firstName, - String lastName, - String language, - String country, - String email) - throws UserInfoFetchException - { - Map properties = new HashMap(); - properties.put("extServerOrgMap.sid", serverMap.getSid()); - properties.put("extUsername", extUsername); - List list = service.findByProperties(ExtUserUseridMap.class, properties); - if(list==null || list.size()==0){ - return createImplicitExtUserUseridMap(serverMap, extUsername, firstName, lastName, language, country, email); - }else{ - return (ExtUserUseridMap)list.get(0); - } - } - - private ExtCourseClassMap createExtCourseClassMap(ExtServerOrgMap serverMap, User user, - String extCourseId, String extCourseName, String countryIsoCode, String langIsoCode, - String parentOrgId, Boolean isTeacher, Boolean prefix) { - Organisation org = createOrganisation(serverMap, user, extCourseId, extCourseName, countryIsoCode, langIsoCode, parentOrgId, prefix); - addMemberships(user,org,isTeacher); - ExtCourseClassMap map = new ExtCourseClassMap(); - map.setCourseid(extCourseId); - map.setExtServerOrgMap(serverMap); - map.setOrganisation(org); - service.save(map); - return map; - } - - private Organisation createOrganisation(ExtServerOrgMap serverMap, User user, - String extCourseId, String extCourseName, String countryIsoCode, String langIsoCode, - String parentOrgId, Boolean prefix) { - Organisation org = new Organisation(); - org.setName( prefix ? buildName(serverMap.getPrefix(), extCourseName) : extCourseName ); - org.setDescription(extCourseId); - org.setOrganisationState((OrganisationState)service.findById(OrganisationState.class,OrganisationState.ACTIVE)); - org.setLocale(LanguageUtil.getSupportedLocale(langIsoCode, countryIsoCode)); + } - // determine whether org will be a group or subgroup - Organisation parent = (Organisation)service.findById(Organisation.class, Integer.valueOf(parentOrgId)); - if (parent != null) { - org.setParentOrganisation(parent); - if (!parent.getOrganisationId().equals(service.getRootOrganisation().getOrganisationId())) { - org.setOrganisationType((OrganisationType)service.findById(OrganisationType.class,OrganisationType.CLASS_TYPE)); - } else { - org.setOrganisationType((OrganisationType)service.findById(OrganisationType.class,OrganisationType.COURSE_TYPE)); - } - } else { - // default - org.setParentOrganisation(service.getRootOrganisation()); - org.setOrganisationType((OrganisationType)service.findById(OrganisationType.class,OrganisationType.COURSE_TYPE)); - } - return service.saveOrganisation(org, user.getUserId()); + private ExtCourseClassMap createExtCourseClassMap(ExtServerOrgMap serverMap, User user, String extCourseId, + String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean isTeacher, + Boolean prefix) { + Organisation org = createOrganisation(serverMap, user, extCourseId, extCourseName, countryIsoCode, langIsoCode, + parentOrgId, prefix); + addMemberships(user, org, isTeacher); + ExtCourseClassMap map = new ExtCourseClassMap(); + map.setCourseid(extCourseId); + map.setExtServerOrgMap(serverMap); + map.setOrganisation(org); + service.save(map); + return map; + } + + private Organisation createOrganisation(ExtServerOrgMap serverMap, User user, String extCourseId, + String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean prefix) { + Organisation org = new Organisation(); + org.setName(prefix ? buildName(serverMap.getPrefix(), extCourseName) : extCourseName); + org.setDescription(extCourseId); + org.setOrganisationState((OrganisationState) service + .findById(OrganisationState.class, OrganisationState.ACTIVE)); + org.setLocale(LanguageUtil.getSupportedLocale(langIsoCode, countryIsoCode)); + + // determine whether org will be a group or subgroup + Organisation parent = (Organisation) service.findById(Organisation.class, Integer.valueOf(parentOrgId)); + if (parent != null) { + org.setParentOrganisation(parent); + if (!parent.getOrganisationId().equals(service.getRootOrganisation().getOrganisationId())) { + org.setOrganisationType((OrganisationType) service.findById(OrganisationType.class, + OrganisationType.CLASS_TYPE)); + } else { + org.setOrganisationType((OrganisationType) service.findById(OrganisationType.class, + OrganisationType.COURSE_TYPE)); + } + } else { + // default + org.setParentOrganisation(service.getRootOrganisation()); + org.setOrganisationType((OrganisationType) service.findById(OrganisationType.class, + OrganisationType.COURSE_TYPE)); } - - // flexible method to specify username and password - private ExtUserUseridMap createExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername, String password, String[] userData, boolean prefix) throws UserInfoFetchException { - User user = new User(); - user.setLogin( prefix ? buildName(serverMap.getPrefix(),extUsername) : extUsername ); - user.setPassword(password); - user.setTitle(userData[0]); - user.setFirstName(userData[1]); - user.setLastName(userData[2]); - user.setAddressLine1(userData[3]); - user.setCity(userData[4]); - user.setState(userData[5]); - user.setPostcode(userData[6]); - user.setCountry(userData[7]); - user.setDayPhone(userData[8]); - user.setMobilePhone(userData[9]); - user.setFax(userData[10]); - user.setEmail(userData[11]); - user.setAuthenticationMethod((AuthenticationMethod)service.findById(AuthenticationMethod.class, AuthenticationMethod.DB)); - user.setCreateDate(new Date()); - user.setDisabledFlag(false); - user.setLocale(LanguageUtil.getSupportedLocale(userData[13], userData[12])); - user.setFlashTheme(service.getDefaultFlashTheme()); - user.setHtmlTheme(service.getDefaultHtmlTheme()); - service.save(user); - ExtUserUseridMap map = new ExtUserUseridMap(); - map.setExtServerOrgMap(serverMap); - map.setExtUsername(extUsername); - map.setUser(user); - service.save(map); - return map; - } - - // compatibility method to support integrations - private ExtUserUseridMap createExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername) throws UserInfoFetchException { - String[] userData = getUserDataFromExtServer(serverMap, extUsername); - String password = HashUtil.sha1(RandomPasswordGenerator.nextPassword(10)); - return createExtUserUseridMap(serverMap, extUsername, password, userData, true); - } - - // compatibility method - public ExtUserUseridMap createImplicitExtUserUseridMap(ExtServerOrgMap serverMap, - String extUsername, - String firstName, - String lastName, - String language, - String country, - String email) throws UserInfoFetchException - { - String[] userData = { "",firstName,lastName,"","","","","","","","",email, country, language }; - String password = HashUtil.sha1(RandomPasswordGenerator.nextPassword(10)); - return createExtUserUseridMap(serverMap, extUsername, password, userData, true); - } - + return service.saveOrganisation(org, user.getUserId()); + } - private String[] getUserDataFromExtServer(ExtServerOrgMap serverMap, String extUsername) throws UserInfoFetchException { - //the callback url must contain %username%, %timestamp% and %hash% - //eg: "http://test100.ics.mq.edu.au/webapps/lams-plglamscontent-bb_bb60/UserData?uid=%username%&ts=%timestamp%&hash=%hash%"; - //where %username%, %timestamp% and %hash% will be replaced with their real values - try { - String userDataCallbackUrl = serverMap.getUserinfoUrl(); - String timestamp = Long.toString(new Date().getTime()); - String hash = hash(serverMap, extUsername, timestamp); - - String encodedExtUsername = URLEncoder.encode(extUsername, "UTF8"); - - //set the values for the parameters - userDataCallbackUrl = userDataCallbackUrl.replaceAll("%username%", encodedExtUsername).replaceAll("%timestamp%", timestamp).replaceAll("%hash%", hash); - log.debug(userDataCallbackUrl); - URL url = new URL(userDataCallbackUrl); - URLConnection conn = url.openConnection(); - if (!(conn instanceof HttpURLConnection)) - throw new UserInfoFetchException("Fail to fetch user data from external server:" - + serverMap.getServerid() + "- Invalid connection type"); + // flexible method to specify username and password + private ExtUserUseridMap createExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername, String password, + String[] userData, boolean prefix) throws UserInfoFetchException { + User user = new User(); + user.setLogin(prefix ? buildName(serverMap.getPrefix(), extUsername) : extUsername); + user.setPassword(password); + user.setTitle(userData[0]); + user.setFirstName(userData[1]); + user.setLastName(userData[2]); + user.setAddressLine1(userData[3]); + user.setCity(userData[4]); + user.setState(userData[5]); + user.setPostcode(userData[6]); + user.setCountry(userData[7]); + user.setDayPhone(userData[8]); + user.setMobilePhone(userData[9]); + user.setFax(userData[10]); + user.setEmail(userData[11]); + user.setAuthenticationMethod((AuthenticationMethod) service.findById(AuthenticationMethod.class, + AuthenticationMethod.DB)); + user.setCreateDate(new Date()); + user.setDisabledFlag(false); + user.setLocale(LanguageUtil.getSupportedLocale(userData[13], userData[12])); + user.setFlashTheme(service.getDefaultFlashTheme()); + user.setHtmlTheme(service.getDefaultHtmlTheme()); + service.save(user); + ExtUserUseridMap map = new ExtUserUseridMap(); + map.setExtServerOrgMap(serverMap); + map.setExtUsername(extUsername); + map.setUser(user); + service.save(map); + return map; + } - HttpURLConnection httpConn = (HttpURLConnection) conn; - if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) - throw new UserInfoFetchException( - "Fail to fetch user data from external server:" - + serverMap.getServerid() - + " - Unexpected return HTTP Status:"+httpConn.getResponseCode()); + // compatibility method to support integrations + private ExtUserUseridMap createExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername) + throws UserInfoFetchException { + String[] userData = getUserDataFromExtServer(serverMap, extUsername); + String password = HashUtil.sha1(RandomPasswordGenerator.nextPassword(10)); + return createExtUserUseridMap(serverMap, extUsername, password, userData, true); + } - InputStream is = url.openConnection().getInputStream(); - BufferedReader isReader = new BufferedReader(new InputStreamReader(is)); - String str = isReader.readLine(); - if (str == null) { - throw new UserInfoFetchException("Fail to fetch user data from external server:" - + serverMap.getServerid() - + " - No data returned from external server"); - } + // compatibility method + public ExtUserUseridMap createImplicitExtUserUseridMap(ExtServerOrgMap serverMap, String extUsername, + String firstName, String lastName, String language, String country, String email) + throws UserInfoFetchException { + String[] userData = { "", firstName, lastName, "", "", "", "", "", "", "", "", email, country, language }; + String password = HashUtil.sha1(RandomPasswordGenerator.nextPassword(10)); + return createExtUserUseridMap(serverMap, extUsername, password, userData, true); + } - return CSVUtil.parse(str); + private String[] getUserDataFromExtServer(ExtServerOrgMap serverMap, String extUsername) + throws UserInfoFetchException { + //the callback url must contain %username%, %timestamp% and %hash% + //eg: "http://test100.ics.mq.edu.au/webapps/lams-plglamscontent-bb_bb60/UserData?uid=%username%&ts=%timestamp%&hash=%hash%"; + //where %username%, %timestamp% and %hash% will be replaced with their real values + try { + String userDataCallbackUrl = serverMap.getUserinfoUrl(); + String timestamp = Long.toString(new Date().getTime()); + String hash = hash(serverMap, extUsername, timestamp); - } catch (MalformedURLException e) { - log.error(e); - throw new UserInfoFetchException(e); - } catch (IOException e) { - log.error(e); - throw new UserInfoFetchException(e); - } catch (ParseException e) { - log.error(e); - throw new UserInfoFetchException(e); - } - } + String encodedExtUsername = URLEncoder.encode(extUsername, "UTF8"); - public String hash(ExtServerOrgMap serverMap, String extUsername, String timestamp) { - String serverId = serverMap.getServerid(); - String serverKey = serverMap.getServerkey(); - String plaintext = timestamp.trim().toLowerCase()+extUsername.trim().toLowerCase()+serverId.trim().toLowerCase()+serverKey.trim().toLowerCase(); - return HashUtil.sha1(plaintext); - } + //set the values for the parameters + userDataCallbackUrl = userDataCallbackUrl.replaceAll("%username%", encodedExtUsername).replaceAll( + "%timestamp%", timestamp).replaceAll("%hash%", hash); + log.debug(userDataCallbackUrl); + URL url = new URL(userDataCallbackUrl); + URLConnection conn = url.openConnection(); + if (!(conn instanceof HttpURLConnection)) + throw new UserInfoFetchException("Fail to fetch user data from external server:" + + serverMap.getServerid() + "- Invalid connection type"); - private String buildName(String prefix, String name){ - return prefix+'_'+name; - } + HttpURLConnection httpConn = (HttpURLConnection) conn; + if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) + throw new UserInfoFetchException("Fail to fetch user data from external server:" + + serverMap.getServerid() + " - Unexpected return HTTP Status:" + httpConn.getResponseCode()); - public List getAllExtServerOrgMaps() { - return service.findAll(ExtServerOrgMap.class); - } + InputStream is = url.openConnection().getInputStream(); + BufferedReader isReader = new BufferedReader(new InputStreamReader(is)); + String str = isReader.readLine(); + if (str == null) { + throw new UserInfoFetchException("Fail to fetch user data from external server:" + + serverMap.getServerid() + " - No data returned from external server"); + } - public void saveExtServerOrgMap(ExtServerOrgMap map) { - service.save(map); + return CSVUtil.parse(str); + + } catch (MalformedURLException e) { + log.error(e); + throw new UserInfoFetchException(e); + } catch (IOException e) { + log.error(e); + throw new UserInfoFetchException(e); + } catch (ParseException e) { + log.error(e); + throw new UserInfoFetchException(e); } + } - public ExtServerOrgMap getExtServerOrgMap(Integer sid) { - return (ExtServerOrgMap)service.findById(ExtServerOrgMap.class, sid); + public String hash(ExtServerOrgMap serverMap, String extUsername, String timestamp) { + String serverId = serverMap.getServerid(); + String serverKey = serverMap.getServerkey(); + String plaintext = timestamp.trim().toLowerCase() + extUsername.trim().toLowerCase() + + serverId.trim().toLowerCase() + serverKey.trim().toLowerCase(); + return HashUtil.sha1(plaintext); + } + + private String buildName(String prefix, String name) { + return prefix + '_' + name; + } + + public List getAllExtServerOrgMaps() { + return service.findAll(ExtServerOrgMap.class); + } + + @SuppressWarnings("unchecked") + public List getMappedServers(String toolSig) { + + Map properties = new HashMap(); + properties.put("tool.toolSignature", toolSig); + return (List)service.findByProperties(ExtServerToolAdapterMap.class, properties); + } + + @SuppressWarnings("unchecked") + public ExtServerToolAdapterMap getMappedServer(String serverId, String toolSig){ + Map properties = new HashMap(); + properties.put("tool.toolSignature", toolSig); + properties.put("extServer.serverid", serverId); + List ret = service.findByProperties(ExtServerToolAdapterMap.class, properties); + if (ret != null && ret.size() > 0) { + return (ExtServerToolAdapterMap)ret.get(0); + } else { + return null; } + } + + public void saveExtServerToolAdapterMap(ExtServerToolAdapterMap map){ + service.save(map); + } + + public void deleteExtServerToolAdapterMap(ExtServerToolAdapterMap map){ + service.delete(map); + } + + public void saveExtServerOrgMap(ExtServerOrgMap map) { + service.save(map); + } + + public ExtServerOrgMap getExtServerOrgMap(Integer sid) { + return (ExtServerOrgMap) service.findById(ExtServerOrgMap.class, sid); + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupUser.java =================================================================== diff -u -r14c6e281badaa90212469e3f4f60d803416d067b -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupUser.java (.../GroupUser.java) (revision 14c6e281badaa90212469e3f4f60d803416d067b) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupUser.java (.../GroupUser.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -23,33 +23,36 @@ /* $Id$ */ package org.lamsfoundation.lams.learningdesign; +import java.io.Serializable; + import org.lamsfoundation.lams.usermanagement.User; - + /** * A persistence bean for group/user mappings + * * @author lfoxton - * + * * @hibernate.class table="lams_user_group" */ -public class GroupUser { +public class GroupUser implements Serializable { - private Group group; private User user; - - public GroupUser() {} + public GroupUser() { + } + /** * @hibernate.many-to-one not-null="true" lazy="false" * @hibernate.column name="group_id" * */ public Group getGroup() { - return group; + return group; } public void setGroup(Group group) { - this.group = group; + this.group = group; } /** @@ -58,11 +61,10 @@ * */ public User getUser() { - return user; + return user; } public void setUser(User user) { - this.user = user; + this.user = user; } } - \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java =================================================================== diff -u -r1fe0f4f546903187be6f35e4d5c027853da9408c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -32,116 +32,119 @@ import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO; import org.lamsfoundation.lams.learningdesign.exception.LearningDesignProcessorException; -/** Run through a learning design, in the order of the activities. Process the learning design - * to produce somethings else. +/** + * Run through a learning design, in the order of the activities. Process the learning design to produce somethings + * else. * - * This is an abstract class that implements stepping through the learning design. It is used - * by getAllContributeActivities to build up the list of "todo" activities and can also be used - * by export portfolio and export learning design. The implementing classes will need to implement - * the startBlah and endBlah methods. + * This is an abstract class that implements stepping through the learning design. It is used by + * getAllContributeActivities to build up the list of "todo" activities and can also be used by export portfolio and + * export learning design. The implementing classes will need to implement the startBlah and endBlah methods. * * @author Fiona Malikoff - * + * */ public abstract class LearningDesignProcessor { - private static Logger log = Logger.getLogger(LearningDesignProcessor.class); - - private LearningDesign design; - private IActivityDAO activityDAO; - - public LearningDesignProcessor(LearningDesign design, IActivityDAO activityDAO) { - this.design = design; - this.activityDAO = activityDAO; - } + private static Logger log = Logger.getLogger(LearningDesignProcessor.class); - /** A complex activity has been found. Do any processing needed at the start of the activity */ - public abstract boolean startComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException ; - - /** Do any processing needed at the end of a complex activity */ - public abstract void endComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException ; + private LearningDesign design; + private IActivityDAO activityDAO; - /** A simple activity has been found. Do any processing needed at the start of the activity */ - public abstract void startSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException ; + public LearningDesignProcessor(LearningDesign design, IActivityDAO activityDAO) { + this.design = design; + this.activityDAO = activityDAO; + } - /** Do any processing needed at the end of a complex activity */ - public abstract void endSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException; - - /** A simple activity has been found. Do any processing needed at the start of the activity */ - //public abstract void startFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException ; + /** A complex activity has been found. Do any processing needed at the start of the activity */ + public abstract boolean startComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException; - /** Do any processing needed at the end of a complex activity */ - //public abstract void endFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException; + /** Do any processing needed at the end of a complex activity */ + public abstract void endComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException; - public void parseLearningDesign() throws LearningDesignProcessorException { - if ( getDesign() != null ) { - handleActivity(getDesign().getFirstActivity()); - if(getDesign().getFloatingActivity() != null) handleComplexActivity(getDesign().getFloatingActivity()); - } + /** A simple activity has been found. Do any processing needed at the start of the activity */ + public abstract void startSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException; + + /** Do any processing needed at the end of a complex activity */ + public abstract void endSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException; + + /** A simple activity has been found. Do any processing needed at the start of the activity */ + // public abstract void startFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException ; + /** Do any processing needed at the end of a complex activity */ + // public abstract void endFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException; + public void parseLearningDesign() throws LearningDesignProcessorException { + if (getDesign() != null) { + handleActivity(getDesign().getFirstActivity()); + if (getDesign().getFloatingActivity() != null) { + handleComplexActivity(getDesign().getFloatingActivity()); + } } - - protected void handleActivity( Activity activity ) throws LearningDesignProcessorException { - if ( activity == null ) { - log.warn("Parsing activity method handleActivity got a null activity. Learning design was "+getDesign()); - } else { - if ( log.isDebugEnabled() ) { - log.debug("Processing activity "+activity.getActivityId()+" "+activity.getTitle()); - } - if ( activity.isComplexActivity() ) { - handleComplexActivity( activity ); - } else { - handleSimpleActivity( activity ); - } - - // if there is a transition to the next one then go to it, - // otherwise just return as we must be either at the end or inside another activity. - if ( activity.getTransitionFrom() != null ) { - handleActivity(activity.getTransitionFrom().getToActivity()); - } - } + } + + protected void handleActivity(Activity activity) throws LearningDesignProcessorException { + if (activity == null) { + LearningDesignProcessor.log + .warn("Parsing activity method handleActivity got a null activity. Learning design was " + + getDesign()); + } else { + if (LearningDesignProcessor.log.isDebugEnabled()) { + LearningDesignProcessor.log.debug("Processing activity " + activity.getActivityId() + " " + + activity.getTitle()); + } + if (activity.isComplexActivity()) { + handleComplexActivity(activity); + } else { + handleSimpleActivity(activity); + } + + // if there is a transition to the next one then go to it, + // otherwise just return as we must be either at the end or inside another activity. + if (activity.getTransitionFrom() != null) { + handleActivity(activity.getTransitionFrom().getToActivity()); + } } - - protected void handleComplexActivity( Activity activity ) throws LearningDesignProcessorException { - // ensure it is a real activity not a CGLIB proxy - ComplexActivity complex = (ComplexActivity) activityDAO.getActivityByActivityId(activity.getActivityId(),SimpleActivity.class); - boolean processChildren = startComplexActivity(complex); + } - if ( processChildren ) { - if ( activity.isSequenceActivity() ) { - // sequence is a funny one - the child activities are linked by transitions rather - // than ordered by order id - SequenceActivity sequenceActivity = (SequenceActivity) complex; - Activity child = sequenceActivity.getNextActivityByParent(new NullActivity()); - while ( ! child.isNull() ) { - handleActivity(child); - child = sequenceActivity.getNextActivityByParent(child); - } - - } else { - // work through all the child activities for this activity, in order id - Set children = new TreeSet(new ActivityOrderComparator()); - children.addAll(complex.getActivities()); - Iterator i=children.iterator(); - while ( i.hasNext() ) { - handleActivity((Activity)i.next()); - } - } + protected void handleComplexActivity(Activity activity) throws LearningDesignProcessorException { + // ensure it is a real activity not a CGLIB proxy + ComplexActivity complex = (ComplexActivity) activityDAO.getActivityByActivityId(activity.getActivityId(), + ComplexActivity.class); + boolean processChildren = startComplexActivity(complex); + + if (processChildren) { + if (activity.isSequenceActivity()) { + // sequence is a funny one - the child activities are linked by transitions rather + // than ordered by order id + SequenceActivity sequenceActivity = (SequenceActivity) complex; + Activity child = sequenceActivity.getNextActivityByParent(new NullActivity()); + while (!child.isNull()) { + handleActivity(child); + child = sequenceActivity.getNextActivityByParent(child); } - - endComplexActivity(complex); + } else { + // work through all the child activities for this activity, in order id + Set children = new TreeSet(new ActivityOrderComparator()); + children.addAll(complex.getActivities()); + Iterator i = children.iterator(); + while (i.hasNext()) { + handleActivity((Activity) i.next()); + } + } } - - protected void handleSimpleActivity( Activity activity ) throws LearningDesignProcessorException { - // ensure it is a real activity not a CGLIB proxy - SimpleActivity simple = (SimpleActivity) activityDAO.getActivityByActivityId(activity.getActivityId(),SimpleActivity.class); - startSimpleActivity(simple); - endSimpleActivity(simple); - } - - public LearningDesign getDesign() { - return design; - } -} + endComplexActivity(complex); + } + + protected void handleSimpleActivity(Activity activity) throws LearningDesignProcessorException { + // ensure it is a real activity not a CGLIB proxy + SimpleActivity simple = (SimpleActivity) activityDAO.getActivityByActivityId(activity.getActivityId(), + SimpleActivity.class); + startSimpleActivity(simple); + endSimpleActivity(simple); + } + + public LearningDesign getDesign() { + return design; + } +} Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java =================================================================== diff -u -r209087915bc219f430c282ad00e5d1e6462f9b5f -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision 209087915bc219f430c282ad00e5d1e6462f9b5f) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -24,7 +24,9 @@ package org.lamsfoundation.lams.learningdesign.dto; import java.util.Date; +import java.util.Set; +import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.BranchingActivity; import org.lamsfoundation.lams.learningdesign.ConditionGateActivity; @@ -104,7 +106,7 @@ /** Used for I18N the URLS. Does not need to be sent to clients, so no getter exists. */ private String languageCode; - private Boolean toolAdapter; + private String[] mappedServers; public LibraryActivityDTO(Activity activity, String languageCode) { activityTypeID = activity.getActivityTypeId(); @@ -209,6 +211,17 @@ adminURL = tool.getAdminUrl(); supportsOutputs = tool.getSupportsOutputs(); extLmsId = tool.getExtLmsId(); + + Set mappedServersArray = tool.getMappedServers(); + if (mappedServersArray != null) { + this.mappedServers = new String[mappedServersArray.size()]; + int i = 0; + for (ExtServerToolAdapterMap map : mappedServersArray) { + mappedServers[i] = map.getExtServer().getServerid(); + i++; + } + } + helpURL = HelpUtil.constructToolURL(tool.getHelpUrl(), toolSignature, "", languageCode); } @@ -618,4 +631,14 @@ this.extLmsId = extLmsId; } + public String[] getMappedServers() { + return mappedServers; + } + + public void setMappedServers(String[] mappedServers) { + this.mappedServers = mappedServers; + } + + + } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java =================================================================== diff -u -r1fe0f4f546903187be6f35e4d5c027853da9408c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java (.../LearningDesignValidator.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java (.../LearningDesignValidator.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -30,498 +30,510 @@ import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ComplexActivity; +import org.lamsfoundation.lams.learningdesign.FloatingActivity; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.OptionsActivity; -import org.lamsfoundation.lams.learningdesign.FloatingActivity; import org.lamsfoundation.lams.learningdesign.RandomGrouping; import org.lamsfoundation.lams.learningdesign.Transition; import org.lamsfoundation.lams.learningdesign.dto.ValidationErrorDTO; import org.lamsfoundation.lams.util.MessageService; /** - * Validates a learning design. Encapsulates all the validation rules that are "cross activity" for a learning design as well - * as calling any activity specific validation functionality. + * Validates a learning design. Encapsulates all the validation rules that are "cross activity" for a learning design as + * well as calling any activity specific validation functionality. * - * Most of the rules will never trigger as the GUI client will stop them occurring, but they are checked again here just in case. + * Most of the rules will never trigger as the GUI client will stop them occurring, but they are checked again here just + * in case. * * Users can save invalid design - mainly for things like missing transitions. But LAMS won't run an invalid design. * * @author Fiona Malikoff */ public class LearningDesignValidator { - MessageService messageService; - LearningDesign learningDesign; - Vector errors; + MessageService messageService; + LearningDesign learningDesign; + Vector errors; - LearningDesignValidator(LearningDesign learningDesign, MessageService messageService) { - this.messageService = messageService; - this.learningDesign = learningDesign; - } + LearningDesignValidator(LearningDesign learningDesign, MessageService messageService) { + this.messageService = messageService; + this.learningDesign = learningDesign; + } - /** Run the validation */ - public Vector validate() { - errors = new Vector(); // initialises the list of validation messages. + /** Run the validation */ + public Vector validate() { + errors = new Vector(); // initialises the list of validation messages. - // check the design has a starting or first activity - if(learningDesign.getFirstActivity() == null) - errors.add(new ValidationErrorDTO(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_KEY))); - - // check all activities have their necessary transitions. First check the - // top level, then we need to check each branch inside a branching activity. - Set topLevelActivities = extractFloatingActivities(learningDesign.getParentActivities()); - validateActivityTransitionRules(topLevelActivities, learningDesign.getTransitions()); + // check the design has a starting or first activity + if (learningDesign.getFirstActivity() == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_KEY))); + } - for (Activity activity : (Set) learningDesign.getActivities()) { - checkIfGroupingRequired(activity); - validateGroupingIfGroupingIsApplied(activity); - validateOptionalActivity(activity); - validateOptionsActivityOrderId(activity); - validateFloatingActivity(activity); - validateGroupingActivity(activity); - Vector activityErrors = activity.validateActivity(messageService); - if (activityErrors != null && !activityErrors.isEmpty()) { - errors.addAll(activityErrors); - } - } + // check all activities have their necessary transitions. First check the + // top level, then we need to check each branch inside a branching activity. + Set topLevelActivities = extractFloatingActivities(learningDesign.getParentActivities()); + validateActivityTransitionRules(topLevelActivities, learningDesign.getTransitions()); - cleanupValidationErrors(); - return errors; + for (Activity activity : (Set) learningDesign.getActivities()) { + checkIfGroupingRequired(activity); + validateGroupingIfGroupingIsApplied(activity); + validateOptionalActivity(activity); + validateOptionsActivityOrderId(activity); + validateFloatingActivity(activity); + validateGroupingActivity(activity); + Vector activityErrors = activity.validateActivity(messageService); + if (activityErrors != null && !activityErrors.isEmpty()) { + errors.addAll(activityErrors); + } } - - /** - * Removes all Floating Activity(s) from the top level collection for validation procressing. - * - * @param topLevelActivities Set of Top-level activities. - */ - private Set extractFloatingActivities(Set topLevelActivities) { - for (Activity activity : (Set) topLevelActivities) { - if(activity.isFloatingActivity()) { - topLevelActivities.remove(activity); - return topLevelActivities; - } - } - + + cleanupValidationErrors(); + return errors; + } + + /** + * Removes all Floating Activity(s) from the top level collection for validation procressing. + * + * @param topLevelActivities + * Set of Top-level activities. + */ + private Set extractFloatingActivities(Set topLevelActivities) { + for (Activity activity : topLevelActivities) { + if (activity.isFloatingActivity()) { + topLevelActivities.remove(activity); return topLevelActivities; + } } - /** - * Cleans up multiple and redundant error messages in the list. - * @param errors List of errors to cleanup. - */ - private void cleanupValidationErrors() { - Iterator it = errors.iterator(); - while (it.hasNext()) { - cleanupTransitionErrors(it); - } + return topLevelActivities; + } + + /** + * Cleans up multiple and redundant error messages in the list. + * + * @param errors + * List of errors to cleanup. + */ + private void cleanupValidationErrors() { + Iterator it = errors.iterator(); + while (it.hasNext()) { + cleanupTransitionErrors(it); } + } - private void cleanupTransitionErrors(Iterator topIt) { - ValidationErrorDTO nextError; - ValidationErrorDTO currentError = (ValidationErrorDTO) topIt.next(); - Iterator it = errors.iterator(); + private void cleanupTransitionErrors(Iterator topIt) { + ValidationErrorDTO nextError; + ValidationErrorDTO currentError = (ValidationErrorDTO) topIt.next(); + Iterator it = errors.iterator(); - while (it.hasNext()) { - nextError = (ValidationErrorDTO) it.next(); + while (it.hasNext()) { + nextError = (ValidationErrorDTO) it.next(); - if (currentError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE) - && (nextError.getCode().equals(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE) || nextError.getCode().equals( - ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE))) { + if (currentError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE) + && (nextError.getCode().equals(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE) || nextError + .getCode().equals(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE))) { + if (currentError.getUIID().equals(nextError.getUIID())) { + topIt.remove(); + return; + } else if (currentError.getCode().equals(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE)) { + if (nextError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE)) { + if (currentError.getUIID().equals(nextError.getUIID())) { + it.remove(); + } else if (currentError.getCode().equals(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE)) { + if (nextError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE)) { if (currentError.getUIID().equals(nextError.getUIID())) { - topIt.remove(); - return; + it.remove(); } - else if (currentError.getCode().equals(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE)) { - if (nextError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE)) { - if (currentError.getUIID().equals(nextError.getUIID())) { - it.remove(); - } - else if (currentError.getCode().equals(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE)) { - if (nextError.getCode().equals(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE)) { - if (currentError.getUIID().equals(nextError.getUIID())) { - it.remove(); - } - } - } - } - } + } } - + } } + } } - /** - * Perform transition related validations. - * - * All activities with no input transitions are added to the vector - * noInputTransition. If the size of this list is greater - * than 1 (which violates the rule of having exactly one top level activity - * with no input transition), then a ValidationErrorDTO will be created - * for each activity with no input transition. - * Similarly, the same concept applies for activities with no output transition. - * - * @param activities A subset of the overall design. Will be just the top level activities. - * @param transitions A transitions from the design - * - */ - private void validateActivityTransitionRules(Set activities, Set transitions) { - validateTransitions(transitions); - ArrayList noInputTransition = new ArrayList(); //a list to hold the activities which have no input transition - ArrayList noOuputTransition = new ArrayList(); //a list to hold the activities which have no output transition - int numOfTopLevelActivities = activities.size(); + } - // All the branching activities and optional activities we find are stored in this list, so we can process them at the end. - // We don't want to process them straight away or the branch activity errors would be mixed up with the previous level's errors. - // We need the optional activities, as they may contain a branching activity. - ArrayList complexActivitiesToProcess = null; + /** + * Perform transition related validations. + * + * All activities with no input transitions are added to the vector noInputTransition. If the size + * of this list is greater than 1 (which violates the rule of having exactly one top level activity with no input + * transition), then a ValidationErrorDTO will be created for each activity with no input transition. Similarly, the + * same concept applies for activities with no output transition. + * + * @param activities + * A subset of the overall design. Will be just the top level activities. + * @param transitions + * A transitions from the design + * + */ + private void validateActivityTransitionRules(Set activities, Set transitions) { + validateTransitions(transitions); + ArrayList noInputTransition = new ArrayList(); // a list to hold the activities which have + // no input transition + ArrayList noOuputTransition = new ArrayList(); // a list to hold the activities which have + // no output transition + int numOfTopLevelActivities = activities.size(); - for (Activity activity : activities) { - if(activity.isFloatingActivity()) - break; - - checkActivityForTransition(activity, numOfTopLevelActivities); - - if (activity.getTransitionFrom() == null) { - noOuputTransition.add(activity); - } - if (activity.getTransitionTo() == null) { - noInputTransition.add(activity); - } - complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); - } + // All the branching activities and optional activities we find are stored in this list, so we can process them + // at the end. + // We don't want to process them straight away or the branch activity errors would be mixed up with the previous + // level's errors. + // We need the optional activities, as they may contain a branching activity. + ArrayList complexActivitiesToProcess = null; - if (numOfTopLevelActivities > 0) { - if (noInputTransition.size() == 0) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.INPUT_TRANSITION_ERROR_TYPE2_KEY))); - } + for (Activity activity : activities) { + if (activity.isFloatingActivity()) { + break; + } - if (noInputTransition.size() > 1) { + checkActivityForTransition(activity, numOfTopLevelActivities); - // put out an error for each activity, but skip the any activities that are the first activity in the branch as they shouldn't have an input transition. - for (Activity a : noInputTransition) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.INPUT_TRANSITION_ERROR_TYPE1_KEY), a.getActivityUIID())); - } - } + if (activity.getTransitionFrom() == null) { + noOuputTransition.add(activity); + } + if (activity.getTransitionTo() == null) { + noInputTransition.add(activity); + } + complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); + } - if (noOuputTransition.size() == 0) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_TYPE2_KEY))); - } + if (numOfTopLevelActivities > 0) { + if (noInputTransition.size() == 0) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.INPUT_TRANSITION_ERROR_TYPE2_KEY))); + } - if (noOuputTransition.size() > 1) { - //there is more than one activity with no output transitions - for (Activity a : noOuputTransition) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_TYPE1_KEY), a.getActivityUIID())); - } - } + if (noInputTransition.size() > 1) { + + // put out an error for each activity, but skip the any activities that are the first activity in the + // branch as they shouldn't have an input transition. + for (Activity a : noInputTransition) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.INPUT_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.INPUT_TRANSITION_ERROR_TYPE1_KEY), a.getActivityUIID())); } + } - processComplexActivitiesForTransitions(complexActivitiesToProcess); + if (noOuputTransition.size() == 0) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_TYPE2_KEY))); + } + if (noOuputTransition.size() > 1) { + // there is more than one activity with no output transitions + for (Activity a : noOuputTransition) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.OUTPUT_TRANSITION_ERROR_TYPE1_KEY), a.getActivityUIID())); + } + } } - private void processComplexActivitiesForTransitions(ArrayList complexActivitiesToProcess) { + processComplexActivitiesForTransitions(complexActivitiesToProcess); - if (complexActivitiesToProcess != null) { - for (ComplexActivity complex : complexActivitiesToProcess) { - checkTransitionsInComplexActivity(complex); - } - } + } + private void processComplexActivitiesForTransitions(ArrayList complexActivitiesToProcess) { + + if (complexActivitiesToProcess != null) { + for (ComplexActivity complex : complexActivitiesToProcess) { + checkTransitionsInComplexActivity(complex); + } } - private void checkTransitionsInComplexActivity(ComplexActivity complexActivity) { - // All the branching activities and optional activities we find are stored in this list, so we can process them at the end. - // We don't want to process them straight away or the branch activity errors would be mixed up with the previous level's errors. - // We need the optional activities, as they may contain a branching activity. - ArrayList complexActivitiesToProcess = null; + } - if (complexActivity.isBranchingActivity()) { - for (ComplexActivity sequence : (Set) complexActivity.getActivities()) { - for (Activity activity : (Set) sequence.getActivities()) { - checkActivityForTransition(activity, sequence.getActivities().size()); - complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); - } - } - } - else { - for (Activity activity : (Set) complexActivity.getActivities()) { - complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); - } - } + private void checkTransitionsInComplexActivity(ComplexActivity complexActivity) { + // All the branching activities and optional activities we find are stored in this list, so we can process them + // at the end. + // We don't want to process them straight away or the branch activity errors would be mixed up with the previous + // level's errors. + // We need the optional activities, as they may contain a branching activity. + ArrayList complexActivitiesToProcess = null; - processComplexActivitiesForTransitions(complexActivitiesToProcess); + if (complexActivity.isBranchingActivity()) { + for (ComplexActivity sequence : (Set) complexActivity.getActivities()) { + for (Activity activity : (Set) sequence.getActivities()) { + checkActivityForTransition(activity, sequence.getActivities().size()); + complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); + } + } + } else { + for (Activity activity : (Set) complexActivity.getActivities()) { + complexActivitiesToProcess = checkActivityForFurtherProcessing(complexActivitiesToProcess, activity); + } } - /** - * @param complexActivitiesToProcess - * @param activity - * @return - */ - private ArrayList checkActivityForFurtherProcessing(ArrayList complexActivitiesToProcess, - Activity activity) { - if (activity.isComplexActivity() && !activity.isParallelActivity() && !activity.isFloatingActivity()) { - if (complexActivitiesToProcess == null) { - complexActivitiesToProcess = new ArrayList(); - } - complexActivitiesToProcess.add((ComplexActivity) activity); - } - return complexActivitiesToProcess; + processComplexActivitiesForTransitions(complexActivitiesToProcess); + } + + /** + * @param complexActivitiesToProcess + * @param activity + * @return + */ + private ArrayList checkActivityForFurtherProcessing( + ArrayList complexActivitiesToProcess, Activity activity) { + if (activity.isComplexActivity() && !activity.isParallelActivity() && !activity.isFloatingActivity()) { + if (complexActivitiesToProcess == null) { + complexActivitiesToProcess = new ArrayList(); + } + complexActivitiesToProcess.add((ComplexActivity) activity); } + return complexActivitiesToProcess; + } - private boolean isFirstActivityInBranch(Activity a) { - ComplexActivity parentActivity = (ComplexActivity) a.getParentActivity(); - if (parentActivity == null || !parentActivity.isSequenceActivity()) { - return false; - } - else { - return parentActivity.getDefaultActivity() != null && parentActivity.getDefaultActivity().equals(a); - } + private boolean isFirstActivityInBranch(Activity a) { + ComplexActivity parentActivity = (ComplexActivity) a.getParentActivity(); + if (parentActivity == null || !parentActivity.isSequenceActivity()) { + return false; + } else { + return parentActivity.getDefaultActivity() != null && parentActivity.getDefaultActivity().equals(a); } + } - /** - * This method checks if each transition in the learning design has an activity - * before and after the transition. - * - * If there exists a transition which does not have an activity before or after it, - * the ValidationErrorDTO is added to the list of validation messages. - * @param transitions the set of transitions to iterate through and validate - */ - private void validateTransitions(Set transitions) { - Iterator i = transitions.iterator(); - while (i.hasNext()) { - Transition transition = (Transition) i.next(); - Activity fromActivity = transition.getFromActivity(); - Activity toActivity = transition.getToActivity(); - if (fromActivity == null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.TRANSITION_ERROR_KEY), transition.getTransitionUIID())); - } - else if (toActivity == null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.TRANSITION_ERROR_KEY), transition.getTransitionUIID())); - } + /** + * This method checks if each transition in the learning design has an activity before and after the transition. + * + * If there exists a transition which does not have an activity before or after it, the ValidationErrorDTO is added + * to the list of validation messages. + * + * @param transitions + * the set of transitions to iterate through and validate + */ + private void validateTransitions(Set transitions) { + Iterator i = transitions.iterator(); + while (i.hasNext()) { + Transition transition = (Transition) i.next(); + Activity fromActivity = transition.getFromActivity(); + Activity toActivity = transition.getToActivity(); + if (fromActivity == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.TRANSITION_ERROR_KEY), transition.getTransitionUIID())); + } else if (toActivity == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.TRANSITION_ERROR_KEY), transition.getTransitionUIID())); + } - } - } - /** - * For any learning design that has more than one activity then each activity should have at least an input - * or output transition. If there is only one activity in the learning design, then that activity should - * not have any transitions. - * This method will check if there is an activity that exists that has no transitions at all (if there is - * more than one activity in the learning design) - * @param activity The Activity to validate - * @param numOfActivities The number of activities in the learning design. - */ - private void checkActivityForTransition(Activity activity, int numOfActivities) { - //if one activity, then shouldn't have any transitions - Transition inputTransition = activity.getTransitionTo(); - Transition outputTransition = activity.getTransitionFrom(); + } - if (numOfActivities > 1) { - if (inputTransition == null && outputTransition == null && !isFirstActivityInBranch(activity)) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_KEY), activity.getActivityUIID())); - } - } - if (numOfActivities == 1) { - if (inputTransition != null || outputTransition != null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_KEY), activity.getActivityUIID())); - } + /** + * For any learning design that has more than one activity then each activity should have at least an input or + * output transition. If there is only one activity in the learning design, then that activity should not have any + * transitions. This method will check if there is an activity that exists that has no transitions at all (if there + * is more than one activity in the learning design) + * + * @param activity + * The Activity to validate + * @param numOfActivities + * The number of activities in the learning design. + */ + private void checkActivityForTransition(Activity activity, int numOfActivities) { + // if one activity, then shouldn't have any transitions + Transition inputTransition = activity.getTransitionTo(); + Transition outputTransition = activity.getTransitionFrom(); - } + if (numOfActivities > 1) { + if (inputTransition == null && outputTransition == null && !isFirstActivityInBranch(activity)) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_KEY), activity.getActivityUIID())); + } + } + if (numOfActivities == 1) { + if (inputTransition != null || outputTransition != null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.ACTIVITY_TRANSITION_ERROR_KEY), activity.getActivityUIID())); + } } - /** - * If grouping support type is set to GROUPING_SUPPORT_REQUIRED, - * then the activity is validated to ensure that the grouping exists. - * If grouping support type is set to GROUPING_SUPPORT_NONE - * then the activity is validated to ensure that the grouping does not exist. - * - * If any validation fails, the message will be added to the list of validation - * messages. - * - * @param activity - */ - private void checkIfGroupingRequired(Activity activity) { + } - Integer groupingSupportType = activity.getGroupingSupportType(); - if (groupingSupportType.intValue() == Grouping.GROUPING_SUPPORT_REQUIRED) { - //make sure activity has been assigned a grouping - Grouping grouping = activity.getGrouping(); - if (grouping == null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_REQUIRED_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.GROUPING_REQUIRED_ERROR_KEY), activity.getActivityUIID())); - } - } - else if (groupingSupportType.intValue() == Grouping.GROUPING_SUPPORT_NONE) { - Grouping grouping = activity.getGrouping(); - if (grouping != null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_NOT_REQUIRED_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.GROUPING_NOT_REQUIRED_ERROR_KEY), activity.getActivityUIID())); - } - } + /** + * If grouping support type is set to GROUPING_SUPPORT_REQUIRED, then the activity is validated to + * ensure that the grouping exists. If grouping support type is set to GROUPING_SUPPORT_NONE then the + * activity is validated to ensure that the grouping does not exist. + * + * If any validation fails, the message will be added to the list of validation messages. + * + * @param activity + */ + private void checkIfGroupingRequired(Activity activity) { + Integer groupingSupportType = activity.getGroupingSupportType(); + if (groupingSupportType.intValue() == Grouping.GROUPING_SUPPORT_REQUIRED) { + // make sure activity has been assigned a grouping + Grouping grouping = activity.getGrouping(); + if (grouping == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_REQUIRED_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.GROUPING_REQUIRED_ERROR_KEY), activity.getActivityUIID())); + } + } else if (groupingSupportType.intValue() == Grouping.GROUPING_SUPPORT_NONE) { + Grouping grouping = activity.getGrouping(); + if (grouping != null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_NOT_REQUIRED_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.GROUPING_NOT_REQUIRED_ERROR_KEY), activity.getActivityUIID())); + } } - /** - * If this activity is an OptionalActivity, then it must contain one or more - * activities. - * - * @param parentActivity - */ - private void validateOptionalActivity(Activity parentActivity) { + } - if (parentActivity.isOptionsActivity()) { - //get the child activities and check how many there are. - OptionsActivity optionsActivity = (OptionsActivity) parentActivity; - Set childActivities = optionsActivity.getActivities(); - int numOfChildActivities = childActivities.size(); - if (numOfChildActivities == 0) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.OPTIONAL_ACTIVITY_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.OPTIONAL_ACTIVITY_ERROR_KEY), optionsActivity.getActivityUIID())); - } + /** + * If this activity is an OptionalActivity, then it must contain one or more activities. + * + * @param parentActivity + */ + private void validateOptionalActivity(Activity parentActivity) { - } + if (parentActivity.isOptionsActivity()) { + // get the child activities and check how many there are. + OptionsActivity optionsActivity = (OptionsActivity) parentActivity; + Set childActivities = optionsActivity.getActivities(); + int numOfChildActivities = childActivities.size(); + if (numOfChildActivities == 0) { + errors + .add(new ValidationErrorDTO(ValidationErrorDTO.OPTIONAL_ACTIVITY_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.OPTIONAL_ACTIVITY_ERROR_KEY), optionsActivity + .getActivityUIID())); + } } - - /** - * If this activity is an FloatingActivity, then it must contain at least one activity and no more than the - * maximum activities value. - * - * @param parentActivity - */ - private void validateFloatingActivity(Activity parentActivity) { - if (parentActivity.isFloatingActivity()) { - //get the child activities and check how many there are. - FloatingActivity floatingActivity = (FloatingActivity) parentActivity; - Set childActivities = floatingActivity.getActivities(); - int numOfChildActivities = childActivities.size(); - // require at least one floating activity - if (numOfChildActivities == 0) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.FLOATING_ACTIVITY_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.FLOATING_ACTIVITY_ERROR_KEY), floatingActivity.getActivityUIID())); - } - // collection cannot exceed max limit - if (numOfChildActivities > floatingActivity.getMaxNumberOfActivities()) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.FLOATING_ACTIVITY_MAX_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.FLOATING_ACTIVITY_MAX_ERROR_KEY), floatingActivity.getActivityUIID())); - } - - - } + } + /** + * If this activity is an FloatingActivity, then it must contain at least one activity and no more than the maximum + * activities value. + * + * @param parentActivity + */ + private void validateFloatingActivity(Activity parentActivity) { + String[] args = new String[1]; + + if (parentActivity.isFloatingActivity()) { + // get the child activities and check how many there are. + FloatingActivity floatingActivity = (FloatingActivity) parentActivity; + Set childActivities = floatingActivity.getActivities(); + int numOfChildActivities = childActivities.size(); + // require at least one floating activity + if (numOfChildActivities == 0) { + errors + .add(new ValidationErrorDTO(ValidationErrorDTO.FLOATING_ACTIVITY_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.FLOATING_ACTIVITY_ERROR_KEY), floatingActivity + .getActivityUIID())); + } + // collection cannot exceed max limit + if (numOfChildActivities > floatingActivity.getMaxNumberOfActivitiesNotNull()) { + args[0] = floatingActivity.getMaxNumberOfActivities().toString(); + String errorMsg = messageService.getMessage(ValidationErrorDTO.FLOATING_ACTIVITY_MAX_ERROR_KEY, args); + errors.add(new ValidationErrorDTO(ValidationErrorDTO.FLOATING_ACTIVITY_MAX_ERROR_CODE, errorMsg, + floatingActivity.getActivityUIID())); + } + } - /** - * If this activity is an GroupingActivity, the number of groups in the grouping records is greater than 0 and - * the grouping has some groups, then the actual number of groups must no exceed the desired number of groups. - * If the desired number of groups is 0 then don't check the number of actual groups as there is no semantic limit - * to the number of groups. - * - * @param parentActivity - */ - private void validateGroupingActivity(Activity activity) { + } - if (activity.isGroupingActivity()) { - //get the child activities and check how many there are. - GroupingActivity groupingActivity = (GroupingActivity) activity; - Grouping grouping = groupingActivity.getCreateGrouping(); - if (grouping == null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_ACTIVITY_MISSING_GROUPING_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.GROUPING_ACTIVITY_MISSING_GROUPING_KEY), activity - .getActivityUIID())); - } - Integer numGroupsInteger = null; - if (grouping.isRandomGrouping()) { - RandomGrouping random = (RandomGrouping) grouping; - numGroupsInteger = random.getNumberOfGroups(); - } - else { - numGroupsInteger = grouping.getMaxNumberOfGroups(); - } - int maxNumGroups = numGroupsInteger == null ? 0 : numGroupsInteger.intValue(); - if (maxNumGroups > 0 && grouping.getGroups() != null && grouping.getGroups().size() > maxNumGroups) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_KEY), activity - .getActivityUIID())); - } - } + /** + * If this activity is an GroupingActivity, the number of groups in the grouping records is greater than 0 and the + * grouping has some groups, then the actual number of groups must no exceed the desired number of groups. If the + * desired number of groups is 0 then don't check the number of actual groups as there is no semantic limit to the + * number of groups. + * + * @param parentActivity + */ + private void validateGroupingActivity(Activity activity) { + if (activity.isGroupingActivity()) { + // get the child activities and check how many there are. + GroupingActivity groupingActivity = (GroupingActivity) activity; + Grouping grouping = groupingActivity.getCreateGrouping(); + if (grouping == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_ACTIVITY_MISSING_GROUPING_ERROR_CODE, + messageService.getMessage(ValidationErrorDTO.GROUPING_ACTIVITY_MISSING_GROUPING_KEY), activity + .getActivityUIID())); + } + Integer numGroupsInteger = null; + if (grouping.isRandomGrouping()) { + RandomGrouping random = (RandomGrouping) grouping; + numGroupsInteger = random.getNumberOfGroups(); + } else { + numGroupsInteger = grouping.getMaxNumberOfGroups(); + } + int maxNumGroups = numGroupsInteger == null ? 0 : numGroupsInteger.intValue(); + if (maxNumGroups > 0 && grouping.getGroups() != null && grouping.getGroups().size() > maxNumGroups) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_ERROR_CODE, + messageService.getMessage(ValidationErrorDTO.GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_KEY), + activity.getActivityUIID())); + } } - /** - * This method ensures that the order id of the optional activities - * start from 1, are sequential and do not contain any duplicates. - * It will iterate through the child activities of the OptionalActivity, - * and compare the current activity order id with the previous activity order id. - * The currentActivityId should be 1 greater than the previous activity order id. - * @param parentActivity - */ - private void validateOptionsActivityOrderId(Activity parentActivity) { - Integer thisActivityOrderId = null; - Integer previousActivityOrderId = null; - boolean validOrderId = true; - if (parentActivity.isOptionsActivity()) { - OptionsActivity optionsActivity = (OptionsActivity) parentActivity; - Set childActivities = optionsActivity.getActivities(); //childActivities should be sorted according to order id (using the activityOrderComparator) - Iterator i = childActivities.iterator(); - while (i.hasNext() && validOrderId) { - Activity childActivity = (Activity) i.next(); - thisActivityOrderId = childActivity.getOrderId(); - if (previousActivityOrderId != null) { - //compare the two numbers - if (thisActivityOrderId == null) { - validOrderId = false; - } - else if (thisActivityOrderId.longValue() != previousActivityOrderId.longValue() + 1) { - validOrderId = false; - } + } - } - else { - //this is the first activity, since the previousActivityId is null - if (thisActivityOrderId == null || thisActivityOrderId.longValue() != 1) { - validOrderId = false; - } - } - previousActivityOrderId = thisActivityOrderId; - } + /** + * This method ensures that the order id of the optional activities start from 1, are sequential and do not contain + * any duplicates. It will iterate through the child activities of the OptionalActivity, and compare the current + * activity order id with the previous activity order id. The currentActivityId should be 1 greater than the + * previous activity order id. + * + * @param parentActivity + */ + private void validateOptionsActivityOrderId(Activity parentActivity) { + Integer thisActivityOrderId = null; + Integer previousActivityOrderId = null; + boolean validOrderId = true; + if (parentActivity.isOptionsActivity()) { + OptionsActivity optionsActivity = (OptionsActivity) parentActivity; + Set childActivities = optionsActivity.getActivities(); // childActivities should be sorted according to + // order id (using the activityOrderComparator) + Iterator i = childActivities.iterator(); + while (i.hasNext() && validOrderId) { + Activity childActivity = (Activity) i.next(); + thisActivityOrderId = childActivity.getOrderId(); + if (previousActivityOrderId != null) { + // compare the two numbers + if (thisActivityOrderId == null) { + validOrderId = false; + } else if (thisActivityOrderId.longValue() != previousActivityOrderId.longValue() + 1) { + validOrderId = false; + } - if (!validOrderId) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_KEY), - optionsActivity.getActivityUIID())); - } - + } else { + // this is the first activity, since the previousActivityId is null + if (thisActivityOrderId == null || thisActivityOrderId.longValue() != 1) { + validOrderId = false; + } } - } + previousActivityOrderId = thisActivityOrderId; + } - /** - * If applyGrouping is set, then the grouping must exist - * @param activity - */ - private void validateGroupingIfGroupingIsApplied(Activity activity) { - if (activity.getApplyGrouping().booleanValue()) //if grouping is applied, ensure grouping exists - { - if (activity.getGrouping() == null) { - errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_SELECTED_ERROR_CODE, messageService - .getMessage(ValidationErrorDTO.GROUPING_SELECTED_ERROR_KEY), activity.getActivityUIID())); - } - } + if (!validOrderId) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_CODE, + messageService.getMessage(ValidationErrorDTO.OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_KEY), + optionsActivity.getActivityUIID())); + } } + } + + /** + * If applyGrouping is set, then the grouping must exist + * + * @param activity + */ + private void validateGroupingIfGroupingIsApplied(Activity activity) { + if (activity.getApplyGrouping().booleanValue()) // if grouping is applied, ensure grouping exists + { + if (activity.getGrouping() == null) { + errors.add(new ValidationErrorDTO(ValidationErrorDTO.GROUPING_SELECTED_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.GROUPING_SELECTED_ERROR_KEY), activity.getActivityUIID())); + } + } + + } } Index: lams_common/src/java/org/lamsfoundation/lams/localCommonContext.xml =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/localCommonContext.xml (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/localCommonContext.xml (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + org.hibernate.dialect.MySQLDialect + false + 5 + 20 + 1800 + 50 + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost/lams?zeroDateTimeBehavior=convertToNull&characterEncoding=utf8&autoReconnect=true + lams + lams + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost/lams?zeroDateTimeBehavior=convertToNull&characterEncoding=utf8&autoReconnect=true + lams + lams + + + + + + + + + + + + + + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost/lams?characterEncoding=utf8 + lams + lams + + + + + + + + + + + + classpath:org/lamsfoundation/lams/usermanagement/AuthenticationMethod.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/AuthenticationMethodType.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/Organisation.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/OrganisationState.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/OrganisationType.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/Role.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/Privilege.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/RolePrivilege.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/User.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/ForgotPasswordRequest.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/UserOrganisation.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/UserOrganisationCollapsed.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/UserOrganisationRole.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/Workspace.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/WorkspaceFolder.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.hbm.xml + classpath:org/lamsfoundation/lams/usermanagement/SupportedLocale.hbm.xml + + + classpath:org/lamsfoundation/lams/learningdesign/Activity.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/Group.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/Grouping.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/Competence.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/CompetenceMapping.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/LearningLibrary.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/Transition.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/License.hbm.xml + classpath:org/lamsfoundation/lams/learningdesign/ActivityEvaluation.hbm.xml + + + classpath:org/lamsfoundation/lams/lesson/LearnerProgress.hbm.xml + classpath:org/lamsfoundation/lams/lesson/Lesson.hbm.xml + + + classpath:org/lamsfoundation/lams/workspace/WorkspaceFolderContent.hbm.xml + + + classpath:org/lamsfoundation/lams/themes/CSSProperty.hbm.xml + classpath:org/lamsfoundation/lams/themes/CSSStyle.hbm.xml + classpath:org/lamsfoundation/lams/themes/CSSThemeVisualElement.hbm.xml + + + classpath:org/lamsfoundation/lams/notebook/model/NotebookEntry.hbm.xml + + + classpath:org/lamsfoundation/lams/events/Event.hbm.xml + classpath:org/lamsfoundation/lams/events/Subscription.hbm.xml + + + classpath:org/lamsfoundation/lams/config/ConfigurationItem.hbm.xml + classpath:org/lamsfoundation/lams/config/Registration.hbm.xml + + + classpath:org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml + classpath:org/lamsfoundation/lams/integration/ExtCourseClassMap.hbm.xml + classpath:org/lamsfoundation/lams/integration/ExtUserUseridMap.hbm.xml + classpath:org/lamsfoundation/lams/integration/ExtServerToolAdapterMap.hbm.xml + + + classpath:org/lamsfoundation/lams/planner/PedagogicalPlannerSequenceNode.hbm.xml + + + classpath:org/lamsfoundation/lams/gradebook/GradeBookUserActivity.hbm.xml + classpath:org/lamsfoundation/lams/gradebook/GradeBookUserLesson.hbm.xml + + classpath:org/lamsfoundation/lams/contentrepository/CrCredential.hbm.xml + classpath:org/lamsfoundation/lams/contentrepository/CrNode.hbm.xml + classpath:org/lamsfoundation/lams/contentrepository/CrNodeVersion.hbm.xml + classpath:org/lamsfoundation/lams/contentrepository/CrNodeVersionProperty.hbm.xml + classpath:org/lamsfoundation/lams/contentrepository/CrWorkspace.hbm.xml + classpath:org/lamsfoundation/lams/contentrepository/CrWorkspaceCredential.hbm.xml + + + + classpath*:org/lamsfoundation/lams/tool/**/*.hbm.xml + classpath*:org/lamsfoundation/lams/tool/**/model/*.hbm.xml + classpath*:org/lamsfoundation/lams/tool/**/persistence/*.hbm.xml + classpath*:org/lamsfoundation/lams/tool/**/pojos/*.hbm.xml + + + + + + + + + + + + + + + + + + + + + + true + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + + + + + + + + + + + + + + true + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + + + + + + + + + + + true + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED,+java.lang.Exception + PROPAGATION_REQUIRED,+java.lang.Exception + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + + + + + + + + org.springframework.scheduling.quartz.LocalDataSourceJobStore + org.quartz.impl.jdbcjobstore.StdJDBCDelegate + lams_qtz_ + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_SUPPORTS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 60 + + + + + jboss.cache:service=TreeCache + + + \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/tool/Tool.java =================================================================== diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/tool/Tool.java (.../Tool.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1) +++ lams_common/src/java/org/lamsfoundation/lams/tool/Tool.java (.../Tool.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -26,10 +26,12 @@ import java.io.Serializable; import java.util.Date; import java.util.Set; +import java.util.HashSet; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; +import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.tool.dto.AuthoringToolDTO; /** @@ -109,6 +111,9 @@ /** persistent field */ private Set activities; + + /** persistent field */ + private Set mappedServers; /** persistent field */ private Integer groupingSupportTypeId; @@ -174,6 +179,7 @@ this.languageFile = languageFile; this.supportsOutputs = supportsOutputs; this.extLmsId = extLmsId; + this.mappedServers = new HashSet(); } /** default constructor */ @@ -198,6 +204,7 @@ this.createDateTime = createDateTime; this.toolIdentifier = toolIdentifier; this.toolVersion = toolVersion; + this.mappedServers = new HashSet(); } /** @@ -630,4 +637,11 @@ this.pedagogicalPlannerUrl = pedagogicalPlannerUrl; } + public Set getMappedServers() { + return mappedServers; + } + + public void setMappedServers(Set mappedServers) { + this.mappedServers = mappedServers; + } } Index: lams_common/src/java/org/lamsfoundation/lams/tool/ToolAdapterContentManager.java =================================================================== diff -u -r61fc00e63f7f2e365c22da683adb3b52a1708834 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/tool/ToolAdapterContentManager.java (.../ToolAdapterContentManager.java) (revision 61fc00e63f7f2e365c22da683adb3b52a1708834) +++ lams_common/src/java/org/lamsfoundation/lams/tool/ToolAdapterContentManager.java (.../ToolAdapterContentManager.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,5 +1,6 @@ package org.lamsfoundation.lams.tool; +import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; /** @@ -35,4 +36,5 @@ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, String toVersion, String customCSV) throws ToolException; + } Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java =================================================================== diff -u -r542b83631b403e37429fce3bb928f2800c5cd9b8 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision 542b83631b403e37429fce3bb928f2800c5cd9b8) +++ lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -118,8 +118,8 @@ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#createToolSession(org.lamsfoundation.lams.usermanagement.User, * org.lamsfoundation.lams.learningdesign.Activity) */ - public ToolSession createToolSession(User learner, ToolActivity activity, Lesson lesson) - throws LamsToolServiceException { + public synchronized ToolSession createToolSession(User learner, ToolActivity activity, Lesson lesson) + throws LamsToolServiceException, DataIntegrityViolationException { // look for an existing applicable tool session // could be either a grouped (class group or standard group) or an individual. // more likely to be grouped (more tools work that way!) @@ -135,19 +135,8 @@ } toolSession = activity.createToolSessionForActivity(learner, lesson); - try { - toolSessionDAO.saveToolSession(toolSession); - } catch (DataIntegrityViolationException e) { - LamsCoreToolService.log - .error("There was an attempt to create two tool sessions with the same name.", e); - /* - * LDEV-1533: Two users tried to create a tool session with the same name. One of them was successful, - * the other got an error. The second one will now retry. This might create a loop; on the other hand - * the second attempt should be successful, since either the existing session will be retrieved or a - * session with a new name will be created. - */ - toolSession = createToolSession(learner, activity, lesson); - } + toolSessionDAO.saveToolSession(toolSession); + return toolSession; } Index: lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml (.../toolApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml (.../toolApplicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -51,11 +51,11 @@ - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED + PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED - PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED,readOnly
@@ -71,6 +71,7 @@ + PROPAGATION_REQUIRED PROPAGATION_REQUIRED,readOnly Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java =================================================================== diff -u -ra96564b8a5ecd0946a29e1dbd8fd101b92cdd873 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision a96564b8a5ecd0946a29e1dbd8fd101b92cdd873) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -106,12 +106,12 @@ private static IAuditService auditService; private IAuditService getAuditService() { - if (auditService == null) { + if (UserManagementService.auditService == null) { WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(HttpSessionManager .getInstance().getServletContext()); - auditService = (IAuditService) ctx.getBean("auditService"); + UserManagementService.auditService = (IAuditService) ctx.getBean("auditService"); } - return auditService; + return UserManagementService.auditService; } /** @@ -125,7 +125,7 @@ * Get i18n MessageService */ public MessageService getMessageService() { - return this.messageService; + return messageService; } public void setBaseDAO(IBaseDAO baseDAO) { @@ -159,24 +159,24 @@ log.debug(e); } } - + protected User saveUser(User user) { if (user != null) { // LDEV-2196 ensure names saved as UTF-8 try { - user.setFirstName(new String(user.getFirstName().getBytes(), "UTF-8")); - user.setLastName(new String(user.getLastName().getBytes(), "UTF-8")); + user.setFirstName(new String(user.getFirstName().getBytes(), "UTF-8")); + user.setLastName(new String(user.getLastName().getBytes(), "UTF-8")); } catch (UnsupportedEncodingException e) { log.error("Unsupported encoding...", e); } // create user if (user.getUserId() == null) { baseDAO.insertOrUpdate(user); // creating a workspace needs a userId - user = createWorkspaceForUser(user); - } + user = createWorkspaceForUser(user); + } // LDEV-2030 update workspace name if name changed Workspace workspace = user.getWorkspace(); - if (workspace != null && !StringUtils.equals(user.getFullName(), workspace.getName())){ + if (workspace != null && !StringUtils.equals(user.getFullName(), workspace.getName())) { workspace.setName(user.getFullName()); save(workspace); WorkspaceFolder folder = workspace.getDefaultFolder(); @@ -192,7 +192,7 @@ public void saveAll(Collection objects) { for (Object o : objects) { if (o instanceof User) { - baseDAO.insertOrUpdate((User) o); // creating a workspace needs + baseDAO.insertOrUpdate(o); // creating a workspace needs // a userId o = createWorkspaceForUser((User) o); } @@ -371,8 +371,9 @@ map.put("user.userId", user.getUserId()); map.put("organisation.organisationId", orgId); UserOrganisation userOrg = (UserOrganisation) baseDAO.findByProperties(UserOrganisation.class, map).get(0); - if (userOrg == null) + if (userOrg == null) { return null; + } Iterator i = userOrg.getUserOrganisationRoles().iterator(); while (i.hasNext()) { UserOrganisationRole userOrgRole = (UserOrganisationRole) i.next(); @@ -394,14 +395,16 @@ * @see org.lamsfoundation.lams.usermanagement.service.IUserManagementService#getUsersFromOrganisationByRole(java.lang.Integer, * java.lang.String) */ - public Vector getUsersFromOrganisationByRole(Integer organisationID, String roleName, boolean isFlashCall, boolean getUser) { + public Vector getUsersFromOrganisationByRole(Integer organisationID, String roleName, boolean isFlashCall, + boolean getUser) { Vector users = null; - if (isFlashCall) + if (isFlashCall) { users = new Vector(); - else if(getUser) - users = new Vector(); - else + } else if (getUser) { + users = new Vector(); + } else { users = new Vector(); + } Organisation organisation = (Organisation) baseDAO.find(Organisation.class, organisationID); if (organisation != null) { @@ -414,13 +417,15 @@ while (userOrganisationRoleIterator.hasNext()) { UserOrganisationRole userOrganisationRole = (UserOrganisationRole) userOrganisationRoleIterator .next(); - if (userOrganisationRole.getRole().getName().equals(roleName)) - if (isFlashCall && !getUser) - users.add(userOrganisation.getUser().getUserFlashDTO()); - else if(getUser) - users.add(userOrganisation.getUser()); - else - users.add(userOrganisation.getUser().getUserDTO()); + if (userOrganisationRole.getRole().getName().equals(roleName)) { + if (isFlashCall && !getUser) { + users.add(userOrganisation.getUser().getUserFlashDTO()); + } else if (getUser) { + users.add(userOrganisation.getUser()); + } else { + users.add(userOrganisation.getUser().getUserDTO()); + } + } } } } @@ -438,8 +443,9 @@ properties.put("userOrganisation.user.userId", userId); properties.put("userOrganisation.organisation.organisationId", orgId); properties.put("role.name", roleName); - if (baseDAO.findByProperties(UserOrganisationRole.class, properties).size() == 0) + if (baseDAO.findByProperties(UserOrganisationRole.class, properties).size() == 0) { return false; + } return true; } @@ -559,8 +565,9 @@ Organisation pOrg = organisation.getParentOrganisation(); // set parent's child orgs Set children = pOrg.getChildOrganisations(); - if (children == null) + if (children == null) { children = new HashSet(); + } children.add(organisation); pOrg.setChildOrganisations(children); // get course managers and give them staff role in this new @@ -585,8 +592,9 @@ // (i.e. if there are // several course managers). Set uos = organisation.getUserOrganisations(); - if (uos == null) + if (uos == null) { uos = new HashSet(); + } uos.add(uo); organisation.setUserOrganisations(uos); @@ -599,11 +607,13 @@ if (workspace != null) { workspace.setName(organisation.getName()); WorkspaceFolder defaultFolder = workspace.getDefaultFolder(); - if (defaultFolder != null) + if (defaultFolder != null) { defaultFolder.setName(organisation.getName()); + } WorkspaceFolder runSeqFolder = workspace.getDefaultRunSequencesFolder(); - if (runSeqFolder != null) + if (runSeqFolder != null) { runSeqFolder.setName(getRunSequencesFolderName(organisation.getName())); + } } } @@ -620,13 +630,15 @@ baseDAO.update(workspace); WorkspaceFolder defaultFolder = workspace.getDefaultFolder(); - if (defaultFolder != null) + if (defaultFolder != null) { defaultFolder.setName(organisation.getName()); + } baseDAO.update(defaultFolder); WorkspaceFolder runSeqFolder = workspace.getDefaultRunSequencesFolder(); - if (runSeqFolder != null) + if (runSeqFolder != null) { runSeqFolder.setName(getRunSequencesFolderName(organisation.getName())); + } baseDAO.update(runSeqFolder); } } @@ -636,12 +648,12 @@ // get i18n'd message according to server locale String[] tokenisedLocale = LanguageUtil.getDefaultLangCountry(); Locale serverLocale = new Locale(tokenisedLocale[0], tokenisedLocale[1]); - String runSeqName = messageService.getMessageSource().getMessage(SEQUENCES_FOLDER_NAME_KEY, - new Object[] { workspaceName }, serverLocale); + String runSeqName = messageService.getMessageSource().getMessage( + UserManagementService.SEQUENCES_FOLDER_NAME_KEY, new Object[] { workspaceName }, serverLocale); if (runSeqName != null && runSeqName.startsWith("???")) { - log.warn("Problem in the language file - can't find an entry for " + SEQUENCES_FOLDER_NAME_KEY - + ". Creating folder as \"run sequences\" "); + log.warn("Problem in the language file - can't find an entry for " + + UserManagementService.SEQUENCES_FOLDER_NAME_KEY + ". Creating folder as \"run sequences\" "); runSeqName = "run sequences"; } return runSeqName; @@ -847,8 +859,9 @@ // when a user gets these roles, they need a workspace if (role.getName().equals(Role.AUTHOR) || role.getName().equals(Role.AUTHOR_ADMIN) || role.getName().equals(Role.SYSADMIN)) { - if (user.getWorkspace() == null) + if (user.getWorkspace() == null) { createWorkspaceForUser(user); + } } } uo.setUserOrganisationRoles(uors); @@ -956,15 +969,17 @@ } public boolean hasRoleInOrganisation(User user, Integer roleId, Organisation organisation) { - if (roleDAO.getUserByOrganisationAndRole(user.getUserId(), roleId, organisation) != null) + if (roleDAO.getUserByOrganisationAndRole(user.getUserId(), roleId, organisation) != null) { return true; - else + } else { return false; + } } public void deleteChildUserOrganisations(User user, Organisation org) { - if (!org.getOrganisationType().getOrganisationTypeId().equals(OrganisationType.COURSE_TYPE)) + if (!org.getOrganisationType().getOrganisationTypeId().equals(OrganisationType.COURSE_TYPE)) { return; + } Set childOrgs = org.getChildOrganisations(); Iterator iter = childOrgs.iterator(); while (iter.hasNext()) { @@ -1000,47 +1015,49 @@ private Integer getRequestorId() { UserDTO userDTO = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); - return (userDTO != null ? userDTO.getUserID() : null); + return userDTO != null ? userDTO.getUserID() : null; } public boolean isUserGlobalGroupAdmin() { Integer rootOrgId = getRootOrganisation().getOrganisationId(); Integer requestorId = getRequestorId(); - return (requestorId != null ? isUserInRole(requestorId, rootOrgId, Role.GROUP_ADMIN) : false); + return requestorId != null ? isUserInRole(requestorId, rootOrgId, Role.GROUP_ADMIN) : false; } public boolean isUserSysAdmin() { Integer rootOrgId = getRootOrganisation().getOrganisationId(); Integer requestorId = getRequestorId(); - return (requestorId != null ? isUserInRole(requestorId, rootOrgId, Role.SYSADMIN) : false); + return requestorId != null ? isUserInRole(requestorId, rootOrgId, Role.SYSADMIN) : false; } public Integer getCountRoleForSystem(Integer roleId) { Integer count = roleDAO.getCountRoleForSystem(roleId); - if (count != null) + if (count != null) { return count; - else + } else { return new Integer(0); + } } public Integer getCountRoleForOrg(Integer orgId, Integer roleId) { Integer count = roleDAO.getCountRoleForOrg(roleId, orgId); - if (count != null) + if (count != null) { return count; - else + } else { return new Integer(0); + } } public CSSThemeVisualElement getDefaultFlashTheme() { String flashName = Configuration.get(ConfigurationKeys.DEFAULT_FLASH_THEME); List list = findByProperty(CSSThemeVisualElement.class, "name", flashName); - return (list != null ? (CSSThemeVisualElement) list.get(0) : null); + return list != null ? (CSSThemeVisualElement) list.get(0) : null; } public CSSThemeVisualElement getDefaultHtmlTheme() { String htmlName = Configuration.get(ConfigurationKeys.DEFAULT_HTML_THEME); List list = findByProperty(CSSThemeVisualElement.class, "name", htmlName); - return (list != null ? (CSSThemeVisualElement) list.get(0) : null); + return list != null ? (CSSThemeVisualElement) list.get(0) : null; } public void auditPasswordChanged(User user, String moduleName) { @@ -1072,7 +1089,7 @@ private Integer getFindIntegerResult(String query) { List list = baseDAO.find(query); if (list != null && list.size() > 0) { - return (Integer) list.get(0); + return ((Number) list.get(0)).intValue(); } return null; } @@ -1111,17 +1128,17 @@ public List searchUserSingleTerm(String term) { term = StringEscapeUtils.escapeSql(term); - String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" - + term + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" + term + + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + " and u.disabledFlag=0 order by u.login"; List list = baseDAO.find(query); return list; } public List searchUserSingleTerm(String term, Integer filteredOrgId) { term = StringEscapeUtils.escapeSql(term); - String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" - + term + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" + term + + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + " and u.disabledFlag=0 and u.userId not in (select uo.user.userId from UserOrganisation uo" + " where uo.organisation.organisationId=" + filteredOrgId + ") order by u.login"; List list = baseDAO.find(query); @@ -1147,8 +1164,8 @@ whereClause = " or uo.organisation.parentOrganisation.organisationId=" + orgId; } - String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" - + term + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + String query = "select u from User u where (u.login like '%" + term + "%' or u.firstName like '%" + term + + "%' or u.lastName like '%" + term + "%' or u.email like '%" + term + "%')" + " and u.disabledFlag=0 and u.userId in (select uo.user.userId from UserOrganisation uo" + " where uo.organisation.organisationId=" + orgId + whereClause + ") order by u.login"; List list = baseDAO.find(query); @@ -1180,16 +1197,16 @@ } public boolean canEditGroup(Integer userId, Integer orgId) { - if (isUserSysAdmin() || isUserGlobalGroupAdmin()) + if (isUserSysAdmin() || isUserGlobalGroupAdmin()) { return true; + } Organisation org = (Organisation) findById(Organisation.class, orgId); if (org != null) { Integer groupId = orgId; if (org.getOrganisationType().getOrganisationTypeId().equals(OrganisationType.CLASS_TYPE)) { groupId = org.getParentOrganisation().getOrganisationId(); } - return (isUserInRole(userId, groupId, Role.GROUP_ADMIN) || (isUserInRole(userId, groupId, - Role.GROUP_MANAGER))); + return isUserInRole(userId, groupId, Role.GROUP_ADMIN) || isUserInRole(userId, groupId, Role.GROUP_MANAGER); } return false; } Index: lams_common/src/java/org/lamsfoundation/lams/util/XMPPUtil.java =================================================================== diff -u -rea902e25fa390b0cf4a686c9e16d6551e66ee01f -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/util/XMPPUtil.java (.../XMPPUtil.java) (revision ea902e25fa390b0cf4a686c9e16d6551e66ee01f) +++ lams_common/src/java/org/lamsfoundation/lams/util/XMPPUtil.java (.../XMPPUtil.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -30,14 +30,19 @@ // using the lams userId as xmpp username and password. manager.createAccount(user.getUserID().toString(), user.getUserID().toString()); } + } catch (XMPPException e) { - if (e.getXMPPError().getCode() != 409) { - logger.error(e); - return null; - } // else conflict error, user already exists + if (e.getXMPPError().getCode() == 409) { // log and continue + if (logger.isDebugEnabled()) { + logger.debug(e + " : XMPP account with id = " + user.getUserID() + " already exists"); + } + }else{ + logger.error(e); + return null; + } } - return user.getUserID() + "@" + Configuration.get(ConfigurationKeys.XMPP_DOMAIN); + return user.getUserID() + "@" + Configuration.get(ConfigurationKeys.XMPP_DOMAIN); } /** @@ -85,9 +90,26 @@ return true; } catch (XMPPException e) { - logger.error(e); - logger.error(e.getXMPPError()); + // if we get a connection refused exception but the server is not configured correctly, just debug print + if (e.getXMPPError() != null && e.getXMPPError().getCode() == 502 && ( + Configuration.get(ConfigurationKeys.XMPP_DOMAIN).compareTo("") == 0 || + Configuration.get(ConfigurationKeys.XMPP_ADMIN).compareTo("") == 0 || + Configuration.get(ConfigurationKeys.XMPP_PASSWORD).compareTo("") == 0)) { + logger.debug(e); + } + // if we are recreating the same room (no error code) + else if(e.getMessage().compareTo("Creation failed - Missing acknowledge of room creation.") == 0){ + logger.debug(e); + } + // otherwise, we've got a problem + else{ + logger.error(e); + } + return false; + }catch (Exception e) { + logger.error(e); + return false; } } Index: lams_common/src/java/org/lamsfoundation/lams/web/session/SessionManager.java =================================================================== diff -u -r213c2e221c577adb9986040687a5119ecadaa6a6 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/web/session/SessionManager.java (.../SessionManager.java) (revision 213c2e221c577adb9986040687a5119ecadaa6a6) +++ lams_common/src/java/org/lamsfoundation/lams/web/session/SessionManager.java (.../SessionManager.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -23,7 +23,6 @@ /* $$Id$$ */ package org.lamsfoundation.lams.web.session; - import java.util.Enumeration; import java.util.Iterator; import java.util.Map; @@ -39,468 +38,513 @@ import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionContext; -import org.hibernate.id.UUIDHexGenerator; - import org.apache.log4j.Logger; +import org.hibernate.id.UUIDHexGenerator; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap; + /** * * @author Steve.Ni * * @version $Revision$ */ -public class SessionManager{ +public class SessionManager { - private static final Logger log = Logger.getLogger(SessionManager.class); - - //singleton - private static SessionManager sessionMgr; - //KEY: sessionId, each session will have an identified id. VALUE: SessionImpl instance, which contains - //true session key/value pairs. - private Map sessionContainer = new ConcurrentReaderHashMap(); - //Save current session id - private ThreadLocal currentSessionIdContainer = new ThreadLocal(); - - //The system monitoring thread instance - private Monitor monitor; - //The sleep time in seconds period to monitoring the thread. - //This attribute could be set in spring context.xml. - private short monitorPeriod = 20; - + private static final Logger log = Logger.getLogger(SessionManager.class); + + // singleton + private static SessionManager sessionMgr; + // KEY: sessionId, each session will have an identified id. VALUE: SessionImpl instance, which contains + // true session key/value pairs. + private Map sessionContainer = new ConcurrentReaderHashMap(); + // Save current session id + private ThreadLocal currentSessionIdContainer = new ThreadLocal(); + + // The system monitoring thread instance + private Monitor monitor; + // The sleep time in seconds period to monitoring the thread. + // This attribute could be set in spring context.xml. + private short monitorPeriod = 20; + + /** + * Get the singleton instance of this class. + * + * @return + */ + private static SessionManager getInstance() { + if (SessionManager.sessionMgr == null) { + SessionManager.log.error("init SessionManager failed"); + } + + return SessionManager.sessionMgr; + } + + /** + * Get system level HttpSession by current session id. + * + * @return HttpSession instanceof org.lamsfoundation.lams.systemsession.SessionManager#SessionImpl + */ + public static HttpSession getSession() { + String sessionId = (String) getInstance().currentSessionIdContainer.get(); + return getSession(sessionId); + } + + /** + * Get system session by given session id. + * + * @param sessionId + * @return system session. Return an null if the given sessionid can not map to an existed session. + */ + public static HttpSession getSession(String sessionId) { + if (sessionId == null) { + SessionManager.log.debug("Failed on finding current system session with null sessionId"); + return null; + } + return (HttpSession) getInstance().sessionContainer.get(sessionId); + + } + + static void createSession(String sessionId) { + // initialize a new one + HttpSession session = getInstance().new SessionImpl(sessionId); + getInstance().sessionContainer.put(sessionId, session); + } + + /** + * Return SessionVisitor of currentSessionId. An internal method, only + * available in package. + * + * @return + */ + static SessionVisitor getSessionVisitor() { + return (SessionVisitor) getSession(); + } + + /** + * An internal method, only available in package. + * + * @param currentSessionId + */ + static void setCurrentSessionId(String currentSessionId) { + getInstance().currentSessionIdContainer.set(currentSessionId); + } + + /** + * This class initialize method called by Spring framework. + */ + public void init() { + if (SessionManager.sessionMgr == null) { + // only start once + SessionManager.sessionMgr = this; + if (monitorPeriod > 0) { + monitor = new Monitor(); + monitor.start(); + } + } + } + + /** + * This class destroy method called by Spring framework. + */ + public void destroy() { + if (monitor != null) { + SessionManager.sessionMgr = null; + monitor.stop(); + monitor = null; + } + + } + + public short getMonitorPeriod() { + return monitorPeriod; + } + + public void setMonitorPeriod(short monitorPeriod) { + this.monitorPeriod = monitorPeriod; + } + + /** + * Start a session for current ServletRequest and SerlvetResponse. If session does not exist, then create a new + * session. If it exists, just using current session. + * + * @param req + * @param res + */ + public static void startSession(ServletRequest req, ServletResponse res) { + Cookie ssoCookie = findCookie((HttpServletRequest) req, SystemSessionFilter.SSO_SESSION_COOKIE); + if (ssoCookie == null) { + SessionManager.log.debug("==>Couldn't find the sso cookie"); + String value = (String) new UUIDHexGenerator().generate(null, null); + ssoCookie = createCookie((HttpServletResponse) res, SystemSessionFilter.SSO_SESSION_COOKIE, value); + SessionManager.log.debug("==>Created one - " + ssoCookie.getValue()); + } + Cookie cookie = findCookie((HttpServletRequest) req, SystemSessionFilter.SYS_SESSION_COOKIE); + String currentSessionId = null; + if (cookie != null) { + currentSessionId = cookie.getValue(); + Object obj = getSession(currentSessionId); + // if cookie exist, but session does not. This usually menas seesion expired. + // then delete the cookie first and set it null in order to create a new one + if (obj == null) { + createSession(currentSessionId); + // After changing cookie name to JSESSIONID, left cookie lifecycle management to Server + // removeCookie((HttpServletResponse) res,SystemSessionFilter.SYS_SESSION_COOKIE); + // cookie = null; + } + } + // can not be in else! + if (cookie == null) { + + // create new session and set it into cookie + currentSessionId = (String) new UUIDHexGenerator().generate(null, null); + createSession(currentSessionId); + // TODO remove this debugging - only put in to diagnose Ozgur's session problem + if (SessionManager.log.isDebugEnabled()) { + SessionManager.log.debug("SessionManager: cookie is null, generating a new session: " + + currentSessionId); + } + cookie = createCookie((HttpServletResponse) res, SystemSessionFilter.SYS_SESSION_COOKIE, currentSessionId); + } + + setCurrentSessionId(currentSessionId); + // reset session last access time + SessionVisitor sessionVisitor = getSessionVisitor(); + sessionVisitor.accessed(); + } + + /** + * This method will reset current session id, so programs can not use getSession() to get current + * session after this method is called. + */ + public static void endSession() { + setCurrentSessionId(null); + } + + /** + * Find a cookie by given cookie name from request. + * + * @param req + * @param name + * The cookie name + * @return The cookie of this name in the request, or null if not found. + */ + private static Cookie findCookie(HttpServletRequest req, String name) { + Cookie[] cookies = req.getCookies(); + if (cookies != null) { + for (int i = 0; i < cookies.length; i++) { + if (cookies[i].getName().equals(name)) { + return cookies[i]; + } + } + } + + return null; + } + + /** + * Remove cookie by given name from request + * + * @param res + * @param name + * @return the removed cookies + */ + private static Cookie removeCookie(HttpServletResponse res, String name) { + Cookie cookie = new Cookie(name, ""); + cookie.setPath("/"); + cookie.setMaxAge(0); + res.addCookie(cookie); + + return cookie; + } + + /** + * Create a new cookie for request. + * + * @param res + * @param name + * cookie name + * @param value + * cookie value + * @return the created cookie. + */ + private static Cookie createCookie(HttpServletResponse res, String name, String value) { + Cookie cookie = new Cookie(name, value); + cookie.setPath("/"); + cookie.setMaxAge(-1); + res.addCookie(cookie); + + return cookie; + } + + // ************************************************************************ + // SYSTEM SESSION MONITOR CLASS + // ************************************************************************ + class Monitor implements Runnable { + private static final String THREAD_NAME = "LAMS SYSTEM SESSION MONITOR"; + private Thread monitoringThread; + private boolean stopSign = false; + + public void start() { + monitoringThread = new Thread(this, Monitor.THREAD_NAME); + stopSign = false; + monitoringThread.start(); + } + + public void run() { + while (!stopSign) { + try { + // check whether session is expired + Iterator iter = sessionContainer.values().iterator(); + while (iter.hasNext()) { + SessionImpl session = (SessionImpl) iter.next(); + if (session.getMaxInactiveInterval() > 0) { + if (System.currentTimeMillis() - session.getLastAccessedTime() + - session.getMaxInactiveInterval() * 1000L > 0) { + session.invalidate(); + } + } + } + } catch (Throwable e) { + SessionManager.log.warn("Monitor thread exception: " + e); + } + if (!stopSign) { + try { + Thread.sleep(monitorPeriod * 1000L); + } catch (Exception e) { + // do nothing + } + } + } + } + + public void stop() { + + if (monitoringThread != null) { + stopSign = true; + monitoringThread.interrupt(); + try { + monitoringThread.join(); + } catch (InterruptedException ignore) { + SessionManager.log.error("Exception when interruptting Session Monitoring Thread"); + } + monitoringThread = null; + } + } + } + + // ************************************************************************ + // SYSTEM SESSION IMPLEMENTAION CLASS + // ************************************************************************ + class SessionImpl implements HttpSession, SessionVisitor { + + private String sessionId; + private long createTime; + private long accessTime; + private int timeout; + + private Map valueMap; + + public SessionImpl(String sessionId) { + this.sessionId = sessionId; + createTime = System.currentTimeMillis(); + accessTime = createTime; + timeout = Configuration.getAsInt(ConfigurationKeys.INACTIVE_TIME); + valueMap = new ConcurrentReaderHashMap(); + } + /** - * Get the singleton instance of this class. - * @return + * {@inheritDoc} */ - private static SessionManager getInstance(){ - if(sessionMgr == null) - log.error("init SessionManager failed"); - - return sessionMgr; + public long getCreationTime() { + return createTime; } + /** - * Get system level HttpSession by current session id. - * @return HttpSession instanceof org.lamsfoundation.lams.systemsession.SessionManager#SessionImpl + * {@inheritDoc} */ - public static HttpSession getSession(){ - String sessionId = (String) getInstance().currentSessionIdContainer.get(); - return getSession(sessionId); + public String getId() { + return sessionId; } + /** - * Get system session by given session id. - * @param sessionId - * @return system session. Return an null if the given sessionid can not map to an existed session. + * {@inheritDoc} */ - public static HttpSession getSession(String sessionId){ - if(sessionId == null){ - log.debug("Failed on finding current system session with null sessionId"); - return null; - } - return (HttpSession) getInstance().sessionContainer.get(sessionId); - + public long getLastAccessedTime() { + return accessTime; } - - static void createSession(String sessionId){ - //initialize a new one - HttpSession session = getInstance().new SessionImpl(sessionId); - getInstance().sessionContainer.put(sessionId,session); + + /** + * {@inheritDoc} + */ + public void setMaxInactiveInterval(int timeout) { + this.timeout = timeout; } - + /** - * Return SessionVisitor of currentSessionId. - * An internal method, only available in package. - * @return + * {@inheritDoc} */ - static SessionVisitor getSessionVisitor() { - return (SessionVisitor)getSession(); + public int getMaxInactiveInterval() { + return timeout; } + /** - * An internal method, only available in package. - * @param currentSessionId + * {@inheritDoc} */ - static void setCurrentSessionId(String currentSessionId) { - getInstance().currentSessionIdContainer.set(currentSessionId); + public Object getAttribute(String name) { + return valueMap.get(name); } + /** - * This class initialize method called by Spring framework. + * {@inheritDoc} */ - public void init(){ - if(sessionMgr == null){ - //only start once - sessionMgr = this; - if (monitorPeriod > 0){ - monitor = new Monitor(); - monitor.start(); - } + public Enumeration getAttributeNames() { + + return new Enumeration() { + Iterator iter = valueMap.keySet().iterator(); + + public boolean hasMoreElements() { + return iter.hasNext(); } + + public Object nextElement() { + return iter.next(); + } + + }; } + /** - * This class destroy method called by Spring framework. + * {@inheritDoc} */ - public void destroy(){ - if(monitor != null){ - sessionMgr = null; - monitor.stop(); - monitor = null; - } - + public void setAttribute(String name, Object value) { + if (value == null) { + removeAttribute(name); + } + + Object old = valueMap.put(name, value); + + fireBound(name, value); + + if (old != null) { + fireUnbound(name, old); + } } - - public short getMonitorPeriod() { - return monitorPeriod; + + /** + * {@inheritDoc} + */ + public void removeAttribute(String name) { + Object value = valueMap.remove(name); + if (value != null) { + fireUnbound(name, value); + } } - public void setMonitorPeriod(short monitorPeriod) { - this.monitorPeriod = monitorPeriod; - } /** - * Start a session for current ServletRequest and SerlvetResponse. - * If session does not exist, then create a new session. If it exists, just using current session. - * - * @param req - * @param res + * {@inheritDoc} */ - public static void startSession(ServletRequest req, ServletResponse res) { - Cookie ssoCookie = findCookie((HttpServletRequest) req,SystemSessionFilter.SSO_SESSION_COOKIE); - if(ssoCookie == null){ - log.debug("==>Couldn't find the sso cookie"); - String value = (String) new UUIDHexGenerator().generate(null,null); - ssoCookie = createCookie((HttpServletResponse) res,SystemSessionFilter.SSO_SESSION_COOKIE,value); - log.debug("==>Created one - "+ssoCookie.getValue()); - } - Cookie cookie = findCookie((HttpServletRequest) req,SystemSessionFilter.SYS_SESSION_COOKIE); - String currentSessionId = null; - if(cookie != null){ - currentSessionId = cookie.getValue(); - Object obj = getSession(currentSessionId); - //if cookie exist, but session does not. This usually menas seesion expired. - //then delete the cookie first and set it null in order to create a new one - if(obj == null){ - createSession(currentSessionId); - //After changing cookie name to JSESSIONID, left cookie lifecycle management to Server -// removeCookie((HttpServletResponse) res,SystemSessionFilter.SYS_SESSION_COOKIE); -// cookie = null; - } - } - //can not be in else! - if(cookie == null){ - // TODO remove this debugging - only put in to diagnose Ozgur's session problem - if ( log.isDebugEnabled() ) { - log.debug("SessionManager: cookie is null, generating a new session"); - } - //create new session and set it into cookie - currentSessionId = (String) new UUIDHexGenerator().generate(null,null); - createSession(currentSessionId); - cookie = createCookie((HttpServletResponse) res,SystemSessionFilter.SYS_SESSION_COOKIE,currentSessionId); - } - - setCurrentSessionId(currentSessionId); - //reset session last access time - SessionVisitor sessionVisitor = getSessionVisitor(); - sessionVisitor.accessed(); + public void invalidate() { + + Iterator iter = valueMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + fireUnbound((String) entry.getKey(), entry.getValue()); + } + valueMap.clear(); } + /** - * This method will reset current session id, so programs can not use getSession() to get current - * session after this method is called. + * Notice: This method always return false {@inheritDoc} */ - public static void endSession() { - setCurrentSessionId(null); + public boolean isNew() { + return false; } /** - * Find a cookie by given cookie name from request. - * - * @param req - * @param name The cookie name - * @return The cookie of this name in the request, or null if not found. + * {@inheritDoc} */ - private static Cookie findCookie(HttpServletRequest req, String name) - { - Cookie[] cookies = req.getCookies(); - if (cookies != null) { - for (int i = 0; i < cookies.length; i++) { - if (cookies[i].getName().equals(name)) { - return cookies[i]; - } - } - } - - return null; + public void putValue(String name, Object value) { + setAttribute(name, value); } + /** - * Remove cookie by given name from request - * @param res - * @param name - * @return the removed cookies + * {@inheritDoc} */ - private static Cookie removeCookie(HttpServletResponse res, String name){ - Cookie cookie = new Cookie(name, ""); - cookie.setPath("/"); - cookie.setMaxAge(0); - res.addCookie(cookie); - - return cookie; + public void removeValue(String name) { + removeAttribute(name); } + /** - * Create a new cookie for request. - * @param res - * @param name cookie name - * @param value cookie value - * @return the created cookie. + * {@inheritDoc} */ - private static Cookie createCookie(HttpServletResponse res, String name, String value){ - Cookie cookie = new Cookie(name, value); - cookie.setPath("/"); - cookie.setMaxAge(-1); - res.addCookie(cookie); - - return cookie; + public Object getValue(String name) { + return getAttribute(name); } - //************************************************************************ - // SYSTEM SESSION MONITOR CLASS - //************************************************************************ - class Monitor implements Runnable{ - private static final String THREAD_NAME = "LAMS SYSTEM SESSION MONITOR"; - private Thread monitoringThread; - private boolean stopSign = false; - public void start(){ - monitoringThread = new Thread(this,THREAD_NAME); - stopSign = false; - monitoringThread.start(); - } - public void run() { - while (!stopSign) { - try { - //check whether session is expired - Iterator iter = sessionContainer.values().iterator(); - while(iter.hasNext()) { - SessionImpl session = (SessionImpl) iter.next(); - if(session.getMaxInactiveInterval() > 0){ - if ((System.currentTimeMillis() - session.getLastAccessedTime() - - session.getMaxInactiveInterval() * 1000L) > 0) - session.invalidate(); - } - } - } catch (Throwable e) { - log.warn("Monitor thread exception: " + e); - } - if (!stopSign) { - try { - Thread.sleep(monitorPeriod * 1000L); - } catch (Exception e) { - // do nothing - } - } - } - } - - public void stop(){ - - if (monitoringThread != null){ - stopSign = true; - monitoringThread.interrupt(); - try{ - monitoringThread.join(); - }catch (InterruptedException ignore){ - log.error("Exception when interruptting Session Monitoring Thread"); - } - monitoringThread = null; - } - } + /** + * {@inheritDoc} + */ + public String[] getValueNames() { + return (String[]) valueMap.keySet().toArray(new String[valueMap.size()]); } - //************************************************************************ - // SYSTEM SESSION IMPLEMENTAION CLASS - //************************************************************************ - class SessionImpl implements HttpSession,SessionVisitor { - private String sessionId; - private long createTime; - private long accessTime; - private int timeout; - - private Map valueMap; - - public SessionImpl(String sessionId){ - this.sessionId = sessionId; - createTime = System.currentTimeMillis(); - accessTime = createTime; - timeout = Configuration.getAsInt(ConfigurationKeys.INACTIVE_TIME); - valueMap = new ConcurrentReaderHashMap(); - } - /** - * {@inheritDoc} - */ - public long getCreationTime() { - return createTime; - } - /** - * {@inheritDoc} - */ - public String getId() { - return sessionId; - } - /** - * {@inheritDoc} - */ - public long getLastAccessedTime() { - return accessTime; - } - /** - * {@inheritDoc} - */ - public void setMaxInactiveInterval(int timeout) { - this.timeout = timeout; - } - /** - * {@inheritDoc} - */ - public int getMaxInactiveInterval() { - return timeout; - } + /** + * {@inheritDoc} + */ + public HttpSessionContext getSessionContext() { + return new HttpSessionContext() { - /** - * {@inheritDoc} - */ - public Object getAttribute(String name) { - return valueMap.get(name); + public HttpSession getSession(String sessionId) { + return SessionImpl.this; } - /** - * {@inheritDoc} - */ - public Enumeration getAttributeNames() { - - return new Enumeration(){ - Iterator iter = valueMap.keySet().iterator(); - public boolean hasMoreElements() { - return iter.hasNext(); - } - public Object nextElement() { - return iter.next(); - } - - }; - } - /** - * {@inheritDoc} - */ - public void setAttribute(String name, Object value) { - if(value == null) - removeAttribute(name); - - Object old = valueMap.put(name, value); + public Enumeration getIds() { + return new Enumeration() { + public boolean hasMoreElements() { + return false; + } - fireBound(name, value); - - if (old != null){ - fireUnbound(name, old); + public Object nextElement() { + return null; } + }; } - /** - * {@inheritDoc} - */ - public void removeAttribute(String name) { - Object value = valueMap.remove(name); - if(value != null) - fireUnbound(name, value); - } - /** - * {@inheritDoc} - */ - public void invalidate() { - - Iterator iter = valueMap.entrySet().iterator(); - while(iter.hasNext()){ - Map.Entry entry = (Map.Entry) iter.next(); - fireUnbound((String) entry.getKey(),entry.getValue()); - } - valueMap.clear(); - } - /** - * Notice: This method always return false - * {@inheritDoc} - */ - public boolean isNew() { - return false; - } - - /** - * {@inheritDoc} - */ - public void putValue(String name, Object value) { - setAttribute(name,value); - } - /** - * {@inheritDoc} - */ - public void removeValue(String name) { - removeAttribute(name); - } - /** - * {@inheritDoc} - */ - public Object getValue(String name) { - return getAttribute(name); - } - /** - * {@inheritDoc} - */ - public String[] getValueNames() { - return (String[])valueMap.keySet().toArray(new String[valueMap.size()]); - } - /** - * {@inheritDoc} - */ - public HttpSessionContext getSessionContext() { - return new HttpSessionContext(){ - public HttpSession getSession(String sessionId) { - return SessionImpl.this; - } + }; + } - public Enumeration getIds() { - return new Enumeration(){ - public boolean hasMoreElements() { - return false; - } - public Object nextElement() { - return null; - } - }; - } - - }; - } - /** - * Notice: This method always return null. - * {@inheritDoc} - */ - public ServletContext getServletContext() { - return null; - } - //********************************************************** - // SessionVisitor method - public void accessed() { - accessTime = System.currentTimeMillis(); - } - //********************************************************** - // private method - private void fireUnbound(String name, Object value) { - if(value instanceof HttpSessionBindingListener){ - HttpSessionBindingEvent event = new HttpSessionBindingEvent(this,name,value); - ((HttpSessionBindingListener)value).valueUnbound(event); - } - } - private void fireBound(String name, Object value) { - if(value instanceof HttpSessionBindingListener){ - HttpSessionBindingEvent event = new HttpSessionBindingEvent(this,name,value); - ((HttpSessionBindingListener)value).valueBound(event); - } - } + /** + * Notice: This method always return null. {@inheritDoc} + */ + public ServletContext getServletContext() { + return null; + } + // ********************************************************** + // SessionVisitor method + public void accessed() { + accessTime = System.currentTimeMillis(); } + // ********************************************************** + // private method + private void fireUnbound(String name, Object value) { + if (value instanceof HttpSessionBindingListener) { + HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, name, value); + ((HttpSessionBindingListener) value).valueUnbound(event); + } + } + + private void fireBound(String name, Object value) { + if (value instanceof HttpSessionBindingListener) { + HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, name, value); + ((HttpSessionBindingListener) value).valueBound(event); + } + } + + } + } Index: lams_common/src/java/org/lamsfoundation/lams/web/session/SystemSessionFilter.java =================================================================== diff -u -rb4b6c208215b47ba45bf72fe26a43060a08711ef -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_common/src/java/org/lamsfoundation/lams/web/session/SystemSessionFilter.java (.../SystemSessionFilter.java) (revision b4b6c208215b47ba45bf72fe26a43060a08711ef) +++ lams_common/src/java/org/lamsfoundation/lams/web/session/SystemSessionFilter.java (.../SystemSessionFilter.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -34,47 +34,45 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - /** * - * @author Steve.Ni - * Create and manage system wide (across multiple webapps in JBOSS) session. - * - *

- * NOTICE: This filter must set before org.lamsfoundation.lams.web.filter.LocaleFilter - * in web.xml because LocaleFilter need get value from SystemSession . - * + * @author Steve.Ni Create and manage system wide (across multiple webapps in JBOSS) session. + * + *

+ * NOTICE: This filter must set before org.lamsfoundation.lams.web.filter.LocaleFilter in web.xml + * because LocaleFilter need get value from SystemSession . + * * @version $Revision$ */ public class SystemSessionFilter implements Filter { - - //The session name to trace shared session - public static final String SYS_SESSION_COOKIE = "JSESSIONID"; - - public static final String SSO_SESSION_COOKIE = "JSESSIONIDSSO"; - public void init(FilterConfig config) throws ServletException { - } + // The session name to trace shared session + public static final String SYS_SESSION_COOKIE = "JSESSIONID"; - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) - throws IOException, ServletException { + public static final String SSO_SESSION_COOKIE = "JSESSIONIDSSO"; - // Skip non-http request/response - if (!((req instanceof HttpServletRequest) && (res instanceof HttpServletResponse))){ - chain.doFilter(req, res); - return; - } - - SessionManager.startSession(req, res); - - //do following part of chain - chain.doFilter(req,res); - - SessionManager.endSession(); - - } + public void init(FilterConfig config) throws ServletException { + } - public void destroy() { - //do nothing + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, + ServletException { + + // Skip non-http request/response + if (!(req instanceof HttpServletRequest && res instanceof HttpServletResponse)) { + chain.doFilter(req, res); + return; } + + SessionManager.startSession(req, res); + + // do following part of chain + chain.doFilter(req, res); + + SessionManager.endSession(); + + } + + public void destroy() { + // do nothing + } } Index: lams_contentrepository/.classpath =================================================================== diff -u -r406cdd685f03fa39a0ea0c85bde60f7b268bc05d -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_contentrepository/.classpath (.../.classpath) (revision 406cdd685f03fa39a0ea0c85bde60f7b268bc05d) +++ lams_contentrepository/.classpath (.../.classpath) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -5,9 +5,12 @@ - - - + + + + + + - + Index: lams_contentrepository/conf/xdoclet/web-settings.xml =================================================================== diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_contentrepository/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e) +++ lams_contentrepository/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,10 +1,14 @@ + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/dao/hibernate/CredentialDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/dao/hibernate/CredentialDAO.java (.../CredentialDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/dao/hibernate/CredentialDAO.java (.../CredentialDAO.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -21,7 +21,7 @@ * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.contentrepository.dao.hibernate; import java.sql.Connection; @@ -40,135 +40,131 @@ import org.lamsfoundation.lams.contentrepository.dao.ICredentialDAO; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; - /** - * + * * Implements the credentials lookup using Hibernate. * * @author Fiona Malikoff - * + * */ public class CredentialDAO extends BaseDAO implements ICredentialDAO { - - protected Logger log = Logger.getLogger(CredentialDAO.class); - /** - * Checks whether a user can login to this workspace. The - * Credential must include the password. - */ - public boolean checkCredential(ICredentials credential, IWorkspace workspace) - throws RepositoryRuntimeException { - if ( log.isDebugEnabled() ) - log.debug("Checking credential "+credential+" for workspace "+workspace); + protected Logger log = Logger.getLogger(CredentialDAO.class); - if ( credential == null || workspace == null || workspace.getWorkspaceId() == null ) - return false; - - return checkCredentialInternal(credential, workspace); + /** + * Checks whether a user can login to this workspace. The Credential must include the password. + */ + public boolean checkCredential(ICredentials credential, IWorkspace workspace) throws RepositoryRuntimeException { + if (log.isDebugEnabled()) { + log.debug("Checking credential " + credential + " for workspace " + workspace); } - /** - * Checks whether a user can login to the repository. The - * Credential must include the password. - */ - public boolean checkCredential(ICredentials credential) - throws RepositoryRuntimeException { - if ( log.isDebugEnabled() ) - log.debug("Checking credential "+credential); + if (credential == null || workspace == null || workspace.getWorkspaceId() == null) { + return false; + } - if ( credential == null ) - return false; - - return checkCredentialInternal(credential, null); + return checkCredentialInternal(credential, workspace); + } + + /** + * Checks whether a user can login to the repository. The Credential must include the password. + */ + public boolean checkCredential(ICredentials credential) throws RepositoryRuntimeException { + if (log.isDebugEnabled()) { + log.debug("Checking credential " + credential); } - - /** - * Checks whether a user can login to the repository. The - * Credential must include the password. - * - * If workspace defined then checks workspace, otherwise just checks password - */ - public boolean checkCredentialInternal(ICredentials credential, IWorkspace workspace) - throws RepositoryRuntimeException { - // given the input credential, is there a credential matching - // in the database? why go to so much trouble in this code? I'm trying - // to avoid converting the char[] to a string. - // There will be better ways to do this, but this will do for starters - // until I get more familiar with Spring. - - boolean credentialMatched = false; - - Session hibernateSession = getSession(); - Connection conn = null; - PreparedStatement ps = null; - try { - conn = hibernateSession.connection(); - - StringBuffer buf = new StringBuffer(200); - buf.append("select count(*) num from lams_cr_credential c"); - if ( workspace != null ) { - buf.append(", lams_cr_workspace_credential wc "); - } - buf.append(" where c.name = \""); - buf.append(credential.getName()); - buf.append("\" and c.password = \""); - buf.append(credential.getPassword()); - buf.append("\""); - if ( workspace != null ) { - buf.append(" and wc.credential_id = c.credential_id "); - buf.append(" and wc.workspace_id = "); - buf.append(workspace.getWorkspaceId()); - } - - ps = conn.prepareStatement(buf.toString()); - ps.execute(); - ResultSet rs = ps.getResultSet(); - if ( rs.next() ) { - int val = rs.getInt("num"); - if ( val > 0 ) { - credentialMatched = true; - if ( val > 1 ) { - log.warn("More than one credential found for workspace " - +workspace.getWorkspaceId() - +" credential name " - +credential.getName()); - } - } - } - - } catch (HibernateException e) { - log.error("Hibernate exception occured during login. ",e); - throw new RepositoryRuntimeException("Unable to login due to internal error.", e); - } catch (SQLException se) { - log.error("SQL exception occured during login. ",se); - throw new RepositoryRuntimeException("Unable to login due to internal error.", se); - } finally { - if ( ps != null ) { - try { - ps.close(); - } catch (SQLException se2) { - log.error("SQL exception occured during login, while closing statement. ",se2); - throw new RepositoryRuntimeException("Unable to login due to internal error.", se2); - } - } + if (credential == null) { + return false; + } + + return checkCredentialInternal(credential, null); + } + + /** + * Checks whether a user can login to the repository. The Credential must include the password. + * + * If workspace defined then checks workspace, otherwise just checks password + */ + public boolean checkCredentialInternal(ICredentials credential, IWorkspace workspace) + throws RepositoryRuntimeException { + + // given the input credential, is there a credential matching + // in the database? why go to so much trouble in this code? I'm trying + // to avoid converting the char[] to a string. + // There will be better ways to do this, but this will do for starters + // until I get more familiar with Spring. + + boolean credentialMatched = false; + + Session hibernateSession = getSession(); + Connection conn = null; + PreparedStatement ps = null; + try { + conn = hibernateSession.connection(); + + StringBuffer buf = new StringBuffer(200); + buf.append("select count(*) num from lams_cr_credential c"); + if (workspace != null) { + buf.append(", lams_cr_workspace_credential wc "); + } + buf.append(" where c.name = \""); + buf.append(credential.getName()); + buf.append("\" and c.password = \""); + buf.append(credential.getPassword()); + buf.append("\""); + if (workspace != null) { + buf.append(" and wc.credential_id = c.credential_id "); + buf.append(" and wc.workspace_id = "); + buf.append(workspace.getWorkspaceId()); + } + + ps = conn.prepareStatement(buf.toString()); + ps.execute(); + ResultSet rs = ps.getResultSet(); + if (rs.next()) { + long val = rs.getLong("num"); + if (val > 0) { + credentialMatched = true; + if (val > 1) { + log.warn("More than one credential found for workspace " + workspace.getWorkspaceId() + + " credential name " + credential.getName()); + } } + } - return credentialMatched; + } catch (HibernateException e) { + log.error("Hibernate exception occured during login. ", e); + throw new RepositoryRuntimeException("Unable to login due to internal error.", e); + } catch (SQLException se) { + log.error("SQL exception occured during login. ", se); + throw new RepositoryRuntimeException("Unable to login due to internal error.", se); + } finally { + if (ps != null) { + try { + ps.close(); + } catch (SQLException se2) { + log.error("SQL exception occured during login, while closing statement. ", se2); + throw new RepositoryRuntimeException("Unable to login due to internal error.", se2); + } + } } - public CrCredential findByName(String name) { + return credentialMatched; + } - log.debug("Getting credential for name "+name); - - String queryString = "from CrCredential as c where c.name = ?"; - List credentials = getHibernateTemplate().find(queryString,name); - - if(credentials.size() == 0){ - log.debug("No credentials found"); - return null; - }else{ - return (CrCredential)credentials.get(0); - } + public CrCredential findByName(String name) { + + log.debug("Getting credential for name " + name); + + String queryString = "from CrCredential as c where c.name = ?"; + List credentials = getHibernateTemplate().find(queryString, name); + + if (credentials.size() == 0) { + log.debug("No credentials found"); + return null; + } else { + return (CrCredential) credentials.get(0); } + } } Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as =================================================================== diff -u -rdfee1d58158f373b48b3d116e10fba83ff3a9176 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision dfee1d58158f373b48b3d116e10fba83ff3a9176) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -767,6 +767,11 @@ _copyTypeID = COPY_TYPE_ID_AUTHORING; } + // Appending customCSV when it is available + if (_root.customCSV != null) { + design.customCSV = _root.customCSV; + } + //if the value is null, it is not included in the DTO if(_copyTypeID == COPY_TYPE_ID_RUN && !_editOverrideLock){ design.copyTypeID = COPY_TYPE_ID_AUTHORING; Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as =================================================================== diff -u -rac25d66ce383abbc5adee72515d310bdd4178097 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as (.../ToolActivity.as) (revision ac25d66ce383abbc5adee72515d310bdd4178097) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/ToolActivity.as (.../ToolActivity.as) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -48,6 +48,8 @@ private var _extLmsId:String; //external LMS id for tool adapter tools + private var _mappedServers:Array; // list of possible servers + //flags to tell UI which to disable private var _supportsContribute:Boolean; private var _supportsDefineLater:Boolean; @@ -158,6 +160,13 @@ _gradebookToolOutputDefinitionName = _activityEvaluations[0]; } } + + if(!StringUtils.isWDDXNull(dto.mappedServers)) { + _mappedServers = new Array(); + for (var i=0; iNative tool: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); } // Second condition true if it is an external tool adapter tool - else if (_root.extlmsid != undefined && _root.extlmsid !=null && _root.extlmsid == toolAct.extLmsId){ - Debugger.log('ToolActivity->External tool, external request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); + else if (_root.extlmsid != undefined && _root.extlmsid != null) { + var mappedServers:Array = toolAct.mappedServers; + var found:Boolean = false; + + Debugger.log('FOR LUKE mappedServers length ' + mappedServers.length, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); + + for (var j = 0; j < mappedServers.length; j++) { + Debugger.log('FOR LUKE mappedServers entry ' + mappedServers[j], Debugger.CRITICAL, 'updateLibraries', 'ToolView'); + if (String(mappedServers[j]) == _root.extlmsid) { + found = true; + } + } + + // If the extlmsid is not matched against one of the mapped servers, the tool is invalid + if (!found) { + Debugger.log('ToolActivity->External tool, internal request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); + continue; + } + // Else the extlmsid is matched against one of the mapped servers, the tool is valid + else { + Debugger.log('ToolActivity->External tool, external request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); + } } // Else is a tool adapter tool, but the call was not from external server, therefore disable - else{ + else { + Debugger.log('ToolActivity->External tool, internal request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); continue; - Debugger.log('ToolActivity->Externale tool, internal request: ' + toolAct.title, Debugger.CRITICAL, 'updateLibraries', 'ToolView'); } var templateActivity_mc = toolkitLibraries_sp.content.attachMovie("TemplateActivity","ta_"+learningLib.learningLibraryID,_depth++,{_activities:activities,_toolkitView:tkv, yPos:yPos}); @@ -285,10 +305,10 @@ yPos += templateActivity_mc._height; - } + } _toolkitLoaded = true; - - //toolkitLibraries_sp.refreshPane(); + + //toolkitLibraries_sp.refreshPane(); } @@ -313,15 +333,15 @@ public function hideToolTip():Void{ _tip.CloseToolTip(); - } - + } + /** *The currently selected Template Activity * * @param o The model object that is broadcasting an update. - */ + */ private function updateSelectedTemplateActivity(o:Observable):Void{ - //_global.breakpoint(); + //_global.breakpoint(); //gett the model var tkm = ToolkitModel(o); //set the states of TKActs @@ -443,7 +463,7 @@ */ public function getModel():ToolkitModel{ return ToolkitModel(model); - } + } /** * Returns the default controller for this view (ToolkitController). * Overrides AbstractView.defaultController() Index: lams_gradebook/.classpath =================================================================== diff -u -re074865bde063cd3ac9e531a90857d07de9d121c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_gradebook/.classpath (.../.classpath) (revision e074865bde063cd3ac9e531a90857d07de9d121c) +++ lams_gradebook/.classpath (.../.classpath) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -3,11 +3,9 @@ - - - - + + - + Index: lams_gradebook/conf/xdoclet/web-settings.xml =================================================================== diff -u -re074865bde063cd3ac9e531a90857d07de9d121c -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_gradebook/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision e074865bde063cd3ac9e531a90857d07de9d121c) +++ lams_gradebook/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -7,13 +7,17 @@ org.lamsfoundation.lams.gradebook.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/gradebook/gradebookApplicationContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/ExcelCell.java =================================================================== diff -u --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/ExcelCell.java (revision 0) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/ExcelCell.java (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -0,0 +1,54 @@ +/**************************************************************** + * Copyright (C) 2008 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.gradebook.dto; + +public class ExcelCell { + + private Object cellValue; + private Boolean isBold; + + public ExcelCell() { + } + + public ExcelCell(Object cellValue, Boolean isBold) { + this.cellValue = cellValue; + this.isBold = isBold; + } + + public Object getCellValue() { + return cellValue; + } + + public void setCellValue(Object cellValue) { + this.cellValue = cellValue; + } + + public Boolean getIsBold() { + return isBold; + } + + public void setIsBold(Boolean isBold) { + this.isBold = isBold; + } +} Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java =================================================================== diff -u -r12673718843ca7b082dee1c8a42e73f5fc6c805a -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java (.../GradebookGridRowDTO.java) (revision 12673718843ca7b082dee1c8a42e73f5fc6c805a) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java (.../GradebookGridRowDTO.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -23,19 +23,20 @@ /* $Id$ */ package org.lamsfoundation.lams.gradebook.dto; +import java.text.DecimalFormat; import java.util.ArrayList; import org.lamsfoundation.lams.gradebook.util.GBGridView; - -public abstract class GradebookGridRowDTO{ - + +public abstract class GradebookGridRowDTO { + public abstract ArrayList toStringArray(GBGridView view); - + public static final String CELL_EMPTY = "-"; - + // The id for a row, might be activityId, userId, lessonID etc public String id; - + // The name for the row, every gradebook row has some sort of name // Be it the user's name, the activity name, the lesson name etc public String rowName; @@ -52,6 +53,9 @@ // Average mark for the corresponding task public Double averageMark; + // Number of marks available where applicable + public Long marksAvailable; + /** * A shared function to convert milliseconds into a readable string * @@ -63,76 +67,139 @@ if (timeInMillis != null && timeInMillis > 1000) { long totalTimeInSeconds = timeInMillis / 1000; - long seconds = (totalTimeInSeconds >= 60 ? totalTimeInSeconds % 60 : totalTimeInSeconds); - long minutes = (totalTimeInSeconds = (totalTimeInSeconds / 60)) >= 60 ? totalTimeInSeconds % 60 : totalTimeInSeconds; - long hours = (totalTimeInSeconds = (totalTimeInSeconds / 60)) >= 24 ? totalTimeInSeconds % 24 : totalTimeInSeconds; - long days = (totalTimeInSeconds = (totalTimeInSeconds / 24)); + long seconds = (totalTimeInSeconds >= 60 ? totalTimeInSeconds % 60 : totalTimeInSeconds); + long minutes = (totalTimeInSeconds = (totalTimeInSeconds / 60)) >= 60 ? totalTimeInSeconds % 60 + : totalTimeInSeconds; + long hours = (totalTimeInSeconds = (totalTimeInSeconds / 60)) >= 24 ? totalTimeInSeconds % 24 + : totalTimeInSeconds; + long days = (totalTimeInSeconds = (totalTimeInSeconds / 24)); - if (days != 0 ) { sb.append("" + days + "d, "); } - if (hours != 0 ) { sb.append("" + hours + "h, "); } - if (minutes != 0 ) { sb.append("" + minutes + "m, "); } - if (seconds != 0 ) { sb.append("" + seconds + "s"); } + if (days != 0) { + sb.append("" + days + "d, "); + } + if (hours != 0) { + sb.append("" + hours + "h, "); + } + if (minutes != 0) { + sb.append("" + minutes + "m, "); + } + if (seconds != 0) { + sb.append("" + seconds + "s"); + } } - + if (sb.length() > 0) { return sb.toString(); } else { return null; } } + + protected String markToString() { + if (mark != null) { + if (marksAvailable != null) { + return "" + mark.toString() + "/" + marksAvailable.toString() + ""; + } else { + return mark.toString(); + } + } else { + if (marksAvailable != null) { + return "" + CELL_EMPTY + "/" + marksAvailable.toString() + ""; + } else { + + } + return CELL_EMPTY; + + } + } + + protected String averageMarkToString() { + if (averageMark != null) { + String avgStr = new DecimalFormat("###.00").format(averageMark); + if (marksAvailable != null) { + return avgStr + "/" + marksAvailable.toString(); + } else { + return avgStr; + } + } else { + return CELL_EMPTY; + } + } + protected String toItalic(String string) { return "" + string + ""; } public Long getTimeTaken() { - return timeTaken; + return timeTaken; } + public Long getTimeTakenSeconds() { + if (timeTaken != null) { + return timeTaken / 1000; + } else { + return null; + } + } + public void setTimeTaken(Long timeTaken) { - this.timeTaken = timeTaken; + this.timeTaken = timeTaken; } public Double getMark() { - return mark; + return mark; } public void setMark(Double mark) { - this.mark = mark; + this.mark = mark; } public String getId() { - return id; + return id; } public void setId(String id) { - this.id = id; + this.id = id; } public String getRowName() { - return rowName; + return rowName; } public void setRowName(String rowName) { - this.rowName = rowName; + this.rowName = rowName; } public Long getAverageTimeTaken() { - return averageTimeTaken; + return averageTimeTaken; } + + public Long getAverageTimeTakenSeconds() { + if (averageTimeTaken != null) { + return averageTimeTaken/1000; + } else { + return null; + } + } public void setAverageTimeTaken(Long averageTimeTaken) { - this.averageTimeTaken = averageTimeTaken; + this.averageTimeTaken = averageTimeTaken; } public Double getAverageMark() { - return averageMark; + return averageMark; } public void setAverageMark(Double averageMark) { - this.averageMark = averageMark; + this.averageMark = averageMark; } - - + + public Long getMarksAvailable() { + return marksAvailable; + } + + public void setMarksAvailable(Long marksAvailable) { + this.marksAvailable = marksAvailable; + } } - Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/gradebookApplicationContext.xml =================================================================== diff -u -rcd5cef591859ae82025af74f79cf6bf6f9151568 -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/gradebookApplicationContext.xml (.../gradebookApplicationContext.xml) (revision cd5cef591859ae82025af74f79cf6bf6f9151568) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/gradebookApplicationContext.xml (.../gradebookApplicationContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -1,35 +1,33 @@ - - - org.lamsfoundation.lams.gradebook.ApplicationResources + + + + + org.lamsfoundation.lams.gradebook.ApplicationResources + + - - + + + + + - + - - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED + PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED - PROPAGATION_REQUIRED + PROPAGATION_REQUIRED,readOnly Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java =================================================================== diff -u -r12673718843ca7b082dee1c8a42e73f5fc6c805a -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java (.../GradebookService.java) (revision 12673718843ca7b082dee1c8a42e73f5fc6c805a) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java (.../GradebookService.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077) @@ -26,33 +26,40 @@ import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeSet; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.dao.IBaseDAO; import org.lamsfoundation.lams.gradebook.GradebookUserActivity; import org.lamsfoundation.lams.gradebook.GradebookUserLesson; import org.lamsfoundation.lams.gradebook.dao.IGradebookDAO; +import org.lamsfoundation.lams.gradebook.dto.ExcelCell; import org.lamsfoundation.lams.gradebook.dto.GBActivityGridRowDTO; import org.lamsfoundation.lams.gradebook.dto.GBLessonGridRowDTO; import org.lamsfoundation.lams.gradebook.dto.GBUserGridRowDTO; import org.lamsfoundation.lams.gradebook.dto.GradebookGridRowDTO; import org.lamsfoundation.lams.gradebook.util.GBGridView; import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.learningdesign.ActivityEvaluation; import org.lamsfoundation.lams.learningdesign.CompetenceMapping; import org.lamsfoundation.lams.learningdesign.Group; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.ToolActivity; +import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO; import org.lamsfoundation.lams.lesson.CompletedActivityProgress; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.lesson.service.ILessonService; -import org.lamsfoundation.lams.monitoring.service.IMonitoringService; import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputDefinition; @@ -65,23 +72,32 @@ import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.util.MessageService; /** * @author lfoxton * * This service handles all gradebook-related service calls * */ +/** + * @author lfoxton + * + */ public class GradebookService implements IGradebookService { private static Logger logger = Logger.getLogger(GradebookService.class); + private static final ExcelCell[] EMPTY_ROW = new ExcelCell[4]; + // Services - private IMonitoringService monitoringService; private ILamsCoreToolService toolService; private IGradebookDAO gradebookDAO; private ILessonService lessonService; private IUserManagementService userService; + private IBaseDAO baseDAO; + private IActivityDAO activityDAO; + private MessageService messageService; /** * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getGBActivityRowsForLearner(org.lamsfoundation.lams.lesson.Lesson, @@ -95,8 +111,10 @@ List gradebookActivityDTOs = new ArrayList(); - LearnerProgress learnerProgress = monitoringService.getLearnerProgress(learner.getUserId(), lesson - .getLessonId()); + Map properties = new HashMap(); + properties.put("lesson", lesson); + properties.put("user", learner); + LearnerProgress learnerProgress = getLearnerProgress(lesson, learner); Set activities = (Set) lesson.getLearningDesign().getActivities(); @@ -109,7 +127,8 @@ * THIS IS A HACK to retrieve the first tool activity * manually so it can be cast as a ToolActivity - if it is one */ - Activity firstActivity = monitoringService.getActivityById(lesson.getLearningDesign().getFirstActivity() + + Activity firstActivity = activityDAO.getActivityByActivityId(lesson.getLearningDesign().getFirstActivity() .getActivityId()); if (firstActivity != null && firstActivity.isToolActivity() && firstActivity instanceof ToolActivity) { @@ -154,7 +173,7 @@ * THIS IS A HACK to retrieve the first tool activity * manually so it can be cast as a ToolActivity - if it is one */ - Activity firstActivity = monitoringService.getActivityById(lesson.getLearningDesign().getFirstActivity() + Activity firstActivity = activityDAO.getActivityByActivityId(lesson.getLearningDesign().getFirstActivity() .getActivityId()); if (firstActivity.isToolActivity() && firstActivity instanceof ToolActivity) { @@ -216,7 +235,7 @@ Set learners = null; if (groupId != null) { - Group group = (Group) userService.findById(Group.class, groupId); + Group group = (Group) baseDAO.find(Group.class, groupId); if (group != null) { learners = (Set) group.getUsers(); } else { @@ -232,12 +251,13 @@ gUserDTO.setRowName(learner.getLastName() + " " + learner.getFirstName()); gUserDTO.setId(learner.getUserId().toString()); + gUserDTO.setMarksAvailable(getTotalMarksAvailable(activity)); + GradebookUserActivity gradebookUserActivity = gradebookDAO.getGradebookUserDataForActivity(activity .getActivityId(), learner.getUserId()); // Set the progress - LearnerProgress learnerProgress = monitoringService.getLearnerProgress(learner.getUserId(), lesson - .getLessonId()); + LearnerProgress learnerProgress = getLearnerProgress(lesson, learner); gUserDTO.setStatus(getActivityStatusStr(learnerProgress, activity)); gUserDTO.setTimeTaken(getActivityDuration(learnerProgress, activity)); @@ -289,8 +309,7 @@ gradebookUserDTO.setRowName(learner.getLastName() + " " + learner.getFirstName()); // Setting the status and time taken for the user's lesson - LearnerProgress learnerProgress = monitoringService.getLearnerProgress(learner.getUserId(), lesson - .getLessonId()); + LearnerProgress learnerProgress = getLearnerProgress(lesson, learner); gradebookUserDTO.setStatus(getLessonStatusStr(learnerProgress)); if (learnerProgress != null) { if (learnerProgress.getStartDate() != null && learnerProgress.getFinishDate() != null) { @@ -315,6 +334,36 @@ } /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getGradebookUserLesson(java.lang.Long, + * java.lang.Integer) + */ + public GradebookUserLesson getGradebookUserLesson(Long lessonID, Integer userID) { + return gradebookDAO.getGradebookUserDataForLesson(lessonID, userID); + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getGradebookUserActivity(java.lang.Long, + * java.lang.Integer) + */ + public GradebookUserActivity getGradebookUserActivity(Long activityID, Integer userID) { + return gradebookDAO.getGradebookUserDataForActivity(activityID, userID); + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getAverageMarkForActivity(java.lang.Long) + */ + public Double getAverageMarkForActivity(Long activityID) { + return gradebookDAO.getAverageMarkForActivity(activityID); + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getAverageMarkForLesson(java.lang.Long) + */ + public Double getAverageMarkForLesson(Long lessonID) { + return gradebookDAO.getAverageMarkForLesson(lessonID); + } + + /** * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#updateUserLessonGradebookMark(org.lamsfoundation.lams.lesson.Lesson, * org.lamsfoundation.lams.usermanagement.User, java.lang.Double) */ @@ -336,7 +385,8 @@ * org.lamsfoundation.lams.usermanagement.User, * org.lamsfoundation.lams.learningdesign.Activity, java.lang.Double) */ - public void updateUserActivityGradebookMark(Lesson lesson, User learner, Activity activity, Double mark) { + public void updateUserActivityGradebookMark(Lesson lesson, User learner, Activity activity, Double mark, + Boolean markedInGradebook) { if (lesson != null && activity != null && learner != null && activity.isToolActivity()) { // First, update the mark for the activity @@ -348,6 +398,7 @@ } gradebookUserActivity.setMark(mark); + gradebookUserActivity.setMarkedInGradebook(markedInGradebook); gradebookDAO.insertOrUpdate(gradebookUserActivity); // Now update the lesson mark @@ -413,11 +464,13 @@ for (Lesson lesson : lessons) { + boolean marksReleased = lesson.getMarksReleased() != null && lesson.getMarksReleased(); + // Dont include lesson in list if the user doesnt have permission if (!(view == GBGridView.MON_COURSE && (lesson.getLessonClass().isStaffMember(user) || userService.isUserInRole(user .getUserId(), organisation.getOrganisationId(), Role.GROUP_MANAGER)) || view == GBGridView.LRN_COURSE - && lesson.getAllLearners().contains(user) && lesson.getMarksReleased())) { + && lesson.getAllLearners().contains(user) && marksReleased)) { continue; } @@ -449,8 +502,7 @@ lessonRow.setFeedback(gbLesson.getFeedback()); } - LearnerProgress learnerProgress = monitoringService.getLearnerProgress(user.getUserId(), lesson - .getLessonId()); + LearnerProgress learnerProgress = getLearnerProgress(lesson, user); lessonRow.setStatus(getLessonStatusStr(learnerProgress)); if (learnerProgress != null) { if (learnerProgress.getStartDate() != null && learnerProgress.getFinishDate() != null) { @@ -465,7 +517,7 @@ if (lesson.getOrganisation().getOrganisationId() != organisation.getOrganisationId()) { lessonRow.setSubGroup(lesson.getOrganisation().getName()); } else { - lessonRow.setSubGroup("-"); + lessonRow.setSubGroup(""); } lessonRows.add(lessonRow); @@ -480,6 +532,238 @@ return lessonRows; } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getActivityViewDataForExcel(org.lamsfoundation.lams.lesson.Lesson) + */ + @SuppressWarnings("unchecked") + public ExcelCell[][] getActivityViewDataForExcel(Lesson lesson) { + ExcelCell[][] data = null; + if (lesson != null) { + + Set activities = (Set) lesson.getLearningDesign().getActivities(); + + Activity firstActivity = activityDAO.getActivityByActivityId(lesson.getLearningDesign().getFirstActivity() + .getActivityId()); + + HashMap> activityViewMap = new HashMap>(); + + if (firstActivity != null && firstActivity.isToolActivity() && firstActivity instanceof ToolActivity) { + + List userRows = getGBUserRowsForActivity(lesson, (ToolActivity) firstActivity, null); + activityViewMap.put(firstActivity, userRows); + } + + SortedSet sortedActivities = new TreeSet(activities); + + for (Activity activity : sortedActivities) { + if (activity.getActivityId().longValue() != firstActivity.getActivityId().longValue() + && activity instanceof ToolActivity) { + + List userRows = getGBUserRowsForActivity(lesson, (ToolActivity) activity, null); + activityViewMap.put(activity, userRows); + } + } + + List rowList = new LinkedList(); + + for (Activity act : activityViewMap.keySet()) { + + ExcelCell[] activityTitleRow = new ExcelCell[4]; + activityTitleRow[0] = new ExcelCell(act.getTitle(), true); + rowList.add(activityTitleRow); + ExcelCell[] titleRow = new ExcelCell[4]; + titleRow[0] = new ExcelCell(getMessage("gradebook.export.user"), true); + titleRow[1] = new ExcelCell(getMessage("gradebook.export.time.taken.seconds"), true); + titleRow[2] = new ExcelCell(getMessage("gradebook.export.outputs"), true); + titleRow[3] = new ExcelCell(getMessage("gradebook.columntitle.mark"), true); + rowList.add(titleRow); + + // Get the rest of the data + List userRows = activityViewMap.get(act); + for (GBUserGridRowDTO userRow : userRows) { + ExcelCell[] userDataRow = new ExcelCell[4]; + + userDataRow[0] = new ExcelCell(userRow.getRowName(), false); + userDataRow[1] = new ExcelCell(userRow.getTimeTakenSeconds(), false); + userDataRow[2] = new ExcelCell(userRow.getOutput(), false); + userDataRow[3] = new ExcelCell(userRow.getMark(), false); + rowList.add(userDataRow); + } + + rowList.add(EMPTY_ROW); + } + + data = rowList.toArray(new ExcelCell[][] {}); + + } + return data; + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getUserViewDataForExcel(org.lamsfoundation.lams.lesson.Lesson) + */ + @SuppressWarnings("unchecked") + public ExcelCell[][] getUserViewDataForExcel(Lesson lesson) { + ExcelCell[][] data = null; + if (lesson != null) { + + Set learners = (Set) lesson.getAllLearners(); + + List rowList = new LinkedList(); + for (User learner : learners) { + List activityRows = getGBActivityRowsForLearner(lesson, learner); + + ExcelCell[] activityTitleRow = new ExcelCell[4]; + activityTitleRow[0] = new ExcelCell(learner.getFullName(), true); + rowList.add(activityTitleRow); + + ExcelCell[] titleRow = new ExcelCell[4]; + titleRow[0] = new ExcelCell(getMessage("gradebook.export.activity"), true); + titleRow[1] = new ExcelCell(getMessage("gradebook.export.time.taken.seconds"), true); + titleRow[2] = new ExcelCell(getMessage("gradebook.export.outputs"), true); + titleRow[3] = new ExcelCell(getMessage("gradebook.columntitle.mark"), true); + rowList.add(titleRow); + + Iterator it = activityRows.iterator(); + while (it.hasNext()) { + GBActivityGridRowDTO activityRow = (GBActivityGridRowDTO) it.next(); + ExcelCell[] activityDataRow = new ExcelCell[4]; + activityDataRow[0] = new ExcelCell(activityRow.getRowName(), false); + activityDataRow[1] = new ExcelCell(activityRow.getTimeTakenSeconds(), false); + activityDataRow[2] = new ExcelCell(activityRow.getOutput(), false); + activityDataRow[3] = new ExcelCell(activityRow.getMark(), false); + rowList.add(activityDataRow); + } + + rowList.add(EMPTY_ROW); + } + + data = rowList.toArray(new ExcelCell[][] {}); + + } + return data; + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getSummaryDataForExcel(org.lamsfoundation.lams.lesson.Lesson) + */ + @SuppressWarnings("unchecked") + public ExcelCell[][] getSummaryDataForExcel(Lesson lesson) { + ExcelCell[][] data = null; + if (lesson != null) { + + // The entire data list + List rowList = new LinkedList(); + + // Adding the lesson average data to the summary ------------------- + ExcelCell[] lessonAverageMark = new ExcelCell[2]; + lessonAverageMark[0] = new ExcelCell(getMessage("gradebook.export.average.lesson.mark"), true); + lessonAverageMark[1] = new ExcelCell(getAverageMarkForLesson(lesson.getLessonId()), false); + rowList.add(lessonAverageMark); + + ExcelCell[] lessonAverageTimeTaken = new ExcelCell[2]; + lessonAverageTimeTaken[0] = new ExcelCell(getMessage("gradebook.export.average.lesson.time.taken"), true); + lessonAverageTimeTaken[1] = new ExcelCell(gradebookDAO.getAverageDurationLesson(lesson.getLessonId()), false); + rowList.add(lessonAverageTimeTaken); + rowList.add(EMPTY_ROW); + //------------------------------------------------------------------ + + + // Adding the activity average data to the summary ----------------- + List activityRows = getGBActivityRowsForLesson(lesson); + ExcelCell[] activityAverageTitle = new ExcelCell[1]; + activityAverageTitle[0] = new ExcelCell(getMessage("gradebook.export.activities"), true); + rowList.add(activityAverageTitle); + + // Setting up the activity summary table + ExcelCell[] activityAverageRow = new ExcelCell[4]; + activityAverageRow[0] = new ExcelCell(getMessage("gradebook.export.activity"), true); + activityAverageRow[1] = new ExcelCell(getMessage("gradebook.columntitle.competences"), true); + activityAverageRow[2] = new ExcelCell(getMessage("gradebook.export.average.time.taken.seconds"), true); + activityAverageRow[3] = new ExcelCell(getMessage("gradebook.columntitle.averageMark"), true); + rowList.add(activityAverageRow); + + Iterator it = activityRows.iterator(); + while (it.hasNext()) { + GBActivityGridRowDTO activityRow = (GBActivityGridRowDTO)it.next(); + // Add the activity average data + ExcelCell[] activityDataRow = new ExcelCell[4]; + activityDataRow[0] = new ExcelCell(activityRow.getRowName(), false); + activityDataRow[1] = new ExcelCell(activityRow.getCompetences(), false); + activityDataRow[2] = new ExcelCell(activityRow.getAverageTimeTakenSeconds(), false); + activityDataRow[3] = new ExcelCell(activityRow.getAverageMark(), false); + rowList.add(activityDataRow); + } + rowList.add(EMPTY_ROW); + //------------------------------------------------------------------ + + + // Adding the user lesson marks to the summary---------------------- + ExcelCell[] userMarksTitle = new ExcelCell[1]; + userMarksTitle[0] = new ExcelCell(getMessage("gradebook.export.total.marks.for.lesson"), true); + rowList.add(userMarksTitle); + + // Fetching the user data + ArrayList userRows = getGBUserRowsForLesson(lesson); + + // Setting up the user marks table + ExcelCell[] userTitleRow = new ExcelCell[3]; + userTitleRow[0] = new ExcelCell(getMessage("gradebook.export.user"), true); + userTitleRow[1] = new ExcelCell(getMessage("gradebook.export.time.taken.seconds"), true); + userTitleRow[2] = new ExcelCell(getMessage("gradebook.export.total.mark"), true); + rowList.add(userTitleRow); + + for (GBUserGridRowDTO userRow : userRows) { + // Adding the user data for the lesson + ExcelCell[] userDataRow = new ExcelCell[3]; + userDataRow[0] = new ExcelCell(userRow.getRowName(), false); + userDataRow[1] = new ExcelCell(userRow.getTimeTakenSeconds(), false); + userDataRow[2] = new ExcelCell(userRow.getMark(), false); + rowList.add(userDataRow); + } + //------------------------------------------------------------------ + + data = rowList.toArray(new ExcelCell[][] {}); + + } + return data; + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#updateActivityMark(java.lang.Double, + * java.lang.String, java.lang.Integer, java.lang.Long) + */ + public void updateActivityMark(Double mark, String feedback, Integer userID, Long toolSessionID, + Boolean markedInGradebook) { + ToolSession toolSession = toolService.getToolSessionById(toolSessionID); + User learner = (User) userService.findById(User.class, userID); + if (learner != null && toolSession != null) { + ToolActivity activity = toolSession.getToolActivity(); + GradebookUserActivity gradebookUserActivity = getGradebookUserActivity(activity.getActivityId(), userID); + + // If gradebook user activity is null, save the mark and feedback + if (gradebookUserActivity == null || !gradebookUserActivity.getMarkedInGradebook()) { + updateUserActivityGradebookMark(toolSession.getLesson(), learner, activity, mark, markedInGradebook); + } + + } + } + + /** + * @see org.lamsfoundation.lams.gradebook.service.IGradebookService#getActivityById(java.lang.Long) + */ + public Activity getActivityById(Long activityID) { + return activityDAO.getActivityByActivityId(activityID); + } + + /** + * Gets the internationalised date + * + * @param user + * @param date + * @return + */ private String getLocaleDateString(User user, Date date) { if (user == null || date == null) { return null; @@ -521,20 +805,25 @@ if (groupName != null && groupId != null) { gactivityDTO.setGroupId(groupId); gactivityDTO.setRowName(activity.getTitle() + " (" + groupName + ")"); - + // Need to make the id unique, so appending the group id for this row gactivityDTO.setId(activity.getActivityId().toString() + "_" + groupId.toString()); - + // Setting averages for group - gactivityDTO.setAverageMark(gradebookDAO.getAverageMarkForGroupedActivity(activity.getActivityId(), groupId)); - gactivityDTO.setAverageTimeTaken(gradebookDAO.getAverageDurationForGroupedActivity(activity.getActivityId(), groupId)); - + gactivityDTO.setAverageMark(gradebookDAO + .getAverageMarkForGroupedActivity(activity.getActivityId(), groupId)); + gactivityDTO.setAverageTimeTaken(gradebookDAO.getAverageDurationForGroupedActivity( + activity.getActivityId(), groupId)); + } else { // Setting averages for lesson gactivityDTO.setAverageMark(gradebookDAO.getAverageMarkForActivity(activity.getActivityId())); gactivityDTO.setAverageTimeTaken(gradebookDAO.getAverageDurationForActivity(activity.getActivityId())); } + // Set the possible marks if applicable + gactivityDTO.setMarksAvailable(this.getTotalMarksAvailable(activity)); + String monitorUrl = Configuration.get(ConfigurationKeys.SERVER_URL) + activity.getTool().getMonitorUrl() + "?" + AttributeNames.PARAM_CONTENT_FOLDER_ID + "=" + lesson.getLearningDesign().getContentFolderID() + "&" + AttributeNames.PARAM_TOOL_CONTENT_ID + "=" + activity.getToolContentId(); @@ -585,6 +874,9 @@ } } + // Set the possible marks if applicable + gactivityDTO.setMarksAvailable(this.getTotalMarksAvailable(activity)); + GradebookUserActivity gradebookActivity = gradebookDAO.getGradebookUserDataForActivity( activity.getActivityId(), learner.getUserId()); if (gradebookActivity != null) { @@ -727,9 +1019,8 @@ if (toolOutput != null && toolOutput.getValue().getType() != OutputType.OUTPUT_COMPLEX) { toolOutputs.add(toolOutput); - toolOutputsStr += ""; + toolOutputsStr += "
"; noOutputs = false; } @@ -739,31 +1030,84 @@ + toolAct.getActivityId() + ", continuing for other activities", e); } } - toolOutputsStr += ""; + //toolOutputsStr += ""; } } // Fix up outputs html if there are not outputs available if (noOutputs) { toolOutputsStr = "-"; - } else { - toolOutputsStr = "