xlawrence    2005/05/09 14:49:16 CEST

  Modified files:
    calClient/conf       hibernate.cfg.xml 
    calClient            maven.xml project.xml 
    calClient/src/java   hibernate.properties 
    calClient/src/java/org/jahia/suite/calendar/calServer 
                                                          Calendarclient.java 
                                                          JMSAgent.java 
                                                          PersistentStore.java 
                                                          StorableFactory.java 
                                                          SyncEventID.java 
                                                          SyncManagerImpl.java 
                                                          SyncSession.java 
                                                          
TransportReceiverFactory.java 
                                                          UwCalConnector.java 
                                                          
UwCalConnectorServlet.java 
    calClient/src/java/org/jahia/suite/calendar/test 
                                                     
CalendarTransportAgentTest.java 
                                                     DummyCalendarServer.java 
    calClient/src/java/org/jahia/suite/calendar/util 
                                                     JMSQueueDumper.java 
                                                     JORAMAdmin.java 
    calClient/webapp     project.xml 
  Added files:
    calClient/src/java   settings.properties 
  
  Revision  Changes    Path
  1.4       +1 -1      uwcal_JSR168/calClient/conf/hibernate.cfg.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/conf/hibernate.cfg.xml.diff?r1=1.3&r2=1.4&f=h
  1.11      +3 -0      uwcal_JSR168/calClient/maven.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/maven.xml.diff?r1=1.10&r2=1.11&f=h
  1.9       +2 -2      uwcal_JSR168/calClient/project.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/project.xml.diff?r1=1.8&r2=1.9&f=h
  1.2       +11 -13    uwcal_JSR168/calClient/src/java/hibernate.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/hibernate.properties.diff?r1=1.1&r2=1.2&f=h
  1.12      +6 -3      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/Calendarclient.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/Calendarclient.java.diff?r1=1.11&r2=1.12&f=h
  1.4       +20 -10    
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/JMSAgent.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/JMSAgent.java.diff?r1=1.3&r2=1.4&f=h
  1.11      +19 -10    
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/PersistentStore.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/PersistentStore.java.diff?r1=1.10&r2=1.11&f=h
  1.2       +34 -4     
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/StorableFactory.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/StorableFactory.java.diff?r1=1.1&r2=1.2&f=h
  1.5       +6 -0      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncEventID.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncEventID.java.diff?r1=1.4&r2=1.5&f=h
  1.10      +2 -3      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncManagerImpl.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncManagerImpl.java.diff?r1=1.9&r2=1.10&f=h
  1.7       +2 -2      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncSession.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncSession.java.diff?r1=1.6&r2=1.7&f=h
  1.2       +6 -2      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/TransportReceiverFactory.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/TransportReceiverFactory.java.diff?r1=1.1&r2=1.2&f=h
  1.18      +2 -2      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java.diff?r1=1.17&r2=1.18&f=h
  1.5       +1 -4      
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnectorServlet.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnectorServlet.java.diff?r1=1.4&r2=1.5&f=h
  1.2       +11 -7     
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/CalendarTransportAgentTest.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/CalendarTransportAgentTest.java.diff?r1=1.1&r2=1.2&f=h
  1.4       +11 -5     
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalendarServer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalendarServer.java.diff?r1=1.3&r2=1.4&f=h
  1.2       +29 -7     
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JMSQueueDumper.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JMSQueueDumper.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +42 -9     
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JORAMAdmin.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JORAMAdmin.java.diff?r1=1.1&r2=1.2&f=h
  1.1       +17 -0     uwcal_JSR168/calClient/src/java/settings.properties (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/settings.properties?rev=1.1&content-type=text/plain
  1.5       +2 -2      uwcal_JSR168/calClient/webapp/project.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/webapp/project.xml.diff?r1=1.4&r2=1.5&f=h
  
  
  
  Index: hibernate.cfg.xml
  ===================================================================
  RCS file: /home/cvs/repository/uwcal_JSR168/calClient/conf/hibernate.cfg.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- hibernate.cfg.xml 21 Jan 2005 11:02:50 -0000      1.3
  +++ hibernate.cfg.xml 9 May 2005 12:49:14 -0000       1.4
  @@ -1 +1 @@
  -<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd";>

<hibernate-configuration>

    <session-factory>

        <property 
name="connection.datasource">java:comp/env/jdbc/uwcalSynch</property>
        <property name="show_sql">false</property>
        <property 
name="dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>

        <!-- Mapping files -->
        <mapping resource="eventid.hbm.xml"/>

    </session-factory>

</hibernate-configuration>
  \ No newline at end of file
  +<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd";>

<hibernate-configuration>

    <session-factory>

        <property 
name="connection.datasource">java:comp/env/jdbc/uwcalSynch</property>
        <property name="show_sql">false</property>
        <property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>

        <!-- Mapping files -->
        <mapping resource="eventid.hbm.xml"/>

    </session-factory>

</hibernate-configuration>
  \ No newline at end of file
  
  
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/repository/uwcal_JSR168/calClient/maven.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- maven.xml 4 Feb 2005 08:34:11 -0000       1.10
  +++ maven.xml 9 May 2005 12:49:14 -0000       1.11
  @@ -63,6 +63,8 @@
           <fileset dir="${basedir}/src/java/properties" />
        </copy>
   
  +     <copy file="${basedir}/src/java/settings.properties" 
toDir="${maven.build.dest}"/>
  +    
        <copy file="${basedir}/src/java/hibernate.properties" 
toDir="${maven.build.dest}"/>
   
        <copy file="${basedir}/../log4j.xml" toDir="${maven.build.dest}"/>
  @@ -106,6 +108,7 @@
        <echo message="===================================" />
        
        <copy file="${basedir}/../log4j.xml" toDir="${maven.build.dest}"/>
  +     <copy file="${basedir}/src/java/settings.properties" 
toDir="${maven.build.dest}"/>
        
            <java classname="org.jahia.suite.calendar.util.JORAMAdmin"
             fork="yes">
  
  
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/repository/uwcal_JSR168/calClient/project.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.xml       31 Jan 2005 17:06:22 -0000      1.8
  +++ project.xml       9 May 2005 12:49:14 -0000       1.9
  @@ -30,7 +30,7 @@
     <pomVersion>3</pomVersion>
     <id>uwCalSync4jSync-calServer</id>
     <name>Calendar Server Connector</name>
  -  <currentVersion>1.0</currentVersion>
  +  <currentVersion>1.0-SNAPSHOT</currentVersion>
   
     <package>org.jahia.suite.calendar.calServer</package>
   
  @@ -46,7 +46,7 @@
           <dependency>
               <groupId>uwCalSync4jSync-framework</groupId>
               <artifactId>uwCalSync4jSync-framework</artifactId>
  -            <version>1.0</version>
  +            <version>1.0-SNAPSHOT</version>
               <properties>
                   <war.bundle>true</war.bundle>
               </properties>
  
  
  
  Index: settings.properties
  ====================================================================
  
################################################################################
  ## JMS properties
  
################################################################################
  jms.server.host             = localhost
  jms.server.port.jndi        = 16400
  jms.server.port.conn        = 16010
  jms.user.calserver          = calServer
  jms.password.calserver      = calServer
  jms.user.syncserver         = syncServer
  jms.password.syncserver     = syncServer
  
  ## JNDI NAMES
  jms.calendar.server.conn    = jmsQueueConnFactory
  jms.calendar.server.queue   = calServerQueue
  
  
  
################################################################################
  
  
  Index: hibernate.properties
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/hibernate.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- hibernate.properties      11 Jan 2005 09:51:06 -0000      1.1
  +++ hibernate.properties      9 May 2005 12:49:14 -0000       1.2
  @@ -21,23 +21,21 @@
   
   ## HypersonicSQL
   
  -#hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
  -#hibernate.connection.driver_class org.hsqldb.jdbcDriver
  -#hibernate.connection.username sa
  -#hibernate.connection.password
  -#hibernate.connection.url jdbc:hsqldb:hsql://localhost
  -#hibernate.connection.url jdbc:hsqldb:test
  -#hibernate.connection.url jdbc:hsqldb:.
  +hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
  +hibernate.connection.driver_class org.hsqldb.jdbcDriver
  +hibernate.connection.username sa
  +hibernate.connection.password
  +hibernate.connection.url jdbc:hsqldb:hsql://127.0.0.1:8889
   
   
   ## PostgreSQL
   
  -hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
  -hibernate.connection.driver_class org.postgresql.Driver
  -hibernate.connection.url jdbc:postgresql:uwcal
  -hibernate.connection.username calendardb
  -hibernate.connection.password
  -hibernate.query.substitutions yes 'Y', no 'N'
  +#hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
  +#hibernate.connection.driver_class org.postgresql.Driver
  +#hibernate.connection.url jdbc:postgresql:uwcal
  +#hibernate.connection.username calendardb
  +#hibernate.connection.password
  +#hibernate.query.substitutions yes 'Y', no 'N'
   
   
   ## DB2
  
  
  
  Index: Calendarclient.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/Calendarclient.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Calendarclient.java       11 Feb 2005 13:43:41 -0000      1.11
  +++ Calendarclient.java       9 May 2005 12:49:15 -0000       1.12
  @@ -45,6 +45,8 @@
   import org.jahia.suite.calendar.framework.SyncManager;
   import org.jahia.suite.calendar.framework.Storable;
   
  +import org.jahia.suite.calendar.util.Props;
  +
   import org.apache.log4j.Logger;
   
   /**
  @@ -67,7 +69,7 @@
       /**
        * Creates a new instance of Calendarclient
        */
  -    public Calendarclient() {
  +    protected Calendarclient() {
       }
       
       /**
  @@ -84,12 +86,13 @@
       public void start() {
           agent = new TransportReceiverFactory().createTransportReceiver(
                   TransportReceiverFactory.JMS);
  -        agent.start();
  +        Props props = Props.getInstance();
  +        agent.start(props.getValue(Props.JMS_HOST), 
  +                Integer.parseInt(props.getValue(Props.JMS_HOST_JNDI_PORT)));
           log.debug("Connected to JMS Server");
           syncManager = new SyncManagerFactory().createSyncManager(
                   SyncManagerFactory.BASIC);
           agent.setMessageListener(this);
  -        log.info("CalendarClient started");
       }
       
       /**
  
  
  
  Index: JMSAgent.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/JMSAgent.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JMSAgent.java     10 Feb 2005 09:06:21 -0000      1.3
  +++ JMSAgent.java     9 May 2005 12:49:15 -0000       1.4
  @@ -43,6 +43,8 @@
   import org.jahia.suite.calendar.framework.message.Request;
   import org.jahia.suite.calendar.framework.message.MessageListener;
   
  +import org.jahia.suite.calendar.util.Props;
  +
   import javax.naming.Context;
   import javax.naming.InitialContext;
   
  @@ -58,11 +60,7 @@
    * @author  Xavier Lawrence
    */
   public class JMSAgent implements TransportReceiver {
  -    
  -    // JNDI names
  -    public static final String CAL_SERVER_QUEUE = "calServerQueue";
  -    public static final String CONN_FACTORY = "JmsQueueConnectionFactory";
  -    
  +       
       // log4j logger
       private Logger log = Logger.getLogger(JMSAgent.class);
       
  @@ -101,19 +99,28 @@
        * Initializes JMS transport ressources
        * @see org.jahia.suite.calendar.framework.Transport
        */
  -    public void start() throws TransportException {
  -        if (!started) {
  +    public void start(String host, int port) throws TransportException {
  +        
  +        // If arguments are missing, use the default JORAM settings
  +        if (host == null || host.length() < 1) {
  +            host = "localhost";
  +            port = 16400;
  +        }
  +        
  +        if (port < 1024) port = 16400;
  +        
  +        if (!started) { // Only connect once...
               try {
                   // Create the JNDI context
                   Hashtable context = new Hashtable(0);
                   context.put(Context.INITIAL_CONTEXT_FACTORY,
                   "fr.dyade.aaa.jndi2.client.NamingContextFactory");
  -                context.put("java.naming.factory.host", "localhost");
  -                context.put("java.naming.factory.port", "16400");
  +                context.put("java.naming.factory.host", host);
  +                context.put("java.naming.factory.port", 
Integer.toString(port));
                   
                   Context jndiCtx = new InitialContext(context);
                   connFactory = (javax.jms.QueueConnectionFactory)
  -                jndiCtx.lookup(CONN_FACTORY);
  +                
jndiCtx.lookup(Props.getInstance().getValue(Props.JMS_CONN_NAME));
                   receiverQueue = (javax.jms.Queue) 
jndiCtx.lookup(receiverQueueName);
                   jndiCtx.close();
                   log.debug("receiverQueue: "+receiverQueue.getQueueName());
  @@ -158,6 +165,9 @@
               } finally {
                   try {
                       conn.close();
  +                    conn = null;
  +                    qSession = null;
  +                    receiver = null;
                   } catch (Exception e) {}
               }
           } else
  
  
  
  Index: PersistentStore.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/PersistentStore.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PersistentStore.java      10 Feb 2005 09:18:05 -0000      1.10
  +++ PersistentStore.java      9 May 2005 12:49:15 -0000       1.11
  @@ -98,15 +98,17 @@
               
               List query = session.find(
                       "from org.jahia.suite.calendar.calServer.SyncEventID 
eventid where eventid = '"+
  -                    event.getKey() +"'");
  +                    event.getKey().getKey() +"'");
               Iterator it = query.iterator();
               while (it.hasNext()) {
                   result = true;
                   SyncEventID eventID = (SyncEventID) it.next();
  -                log.debug("Found Event: "+eventID.getEventID());
  +                log.debug("Found Event: "+eventID);
               }
               
               tx.commit();
  +            query = null;
  +            it = null;
               return result;
               
           } catch (Throwable t) {
  @@ -122,7 +124,8 @@
               throw new SyncException(t.getMessage(), t);
               
           } finally {
  -            session.clear();          
  +            session.clear();
  +            tx = null;
           }
       }
       
  @@ -143,13 +146,14 @@
               SyncEventID eventID = new SyncEventID();
               eventID.setEventID(event.getKey().getKey());
               
  -            if (calendarID != null) {
  -                eventID.setCalendarID(calendarID);
  +            if (calendarID == null || calendarID.length() < 1) {
  +                eventID.setCalendarID("-1");
               }
               
               session.save(eventID);
               tx.commit();
  -            log.debug("Locked: "+event.getKey().getKey());
  +            log.debug("Locked: "+eventID);
  +            eventID = null;
               return true;
               
           } catch (Throwable t) {
  @@ -164,7 +168,8 @@
               throw new SyncException(t.getMessage(), t);
               
           } finally {
  -            session.clear();           
  +            session.clear();
  +            tx = null;
           }
       }
       
  @@ -188,11 +193,13 @@
               while (it.hasNext()) {
                   result = true;
                   SyncEventID eventID = (SyncEventID) it.next();
  -                log.debug("Unlock Event: "+eventID.getEventID());
  +                log.debug("Unlock Event: "+eventID);
                   session.delete(eventID);
               }
               
               tx.commit();
  +            query = null;
  +            it = null;
               return result;
               
           } catch (Throwable t) {
  @@ -208,7 +215,8 @@
               throw new SyncException(t.getMessage(), t);
               
           } finally {
  -            session.clear();           
  +            session.clear();
  +            tx = null;
           }
       }
       
  @@ -249,6 +257,7 @@
               
               session.delete(eventID);
               tx.commit();
  +            eventID = null;
               return true;
               
           } catch (Throwable t) {
  @@ -265,7 +274,7 @@
               
           } finally {
               session.clear();
  -            
  +            tx = null;
           }
       }
       
  
  
  
  Index: StorableFactory.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/StorableFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StorableFactory.java      11 Feb 2005 13:43:11 -0000      1.1
  +++ StorableFactory.java      9 May 2005 12:49:15 -0000       1.2
  @@ -1,7 +1,38 @@
   /*
  - * StorableFactory.java
  + *                                   ____.
  + *                       __/\ ______|    |__/\.     _______
  + *            __   .____|    |       \   |    +----+       \
  + *    _______|  /--|    |    |    -   \  _    |    :    -   \_________
  + *   \\______: :---|    :    :           |    :    |         \________>
  + *           |__\---\_____________:______:    :____|____:_____\
  + *                                      /_____|
    *
  - * Created on 10. f�vrier 2005, 16:33
  + *              . . . i n   j a h i a   w e   t r u s t . . .
  + *
  + *
  + *
  + * ----- BEGIN LICENSE BLOCK -----
  + * Version: JCSL 1.0
  + *
  + * The contents of this file are subject to the Jahia Community Source 
License
  + * 1.0 or later (the "License"); you may not use this file except in
  + * compliance with the License. You may obtain a copy of the License at
  + * http://www.jahia.org/license
  + *
  + * Software distributed under the License is distributed on an "AS IS" basis,
  + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  + * for the rights, obligations and limitations governing use of the contents
  + * of the file. The Original and Upgraded Code is the Jahia CMS and Portal
  + * Server. The developer of the Original and Upgraded Code is JAHIA Ltd. 
JAHIA
  + * Ltd. owns the copyrights in the portions it created. All Rights Reserved.
  + *
  + * The Shared Modifications are Jahia View Helper.
  + *
  + * The Developer of the Shared Modifications is Jahia Solution S�rl.
  + * Portions created by the Initial Developer are Copyright (C) 2002 by the
  + * Initial Developer. All Rights Reserved.
  + *
  + * ----- END LICENSE BLOCK -----
    */
   
   package org.jahia.suite.calendar.calServer;
  @@ -22,8 +53,7 @@
        */
       public Storable createStorable(String key) {
           if (UWCAL.equals(key)) {
  -            throw new RuntimeException("Please use: "+
  -                    "createStorable(String key, String userName, String 
device)");
  +            throw new RuntimeException("Please use: createStorable(String 
key, String userName, String device)");
           }
           throw new IllegalArgumentException("Unknown key value: "+key);
       }  
  
  
  
  Index: SyncEventID.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncEventID.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SyncEventID.java  3 May 2005 15:22:51 -0000       1.4
  +++ SyncEventID.java  9 May 2005 12:49:15 -0000       1.5
  @@ -53,6 +53,12 @@
       public SyncEventID() {
       }
       
  +    /** Creates a new instance of SyncEventID */
  +    public SyncEventID(String eventID, String calendarID) {
  +        setEventID(eventID);
  +        setCalendarID(calendarID);
  +    }
  +
       public String getEventID() {
           return eventID;
       }
  
  
  
  Index: SyncManagerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncManagerImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SyncManagerImpl.java      11 Feb 2005 13:43:41 -0000      1.9
  +++ SyncManagerImpl.java      9 May 2005 12:49:15 -0000       1.10
  @@ -211,7 +211,7 @@
       /**
        * @see Storable
        */
  -    public synchronized GUID getNewEventID(String calendarID) throws 
