xlawrence    2004/12/21 15:31:04 CET

  Modified files:
    src/java/org/jahia/suite/calendar/calServer SyncManager.java 
                                                UwCalConnector.java 
    src/java/org/jahia/suite/calendar/framework Storable.java 
  Log:
  Added Transaction support
  
  Revision  Changes    Path
  1.6       +2 -0      
uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/SyncManager.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/SyncManager.java.diff?r1=1.5&r2=1.6&f=h
  1.6       +28 -6     
uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java.diff?r1=1.5&r2=1.6&f=h
  1.3       +13 -1     
uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/Storable.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/Storable.java.diff?r1=1.2&r2=1.3&f=h
  
  
  
  Index: SyncManager.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/SyncManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SyncManager.java  21 Dec 2004 14:12:39 -0000      1.5
  +++ SyncManager.java  21 Dec 2004 14:31:03 -0000      1.6
  @@ -156,7 +156,9 @@
           SyncEvent[] sessionEvents = 
(SyncEvent[])sessionToEvents.get(calendarID);
           
           if (operations != null) {
  +            calServer.beginTransaction();
               calServer.updateEvents(operations);
  +            calServer.endTransaction();
           }
           
           if (sessionEvents != null) {
  
  
  
  Index: UwCalConnector.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UwCalConnector.java       17 Dec 2004 15:46:59 -0000      1.5
  +++ UwCalConnector.java       21 Dec 2004 14:31:03 -0000      1.6
  @@ -46,10 +46,10 @@
   import edu.washington.cac.calfacade.shared.EventVO;
   
   /**
  - * This class implements the Storable interface. An object of this class 
will 
  + * This class implements the Storable interface. An object of this class will
    * be directly connected to the Calendar Server, in this case uwCal.<br>
  - * The connector contains methods for storing and retreiving data into/from 
  - * the calendar server. These operations should be performed in some sort 
  + * The connector contains methods for storing and retreiving data into/from
  + * the calendar server. These operations should be performed in some sort
    * of transaction. IE all updates or none should be succesful.
    *
    * @author  Xavier Lawrence
  @@ -58,7 +58,7 @@
       
       // Single Object of this class (Singleton pattern)
       private static UwCalConnector uwCalConnector = new UwCalConnector();
  -
  +    
       /**
        * Common method for getting an instance of this class (singleton 
pattern).
        * @return The reference to the singleton object
  @@ -99,7 +99,7 @@
                   SyncOperation temp = operations[i];
                   String type = temp.getType();
                   if (SyncOperation.ADD.equals(type)) {
  -                     
  +                    
                   } else if (SyncOperation.DELETE.equals(type)) {
                       
                   } else if (SyncOperation.MODIFY.equals(type)) {
  @@ -120,7 +120,7 @@
       public GUID getNewGUID() throws SyncException {
           try {
               // format: eventId - name @ host
  -            String guid = calServer.getNewGuid();            
  +            String guid = calServer.getNewGuid();
               int eventId = Integer.parseInt(guid.substring(0, 
guid.lastIndexOf('-')-1));
               String hostName = guid.substring(guid.lastIndexOf('-')+1);
               return new GUID(hostName, eventId);
  @@ -128,4 +128,26 @@
               throw new SyncException(e.getMessage(), e);
           }
       }
  +    
  +    /**
  +     * @see Storable
  +     */
  +    public void beginTransaction() throws SyncException {
  +        try {
  +            calServer.beginTransaction();
  +        } catch (Exception e) {
  +            throw new SyncException(e.getMessage(), e);
  +        }
  +    }
  +    
  +    /**
  +     * @see Storable
  +     */
  +    public void endTransaction() throws SyncException {
  +        try {
  +            calServer.commit();
  +        } catch (Exception e) {
  +            throw new SyncException(e.getMessage(), e);
  +        }
  +    }  
   }
  
  
  
  Index: Storable.java
  ===================================================================
  RCS file: 
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/Storable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Storable.java     22 Nov 2004 10:58:34 -0000      1.2
  +++ Storable.java     21 Dec 2004 14:31:03 -0000      1.3
  @@ -76,5 +76,17 @@
        * @throws SyncException If something goes wrong
        * @return The new GUID in a GUID object
        */
  -    public GUID getNewGUID() throws SyncException;    
  +    public GUID getNewGUID() throws SyncException; 
  +    
  +    /**
  +     * Starts a Transaction on the calendar server
  +     * @throws SyncException If something goes wrong
  +     */
  +    public void beginTransaction() throws SyncException; 
  +    
  +    /**
  +     * Ends the running Transaction of the calendar server
  +     * @throws SyncException If something goes wrong
  +     */
  +    public void endTransaction() throws SyncException; 
   }
  

Reply via email to