Index: trunk/calendar3/.classpath
===================================================================
--- trunk/calendar3/.classpath (revision 2)
+++ trunk/calendar3/.classpath (revision 18)
@@ -61,6 +61,6 @@
-
+
Index: trunk/calendar3/appcommon/build.xml
===================================================================
--- trunk/calendar3/appcommon/build.xml (revision 2)
+++ trunk/calendar3/appcommon/build.xml (revision 18)
@@ -38,4 +38,5 @@
+
Index: trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeZonesParser.java
===================================================================
--- (revision )
+++ trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeZonesParser.java (revision 18)
@@ -1,0 +1,306 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.appcommon;
+
+import org.bedework.calfacade.BwCalendar;
+import org.bedework.calfacade.CalFacadeException;
+import org.bedework.icalendar.IcalTranslator;
+import org.bedework.icalendar.IcalUtil;
+
+import edu.rpi.sss.util.xml.XmlUtil;
+
+import net.fortuna.ical4j.model.Calendar;
+import net.fortuna.ical4j.model.ComponentList;
+import net.fortuna.ical4j.model.Property;
+import net.fortuna.ical4j.model.component.VTimeZone;
+
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/** This class is used by clients and applications to parse the timezone
+ * information generated by the timezone tool.
+ *
+ * @author Mike Douglass douglm @ rpi.edu
+ */
+public class TimeZonesParser implements Serializable {
+ private boolean debug;
+
+ private InputStream inStr;
+
+ private transient Logger log;
+
+ /** Result class
+ */
+ public static class TimeZoneInfo {
+ /** */
+ public String tzid;
+ /** */
+ public VTimeZone timezone;
+ }
+
+ /** Constructor
+ *
+ * @param inStr
+ * @param debug
+ */
+ public TimeZonesParser(InputStream inStr, boolean debug) {
+ this.inStr = inStr;
+ this.debug = debug;
+ }
+
+ /** Return a collection of TimeZoneInfo
+ *
+ * @return Collection of TimeZoneInfo
+ * @throws CalFacadeException
+ */
+ public Collection getTimeZones() throws CalFacadeException {
+ /* The input file should look something like:
+
+ A-name
+ ...
+
+ file1.ics
+ ...
+
+
+
+ We ignore the first name - it represents the root.
+ Each element may contain other and elements.
+ Each element is a path element
+ */
+
+ DirClass rootDir = parseTzDefs(new InputStreamReader(inStr));
+
+ Vector v = new Vector();
+
+ doDir(v, rootDir, "");
+
+ return v;
+ }
+
+ private String doDir(Vector v, DirClass dir, String indent) throws CalFacadeException {
+ if (debug) {
+ trace(indent + "Dir: " + dir.cal.getName());
+ }
+
+ Iterator dit = dir.dirs.iterator();
+ while (dit.hasNext()) {
+ doDir(v, (DirClass)dit.next(), indent + " ");
+ }
+
+ Iterator tzit = dir.tzs.iterator();
+ while (tzit.hasNext()) {
+ Calendar ical = (Calendar)tzit.next();
+
+ ComponentList cl = ical.getComponents();
+
+ if (cl.size() != 1) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ cl.size() + " components in Calendar");
+ }
+
+ Object o = cl.get(0);
+ if (!(o instanceof VTimeZone)) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ "component in Calendar not VTimeZone");
+ }
+
+ TimeZoneInfo tzi = new TimeZoneInfo();
+
+ tzi.timezone = (VTimeZone)o;
+ tzi.tzid = IcalUtil.getProperty(tzi.timezone, Property.TZID).getValue();
+
+ v.add(tzi);
+
+ if (debug) {
+ trace(indent + "tzid: " + tzi.tzid);
+ }
+ }
+
+ return null;
+ }
+
+ private static class DirClass {
+ BwCalendar cal; // The name will be set according to the dir/name
+
+ Collection dirs = new Vector();
+
+ /* Collection of Calendar obects
+ */
+ Collection tzs = new Vector();
+ }
+
+ private DirClass parseTzDefs(Reader rdr) throws CalFacadeException {
+ Document doc = null;
+
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(false);
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ doc = builder.parse(new InputSource(rdr));
+ } catch (SAXException e) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ e.getMessage());
+ } catch (Throwable t) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ t.getMessage());
+ } finally {
+ if (rdr != null) {
+ try {
+ rdr.close();
+ } catch (Throwable t) {}
+ }
+ }
+
+ return processDir(doc.getDocumentElement());
+ }
+
+ private DirClass processDir(Element dir) throws CalFacadeException {
+ try {
+ DirClass d = new DirClass();
+ Collection children = XmlUtil.getElements(dir);
+
+ Iterator it = children.iterator();
+
+ /* First is name */
+
+ Element nmel = (Element)it.next();
+
+ d.cal = new BwCalendar();
+ d.cal.setName(XmlUtil.getElementContent(nmel));
+
+ while (it.hasNext()) {
+ Element el = (Element)it.next();
+
+ if ("dir".equals(el.getTagName())) {
+ d.dirs.add(processDir(el));
+ } else if ("file".equals(el.getTagName())) {
+ d.tzs.add(processFile(el));
+ } else {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ "Expected or , found: " + el.getTagName());
+ }
+ }
+
+ return d;
+ } catch (CalFacadeException cfe) {
+ throw cfe;
+ } catch (Throwable t) {
+ throw new CalFacadeException(t);
+ }
+ }
+
+ private Calendar processFile(Element ics) throws CalFacadeException {
+ //NodeList ds = ics.getElementsByTagName("data");
+
+ try {
+ Collection children = XmlUtil.getElements(ics);
+
+ Iterator it = children.iterator();
+
+ /* First is name */
+
+ Element el = (Element)it.next();
+ if (!"name".equals(el.getTagName())) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ "Expected , found: " + el.getTagName());
+ }
+
+ /* Next is data */
+ el = (Element)it.next();
+ if (!"data".equals(el.getTagName())) {
+ throw new CalFacadeException(CalFacadeException.timezonesReadError,
+ "Expected , found: " + el.getTagName());
+ }
+
+ return IcalTranslator.getCalendar(XmlUtil.getElementContent(el));
+ } catch (CalFacadeException cfe) {
+ throw cfe;
+ } catch (Throwable t) {
+ throw new CalFacadeException(t);
+ }
+ }
+
+ /** Get a logger for messages
+ */
+ protected Logger getLogger() {
+ if (log == null) {
+ log = Logger.getLogger(this.getClass());
+ }
+
+ return log;
+ }
+
+ protected void trace(String msg) {
+ getLogger().debug(msg);
+ }
+}
+
Index: trunk/calendar3/bldfiles/defjars.properties
===================================================================
--- trunk/calendar3/bldfiles/defjars.properties (revision 2)
+++ trunk/calendar3/bldfiles/defjars.properties (revision 18)
@@ -55,5 +55,5 @@
# ical4j.jar Used for icalendar translation.
-ical4j.jar.name=ical4j-0.9.17.jar
+ical4j.jar.name=ical4j-0.9.18.jar
ical4j.jar=${org.bedework.default.lib}/${ical4j.jar.name}
Index: trunk/calendar3/build.properties
===================================================================
--- trunk/calendar3/build.properties (revision 2)
+++ trunk/calendar3/build.properties (revision 18)
@@ -37,2 +37,4 @@
product.name=Bedework
product.version=3
+
+org.bedework.deploy.log4j.config=no
Index: trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml
===================================================================
--- trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml (revision 2)
+++ trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml (revision 18)
@@ -37,4 +37,5 @@
+
Index: trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
===================================================================
--- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (revision 2)
+++ trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (revision 18)
@@ -69,4 +69,5 @@
import org.bedework.calfacade.BwSynchInfo;
import org.bedework.calfacade.BwSynchState;
+import org.bedework.calfacade.BwSystem;
import org.bedework.calfacade.BwTimeZone;
import org.bedework.calfacade.BwUser;
@@ -127,4 +128,6 @@
private boolean debug;
+ private BwSystem syspars;
+
private BwStats stats = new BwRWStats();
@@ -141,13 +144,14 @@
private AccessUtil access;
- /* From core environment properties */
+ /* From core environment properties * /
private String systemId;
private String publicCalendarRoot;
- private String publicCalendarRootPath;
private String userCalendarRoot;
- private String userCalendarRootPath;
private String userDefaultCalendar;
private String defaultTrashCalendar;
+ */
+ private String publicCalendarRootPath;
+ private String userCalendarRootPath;
/** Ensure we don't open while open
@@ -261,21 +265,19 @@
/** Define the roots of the calendars.
- */
+ * /
publicCalendarRoot = CalEnv.getGlobalProperty("public.calroot");
userCalendarRoot = CalEnv.getGlobalProperty("user.calroot");
userDefaultCalendar = CalEnv.getGlobalProperty("default.user.calendar");
defaultTrashCalendar = CalEnv.getGlobalProperty("default.trash.calendar");
+
+ systemId = CalEnv.getGlobalProperty("systemid");
+ */
} catch (Throwable t) {
throw new CalFacadeException(t);
}
- publicCalendarRootPath = "/" + publicCalendarRoot;
- userCalendarRootPath = "/" + userCalendarRoot;
-
- try {
- systemId = CalEnv.getGlobalProperty("systemid");
- } catch (Throwable t) {
- throw new CalFacadeException(t);
- }
+ publicCalendarRootPath = "/" + getSyspars().getPublicCalendarRoot();
+ userCalendarRootPath = "/" + getSyspars().getUserCalendarRoot();
+ //systemId = getSyspars().getSystemid();
if (user == null) {
@@ -350,18 +352,35 @@
}
- /** Get the current stats
- *
- * @return BwStats object
- * @throws CalFacadeException if not admin
- */
public BwStats getStats() throws CalFacadeException {
return stats;
}
- /** Get the timezones cache object
- *
- * @return CalTimezones object
- * @throws CalFacadeException if not admin
- */
+ public BwSystem getSyspars() throws CalFacadeException {
+ if (syspars == null) {
+ String name;
+
+ try {
+ name = CalEnv.getGlobalProperty("system.name");
+ } catch (Throwable t) {
+ throw new CalFacadeException(t);
+ }
+
+ sess.namedQuery("getSystemPars");
+
+ sess.setString("name", name);
+
+ syspars = (BwSystem)sess.getUnique();
+
+ if (syspars == null) {
+ throw new CalFacadeException("No system parameters with name " + name);
+ }
+
+ if (debug) {
+ trace("Read system parameters: " + syspars);
+ }
+ }
+ return syspars;
+ }
+
public CalTimezones getTimezones() throws CalFacadeException {
return timezones;
@@ -549,5 +568,5 @@
public String getSysid() throws CalFacadeException {
- return systemId;
+ return getSyspars().getSystemid();
}
@@ -604,5 +623,5 @@
sess.namedQuery("getCalendarByPath");
- String path = "/" + userCalendarRoot;
+ String path = "/" + getSyspars().getUserCalendarRoot();
sess.setString("path", path);
@@ -622,4 +641,5 @@
}
+ /* Create a folder for the user */
usercal = new BwCalendar();
usercal.setName(user.getAccount());
@@ -633,10 +653,11 @@
sess.save(userrootcal);
+ /* Create a default calendar */
BwCalendar cal = new BwCalendar();
- cal.setName(userDefaultCalendar);
+ cal.setName(getSyspars().getUserDefaultCalendar());
cal.setCreator(user);
cal.setOwner(user);
cal.setPublick(false);
- cal.setPath(path + "/" + userDefaultCalendar);
+ cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar());
cal.setCalendar(usercal);
cal.setCalendarCollection(true);
@@ -644,11 +665,32 @@
/* Add the trash calendar */
-
cal = new BwCalendar();
- cal.setName(defaultTrashCalendar);
+ cal.setName(getSyspars().getDefaultTrashCalendar());
cal.setCreator(user);
cal.setOwner(user);
cal.setPublick(false);
- cal.setPath(path + "/" + defaultTrashCalendar);
+ cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar());
+ cal.setCalendar(usercal);
+ cal.setCalendarCollection(true);
+ usercal.addChild(cal);
+
+ /* Add the inbox */
+ cal = new BwCalendar();
+ cal.setName(getSyspars().getUserInbox());
+ cal.setCreator(user);
+ cal.setOwner(user);
+ cal.setPublick(false);
+ cal.setPath(path + "/" + getSyspars().getUserInbox());
+ cal.setCalendar(usercal);
+ cal.setCalendarCollection(true);
+ usercal.addChild(cal);
+
+ /* Add the outbox */
+ cal = new BwCalendar();
+ cal.setName(getSyspars().getUserOutbox());
+ cal.setCreator(user);
+ cal.setOwner(user);
+ cal.setPublick(false);
+ cal.setPath(path + "/" + getSyspars().getUserOutbox());
cal.setCalendar(usercal);
cal.setCalendarCollection(true);
@@ -907,9 +949,9 @@
sb.append("/");
- sb.append(userCalendarRoot);
+ sb.append(getSyspars().getUserCalendarRoot());
sb.append("/");
sb.append(user.getAccount());
sb.append("/");
- sb.append(userDefaultCalendar);
+ sb.append(getSyspars().getUserDefaultCalendar());
return getCalendar(sb.toString());
@@ -920,9 +962,9 @@
sb.append("/");
- sb.append(userCalendarRoot);
+ sb.append(getSyspars().getUserCalendarRoot());
sb.append("/");
sb.append(user.getAccount());
sb.append("/");
- sb.append(defaultTrashCalendar);
+ sb.append(getSyspars().getDefaultTrashCalendar());
return getCalendar(sb.toString());
Index: trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
===================================================================
--- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (revision 2)
+++ trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (revision 18)
@@ -966,5 +966,5 @@
}
- debugMsg("Try query " + sb.toString());
+ //debugMsg("Try query " + sb.toString());
}
Index: trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java
===================================================================
--- (revision )
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java (revision 18)
@@ -1,0 +1,465 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.calfacade;
+
+import org.bedework.calfacade.base.BwDbentity;
+
+import java.util.Comparator;
+
+/** System settings for an instance of bedework as represented by a single
+ * database. These settings may be changed by the super user but most should
+ * not be changed after system initialisation..
+ *
+ * @author Mike Douglass douglm@rpi.edu
+ */
+public class BwSystem extends BwDbentity implements Comparator {
+ /* A name for the system */
+ private String name;
+
+ /* Default time zone */
+ private String tzid;
+
+ /* The system id */
+ private String systemid;
+
+ /* Default calendara names */
+ private String publicCalendarRoot;
+ private String userCalendarRoot;
+ private String userDefaultCalendar;
+ private String defaultTrashCalendar;
+ private String userInbox;
+ private String userOutbox;
+
+ private String publicUser;
+
+ private boolean directoryBrowsingDisallowed;
+
+ private int httpConnectionsPerUser;
+ private int httpConnectionsPerHost;
+ private int httpConnections;
+
+ private String userauthClass;
+ private String mailerClass;
+ private String admingroupsClass;
+ private String usergroupsClass;
+
+ /** Set the system's name
+ *
+ * @param val String system name
+ */
+ public void setName(String val) {
+ name = val;
+ }
+
+ /** Get the system's name.
+ *
+ * @return String system's name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /** Set the default tzid
+ *
+ * @param val String
+ */
+ public void setTzid(String val) {
+ tzid = val;
+ }
+
+ /** Get the default tzid.
+ *
+ * @return String tzid
+ */
+ public String getTzid() {
+ return tzid;
+ }
+
+ /** Set the default systemid
+ *
+ * @param val String
+ */
+ public void setSystemid(String val) {
+ systemid = val;
+ }
+
+ /** Get the default systemid.
+ *
+ * @return String systemid
+ */
+ public String getSystemid() {
+ return systemid;
+ }
+
+ /** Set the public Calendar Root
+ *
+ * @param val String
+ */
+ public void setPublicCalendarRoot(String val) {
+ publicCalendarRoot = val;
+ }
+
+ /** Get the publicCalendarRoot
+ *
+ * @return String publicCalendarRoot
+ */
+ public String getPublicCalendarRoot() {
+ return publicCalendarRoot;
+ }
+
+ /** Set the user Calendar Root
+ *
+ * @param val String
+ */
+ public void setUserCalendarRoot(String val) {
+ userCalendarRoot = val;
+ }
+
+ /** Get the userCalendarRoot
+ *
+ * @return String userCalendarRoot
+ */
+ public String getUserCalendarRoot() {
+ return userCalendarRoot;
+ }
+
+ /** Set the user default calendar
+ *
+ * @param val String
+ */
+ public void setUserDefaultCalendar(String val) {
+ userDefaultCalendar = val;
+ }
+
+ /** Get the userDefaultCalendar
+ *
+ * @return String userDefaultCalendar
+ */
+ public String getUserDefaultCalendar() {
+ return userDefaultCalendar;
+ }
+
+ /** Set the user trash calendar
+ *
+ * @param val String
+ */
+ public void setDefaultTrashCalendar(String val) {
+ defaultTrashCalendar = val;
+ }
+
+ /** Get the userTrashCalendar
+ *
+ * @return String userTrashCalendar
+ */
+ public String getDefaultTrashCalendar() {
+ return defaultTrashCalendar;
+ }
+
+ /** Set the user inbox
+ *
+ * @param val String
+ */
+ public void setUserInbox(String val) {
+ userInbox = val;
+ }
+
+ /** Get the userCalendar
+ *
+ * @return String userTrashCalendar
+ */
+ public String getUserInbox() {
+ return userInbox;
+ }
+
+ /** Set the user outbox
+ *
+ * @param val String
+ */
+ public void setUserOutbox(String val) {
+ userOutbox = val;
+ }
+
+ /** Get the userCalendar
+ *
+ * @return String userTrashCalendar
+ */
+ public String getUserOutbox() {
+ return userOutbox;
+ }
+
+ /** Set the public user
+ *
+ * @param val String
+ */
+ public void setPublicUser(String val) {
+ publicUser = val;
+ }
+
+ /**
+ *
+ * @return String
+ */
+ public String getPublicUser() {
+ return publicUser;
+ }
+
+ /** Set the directory browsing disallowed
+ *
+ * @param val boolean directory browsing disallowed
+ */
+ public void setDirectoryBrowsingDisallowed(boolean val) {
+ directoryBrowsingDisallowed = val;
+ }
+
+ /**
+ *
+ * @return boolean
+ */
+ public boolean getDirectoryBrowsingDisallowed() {
+ return directoryBrowsingDisallowed;
+ }
+
+ /** Set the max http connections per user
+ *
+ * @param val int max http connections per user
+ */
+ public void setHttpConnectionsPerUser(int val) {
+ httpConnectionsPerUser = val;
+ }
+
+ /**
+ *
+ * @return int
+ */
+ public int getHttpConnectionsPerUser() {
+ return httpConnectionsPerUser;
+ }
+
+ /** Set the max http connections per host
+ *
+ * @param val int max http connections per host
+ */
+ public void setHttpConnectionsPerHost(int val) {
+ httpConnectionsPerHost = val;
+ }
+
+ /**
+ *
+ * @return int
+ */
+ public int getHttpConnectionsPerHost() {
+ return httpConnectionsPerHost;
+ }
+
+ /** Set the max http connections
+ *
+ * @param val int max http connections
+ */
+ public void setHttpConnections(int val) {
+ httpConnections = val;
+ }
+
+ /**
+ *
+ * @return int
+ */
+ public int getHttpConnections() {
+ return httpConnections;
+ }
+
+ /** Set the userauth class
+ *
+ * @param val String userauth class
+ */
+ public void setUserauthClass(String val) {
+ userauthClass = val;
+ }
+
+ /**
+ *
+ * @return String
+ */
+ public String getUserauthClass() {
+ return userauthClass;
+ }
+
+ /** Set the mailer class
+ *
+ * @param val String mailer class
+ */
+ public void setMailerClass(String val) {
+ mailerClass = val;
+ }
+
+ /**
+ *
+ * @return String
+ */
+ public String getMailerClass() {
+ return mailerClass;
+ }
+
+ /** Set the admingroups class
+ *
+ * @param val String admingroups class
+ */
+ public void setAdmingroupsClass(String val) {
+ admingroupsClass = val;
+ }
+
+ /**
+ *
+ * @return String
+ */
+ public String getAdmingroupsClass() {
+ return admingroupsClass;
+ }
+
+ /** Set the usergroups class
+ *
+ * @param val String usergroups class
+ */
+ public void setUsergroupsClass(String val) {
+ usergroupsClass = val;
+ }
+
+ /**
+ *
+ * @return String
+ */
+ public String getUsergroupsClass() {
+ return usergroupsClass;
+ }
+
+ /* ====================================================================
+ * Object methods
+ * ==================================================================== */
+
+ public int compare(Object o1, Object o2) {
+ if (!(o1 instanceof BwSystem)) {
+ return -1;
+ }
+
+ if (!(o2 instanceof BwSystem)) {
+ return 1;
+ }
+
+ if (o1 == o2) {
+ return 0;
+ }
+
+ BwSystem s1 = (BwSystem)o1;
+ BwSystem s2 = (BwSystem)o2;
+
+ return s1.getName().compareTo(s2.getName());
+ }
+
+ public int compareTo(Object o2) {
+ return compare(this, o2);
+ }
+
+ public int hashCode() {
+ return getName().hashCode();
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer("BwSystem{");
+
+ toStringSegment(sb);
+ sb.append("name=");
+ sb.append(getName());
+ sb.append("tzid=");
+ sb.append(getTzid());
+ sb.append("systemid=");
+ sb.append(getSystemid());
+ sb.append("publicCalendarRoot=");
+ sb.append(getPublicCalendarRoot());
+ sb.append("userCalendarRoot=");
+ sb.append(getUserCalendarRoot());
+ sb.append("userDefaultCalendar=");
+ sb.append(getUserDefaultCalendar());
+ sb.append("defaultTrashCalendar=");
+ sb.append(getDefaultTrashCalendar());
+ sb.append("userInbox=");
+ sb.append(getUserInbox());
+ sb.append("userOutbox=");
+ sb.append(getUserOutbox());
+
+ sb.append("publicUser=");
+ sb.append(getPublicUser());
+ sb.append("directoryBrowsingDisallowed=");
+ sb.append(getDirectoryBrowsingDisallowed());
+
+ sb.append("httpConnectionsPerUser=");
+ sb.append(getHttpConnectionsPerUser());
+ sb.append("httpConnectionsPerHost=");
+ sb.append(getHttpConnectionsPerHost());
+ sb.append("httpConnections=");
+ sb.append(getHttpConnections());
+
+ sb.append("userauthClass=");
+ sb.append(getUserauthClass());
+ sb.append("mailerClass=");
+ sb.append(getMailerClass());
+ sb.append("admingroupsClass=");
+ sb.append(getAdmingroupsClass());
+ sb.append("usergroupsClass=");
+ sb.append(getUsergroupsClass());
+
+ sb.append("}");
+
+ return sb.toString();
+ }
+}
Index: trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java (revision 2)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java (revision 18)
@@ -88,4 +88,11 @@
"org.bedework.exception.duplicateguid";
+ /** Error reading timezones */
+ public static final String timezonesReadError =
+ "org.bedework.error.timezones.readerror";
+
+
+ private String extra;
+
/** Constrictor
*
@@ -108,3 +115,19 @@
super(s);
}
+
+ /**
+ * @param s - retrieve with getMessage(), property ame
+ * @param extra String extra text
+ */
+ public CalFacadeException(String s, String extra) {
+ super(s);
+ this.extra = extra;
+ }
+
+ /**
+ * @return String extra text
+ */
+ public String getExtra() {
+ return extra;
+ }
}
Index: trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java (revision 2)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java (revision 18)
@@ -503,4 +503,35 @@
}
+ /** Given a class name return an object of that class.
+ * The class parameter is used to check that the
+ * named class is an instance of that class.
+ *
+ * @param className String class name
+ * @param cl Class expected
+ * @return Object checked to be an instance of that class
+ * @throws CalFacadeException
+ */
+ public static Object getObject(String className, Class cl) throws CalFacadeException {
+ try {
+ Object o = Class.forName(className).newInstance();
+
+ if (o == null) {
+ throw new CalFacadeException("Class " + className + " not found");
+ }
+
+ if (!cl.isInstance(o)) {
+ throw new CalFacadeException("Class " + className +
+ " is not a subclass of " +
+ cl.getName());
+ }
+
+ return o;
+ } catch (CalFacadeException ce) {
+ throw ce;
+ } catch (Throwable t) {
+ throw new CalFacadeException(t);
+ }
+ }
+
/* ====================================================================
ical utilities
Index: trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java (revision 2)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java (revision 18)
@@ -65,4 +65,5 @@
import org.bedework.calfacade.BwSynchInfo;
import org.bedework.calfacade.BwSynchState;
+import org.bedework.calfacade.BwSystem;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.CalFacadeAccessException;
@@ -168,4 +169,8 @@
}
+ public BwSystem getSyspars() throws CalFacadeException {
+ return null;
+ }
+
/** Get the timezones cache object
*
Index: trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java (revision 2)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java (revision 18)
@@ -64,4 +64,5 @@
import org.bedework.calfacade.BwSynchInfo;
import org.bedework.calfacade.BwSynchState;
+import org.bedework.calfacade.BwSystem;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.CalFacadeException;
@@ -121,4 +122,11 @@
public BwStats getStats() throws CalFacadeException;
+ /** Get the system pars
+ *
+ * @return BwSystem object
+ * @throws CalFacadeException if not admin
+ */
+ public BwSystem getSyspars() throws CalFacadeException;
+
/** Get the timezones cache object
*
Index: trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
===================================================================
--- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (revision 2)
+++ trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (revision 18)
@@ -74,8 +74,10 @@
import org.bedework.calfacade.BwSynchInfo;
import org.bedework.calfacade.BwSynchState;
+import org.bedework.calfacade.BwSystem;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.CalFacadeAccessException;
import org.bedework.calfacade.CalFacadeDefs;
import org.bedework.calfacade.CalFacadeException;
+import org.bedework.calfacade.CalFacadeUtil;
import org.bedework.calfacade.filter.BwFilter;
import org.bedework.calfacade.ifs.CalTimezones;
@@ -129,4 +131,6 @@
*/
private BwUser publicUser;
+
+ // Set up by call to getCal()
private String publicUserAccount;
@@ -290,5 +294,5 @@
env = new CalEnv(appPrefix, debug);
- publicUserAccount = CalEnv.getGlobalProperty("public.user");
+ //publicUserAccount = CalEnv.getGlobalProperty("public.user");
if (pars.isGuest() && (pars.getUser() == null)) {
@@ -325,4 +329,13 @@
}
+ /** Get the system pars
+ *
+ * @return BwSystem object
+ * @throws CalFacadeException if not admin
+ */
+ public BwSystem getSyspars() throws CalFacadeException {
+ return getCal().getSyspars();
+ }
+
public CalTimezones getTimezones() throws CalFacadeException {
return getCal().getTimezones();
@@ -445,5 +458,5 @@
try {
- userAuth = (UserAuth)CalEnv.getGlobalObject("userauthclass",
+ userAuth = (UserAuth)CalFacadeUtil.getObject(getSyspars().getUserauthClass(),
UserAuth.class);
} catch (Throwable t) {
@@ -479,5 +492,5 @@
try {
- userGroups = (Groups)CalEnv.getGlobalObject("usergroupsclass", Groups.class);
+ userGroups = (Groups)CalFacadeUtil.getObject(getSyspars().getUsergroupsClass(), Groups.class);
userGroups.init(getGroupsCallBack());
} catch (Throwable t) {
@@ -494,5 +507,5 @@
try {
- adminGroups = (Groups)CalEnv.getGlobalObject("admingroupsclass", Groups.class);
+ adminGroups = (Groups)CalFacadeUtil.getObject(getSyspars().getAdmingroupsClass(), Groups.class);
adminGroups.init(getGroupsCallBack());
} catch (Throwable t) {
@@ -1781,6 +1794,5 @@
try {
- cali = (Calintf)CalEnv.getGlobalObject("calintfclass",
- Calintf.class);
+ cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class);
} catch (Throwable t) {
throw new CalFacadeException(t);
@@ -1799,4 +1811,7 @@
debug);
+ // Prepare for call below.
+ publicUserAccount = cali.getSyspars().getPublicUser();
+
BwUser auth;
if (isPublicAdmin() || isGuest()) {
Index: trunk/calendar3/config/configs/democal.properties
===================================================================
--- trunk/calendar3/config/configs/democal.properties (revision 2)
+++ trunk/calendar3/config/configs/democal.properties (revision 18)
@@ -24,23 +24,25 @@
#
org.bedework.global.hibernate.dialect=org.hibernate.dialect.HSQLDialect
-org.bedework.global.systemid=demobedework@mysite.edu
-org.bedework.global.directory.browsing.disallowed=false
-org.bedework.global.http.connections.peruser=10
-org.bedework.global.http.connections.perhost=50
-org.bedework.global.http.connections=200
-
-org.bedework.global.public.calroot=public
-org.bedework.global.user.calroot=user
-org.bedework.global.default.user.calendar=calendar
-org.bedework.global.default.trash.calendar=Trash
-org.bedework.global.public.user=public-user
-org.bedework.global.timezoneroot=timezones
-
-org.bedework.global.userauthclass=org.bedework.calcore.hibernate.UserAuthUWDbImpl
-org.bedework.global.mailerclass=org.bedework.mail.DummyMailer
+org.bedework.global.system.name=bedework
+#org.bedework.global.systemid=demobedework@mysite.edu
+#org.bedework.global.directory.browsing.disallowed=false
+#org.bedework.global.http.connections.peruser=10
+#org.bedework.global.http.connections.perhost=50
+#org.bedework.global.http.connections=200
+
+#org.bedework.global.public.calroot=public
+#org.bedework.global.user.calroot=user
+#org.bedework.global.default.user.calendar=calendar
+#org.bedework.global.default.trash.calendar=Trash
+#org.bedework.global.public.user=public-user
+#org.bedework.global.timezoneroot=timezones
+
org.bedework.global.calintfclass=org.bedework.calcore.hibernate.CalintfImpl
-org.bedework.global.update.check.interval=5000
-org.bedework.global.admingroupsclass=org.bedework.calcore.hibernate.AdminGroupsDbImpl
-org.bedework.global.usergroupsclass=org.bedework.calcore.hibernate.GroupsDbImpl
+
+#org.bedework.global.userauthclass=org.bedework.calcore.hibernate.UserAuthUWDbImpl
+#org.bedework.global.mailerclass=org.bedework.mail.DummyMailer
+#org.bedework.global.admingroupsclass=org.bedework.calcore.hibernate.AdminGroupsDbImpl
+#org.bedework.global.usergroupsclass=org.bedework.calcore.hibernate.GroupsDbImpl
+#org.bedework.global.update.check.interval=5000
#
Index: trunk/calendar3/docs/todo.txt
===================================================================
--- trunk/calendar3/docs/todo.txt (revision 2)
+++ trunk/calendar3/docs/todo.txt (revision 18)
@@ -5,11 +5,5 @@
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-The EventAnnotation class is causing multiple queries - (polymorphic queries)
-For example, the hql "select count(*) from BwEvents where ..."
-causes 2 queries and a non-unique result exception
-
-Perhaps create a BwEventCommon class then subclass for BwEvent,
-BwEventAnnotation?
+svn
--------------------------------------------------------------------------------
All times should have a timezone - we need to set the default timezone for the
@@ -28,5 +22,10 @@
is the container for that stuff.
--------------------------------------------------------------------------------
-Acl.encode should not encode Ace with inherited = true
+The EventAnnotation class was causing multiple queries - (polymorphic queries)
+For example, the hql "select count(*) from BwEvents where ..."
+caused 2 queries and a non-unique result exception
+
+Fixed by changing the hierarchy, making BwEvent a common base class then
+subclass for BwEventObj and BwEventAnnotation.
--------------------------------------------------------------------------------
FiltersRule needs to add Inbox
@@ -35,4 +34,6 @@
--------------------------------------------------------------------------------
lazy="false" is set on calendar objects.
+--------------------------------------------------------------------------------
+Acl.encode should not encode Ace with inherited = true
--------------------------------------------------------------------------------
Access control not quite right. The requirements are something like:
@@ -103,9 +104,4 @@
--------------------------------------------------------------------------------
Remove target from BwEvent?
---------------------------------------------------------------------------------
-Events.getEvent by guid/rid/seq fails because we get same guid in different
-users events. Do we enforce absolute uniqueness - probably
-
-Should probably remove owner from unique key
--------------------------------------------------------------------------------
We probably need the equivalent of an event info object at the Calintf level to
Index: trunk/calendar3/tools/build.xml
===================================================================
--- trunk/calendar3/tools/build.xml (revision 2)
+++ trunk/calendar3/tools/build.xml (revision 18)
@@ -49,4 +49,5 @@
+
Index: trunk/calendar3/tools/dumprestore/build.xml
===================================================================
--- trunk/calendar3/tools/dumprestore/build.xml (revision 2)
+++ trunk/calendar3/tools/dumprestore/build.xml (revision 18)
@@ -197,7 +197,20 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -208,14 +221,22 @@
-
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/calendar3/tools/properties/dumprestore.properties
===================================================================
--- trunk/calendar3/tools/properties/dumprestore.properties (revision 2)
+++ trunk/calendar3/tools/properties/dumprestore.properties (revision 18)
@@ -36,6 +36,6 @@
# -debug or -ndebug
org.bedework.restore.arg.debug=-debug
+org.bedework.restore.arg.from2p3px=
-org.bedework.restore.arg.hib=-nhib
org.bedework.restore.arg.fixcals=-nfixcals
org.bedework.restore.arg.defaultpubliccal=
@@ -55,8 +55,27 @@
org.bedework.restore.arg.jdbcpw=
-# ------------------- global properties --------------------------
+# -------------------- System parameters ----------------------------
+org.bedework.restore.arg.sysname=bedework
+org.bedework.restore.arg.tzid=America/New_York
+org.bedework.restore.arg.sysid=calendar@bedework.org
+
org.bedework.env.public.calroot=public
org.bedework.env.user.calroot=user
org.bedework.env.default.user.calendar=calendar
org.bedework.env.default.trash.calendar=Trash
+org.bedework.env.default.user.inbox=Inbox
+org.bedework.env.default.user.outbox=Outbox
+org.bedework.restore.arg.public.user=-pu public-user
+
+org.bedework.restore.arg.dirbrowsing.disallowed=-dirbrowsing-disallowed false
+
+org.bedework.restore.arg.httpconns.peruser=-httpconnsperuser 10
+org.bedework.restore.arg.httpconns.perhost=-httpconnsperhost 50
+org.bedework.restore.arg.httpconns=-httpconns 200
+
+org.bedework.restore.arg.userauthClass=-userauthClass org.bedework.calcore.hibernate.UserAuthUWDbImpl
+org.bedework.restore.arg.mailerClass=-mailerClass org.bedework.mail.DummyMailer
+org.bedework.restore.arg.admingroupsClass=-admingroupsClass org.bedework.calcore.hibernate.AdminGroupsDbImpl
+org.bedework.restore.arg.usergroupsClass=-usergroupsClass org.bedework.calcore.hibernate.GroupsDbImpl
+
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/HibRestore.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/HibRestore.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/HibRestore.java (revision 18)
@@ -63,4 +63,6 @@
import org.bedework.calfacade.BwPrincipal;
import org.bedework.calfacade.BwSponsor;
+import org.bedework.calfacade.BwSystem;
+import org.bedework.calfacade.BwTimeZone;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.BwUserInfo;
@@ -144,4 +146,8 @@
ps.close();
+ ps = conn.prepareStatement("delete from bedework_settings");
+ ps.executeUpdate();
+ ps.close();
+
ps = conn.prepareStatement("delete from adminGroupMembers");
ps.executeUpdate();
@@ -211,5 +217,5 @@
ps.executeUpdate();
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
ps = conn.prepareStatement("delete from filters");
ps.executeUpdate();
@@ -281,5 +287,5 @@
ps.close();
- if (!globals.toHibernate) {
+ if (!globals.from2p3px) {
ps = conn.prepareStatement("delete from lastmods");
ps.executeUpdate();
@@ -306,4 +312,12 @@
} catch (Throwable t) {
}
+ }
+
+ public void restoreSyspars(BwSystem o) throws Throwable {
+ openSess();
+
+ sess.save(o);
+
+ closeSess();
}
@@ -332,4 +346,12 @@
}
+ public void restoreTimezone(BwTimeZone o) throws Throwable {
+ openSess();
+
+ sess.save(o);
+
+ closeSess();
+ }
+
/* (non-Javadoc)
* @see org.bedework.tools.dumprestore.restore.RestoreIntf#restoreAdminGroup(org.bedework.calfacade.svc.BwAdminGroup)
@@ -338,5 +360,5 @@
openSess();
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
// No id assigned
sess.save(o);
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/Restore.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/Restore.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/Restore.java (revision 18)
@@ -54,4 +54,5 @@
package org.bedework.tools.dumprestore.restore;
+import org.bedework.appcommon.TimeZonesParser;
import org.bedework.calfacade.BwCalendar;
import org.bedework.calfacade.BwUser;
@@ -63,4 +64,5 @@
import org.bedework.tools.dumprestore.restore.rules.RestoreRuleSet;
+import java.io.FileInputStream;
import java.io.FileReader;
import java.util.Collection;
@@ -121,6 +123,4 @@
void open() throws Throwable {
- globals.timezones = new TimezonesImpl(false, globals.debug);
-
if (globals.rintf == null) {
// globals.rintf = new JdbcRestore();
@@ -129,4 +129,29 @@
globals.rintf.open();
}
+
+ globals.timezones = new TimezonesImpl(globals.debug,
+ globals.getPublicUser(),
+ globals.rintf);
+
+ if (globals.from2p3px) {
+ // System prefs are set up by run time pars
+
+ globals.rintf.restoreSyspars(globals.syspars);
+ }
+
+ if (globals.timezonesFilename != null) {
+ TimeZonesParser tzp = new TimeZonesParser(
+ new FileInputStream(globals.timezonesFilename),
+ globals.debug);
+
+ Collection tzis = tzp.getTimeZones();
+
+ Iterator it = tzis.iterator();
+ while (it.hasNext()) {
+ TimeZonesParser.TimeZoneInfo tzi = (TimeZonesParser.TimeZoneInfo)it.next();
+
+ globals.timezones.saveTimeZone(tzi.tzid, tzi.timezone);
+ }
+ }
}
@@ -146,5 +171,5 @@
digester.parse(new FileReader(fileName));
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
makePrefs();
if (globals.rintf != null) {
@@ -271,10 +296,4 @@
} else if (args[i].equals("-noarg")) {
globals.debug = false;
- } else if (argpar("-sysid", args, i)) {
- i++;
- globals.systemId = args[i];
- } else if (argpar("-publiccalroot", args, i)) {
- i++;
- globals.publicCalendarRoot = args[i];
} else if (argpar("-supergroup", args, i)) {
i++;
@@ -284,31 +303,9 @@
globals.defaultPublicCalPath = args[i];
trace("Setting null event calendars to " + args[i]);
- } else if (argpar("-usercalroot", args, i)) {
- i++;
- globals.userCalendarRoot = args[i];
- } else if (argpar("-defusercal", args, i)) {
- i++;
- globals.userDefaultCalendar = args[i];
- } else if (argpar("-deftrashcal", args, i)) {
- i++;
- globals.defaultTrashCalendar = args[i];
} else if (argpar("-fixOwner", args, i)) {
i++;
globals.fixOwnerAccount = args[i];
- //} else if (args[i].equals("-concatdesc")) {
- // concatdesc = true;
- //} else if (args[i].equals("-printdata")) {
- // printData = true;
- } else if (args[i].equals("-hib")) {
- globals.toHibernate = true;
- } else if (args[i].equals("-nhib")) {
- globals.toHibernate = false;
- } else if (argpar("-pu", args, i)) {
- i++;
- globals.publicUserAccount = args[i];
- //} else if (args[i].equals("-jdbc")) {
- // jdbcUpdate = true;
- //} else if (args[i].equals("-njdbc")) {
- // jdbcUpdate = false;
+ } else if (args[i].equals("-from2p3px")) {
+ globals.from2p3px = true;
} else if (argpar("-d", args, i)) {
i++;
@@ -326,4 +323,67 @@
i++;
fileName = args[i];
+ } else if (argpar("-timezones", args, i)) {
+ i++;
+ globals.timezonesFilename = args[i];
+
+ /* System parameters */
+ } else if (argpar("-sysname", args, i)) {
+ i++;
+ globals.syspars.setName(args[i]);
+ } else if (argpar("-tzid", args, i)) {
+ i++;
+ globals.syspars.setTzid(args[i]);
+ } else if (argpar("-sysid", args, i)) {
+ i++;
+ globals.syspars.setSystemid(args[i]);
+ } else if (argpar("-publiccalroot", args, i)) {
+ i++;
+ globals.syspars.setPublicCalendarRoot(args[i]);
+ } else if (argpar("-usercalroot", args, i)) {
+ i++;
+ globals.syspars.setUserCalendarRoot(args[i]);
+ } else if (argpar("-defusercal", args, i)) {
+ i++;
+ globals.syspars.setUserDefaultCalendar(args[i]);
+ } else if (argpar("-deftrashcal", args, i)) {
+ i++;
+ globals.syspars.setDefaultTrashCalendar(args[i]);
+ } else if (argpar("-definbox", args, i)) {
+ i++;
+ globals.syspars.setUserInbox(args[i]);
+ } else if (argpar("-defoutbox", args, i)) {
+ i++;
+ globals.syspars.setUserOutbox(args[i]);
+
+ } else if (argpar("-pu", args, i)) {
+ i++;
+ globals.syspars.setPublicUser(args[i]);
+
+ } else if (argpar("-dirbrowsing-disallowed", args, i)) {
+ i++;
+ globals.syspars.setDirectoryBrowsingDisallowed("true".equals(args[i]));
+
+ } else if (argpar("-httpconnsperuser", args, i)) {
+ i++;
+ globals.syspars.setHttpConnectionsPerUser(intPar(args[i]));
+ } else if (argpar("-httpconnsperhost", args, i)) {
+ i++;
+ globals.syspars.setHttpConnectionsPerHost(intPar(args[i]));
+ } else if (argpar("-httpconns", args, i)) {
+ i++;
+ globals.syspars.setHttpConnections(intPar(args[i]));
+
+ } else if (argpar("-userauthClass", args, i)) {
+ i++;
+ globals.syspars.setUserauthClass(args[i]);
+ } else if (argpar("-mailerClass", args, i)) {
+ i++;
+ globals.syspars.setMailerClass(args[i]);
+ } else if (argpar("-admingroupsClass", args, i)) {
+ i++;
+ globals.syspars.setAdmingroupsClass(args[i]);
+ } else if (argpar("-usergroupsClass", args, i)) {
+ i++;
+ globals.syspars.setUsergroupsClass(args[i]);
} else {
error("Illegal argument: " + args[i]);
@@ -334,4 +394,8 @@
return true;
+ }
+
+ private int intPar(String par) throws Throwable {
+ return Integer.parseInt(par);
}
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreGlobals.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreGlobals.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreGlobals.java (revision 18)
@@ -62,4 +62,5 @@
import org.bedework.calfacade.BwOrganizer;
import org.bedework.calfacade.BwSponsor;
+import org.bedework.calfacade.BwSystem;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.BwUserInfo;
@@ -91,9 +92,33 @@
public boolean debugEntity;
+ /** We can restore timezone info from this file
+ */
+ public String timezonesFilename;
+
+ /** System parameters object */
+ public BwSystem syspars = new BwSystem();
+
+ /** * /
+ public String publicCalendarRoot;
+ /** * /
+ public String userCalendarRoot;
+ /** * /
+ public String userDefaultCalendar;
+ /** * /
+ public String defaultTrashCalendar;
+
+ /** Account name for owner of public entities* /
+ public String publicUserAccount;
+
+ /** * /
+ public String systemId; // required for fixing guids
+
+ */
+
/** */
public CalTimezones timezones;
- /** True if we doing the conversion from 2.3.2 to hibernate (V3) */
- public boolean toHibernate;
+ /** True if we doing the conversion from 2.3.2 to V3 */
+ public boolean from2p3px;
/** When converting put all admin groups into the new group with this name */
@@ -119,18 +144,4 @@
public BwCalendar defaultPublicCal;
- /* names from env properties */
-
- /** */
- public String publicCalendarRoot;
- /** */
- public String userCalendarRoot;
- /** */
- public String userDefaultCalendar;
- /** */
- public String defaultTrashCalendar;
-
- /** Account name for owner of public entities*/
- public String publicUserAccount;
-
/** User entry for owner of public entities.
*/
@@ -164,7 +175,4 @@
*/
public int fixedNoEndTime;
-
- /** */
- public String systemId; // required for fixing guids
/** Used when converting from 2.3.2 */
@@ -559,5 +567,5 @@
classes.put("category", "org.bedework.calfacade.BwCategory");
classes.put("authuser", "org.bedework.calfacade.svc.BwAuthUser");
- classes.put("event", "org.bedework.calfacade.BwEvent");
+ classes.put("event", "org.bedework.calfacade.BwEventObj");
classes.put("adminGroup", "org.bedework.calfacade.svc.BwAdminGroup");
classes.put("user-prefs", "org.bedework.calfacade.svc.BwPreferences");
@@ -586,13 +594,13 @@
/* See if it's in the user map first. */
- if (publicUserAccount == null) {
+ if (syspars.getPublicUser() == null) {
throw new Exception("publicUserAccount must be defined");
}
- publicUser = usersTbl.get(publicUserAccount);
+ publicUser = usersTbl.get(syspars.getPublicUser());
if (publicUser == null) {
// Create it
- publicUser = new BwUser(publicUserAccount);
+ publicUser = new BwUser(syspars.getPublicUser());
publicUser.setInstanceOwner(true);
publicUser.setCategoryAccess(getDefaultPublicAccess());
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreIntf.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreIntf.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/RestoreIntf.java (revision 18)
@@ -60,4 +60,6 @@
import org.bedework.calfacade.BwOrganizer;
import org.bedework.calfacade.BwSponsor;
+import org.bedework.calfacade.BwSystem;
+import org.bedework.calfacade.BwTimeZone;
import org.bedework.calfacade.BwUser;
import org.bedework.calfacade.BwUserInfo;
@@ -110,4 +112,11 @@
public void close() throws Throwable;
+ /** Restore system pars
+ *
+ * @param o
+ * @throws Throwable
+ */
+ public void restoreSyspars(BwSystem o) throws Throwable;
+
/** Restore user
*
@@ -123,4 +132,11 @@
*/
public void restoreUserInfo(BwUserInfo o) throws Throwable;
+
+ /** Restore timezone
+ *
+ * @param o
+ * @throws Throwable
+ */
+ public void restoreTimezone(BwTimeZone o) throws Throwable;
/** Restore an admin group - though not the user entries nor
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/TimezonesImpl.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/TimezonesImpl.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/TimezonesImpl.java (revision 18)
@@ -57,4 +57,5 @@
import org.bedework.calfacade.BwUser;
//import org.bedework.calfacade.BwTimeZone;
+import org.bedework.calfacade.BwTimeZone;
import org.bedework.calfacade.CalFacadeBadDateException;
import org.bedework.calfacade.CalFacadeException;
@@ -87,6 +88,9 @@
private transient Logger log;
- private boolean publicAdmin;
private boolean debug;
+ private boolean publick = true; // current mode
+ private BwUser user;
+
+ private RestoreIntf ri;
private static class TimezoneInfo {
@@ -107,11 +111,28 @@
//private transient Logger log;
- TimezonesImpl(boolean publicAdmin, boolean debug)
+ TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri)
throws CalFacadeException {
- this.publicAdmin = publicAdmin;
this.debug = debug;
+ this.user = user;
+ this.ri = ri;
// Force fetch of timezones
//lookup("not-a-timezone");
+ }
+
+ /** Set current publick mode
+ *
+ * @param val
+ */
+ public void setPublick(boolean val) {
+ publick = val;
+ }
+
+ /** Set current user
+ *
+ * @param val
+ */
+ public void setUser(BwUser val) {
+ user = val;
}
@@ -121,6 +142,25 @@
force a refresh when we're done.
*/
- if (publicAdmin) {
- return;
+
+ BwTimeZone tz = new BwTimeZone();
+
+ tz.setTzid(tzid);
+ tz.setPublick(publick);
+ tz.setOwner(user);
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("BEGIN:VCALENDAR\n");
+ sb.append("PRODID:-//RPI//BEDEWORK//US\n");
+ sb.append("VERSION:2.0\n");
+ sb.append(vtz.toString());
+ sb.append("END:VCALENDAR\n");
+
+ tz.setVtimezone(sb.toString());
+
+ try {
+ ri.restoreTimezone(tz);
+ } catch (Throwable t) {
+ throw new CalFacadeException(t);
}
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AdminGroupRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AdminGroupRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AdminGroupRule.java (revision 18)
@@ -90,5 +90,5 @@
}
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
globals.getSuperGroup().addGroupMember(entity);
}
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AuthUserRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AuthUserRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/AuthUserRule.java (revision 18)
@@ -78,5 +78,5 @@
globals.rintf.restoreAuthUser(au);
- if (globals.toHibernate && (globals.userInfo != null)) {
+ if (globals.from2p3px && (globals.userInfo != null)) {
globals.userInfo.setUser(au.getUser());
globals.rintf.restoreUserInfo(globals.userInfo);
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EntityFieldRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EntityFieldRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EntityFieldRule.java (revision 18)
@@ -148,5 +148,6 @@
/* XXX We need to handle timezones here as well */
- val.init(false, val.getDtval() + tmval, null, globals.timezones);
+ val.init(false, val.getDtval() + tmval,
+ globals.syspars.getTzid(), globals.timezones);
}
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EventRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EventRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/EventRule.java (revision 18)
@@ -103,7 +103,7 @@
try {
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
if ((entity.getGuid() == null) || (entity.getGuid().length() == 0)) {
- if (globals.systemId == null) {
+ if (globals.syspars.getSystemid() == null) {
throw new Exception("You must supply a system id");
}
@@ -116,5 +116,5 @@
}
- String guid = guidPrefix + globals.systemId;
+ String guid = guidPrefix + globals.syspars.getSystemid();
if (globals.debug) {
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FilterRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FilterRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FilterRule.java (revision 18)
@@ -86,5 +86,5 @@
try {
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
/* We are converting filter definitions into calendar definitions.
*/
@@ -124,6 +124,6 @@
// This is the root
globals.publicCalRoot = cal;
- globals.publicCalRoot.setName(globals.publicCalendarRoot);
- globals.publicCalRoot.setPath("/" + globals.publicCalendarRoot);
+ globals.publicCalRoot.setName(globals.syspars.getPublicCalendarRoot());
+ globals.publicCalRoot.setPath("/" + globals.syspars.getPublicCalendarRoot());
globals.publicCalRoot.setAccess(globals.getDefaultPublicCalendarsAccess());
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FiltersRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FiltersRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/FiltersRule.java (revision 18)
@@ -80,5 +80,5 @@
*/
public void end(String ns, String name) throws Exception {
- if (!globals.toHibernate) {
+ if (!globals.from2p3px) {
// Not converting
return;
@@ -100,6 +100,6 @@
userRootCal.setId(globals.nextCalKey);
globals.nextCalKey++;
- userRootCal.setName(globals.userCalendarRoot);
- userRootCal.setPath("/" + globals.userCalendarRoot);
+ userRootCal.setName(globals.syspars.getUserCalendarRoot());
+ userRootCal.setPath("/" + globals.syspars.getUserCalendarRoot());
userRootCal.setCreator(globals.getPublicUser());
userRootCal.setOwner(globals.getPublicUser());
@@ -122,4 +122,5 @@
/* Create a user collection */
+ /* Create a folder for the user */
BwCalendar ucal = new BwCalendar();
ucal.setId(globals.nextCalKey);
@@ -132,8 +133,9 @@
userRootCal.addChild(ucal);
+ /* Create a default calendar */
BwCalendar cal = new BwCalendar();
cal.setId(globals.nextCalKey);
globals.nextCalKey++;
- cal.setName(globals.userDefaultCalendar);
+ cal.setName(globals.syspars.getUserDefaultCalendar());
cal.setPath(ucal.getPath() + "/" + cal.getName());
cal.setCreator(u);
@@ -147,8 +149,33 @@
globals.defaultCalendars.put(new Integer(u.getId()), cal);
+ /* Add the trash calendar */
cal = new BwCalendar();
cal.setId(globals.nextCalKey);
globals.nextCalKey++;
- cal.setName(globals.defaultTrashCalendar);
+ cal.setName(globals.syspars.getDefaultTrashCalendar());
+ cal.setPath(ucal.getPath() + "/" + cal.getName());
+ cal.setCreator(u);
+ cal.setOwner(u);
+ cal.setCalendar(ucal);
+ cal.setCalendarCollection(true);
+ ucal.addChild(cal);
+
+ /* Add the inbox */
+ cal = new BwCalendar();
+ cal.setId(globals.nextCalKey);
+ globals.nextCalKey++;
+ cal.setName(globals.syspars.getUserInbox());
+ cal.setPath(ucal.getPath() + "/" + cal.getName());
+ cal.setCreator(u);
+ cal.setOwner(u);
+ cal.setCalendar(ucal);
+ cal.setCalendarCollection(true);
+ ucal.addChild(cal);
+
+ /* Add the outbox */
+ cal = new BwCalendar();
+ cal.setId(globals.nextCalKey);
+ globals.nextCalKey++;
+ cal.setName(globals.syspars.getUserOutbox());
cal.setPath(ucal.getPath() + "/" + cal.getName());
cal.setCreator(u);
Index: trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/UserRule.java
===================================================================
--- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/UserRule.java (revision 2)
+++ trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/rules/UserRule.java (revision 18)
@@ -74,5 +74,5 @@
globals.users++;
- if (globals.toHibernate) {
+ if (globals.from2p3px) {
entity.setCategoryAccess(globals.getDefaultPersonalAccess());
entity.setLocationAccess(globals.getDefaultPersonalAccess());
Index: trunk/calendar3/webadmin/src/org/bedework/webadmin/timezones/PEUploadTimezonesAction.java
===================================================================
--- trunk/calendar3/webadmin/src/org/bedework/webadmin/timezones/PEUploadTimezonesAction.java (revision 2)
+++ trunk/calendar3/webadmin/src/org/bedework/webadmin/timezones/PEUploadTimezonesAction.java (revision 18)
@@ -55,37 +55,15 @@
package org.bedework.webadmin.timezones;
-import org.bedework.calfacade.BwCalendar;
+import org.bedework.appcommon.TimeZonesParser;
import org.bedework.calsvci.CalSvcI;
-import org.bedework.icalendar.IcalTranslator;
-import org.bedework.icalendar.IcalUtil;
import org.bedework.webadmin.PEAbstractAction;
import org.bedework.webadmin.PEActionForm;
import org.bedework.webcommon.BwSession;
-import edu.rpi.sss.util.xml.XmlUtil;
-
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-
-import net.fortuna.ical4j.model.Calendar;
-import net.fortuna.ical4j.model.component.VTimeZone;
-import net.fortuna.ical4j.model.ComponentList;
-import net.fortuna.ical4j.model.Property;
import org.apache.struts.upload.FormFile;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-//import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
/** This action imports the uploaded system timezone definitions.
@@ -119,32 +97,15 @@
}
- InputStream is = upFile.getInputStream();
+ TimeZonesParser tzp = new TimeZonesParser(upFile.getInputStream(), debug);
- /* The input file should look something like:
-
- A-name
- ...
-
- file1.ics
- ...
-
-
-
- We ignore the first name - it represents the root.
- Each element may contain other and elements.
- Each element is a path element
- */
-
- DirClass rootDir = parseTzDefs(new InputStreamReader(is));
- if (!rootDir.ok) {
- form.getErr().emit("org.bedework.error.timezones.parseerror",
- rootDir.msg);
- return "error";
- }
+ Collection tzis = tzp.getTimeZones();
CalSvcI svci = form.getCalSvcI();
- if (!doDir(svci, rootDir, "", form)) {
- return "error";
+ Iterator it = tzis.iterator();
+ while (it.hasNext()) {
+ TimeZonesParser.TimeZoneInfo tzi = (TimeZonesParser.TimeZoneInfo)it.next();
+
+ svci.saveTimeZone(tzi.tzid, tzi.timezone);
}
@@ -153,147 +114,4 @@
return "success";
}
-
- private boolean doDir(CalSvcI svci, DirClass dir, String indent,
- PEActionForm form) throws Throwable {
- if (debug) {
- debugMsg(indent + "Dir: " + dir.cal.getName());
- }
-
- Iterator dit = dir.dirs.iterator();
- while (dit.hasNext()) {
- doDir(svci, (DirClass)dit.next(), indent + " ", form);
- }
-
- Iterator tzit = dir.tzs.iterator();
- while (tzit.hasNext()) {
- Calendar ical = (Calendar)tzit.next();
-
- ComponentList cl = ical.getComponents();
-
- if (cl.size() != 1) {
- form.getErr().emit("org.bedework.error.timezones.dataerror",
- cl.size() + " components in Calendar");
- return false;
- }
-
- Object o = cl.get(0);
- if (!(o instanceof VTimeZone)) {
- form.getErr().emit("org.bedework.error.timezones.dataerror",
- "component in Calendar not VTimeZone");
- return false;
- }
-
- VTimeZone tz = (VTimeZone)o;
- String tzid = IcalUtil.getProperty(tz, Property.TZID).getValue();
-
- svci.saveTimeZone(tzid, tz);
-
- if (debug) {
- debugMsg(indent + "tzid: " + tzid);
- }
- }
-
- return true;
- }
-
- private static class DirClass {
- boolean ok = true; // Set in root only
- String msg;
- BwCalendar cal; // The name will be set according to the dir/name
-
- Collection dirs = new Vector();
-
- /* Collection of Calendar obects
- */
- Collection tzs = new Vector();
- }
-
- private DirClass parseTzDefs(Reader rdr) throws Throwable {
- Document doc = null;
- boolean ok;
- String msg = null;
-
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(false);
-
- DocumentBuilder builder = factory.newDocumentBuilder();
-
- doc = builder.parse(new InputSource(rdr));
- ok = true;
- } catch (SAXException e) {
- msg = e.getMessage();
- ok = false;
- } catch (Throwable t) {
- msg = t.getMessage();
- ok = false;
- } finally {
- if (rdr != null) {
- try {
- rdr.close();
- } catch (Throwable t) {}
- }
- }
-
- if (!ok) {
- DirClass dir = new DirClass();
- dir.ok = false;
- dir.msg = msg;
- return dir;
- }
-
- return processDir(doc.getDocumentElement());
- }
-
- private DirClass processDir(Element dir) throws Throwable {
- DirClass d = new DirClass();
- Collection children = XmlUtil.getElements(dir);
-
- Iterator it = children.iterator();
-
- /* First is name */
-
- Element nmel = (Element)it.next();
-
- d.cal = new BwCalendar();
- d.cal.setName(XmlUtil.getElementContent(nmel));
-
- while (it.hasNext()) {
- Element el = (Element)it.next();
-
- if ("dir".equals(el.getTagName())) {
- d.dirs.add(processDir(el));
- } else if ("file".equals(el.getTagName())) {
- d.tzs.add(processFile(el));
- } else {
- throw new Exception("Expected or , found: " + el.getTagName());
- }
- }
-
- return d;
- }
-
- private Calendar processFile(Element ics) throws Throwable {
- //NodeList ds = ics.getElementsByTagName("data");
-
- Collection children = XmlUtil.getElements(ics);
-
- Iterator it = children.iterator();
-
- /* First is name */
-
- Element el = (Element)it.next();
- if (!"name".equals(el.getTagName())) {
- throw new Exception("Expected , found: " + el.getTagName());
- }
-
- /* Next is data */
- el = (Element)it.next();
- if (!"data".equals(el.getTagName())) {
- throw new Exception("Expected , found: " + el.getTagName());
- }
-
- return IcalTranslator.getCalendar(XmlUtil.getElementContent(el));
- }
}