SyncException {
  +    public GUID getNewEventID(String calendarID) throws SyncException {
           Storable calServer = session.getCalServer(calendarID);
           GUID guid = calServer.getNewGUID();
           return guid;
  @@ -231,8 +231,7 @@
           log.debug("beginSynch: "+calendarID);
           String userName = calendarID.split("-")[0];
           String devID = calendarID.split("-")[1];
  -        
  -        
  +               
           Storable calServer = new StorableFactory().createStorable(
                   StorableFactory.UWCAL, userName, devID);
           calServer.beginTransaction();
  
  
  
  Index: SyncSession.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncSession.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SyncSession.java  11 Feb 2005 13:43:41 -0000      1.6
  +++ SyncSession.java  9 May 2005 12:49:15 -0000       1.7
  @@ -60,7 +60,7 @@
        * @param calendarID The calendar ID
        * @return The Storable for that calendar or null if not found
        */
  -    public synchronized Storable getCalServer(String calendarID) {
  +    public Storable getCalServer(String calendarID) {
           return (Storable)calendarToStorables.get(calendarID);
       }
       
  @@ -84,7 +84,7 @@
        * Removes an Storable instance from the set of on going SyncSessions
        * @param calendarID The calendar ID
        */
  -    public synchronized void removeCalServer(String calendarID) {
  +    public void removeCalServer(String calendarID) {
           calendarToStorables.remove(calendarID);
       }
   }
  
  
  
  Index: TransportReceiverFactory.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/TransportReceiverFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransportReceiverFactory.java     11 Feb 2005 13:43:11 -0000      1.1
  +++ TransportReceiverFactory.java     9 May 2005 12:49:15 -0000       1.2
  @@ -40,6 +40,8 @@
   import org.jahia.suite.calendar.framework.TransportReceiverFactoryIF;
   import org.jahia.suite.calendar.framework.TransportReceiver;
   
  +import org.jahia.suite.calendar.util.Props;
  +
   /**
    *
    * @author Xavier Lawrence
  @@ -53,8 +55,10 @@
        */
       public TransportReceiver createTransportReceiver(String key) {
           if (JMS.equals(key)) {
  -            return new JMSAgent(JMSAgent.CAL_SERVER_QUEUE, "calServer",
  -                    "calServer");
  +            Props props = Props.getInstance();
  +            return new JMSAgent(props.getValue(props.JMS_QUEUE_NAME), 
  +                    props.getValue(props.JMS_HOST_USERNAME_CAL),
  +                    props.getValue(props.JMS_HOST_PASSWORD_CAL));
           }
           throw new IllegalArgumentException("Unknown key value: "+key);
       }
  
  
  
  Index: UwCalConnector.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- UwCalConnector.java       7 Feb 2005 16:17:52 -0000       1.17
  +++ UwCalConnector.java       9 May 2005 12:49:15 -0000       1.18
  @@ -212,7 +212,7 @@
        * @throws IOException If the reader encounters a problem
        * @throws ParserException If the String is not in the right format
        */
  -    private VEvent getVEventFromString(String eventString) throws 
IOException,
  +    protected VEvent getVEventFromString(String eventString) throws 
IOException,
       ParserException {      
           
           StringBuffer buffer = new StringBuffer();
  @@ -277,7 +277,7 @@
        * @return The corresponding state value of the Framework class
        * @throws SyncException If an unknown state value is given in entry
        */
  -    public int toFrameworkStateValue(int state) throws SyncException {
  +    public static int toFrameworkStateValue(int state) throws SyncException {
           switch (state) {
               case IcalSynchState.DELETED:
                   return SyncEvent.DELETED;
  
  
  
  Index: UwCalConnectorServlet.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnectorServlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UwCalConnectorServlet.java        3 Feb 2005 10:52:34 -0000       1.4
  +++ UwCalConnectorServlet.java        9 May 2005 12:49:15 -0000       1.5
  @@ -67,10 +67,7 @@
        */
       public void init() throws ServletException {
           try {
  -            log.info("Starting UwCal Calendar Client...");
  -            app = new Calendarclient();
  -            app.start();
  -            log.info("Calendar Client successfully started");
  +            Calendarclient.main(new String[]{});
               
           } catch (Throwable t) {
               errorMsg = t.getMessage();
  
  
  
  Index: CalendarTransportAgentTest.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/CalendarTransportAgentTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CalendarTransportAgentTest.java   5 Jan 2005 10:02:57 -0000       1.1
  +++ CalendarTransportAgentTest.java   9 May 2005 12:49:15 -0000       1.2
  @@ -38,7 +38,11 @@
   package org.jahia.suite.calendar.test;
   import org.jahia.suite.calendar.framework.message.Request;
   import org.jahia.suite.calendar.framework.message.Response;
  -import org.jahia.suite.calendar.calServer.JMSAgent;
  +import org.jahia.suite.calendar.framework.TransportReceiver;
  +
  +import org.jahia.suite.calendar.calServer.TransportReceiverFactory;
  +
  +import org.jahia.suite.calendar.util.Props;
   
   import org.apache.log4j.Logger;
   
  @@ -61,12 +65,12 @@
       public static void main(String[] args) {
           try {
               log.info("Starting CalendarTransportAgentTest...");
  -            JMSAgent tAgent = new JMSAgent(JMSAgent.CAL_SERVER_QUEUE, 
  -            "calServer", "calServer");
  -            if (!tAgent.started) {
  -                log.debug("TransportAgent not started, starting...");
  -                tAgent.start();
  -            }
  +            TransportReceiver tAgent = new 
TransportReceiverFactory().createTransportReceiver(
  +                    TransportReceiverFactory.JMS);
  +            Props props = Props.getInstance();
  +            tAgent.start(props.getValue(Props.JMS_HOST),
  +                    
Integer.parseInt(props.getValue(Props.JMS_HOST_JNDI_PORT)));
  +            log.debug("Connected to JMS Server");
               int no = 4;
               log.info("TransportAgent started. Waiting for "+no+" 
requests...");
               for (int i=0; i<no; i++) {
  
  
  
  Index: DummyCalendarServer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalendarServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DummyCalendarServer.java  18 Jan 2005 14:07:08 -0000      1.3
  +++ DummyCalendarServer.java  9 May 2005 12:49:15 -0000       1.4
  @@ -36,7 +36,7 @@
    */
   
   package org.jahia.suite.calendar.test;
  -import org.jahia.suite.calendar.calServer.JMSAgent;
  +import org.jahia.suite.calendar.calServer.TransportReceiverFactory;
   import org.jahia.suite.calendar.framework.model.Calendar;
   import org.jahia.suite.calendar.framework.model.SyncEvent;
   import org.jahia.suite.calendar.framework.model.SyncOperation;
  @@ -44,6 +44,7 @@
   
   import org.jahia.suite.calendar.framework.SyncException;
   import org.jahia.suite.calendar.framework.TransportException;
  +import org.jahia.suite.calendar.framework.TransportReceiver;
   import org.jahia.suite.calendar.framework.message.Message;
   import org.jahia.suite.calendar.framework.message.Response;
   import org.jahia.suite.calendar.framework.message.GetGUIDRequestResponse;
  @@ -54,6 +55,8 @@
   import org.jahia.suite.calendar.framework.message.UpdateCalendarRequest;
   import org.jahia.suite.calendar.framework.message.MessageListener;
   
  +import org.jahia.suite.calendar.util.Props;
  +
   import java.util.Properties;
   
   import org.apache.log4j.Logger;
  @@ -73,7 +76,7 @@
       
       static int respID = 0;
       
  -    private JMSAgent agent;
  +    private TransportReceiver agent;
       private Calendar calendar;
       private DummyCalServerGUI gui;
       private boolean outlook;
  @@ -128,9 +131,12 @@
        */
       public DummyCalendarServer(boolean outlook) {
           this.outlook = outlook;
  -        agent = new JMSAgent(JMSAgent.CAL_SERVER_QUEUE,
  -        "calServer", "calServer");
  -        agent.start();
  +        Props props = Props.getInstance();
  +        agent = new TransportReceiverFactory().createTransportReceiver(
  +                TransportReceiverFactory.JMS);
  +        agent.start(props.getValue(Props.JMS_HOST),
  +                Integer.parseInt(props.getValue(Props.JMS_HOST_JNDI_PORT)));
  +        log.debug("Connected to JMS Server");
           agent.setMessageListener(this);
       }
       
  
  
  
  Index: JMSQueueDumper.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JMSQueueDumper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JMSQueueDumper.java       5 Jan 2005 10:02:57 -0000       1.1
  +++ JMSQueueDumper.java       9 May 2005 12:49:16 -0000       1.2
  @@ -38,7 +38,11 @@
   package org.jahia.suite.calendar.util;
   import org.jahia.suite.calendar.framework.message.MessageListener;
   import org.jahia.suite.calendar.framework.message.Message;
  -import org.jahia.suite.calendar.calServer.JMSAgent;
  +import org.jahia.suite.calendar.framework.TransportReceiver;
  +
  +import org.jahia.suite.calendar.calServer.TransportReceiverFactory;
  +
  +import org.jahia.suite.calendar.util.Props;
   
   import org.apache.log4j.Logger;
   
  @@ -65,20 +69,38 @@
        * @param args the command line arguments
        */
       public static void main(String[] args) {
  +        String host;
  +        int port;
  +        
  +        if (args.length > 1) {
  +            host = args[0];
  +            port = Integer.parseInt(args[1]);
  +            
  +        } else if (args.length > 0) {
  +            host = args[0];
  +            port = 16400;
  +            
  +        } else {
  +            host = "localhost";
  +            port = 16400;
  +        } 
  +        
           try {
               JMSQueueDumper app = new JMSQueueDumper();
               log.info("Starting JMSQueueDumper...");
  -            JMSAgent tAgent = new JMSAgent(JMSAgent.CAL_SERVER_QUEUE,
  -            "calServer", "calServer");
  -            if (!tAgent.started) {
  -                log.debug("TransportAgent not started, starting...");
  -                tAgent.start();
  -            }
  +            TransportReceiver tAgent = new TransportReceiverFactory().
  +                    createTransportReceiver(TransportReceiverFactory.JMS);
  +            Props props = Props.getInstance();
  +            tAgent.start(props.getValue(Props.JMS_HOST),
  +                    
Integer.parseInt(props.getValue(Props.JMS_HOST_JNDI_PORT)));
  +            log.debug("Connected to JMS Server");
               tAgent.setMessageListener(app);
  +            
               final long millis = 10000;
               log.info("Dumping for "+millis/1000+" seconds");
               Thread.currentThread().sleep(millis);
               tAgent.stop();
  +            
           } catch (Exception e) {
               e.printStackTrace();
           }
  
  
  
  Index: JORAMAdmin.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/JORAMAdmin.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JORAMAdmin.java   5 Jan 2005 10:02:57 -0000       1.1
  +++ JORAMAdmin.java   9 May 2005 12:49:16 -0000       1.2
  @@ -46,6 +46,7 @@
   import javax.naming.Context;
   
   import java.util.Hashtable;
  +import java.util.Properties;
   
   import org.jahia.suite.calendar.calServer.JMSAgent;
   
  @@ -59,8 +60,38 @@
   public class JORAMAdmin {
   
       static Logger log = Logger.getLogger(JORAMAdmin.class);
  +    
  +    private Props props;
  +    
  +    protected JORAMAdmin() {
  +        props = Props.getInstance();
  +    }
   
  +    /**
  +     *
  +     */
       public void start() throws Exception {
  +        
  +        String host = props.getValue(props.JMS_HOST);
  +        int jndiPort = 0, connPort = 0;
  +        
  +        try {
  +            jndiPort = 
Integer.parseInt(props.getValue(props.JMS_HOST_JNDI_PORT));
  +            connPort = 
Integer.parseInt(props.getValue(props.JMS_HOST_CONN_PORT));
  +            
  +        } catch (NumberFormatException e) {
  +            log.error("Error getting port values: "+e.getMessage());
  +        }
  +        
  +        // If arguments are missing, use the default JORAM settings
  +        if (host == null || host.length() < 1) {
  +            host = "localhost";
  +        }
  +        
  +        if (jndiPort < 1024) jndiPort = 16400;
  +        
  +        if (connPort < 1024) connPort = 16010;
  +        
           log.info("JORAM Server administration...");
   
           AdminModule.connect("root", "root", 60);
  @@ -70,11 +101,13 @@
           log.info("Queue created");
   
           // Create the 2 users
  -        User calServer = User.create("calServer", "calServer", 0);
  -        User syncServer = User.create("syncServer", "syncServer", 0);
  -
  +        User calServer = 
User.create(props.getValue(props.JMS_HOST_USERNAME_CAL),
  +                props.getValue(props.JMS_HOST_PASSWORD_CAL), 0);
  +        User syncServer = 
User.create(props.getValue(props.JMS_HOST_USERNAME_SYNC),
  +                props.getValue(props.JMS_HOST_PASSWORD_SYNC), 0);
  +        
           javax.jms.QueueConnectionFactory cnxFact =
  -        QueueTcpConnectionFactory.create("localhost", 16010);
  +        QueueTcpConnectionFactory.create(host, connPort);
           log.info("QueueConnectionFactory created");
   
           // Setting reading and writing access
  @@ -85,12 +118,12 @@
           Hashtable context = new Hashtable(0);
           context.put(Context.INITIAL_CONTEXT_FACTORY,
           "fr.dyade.aaa.jndi2.client.NamingContextFactory");
  -        context.put("java.naming.factory.host", "localhost");
  -        context.put("java.naming.factory.port", "16400");
  +        context.put("java.naming.factory.host", host);
  +        context.put("java.naming.factory.port", Integer.toString(jndiPort));
   
           Context jndiCtx = new javax.naming.InitialContext(context);
  -        jndiCtx.bind(JMSAgent.CAL_SERVER_QUEUE, calQueue);
  -        jndiCtx.bind(JMSAgent.CONN_FACTORY, cnxFact);
  +        jndiCtx.bind(props.getValue(props.JMS_QUEUE_NAME), calQueue);
  +        jndiCtx.bind(props.getValue(props.JMS_CONN_NAME), cnxFact);
           jndiCtx.close();
           log.info("Ressources bound into JNDI");
   
  @@ -99,7 +132,7 @@
       }
   
       /**
  -     * Start the program
  +     * Starts the program
        * @param args the command line arguments
        */
       public static void main(String[] args) throws Exception {
  
  
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/repository/uwcal_JSR168/calClient/webapp/project.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.xml       8 Feb 2005 14:56:11 -0000       1.4
  +++ project.xml       9 May 2005 12:49:16 -0000       1.5
  @@ -38,7 +38,7 @@
           <dependency>
               <groupId>uwCalSync4jSync-calServer</groupId>
               <artifactId>uwCalSync4jSync-calServer</artifactId>
  -            <version>1.0</version>
  +            <version>1.0-SNAPSHOT</version>
               <properties>
                   <war.bundle>true</war.bundle>
               </properties>
  @@ -46,7 +46,7 @@
           <dependency>
               <groupId>uwCalSync4jSync-framework</groupId>
               <artifactId>uwCalSync4jSync-framework</artifactId>
  -            <version>1.0</version>
  +            <version>1.0-SNAPSHOT</version>
               <properties>
                   <war.bundle>true</war.bundle>
               </properties>
  

Reply via email to