xlawrence 2005/02/03 11:52:37 CET
Modified files:
calClient/src/java/org/jahia/suite/calendar/calServer
Calendarclient.java
JMSAgent.java
PersistentStore.java
SyncEventID.java
SyncManagerImpl.java
SyncSession.java
UwCalConnector.java
UwCalConnectorServlet.java
WorkerThread.java
calClient/src/java/org/jahia/suite/calendar/test
DummyCalServerGUI.java
SyncEventDialog.java
calClient/src/java/org/jahia/suite/calendar/util
HibernateUtil.java
src/java/org/jahia/suite/calendar/framework
CalendarManageable.java
SyncException.java
src/java/org/jahia/suite/calendar/framework/model
Calendar.java
SyncEvent.java
src/java/org/jahia/suite/calendar/util
StateValueConverter.java
syncClient/src/java/org/jahia/suite/calendar/syncClients
FileMapping.java
ICalendarSyncSource.java
SyncClient.java
syncServer/src/java/org/jahia/suite/calendar/sync4jModule
CalendarSyncSource.java
CalendarSyncSourceOutlook.java
syncServer/src/java/org/jahia/suite/calendar/syncServer
CalendarManager.java
JMSAgent.java
Log:
Updated Javadoc and method names
Revision Changes Path
1.10 +2 -2
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.9&r2=1.10&f=h
1.2 +6 -0
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.1&r2=1.2&f=h
1.8 +32 -12
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.7&r2=1.8&f=h
1.3 +4 -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.2&r2=1.3&f=h
1.8 +9 -7
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.7&r2=1.8&f=h
1.3 +13 -4
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.2&r2=1.3&f=h
1.15 +9 -1
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.14&r2=1.15&f=h
1.4 +3 -0
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.3&r2=1.4&f=h
1.8 +5 -2
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/WorkerThread.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/WorkerThread.java.diff?r1=1.7&r2=1.8&f=h
1.2 +4 -3
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java.diff?r1=1.1&r2=1.2&f=h
1.3 +3 -2
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/SyncEventDialog.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/SyncEventDialog.java.diff?r1=1.2&r2=1.3&f=h
1.2 +10 -4
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/HibernateUtil.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/HibernateUtil.java.diff?r1=1.1&r2=1.2&f=h
1.2 +2 -1
uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/CalendarManageable.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/CalendarManageable.java.diff?r1=1.1&r2=1.2&f=h
1.3 +1 -1
uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/SyncException.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/SyncException.java.diff?r1=1.2&r2=1.3&f=h
1.7 +21 -0
uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/Calendar.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/Calendar.java.diff?r1=1.6&r2=1.7&f=h
1.6 +2 -1
uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/SyncEvent.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/SyncEvent.java.diff?r1=1.5&r2=1.6&f=h
1.4 +3 -3
uwcal_JSR168/src/java/org/jahia/suite/calendar/util/StateValueConverter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/util/StateValueConverter.java.diff?r1=1.3&r2=1.4&f=h
1.2 +36 -16
uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/FileMapping.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/FileMapping.java.diff?r1=1.1&r2=1.2&f=h
1.5 +3 -1
uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/ICalendarSyncSource.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/ICalendarSyncSource.java.diff?r1=1.4&r2=1.5&f=h
1.6 +7 -0
uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java.diff?r1=1.5&r2=1.6&f=h
1.7 +3 -3
uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSource.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSource.java.diff?r1=1.6&r2=1.7&f=h
1.7 +6 -6
uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSourceOutlook.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSourceOutlook.java.diff?r1=1.6&r2=1.7&f=h
1.6 +1 -1
uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/CalendarManager.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/CalendarManager.java.diff?r1=1.5&r2=1.6&f=h
1.2 +6 -0
uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/JMSAgent.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/JMSAgent.java.diff?r1=1.1&r2=1.2&f=h
Index: Calendarclient.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/Calendarclient.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Calendarclient.java 2 Feb 2005 16:53:36 -0000 1.9
+++ Calendarclient.java 3 Feb 2005 10:52:34 -0000 1.10
@@ -74,7 +74,7 @@
* Returns a reference to the sync manager of the application
* @return A reference to the sync manager of the application
*/
- public SyncManager getLockEvent() {
+ public SyncManager getSyncManager() {
return syncManager;
}
@@ -101,7 +101,7 @@
}
/**
- * Implementation of the MessageListener interface.
+ * Implementation of the MessageListener interface (Thread-safe).
* Simply performs the required action based on the Request type or
throws
* a SyncException if the request type is unknown.
* @see MessageListener
Index: JMSAgent.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/JMSAgent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JMSAgent.java 5 Jan 2005 10:02:56 -0000 1.1
+++ JMSAgent.java 3 Feb 2005 10:52:34 -0000 1.2
@@ -165,6 +165,8 @@
}
/**
+ * Invokes the underlying Transport layer to receive Requests
+ *
* @see TransportReceiver
*/
public Request receive(long timeout) throws TransportException {
@@ -172,6 +174,8 @@
}
/**
+ * Invokes the underlying Transport layer to send Responses
+ *
* @see TransportReceiver
*/
public void sendResponse(Response resp, Request req)
@@ -180,6 +184,8 @@
}
/**
+ * Sets a MessageListener on the underlying Transport layer
+ *
* @see TransportReceiver
*/
public void setMessageListener(MessageListener listener)
Index: PersistentStore.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/PersistentStore.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PersistentStore.java 1 Feb 2005 13:37:04 -0000 1.7
+++ PersistentStore.java 3 Feb 2005 10:52:34 -0000 1.8
@@ -54,6 +54,9 @@
import java.util.List;
/**
+ * Object-Relational call using Hibernate. This class will be used by the
+ * SyncManagerImpl to store its state. It defines methods for storing which
+ * are the locked events.
*
* @author Xavier Lawrence
*/
@@ -80,7 +83,11 @@
}
/**
- *
+ * Tests if a given event is allready locked (Thread-safe), by querying
the
+ * database.
+ * @param event The event to test
+ * @returns True if the tested event is allready locked
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
public synchronized boolean isLocked(SyncEvent event) throws
SyncException {
log.debug("isLocked: "+event.getKey().getKey());
@@ -120,7 +127,12 @@
}
/**
- *
+ * Thread safe method for locking a particular event. The method will
only
+ * return once the lock has been granted.
+ * @param event The SyncEvent to lock
+ * @param calendarID The calendar being synchronized
+ * @returns True if the event is correctly locked
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
public synchronized boolean lock(SyncEvent event, String calendarID)
throws SyncException {
@@ -157,7 +169,11 @@
}
/**
- *
+ * Thread safe method for unlocking all the calendar events that are
being
+ * synchronized for a particular calendar.
+ * @param calendarID The calendar being synchronized
+ * @returns True if the events are correctly unlocked
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
public synchronized boolean unlockEvents(String calendarID) throws
SyncException {
Transaction tx = null;
@@ -197,7 +213,12 @@
}
/**
- *
+ * Thread safe method for locking a set of events. The method will only
+ * return once the locks have been granted.
+ * @param events The SyncEvents to lock
+ * @param calendarID The calendar being synchronized
+ * @returns True if the event is correctly locked
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
public synchronized boolean lockEvents(String calendarID, SyncEvent[]
events)
throws SyncException {
@@ -214,19 +235,16 @@
}
/**
- *
+ * Thread safe method for unlocking a particular event.
+ * @param event The event to unlock
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
- public synchronized boolean unlock(SyncEvent event, String calendarID)
- throws SyncException {
+ public synchronized boolean unlock(SyncEvent event) throws SyncException
{
Transaction tx = null;
try {
tx = session.beginTransaction();
SyncEventID eventID = new SyncEventID();
- eventID.setEventID(event.getKey().getKey());
-
- if (calendarID != null) {
- eventID.setCalendarID(calendarID);
- }
+ eventID.setEventID(event.getKey().getKey());
session.delete(eventID);
tx.commit();
@@ -251,7 +269,9 @@
}
/**
+ * Closes the Hibernate Session
*
+ * @throws SyncException If the underlying dataStore encounters a problem
*/
public synchronized void close() throws SyncException {
try {
Index: SyncEventID.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncEventID.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SyncEventID.java 18 Jan 2005 14:07:08 -0000 1.2
+++ SyncEventID.java 3 Feb 2005 10:52:34 -0000 1.3
@@ -83,4 +83,8 @@
return false;
}
}
+
+ public String toString() {
+ return "SyncEventID: "+eventID+"-"+calendarID;
+ }
}
Index: SyncManagerImpl.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncManagerImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SyncManagerImpl.java 1 Feb 2005 13:37:04 -0000 1.7
+++ SyncManagerImpl.java 3 Feb 2005 10:52:34 -0000 1.8
@@ -95,6 +95,7 @@
/**
* Thread safe method for locking a particular event. The method will
only
* return once the lock has been granted.
+ * @param event The SyncEvent to lock
* @see SyncManager
*/
public synchronized void getLock(SyncEvent event) throws SyncException {
@@ -113,6 +114,8 @@
/**
* Thread safe method for locking a particular event. The method will
only
* return once the lock has been granted.
+ * @param event The SyncEvent to lock
+ * @param calendarID The calendar being synchronized
* @see SyncManager
*/
public synchronized void getLock(SyncEvent event, String calendarID)
@@ -152,7 +155,7 @@
*/
public synchronized void unlock(SyncEvent event) throws SyncException {
if (isLocked(event)) {
- store.unlock(event, null);
+ store.unlock(event);
log.debug("Unlocking event: "+event);
} else {
throw new SyncException("Event '"+event+"' is not locked");
@@ -182,7 +185,7 @@
/**
* Tests if a given event is allready locked. (Thread-safe)
* @param event The event to test
- * @returns True if the testes event is allready locked
+ * @returns True if the tested event is allready locked
*/
private synchronized boolean isLocked(SyncEvent event) {
return store.isLocked(event);
@@ -278,22 +281,21 @@
}
/**
- *
+ * Simple Timer Task
*/
private class RemindTask extends TimerTask {
private String calendarID;
/**
- * Creates a new instance of RemindTask
+ * Creates a new instance of RemindTask
+ * @param calendarID The Id of the calendar to which the timer
+ * will be associated
*/
public RemindTask(String calendarID) {
this.calendarID = calendarID;
}
- /**
- *
- */
public synchronized void run() {
log.debug("Time's up for session: "+calendarID);
Index: SyncSession.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/SyncSession.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SyncSession.java 14 Jan 2005 14:36:28 -0000 1.2
+++ SyncSession.java 3 Feb 2005 10:52:34 -0000 1.3
@@ -40,7 +40,8 @@
import java.util.Hashtable;
/**
- *
+ * Manages on going SyncSessions
+ *
* @author Xavier Lawrence
*/
public class SyncSession {
@@ -53,14 +54,21 @@
}
/**
- *
+ * Returns the UwCalConnector instance for the given calendar
+ * @param calendarID The calendar ID
+ * @returns The UwCalConnector for that calendar or null if not found
*/
public synchronized UwCalConnector getCalServer(String calendarID) {
return (UwCalConnector)calendarToUwCalConnectors.get(calendarID);
}
/**
- *
+ * Sets the UwCalConnector instance for the given calendar
+ * @param calendarID The calendar ID
+ * @param calServer The UwCalConnector instance
+ * @returns The UwCalConnector for that calendar or null if not found
+ * @throws SyncException If an onGoing session for the same calendar
allready
+ * exists
*/
public synchronized void addCalServer(String calendarID, UwCalConnector
calServer)
throws SyncException {
@@ -71,7 +79,8 @@
}
/**
- *
+ * Removes an UwCalConnector instance from the set of on going
SyncSessions
+ * @param calendarID The calendar ID
*/
public synchronized void removeCalServer(String calendarID) {
calendarToUwCalConnectors.remove(calendarID);
Index: UwCalConnector.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnector.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- UwCalConnector.java 1 Feb 2005 13:37:04 -0000 1.14
+++ UwCalConnector.java 3 Feb 2005 10:52:34 -0000 1.15
@@ -61,6 +61,7 @@
import java.util.Iterator;
import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
/**
* This class implements the Storable interface. An object of this class will
@@ -79,9 +80,9 @@
public static final String CRLF = "\r\n";
private URIgen urigen;
- private boolean debug = true;
private String privateUser;
private String devid;
+ private boolean debug;
// Connection to uwCal
private Synch calServer;
@@ -99,6 +100,11 @@
try {
urigen = new UWCalWebURIgen("http://cal.rpi.edu");
+ if (log.getLevel().equals(Level.DEBUG)) {
+ debug = true;
+ } else {
+ debug = false;
+ }
calServer = new Synch(privateUser, devid, urigen, debug);
} catch (Exception e) {
@@ -200,6 +206,8 @@
* This method returns a VEvent object constructed from a String
* @param eventString The String object of the Vevent
* @return The VEvent object derived from the given String
+ * @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,
ParserException {
Index: UwCalConnectorServlet.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/UwCalConnectorServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UwCalConnectorServlet.java 20 Jan 2005 15:36:29 -0000 1.3
+++ UwCalConnectorServlet.java 3 Feb 2005 10:52:34 -0000 1.4
@@ -48,6 +48,8 @@
import org.apache.log4j.Logger;
/**
+ * Simple Servlet that replaces the CalendarClient application in case the
+ * Calendar Server connector needs to be used in a WebAPP
*
* @author Xavier Lawrence
*/
@@ -98,6 +100,7 @@
} else {
out.println("<h1>The "+super.getServletName()+" is
running</h1>");
+ out.println("<h3>from "+req.getRequestURI()+"</h3>");
}
out.println("</body></html>");
Index: WorkerThread.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/WorkerThread.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WorkerThread.java 2 Feb 2005 16:53:36 -0000 1.7
+++ WorkerThread.java 3 Feb 2005 10:52:34 -0000 1.8
@@ -199,9 +199,12 @@
}
/**
- *
+ * Sends a Response to the given request
+ * @param resp The Response
+ * @param req The Request
+ * @throws SyncException If something goes wrong
*/
- protected void sendResponse(Response resp, Request req) {
+ protected void sendResponse(Response resp, Request req) throws
SyncException {
agent.sendResponse(resp, req);
log.debug("Response sent");
}
Index: DummyCalServerGUI.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DummyCalServerGUI.java 5 Jan 2005 10:02:57 -0000 1.1
+++ DummyCalServerGUI.java 3 Feb 2005 10:52:34 -0000 1.2
@@ -42,6 +42,7 @@
import java.awt.*;
/**
+ * GUI of the dummy calendar server
*
* @author Xavier Lawrence
*/
@@ -357,7 +358,7 @@
for (int i=0; i<events.length; i++) {
calArea.append("Key -> "+events[i].getKey()+"\n");
calArea.append(new String(events[i].getContent())+"\n");
- calArea.append("State ->
"+StateValueConverter.toUWCalString(events[i].
+ calArea.append("State ->
"+StateValueConverter.toFrameWorkString(events[i].
getState())+"\n\n");
}
}//GEN-LAST:event_printButtonActionPerformed
@@ -379,7 +380,7 @@
String key = (String)keyList.getSelectedValue();
try {
int state =
server.getCalendar().getEvent(key).getState();
- String stateValue =
StateValueConverter.toUWCalString(state);
+ String stateValue =
StateValueConverter.toFrameWorkString(state);
stateSelecter.setSelectedItem(stateValue);
} catch (NullPointerException e) {
server.getCalendar().removeEvent(key);
@@ -401,7 +402,7 @@
JOptionPane.ERROR_MESSAGE);
return;
}
- server.setState(key, StateValueConverter.toUWCalInt(state));
+ server.setState(key, StateValueConverter.toFrameWorkInt(state));
}//GEN-LAST:event_setButtonActionPerformed
Index: SyncEventDialog.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/test/SyncEventDialog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SyncEventDialog.java 18 Jan 2005 14:07:08 -0000 1.2
+++ SyncEventDialog.java 3 Feb 2005 10:52:34 -0000 1.3
@@ -54,6 +54,7 @@
import java.beans.PropertyChangeEvent;
/**
+ * Dialog box for adding/editing an event
*
* @author Xavier Lawrence
*/
@@ -100,7 +101,7 @@
getEvent(key).getContent()));
stateSelecter.setSelectedItem(
-
StateValueConverter.toUWCalString(owner.getServer().getCalendar().
+
StateValueConverter.toFrameWorkString(owner.getServer().getCalendar().
getEvent(key).getState()));
}
@@ -151,7 +152,7 @@
if (value.toString().equals(okText)) {
SyncEvent event = new SyncEvent(new GUID(keyField.getText()),
content.getText().getBytes(),
-
StateValueConverter.toUWCalInt((String)stateSelecter.getSelectedItem()));
+
StateValueConverter.toFrameWorkInt((String)stateSelecter.getSelectedItem()));
if (added) {
owner.getServer().getCalendar().addEvent(event);
Index: HibernateUtil.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/util/HibernateUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HibernateUtil.java 11 Jan 2005 09:50:45 -0000 1.1
+++ HibernateUtil.java 3 Feb 2005 10:52:35 -0000 1.2
@@ -44,6 +44,7 @@
import org.apache.log4j.Logger;
/**
+ * Hibernate utility class for managing the Hibernate Session.
*
* @author Xavier Lawrence
*/
@@ -65,12 +66,14 @@
}
/**
- *
+ * The session variable
*/
public static final ThreadLocal session = new ThreadLocal();
/**
- *
+ * Returns the currentSession for the calling Thread
+ * @return The Hibernate Session object
+ * @throes HibernateException If something goes wrong
*/
public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
@@ -83,14 +86,17 @@
}
/**
- *
+ * Returns a new Session
+ * @return The new Hibernate Session object
+ * @throes HibernateException If something goes wrong
*/
public static Session newSession() throws HibernateException {
return sessionFactory.openSession();
}
/**
- *
+ * Closes currentSession for the calling Thread
+ * @throes HibernateException If something goes wrong
*/
public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
Index: CalendarManageable.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/CalendarManageable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CalendarManageable.java 22 Nov 2004 17:08:10 -0000 1.1
+++ CalendarManageable.java 3 Feb 2005 10:52:35 -0000 1.2
@@ -55,7 +55,8 @@
* @param userName The user name of the calendar owner
* @param deviceID The deviceID that together with the userName uniquely
* identifies a calendar
- * @param since A timestamp
+ * @param since A timestamp to select events that have changed from a
given
+ * point in time.
*/
public void loadCalendar(String userName, String deviceID, Timestamp
since)
throws SyncException;
Index: SyncException.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/SyncException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SyncException.java 23 Nov 2004 10:30:16 -0000 1.2
+++ SyncException.java 3 Feb 2005 10:52:35 -0000 1.3
@@ -38,7 +38,7 @@
package org.jahia.suite.calendar.framework;
/**
- * Represents an Exception that occured during a synchronization
+ * Represents an Exception that occured during a synchronization process
*
* @author Xavier Lawrence
*/
Index: Calendar.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/Calendar.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Calendar.java 18 Jan 2005 14:07:09 -0000 1.6
+++ Calendar.java 3 Feb 2005 10:52:35 -0000 1.7
@@ -142,4 +142,25 @@
}
return buff.toString();
}
+
+ public boolean equals(Object o) {
+ try {
+ Calendar tmp = (Calendar)o;
+ SyncEvent[] tmpEvents = tmp.getEvents();
+
+ if (events.length == tmpEvents.length) {
+ for (int i=0; i<events.length; i++) {
+ SyncEvent evt1 = events[i];
+ SyncEvent evt2 = tmpEvents[i];
+
+ if (!evt1.equals(evt2)) return false;
+ }
+ return true;
+ }
+ return false;
+
+ } catch (Throwable t) {
+ return false;
+ }
+ }
}
Index: SyncEvent.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/framework/model/SyncEvent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SyncEvent.java 18 Jan 2005 14:07:09 -0000 1.5
+++ SyncEvent.java 3 Feb 2005 10:52:35 -0000 1.6
@@ -119,7 +119,8 @@
public boolean equals(Object o) {
try {
SyncEvent ev = (SyncEvent)o;
- if (ev.getKey().equals(this.getKey())) {
+ if (ev.getKey().equals(getKey()) &&
+ new String(ev.getContent()).equals(new
String(getContent()))) {
return true;
}
return false;
Index: StateValueConverter.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/util/StateValueConverter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StateValueConverter.java 8 Dec 2004 16:05:29 -0000 1.3
+++ StateValueConverter.java 3 Feb 2005 10:52:35 -0000 1.4
@@ -109,7 +109,7 @@
* @param state The value of the Sync4j SyncItemState
* @return The corresponding value as defined in SyncEvent
*/
- public static int toUWCal(char state) {
+ public static int toFrameWork(char state) {
switch (state) {
case SyncItemState.DELETED:
return SyncEvent.DELETED;
@@ -136,7 +136,7 @@
* @param state The value of the uwCal SyncEvent
* @return A String representation of the state value
*/
- public static String toUWCalString(int state) {
+ public static String toFrameWorkString(int state) {
switch (state) {
case SyncEvent.DELETED:
return "DELETED";
@@ -163,7 +163,7 @@
* @param state The String value of the uwCal SyncEvent
* @return The state value
*/
- public static int toUWCalInt(String state) {
+ public static int toFrameWorkInt(String state) {
if ("DELETED".equals(state)) {
return SyncEvent.DELETED;
Index: FileMapping.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/FileMapping.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileMapping.java 31 Jan 2005 15:52:43 -0000 1.1
+++ FileMapping.java 3 Feb 2005 10:52:36 -0000 1.2
@@ -49,6 +49,8 @@
import org.apache.log4j.Logger;
/**
+ * Manages a mapping between the VEVENTS and their (initial) position in the
+ * iCalendar file.
*
* @author Xavier Lawrence
*/
@@ -78,14 +80,15 @@
}
/**
- *
+ * Returns the currentMapping object
+ * @return the current FileMapping object
*/
public static FileMapping getCurrentMapping() {
return currentMapping;
}
/**
- *
+ * Loads the existring mapping from the mapping file
*/
public void load() {
try {
@@ -104,7 +107,10 @@
}
/**
- *
+ * Returns the Mapping corresponding to the given String representing a
+ * VEVENT
+ * @param item The VEVENT
+ * @returns The LUID (fileName) of this VEVENT or null if not found
*/
public String getMapping(String item) {
Iterator ite = syncItems.keySet().iterator();
@@ -122,42 +128,51 @@
}
/**
- *
+ * Removes the mapping for the given position
+ * @param position The position to remove
*/
- public void removeMapping (int key) {
- mapping.remove(Integer.toString(key));
+ public void removeMapping (int position) {
+ mapping.remove(Integer.toString(position));
}
/**
- *
+ * Checks if the current LUID (fileName) has been processed
+ * @param fileName The file containing the VEVENT
+ * @returns True if the file has been processed
*/
public boolean processed(String fileName) {
return processedFiles.contains(fileName);
}
/**
- *
+ * Returns an Iterator with all the positions
+ * @returns an Iterator with all the positions
*/
public Iterator keys() {
return mapping.keySet().iterator();
}
/**
- *
+ * Returns a Collection with all the LUIDs mapped
+ * @returns a Collection with all the LUIDs mapped
*/
public Collection values() {
return mapping.values();
}
/**
- *
+ * Returns the LUID of the VEVENT at the given position
+ * @param position The VEVENT position
+ * @return The corresponding LUID (fileName) or null if not found
*/
public String getMappedFile(int position) {
return mapping.getProperty(Integer.toString(position));
}
/**
- *
+ * Returns the position of the given LUID (fileName)
+ * @param fileName The LUID
+ * @return The corresponding position in the file or -1 if not found
*/
public int getFilePosition(String fileName) {
Iterator ite = mapping.keySet().iterator();
@@ -174,14 +189,16 @@
}
/**
- *
+ * Returns the number of the currenttly known mapped VEVENTs
*/
public int size() {
return mapping.size();
}
/**
- *
+ * Sets the mapping for a given position to a given LUID (fileName)
+ * @param key The position
+ * @param value The LUID (fileName)
*/
public void updateMapping(int key, String value) {
mapping.setProperty(Integer.toString(key), value);
@@ -189,7 +206,8 @@
}
/**
- *
+ * Loads the mapping from the mapping Properties file
+ * @throws IOException If soemthing goes wrong
*/
public void loadMapping() throws IOException {
File mappingFile = new File(dbDirectoryName + '.' +
@@ -204,7 +222,8 @@
}
/**
- *
+ * Saves the mapping in the mapping Properties file
+ * @throws IOException If soemthing goes wrong
*/
public void saveMapping() throws IOException {
File mappingFile = new File(dbDirectoryName + '.' +
@@ -217,7 +236,8 @@
}
/**
- *
+ * Loads the content of all current SyncItem files
+ * @throws IOException If soemthing goes wrong
*/
private void loadSyncItemFiles() throws IOException {
// get all the syncITem files
Index: ICalendarSyncSource.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/ICalendarSyncSource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ICalendarSyncSource.java 31 Jan 2005 15:52:42 -0000 1.4
+++ ICalendarSyncSource.java 3 Feb 2005 10:52:36 -0000 1.5
@@ -584,7 +584,9 @@
}
/**
- *
+ * Checks if a given file allready exists
+ * @param fileName The LUID
+ * @return True if the file exists
*/
private boolean fileExists(int fileName) {
return new File(sourceDirectory,
Integer.toString(fileName)).exists();
Index: SyncClient.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncClient/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SyncClient.java 31 Jan 2005 15:52:43 -0000 1.5
+++ SyncClient.java 3 Feb 2005 10:52:36 -0000 1.6
@@ -66,7 +66,14 @@
*/
public class SyncClient {
+ /**
+ * Directory name where the Sync data will be put
+ */
public static final String DB_DIRECTORY = "./target/db/";
+
+ /**
+ * True to ignore the calendar properties during Synch
+ */
public static final boolean withOutCalProps = true;
private SyncClientFrame syncClientGUI;
Index: CalendarSyncSource.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSource.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CalendarSyncSource.java 2 Feb 2005 16:52:18 -0000 1.6
+++ CalendarSyncSource.java 3 Feb 2005 10:52:36 -0000 1.7
@@ -466,7 +466,7 @@
*
*/
private boolean twins(String content1, String content2)
- throws SyncSourceException {
+ throws SyncSourceException {
Properties props1 = new Properties();
Properties props2 = new Properties();
@@ -515,8 +515,8 @@
throw new SyncSourceException(e.getMessage(), e);
}
-// log.debug("Props1: "+props1);
-// log.debug("Props2: "+props2);
+ // log.debug("Props1: "+props1);
+ // log.debug("Props2: "+props2);
return props1.equals(props2);
}
Index: CalendarSyncSourceOutlook.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/sync4jModule/CalendarSyncSourceOutlook.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CalendarSyncSourceOutlook.java 2 Feb 2005 16:52:18 -0000 1.6
+++ CalendarSyncSourceOutlook.java 3 Feb 2005 10:52:36 -0000 1.7
@@ -155,7 +155,7 @@
SyncItem[] results = toICalendar(syncItems);
return super.setSyncItems(principal, results);
}
-
+
/**
* This method converts a SyncItem, the content of which is in the
iCalendar
* format into the Sync4j XML format.
@@ -200,11 +200,11 @@
"VERSION:2.0\r\n" +
"METHOD:PUBLISH\r\n" +
event +
- "END:VCALENDAR";
+ "END:VCALENDAR";
content = compatibleString(content);
-// log.debug("Content: "+content);
+ // log.debug("Content: "+content);
ByteArrayInputStream buffer = new
ByteArrayInputStream(content.getBytes());
@@ -265,13 +265,13 @@
if (byteContent == null) {
byteContent = new byte[0];
}
-
+
String content = new String(byteContent);
if (!content.startsWith("<?")) {
content = new String(Base64.decode(byteContent));
- }
+ }
-// log.debug("content: "+content);
+ // log.debug("content: "+content);
try {
// Converting the xmlStream into a Calendar object
ByteArrayInputStream xmlStream = new
ByteArrayInputStream(content.getBytes());
Index: CalendarManager.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/CalendarManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CalendarManager.java 26 Jan 2005 12:57:58 -0000 1.5
+++ CalendarManager.java 3 Feb 2005 10:52:36 -0000 1.6
@@ -382,7 +382,7 @@
SyncItem item = (SyncItem)ite.next();
SyncEvent ev = new SyncEvent(new
GUID(item.getKey().getKeyAsString()),
(byte[])item.getProperty(SyncItem.PROPERTY_BINARY_CONTENT).getValue(),
- StateValueConverter.toUWCal(item.getState()));
+ StateValueConverter.toFrameWork(item.getState()));
SyncOperation op = new SyncOperation(operationType, ev);
log.debug(op);
result.addElement(op);
Index: JMSAgent.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/syncServer/src/java/org/jahia/suite/calendar/syncServer/JMSAgent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JMSAgent.java 5 Jan 2005 10:04:26 -0000 1.1
+++ JMSAgent.java 3 Feb 2005 10:52:36 -0000 1.2
@@ -164,6 +164,8 @@
}
/**
+ * Invokes the underlying Transport layer to receive Requests
+ *
* @see TransportSender
*/
public Response sendAndGetResponse(Request req) throws
TransportException {
@@ -171,6 +173,8 @@
}
/**
+ * Invokes the underlying Transport layer to send Responses
+ *
* @see TransportSender
*/
public void sendRequest(Request req) throws TransportException {
@@ -178,6 +182,8 @@
}
/**
+ * Sets a MessageListener on the underlying Transport layer
+ *
* @see TransportSender
*/
public void setMessageListener(MessageListener listener)