[Bedework-commit] calendarapi r726 - in trunk: calEnv/src/org/bedework/calenv calFacade/src/org/bedework/calfacade/configs calFacade/src/org/bedework/calfacade/env calsvc/src/org/bedework/calsvc calsvci/src/org/bedework/calsvci logging/src/org/bedework/logging

svnadmin at bedework.org svnadmin at bedework.org
Tue Oct 28 10:12:27 EDT 2008


Author: douglm
Date: 2008-10-28 10:12:24 -0400 (Tue, 28 Oct 2008)
New Revision: 726

Removed:
   trunk/calEnv/src/org/bedework/calenv/CalEnv.java
   trunk/calFacade/src/org/bedework/calfacade/env/CalEnvFactory.java
   trunk/calFacade/src/org/bedework/calfacade/env/CalEnvI.java
Modified:
   trunk/calEnv/src/org/bedework/calenv/CalOptions.java
   trunk/calFacade/src/org/bedework/calfacade/configs/AdminConfig.java
   trunk/calFacade/src/org/bedework/calfacade/configs/CalDAVConfig.java
   trunk/calFacade/src/org/bedework/calfacade/configs/ConfigCommon.java
   trunk/calsvc/src/org/bedework/calsvc/AutoScheduler.java
   trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
   trunk/calsvc/src/org/bedework/calsvc/Scheduling.java
   trunk/calsvci/src/org/bedework/calsvci/CalSvcIPars.java
   trunk/logging/src/org/bedework/logging/BwlogFactory.java
Log:
Two distinct sets of updates here.

1. Add some support (not fully working yet) for liferay5. Some old unused stylesheets were deleted to tidy up and while working on this decided the second set of updates were needed asa  first step to simplification

2. Ensure that only the option xml file is used at run time.
   Some properties were moved into the xml file and code was adjusted to refer to the xml config objects.
   
   CalEnv, CalEnvI, CalEnvFactory were removed.
   
   Following properties were moved into options.xml

org.bedework.app.X.nogroupallowed

org.bedework.app.X.publicadmin

org.bedework.app.X.guestmode

sysintfimpl  (caldav)

org.bedework.global.system.name --> globals.systemName

org.bedework.app.X.run.as.user --> runAsUser

org.bedework.app.CalAdmin.admingroupsidprefix=agrp_


Removed remaining run-time references to
org.bedework.app.X.name
org.bedework.app.X.root


Deleted: trunk/calEnv/src/org/bedework/calenv/CalEnv.java
===================================================================
--- trunk/calEnv/src/org/bedework/calenv/CalEnv.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calEnv/src/org/bedework/calenv/CalEnv.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -1,351 +0,0 @@
-/*
- 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.
- */
-package org.bedework.calenv;
-
-import org.bedework.calfacade.env.CalEnvI;
-import org.bedework.calfacade.exc.CalEnvException;
-
-import java.io.InputStream;
-import java.util.Properties;
-import org.apache.log4j.Logger;
-
-
-/** An interface to the outside world - the methods here provide access to
- * properties and resources supplied by the environment. The concrete class
- * is site specific and its name is defined in the build time properties.
- *
- * <p>The name of the supplied concrete class will be built into the
- * resource "/properties/calendar/env.properties".
- *
- * <p>This is required as a minimum to get the system going. Other properties
- * may be stored elsewhere and can be initialised through a call to one of
- * the abstract init methods, either from the web conetxt or from the ejb
- * context for example.
- *
- * <p>Alternatively, put all the properties in that file.
- *
- * <p>This approach needs revisiting to split out core parameters, those
- * that affect the back end only and those that are client only.
- */
-public class CalEnv implements CalEnvI {
-  /** Location of the properties file */
-  private static final String propertiesFile =
-      "/properties/calendar/env.properties";
-
-  private static volatile Properties pr;
-
-  private static volatile Integer lockit = new Integer(0);
-
-  /** Global properties have this prefix.
-   */
-  public static final String globalPrefix = "org.bedework.global.";
-
-  private String appPrefix;
-
-  /** Initialise a caldav object using the given prefix.
-   *
-   * @param appPrefix
-   * @param debug
-   * @throws CalEnvException
-   */
-  public void init(String appPrefix, boolean debug) throws CalEnvException {
-    this.appPrefix = appPrefix;
-  }
-
-  private static Properties getPr() throws CalEnvException {
-    synchronized (lockit) {
-      if (pr != null) {
-        return pr;
-      }
-
-      /** Load properties file */
-
-      pr = new Properties();
-      InputStream is = null;
-
-      try {
-        try {
-          // The jboss?? way - should work for others as well.
-          ClassLoader cl = Thread.currentThread().getContextClassLoader();
-          is = cl.getResourceAsStream(propertiesFile);
-        } catch (Throwable clt) {}
-
-        if (is == null) {
-          // Try another way
-          is = CalEnv.class.getResourceAsStream(propertiesFile);
-        }
-
-        if (is == null) {
-          throw new CalEnvException("Unable to load properties file" +
-                                      propertiesFile);
-        }
-
-        pr.load(is);
-
-        //if (debug) {
-        //  pr.list(System.out);
-        //  Logger.getLogger(CalEnv.class).debug(
-        //      "file.encoding=" + System.getProperty("file.encoding"));
-        //}
-        return pr;
-      } catch (CalEnvException cee) {
-        throw cee;
-      } catch (Throwable t) {
-        Logger.getLogger(CalEnv.class).error("getEnv error", t);
-        throw new CalEnvException(t.getMessage());
-      } finally {
-        if (is != null) {
-          try {
-            is.close();
-          } catch (Throwable t1) {}
-        }
-      }
-    }
-  }
-
-  /** Return current app prefix
-   *
-   * @return String app prefix
-   */
-  public String getAppPrefix() {
-    return appPrefix;
-  }
-
-  /** Return all properties from the global environment.
-   *
-   * @return Properties    global properties object
-   * @throws CalEnvException
-   */
-  public Properties getProperties() throws CalEnvException {
-    return getPr();
-  }
-
-  /** Get required property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getProperty(String name) throws CalEnvException {
-    String val = getPr().getProperty(name);
-
-    if (val == null) {
-      throw new CalEnvException("Missing property " + name);
-    }
-
-    return val;
-  }
-
-  /** Get optional property.
-   *
-   * @param name String property name
-   * @return String value or null
-   * @throws CalEnvException
-   */
-  public String getOptProperty(String name) throws CalEnvException {
-    String val = getPr().getProperty(name);
-
-    return val;
-  }
-
-  /** Return the value of the named property.
-   *
-   * @param name String property name
-   * @return boolean value of property
-   * @throws CalEnvException
-   */
-  public boolean getBoolProperty(String name) throws CalEnvException {
-    String val = getProperty(name);
-
-    val = val.toLowerCase();
-
-    return "true".equals(val) || "yes".equals(val);
-  }
-
-  /** Return the value of the named property.
-   *
-   * @param name String property name
-   * @return int value of property
-   * @throws CalEnvException
-   */
-  public int getIntProperty(String name) throws CalEnvException {
-    String val = getProperty(name);
-
-    try {
-      return Integer.valueOf(val).intValue();
-    } catch (Throwable t) {
-      throw new CalEnvException("Invalid property " + name + " = " + val);
-    }
-  }
-
-  /* ====================================================================
-   *                 Methods returning global properties.
-   * ==================================================================== */
-
-  /** Get required global property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getGlobalProperty(String name) throws CalEnvException {
-    return getProperty(globalPrefix + name);
-  }
-
-  /** Return the value of the named property or false if absent.
-   *
-   * @param name String unprefixed name
-   * @return boolean value of global property
-   * @throws CalEnvException
-   */
-  public boolean getGlobalBoolProperty(String name) throws CalEnvException {
-    return getBoolProperty(globalPrefix + name);
-  }
-
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
-   */
-  public int getGlobalIntProperty(String name) throws CalEnvException {
-    return getIntProperty(globalPrefix + name);
-  }
-
-  /** Given a global property (hence the "Global" in the 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 name String unprefixed name
-   * @param cl   Class expected
-   * @return     Object checked to be an instance of that class
-   * @throws CalEnvException
-   */
-  public Object getGlobalObject(String name, Class cl) throws CalEnvException {
-    try {
-      String className = getGlobalProperty(name);
-
-      Object o = Class.forName(className).newInstance();
-
-      if (o == null) {
-        throw new CalEnvException("Class " + className + " not found");
-      }
-
-      if (!cl.isInstance(o)) {
-        throw new CalEnvException("Class " + className +
-                                  " is not a subclass of " +
-                                  cl.getName());
-      }
-
-      return o;
-    } catch (CalEnvException ce) {
-      throw ce;
-    } catch (Throwable t) {
-      throw new CalEnvException(t);
-    }
-  }
-
-  /* ====================================================================
-   *                 Methods returning application properties.
-   * ==================================================================== */
-
-  /** Get required app property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getAppProperty(String name) throws CalEnvException {
-    return getProperty(appPrefix + name);
-  }
-
-  /** Get optional app property.
-   *
-   * @param name String property name
-   * @return String value or null
-   * @throws CalEnvException
-   */
-  public String getAppOptProperty(String name) throws CalEnvException {
-    return getOptProperty(appPrefix + name);
-  }
-
-  /** Return the value of the named property or false if absent.
-   *
-   * @param name String unprefixed name
-   * @return boolean value of global property
-   * @throws CalEnvException
-   */
-  public boolean getAppBoolProperty(String name) throws CalEnvException {
-    return getBoolProperty(appPrefix + name);
-  }
-
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
-   */
-  public int getAppIntProperty(String name) throws CalEnvException {
-    return getIntProperty(appPrefix + name);
-  }
-
-  /** Given an application property (hence the "App" in the 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 name String unprefixed name
-   * @param cl   Class expected
-   * @return     Object checked to be an instance of that class
-   * @throws CalEnvException
-   */
-  public Object getAppObject(String name, Class cl) throws CalEnvException {
-    try {
-      String className = getAppProperty(name);
-
-      Object o = Class.forName(className).newInstance();
-
-      if (o == null) {
-        throw new CalEnvException("Class " + className + " not found");
-      }
-
-      if (!cl.isInstance(o)) {
-        throw new CalEnvException("Class " + className +
-                                  " is not a subclass of " +
-                                  cl.getName());
-      }
-
-      return o;
-    } catch (CalEnvException ce) {
-      throw ce;
-    } catch (Throwable t) {
-      throw new CalEnvException(t);
-    }
-  }
-}
-

Modified: trunk/calEnv/src/org/bedework/calenv/CalOptions.java
===================================================================
--- trunk/calEnv/src/org/bedework/calenv/CalOptions.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calEnv/src/org/bedework/calenv/CalOptions.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -1,31 +1,28 @@
-/*
- Copyright (c) 2000-2005 University of Washington.  All rights reserved.
+/* **********************************************************************
+    Copyright 2008 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:
+    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 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;
 
-   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.
- */
+    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.calenv;
 
 import org.bedework.calfacade.env.CalOptionsI;
@@ -332,7 +329,7 @@
 
       if (is == null) {
         // Try another way
-        is = CalEnv.class.getResourceAsStream(optionsFile);
+        is = CalOptions.class.getResourceAsStream(optionsFile);
       }
 
       if (is == null) {
@@ -352,7 +349,7 @@
     } catch (CalEnvException cee) {
       throw cee;
     } catch (Throwable t) {
-      Logger.getLogger(CalEnv.class).error("getEnv error", t);
+      Logger.getLogger(CalOptions.class).error("getEnv error", t);
       throw new CalEnvException(t.getMessage());
     } finally {
       if (is != null) {
@@ -476,41 +473,29 @@
    *                 Methods returning global properties.
    * ==================================================================== */
 
-  /** Get required global property, throw exception if absent
-   *
-   * @param name String property name
-   * @return Object value
-   * @throws CalEnvException
+  /* (non-Javadoc)
+   * @see org.bedework.calfacade.env.CalOptionsI#getGlobalProperty(java.lang.String)
    */
   public Object getGlobalProperty(String name) throws CalEnvException {
     return getProperty(globalPrefix + name);
   }
 
-  /** Get required global property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
+  /* (non-Javadoc)
+   * @see org.bedework.calfacade.env.CalOptionsI#getGlobalStringProperty(java.lang.String)
    */
   public String getGlobalStringProperty(String name) throws CalEnvException {
     return getStringProperty(globalPrefix + name);
   }
 
-  /** Return the value of the named property or false if absent.
-   *
-   * @param name String unprefixed name
-   * @return boolean value of global property
-   * @throws CalEnvException
+  /* (non-Javadoc)
+   * @see org.bedework.calfacade.env.CalOptionsI#getGlobalBoolProperty(java.lang.String)
    */
   public boolean getGlobalBoolProperty(String name) throws CalEnvException {
     return getBoolProperty(globalPrefix + name);
   }
 
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
+  /* (non-Javadoc)
+   * @see org.bedework.calfacade.env.CalOptionsI#getGlobalIntProperty(java.lang.String)
    */
   public int getGlobalIntProperty(String name) throws CalEnvException {
     return getIntProperty(globalPrefix + name);
@@ -570,11 +555,8 @@
     return getBoolProperty(appPrefix + name);
   }
 
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
+  /* (non-Javadoc)
+   * @see org.bedework.calfacade.env.CalOptionsI#getAppIntProperty(java.lang.String)
    */
   public int getAppIntProperty(String name) throws CalEnvException {
     return getIntProperty(appPrefix + name);
@@ -836,11 +818,15 @@
 
         if (objStack.empty()) {
           // Add a leaf node and return
+          /*
           OptionElement valnode = new OptionElement();
           valnode.name = name;
           valnode.isValue = true;
           valnode.val = ndval;
           oel.addChild(valnode);
+          */
+          oel.isValue = true;
+          oel.val = ndval;
 
           return;
         }
@@ -880,13 +866,10 @@
         return;
       }
 
-      Element[] children = XmlUtil.getElementsArray(subroot);
 
       /* Non leaf nodes - call recursively with each of the children
        */
-      for (int i = 0; i < children.length; i++) {
-        Element el = children[i];
-
+      for (Element el: XmlUtil.getElementsArray(subroot)) {
         String className = XmlUtil.getAttrVal(el, "classname");
         OptionElement valnode = new OptionElement();
         valnode.name = el.getNodeName();
@@ -945,122 +928,6 @@
     }
   }
 
-  /* We've been dealing with property names - convert the dotted notation to a path
-   * /
-  private static PathSegment makePath(String val) {
-    return new PathSegment(makePathElements(val));
-  }
-
-  private static class PathSegment {
-    String[] pathElements;
-    PathSegment nextSegment;
-
-    PathSegment(String[] pathElements) {
-      this.pathElements = pathElements;
-    }
-
-    String[] getPathElements() {
-      return pathElements;
-    }
-
-    PathSegment getNextSegment() {
-      return nextSegment;
-    }
-
-    void appendSegment(PathSegment val) {
-      if (nextSegment == null) {
-        nextSegment = val;
-      } else {
-        nextSegment.appendSegment(val);
-      }
-    }
-  }
-
-  private static class PathIterator implements Iterator {
-    PathSegment[] segs;
-    int segi;
-    PathSegment seg;
-    String[] pathElements;
-    int elpos;
-
-    PathIterator(PathSegment[] val) {
-      segs = val;
-      if (segs.length > 0) {
-        seg = segs[0];
-        pathElements = seg.getPathElements();
-      }
-    }
-
-    public boolean hasNext() {
-      if (seg == null) {
-        return false;
-      }
-
-      if ((pathElements != null) && (elpos < pathElements.length)) {
-        return true;
-      }
-
-      return hasNextSeg(segi);
-    }
-
-    public Object next() {
-      if ((pathElements == null) || (elpos >= pathElements.length)) {
-        return getNext();
-      }
-
-      String pe = pathElements[elpos];
-      elpos++;
-
-      return pe;
-    }
-
-    public void remove() {
-      throw new RuntimeException("Can't do this");
-    }
-
-    /* Move to next seg * /
-    private Object getNext() {
-      segi++;
-      if (segi >= segs.length) {
-        throw new RuntimeException("org.bedework.no.next");
-      }
-
-      seg = segs[segi];
-
-      if (seg != null) {
-        pathElements = seg.getPathElements();
-        elpos = 0;
-        if ((pathElements != null) && (pathElements.length > 0)) {
-          String pe = pathElements[elpos];
-          elpos++;
-
-          return pe;
-        }
-      }
-
-      return getNext();
-    }
-
-    private boolean hasNextSeg(int si) {
-      si++;
-      if (si >= segs.length) {
-        return false;
-      }
-
-      PathSegment sg = segs[si];
-
-      if (sg != null) {
-        String[] els = sg.getPathElements();
-        if ((els != null) && (els.length > 0)) {
-          return true;
-        }
-      }
-
-      return hasNextSeg(si);
-    }
-  }
-  */
-
   private static Method findSetter(Object val, String name) throws CalEnvException {
     String methodName = "set" + name.substring(0, 1).toUpperCase() +
                         name.substring(1);

Modified: trunk/calFacade/src/org/bedework/calfacade/configs/AdminConfig.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/configs/AdminConfig.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calFacade/src/org/bedework/calfacade/configs/AdminConfig.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -68,6 +68,10 @@
   private boolean allowEditAllLocations;
   private boolean allowEditAllContacts;
 
+  private boolean noGroupAllowed;
+
+  private String adminGroupsIdPrefix;
+
   /** Constructor
    *
    */
@@ -131,6 +135,34 @@
     return allowEditAllContacts;
   }
 
+  /**
+   *  @param val
+   */
+  public void setNoGroupAllowed(boolean val) {
+    noGroupAllowed = val;
+  }
+
+  /**
+   * @return boolean
+   */
+  public boolean getNoGroupAllowed() {
+    return noGroupAllowed;
+  }
+
+  /**
+   *  @param val
+   */
+  public void setAdminGroupsIdPrefix(String val) {
+    adminGroupsIdPrefix = val;
+  }
+
+  /**
+   * @return boolean
+   */
+  public String getAdminGroupsIdPrefix() {
+    return adminGroupsIdPrefix;
+  }
+
   public Object clone() {
     AdminConfig conf = new AdminConfig();
 
@@ -141,6 +173,9 @@
     conf.setAllowEditAllLocations(getAllowEditAllLocations());
     conf.setAllowEditAllContacts(getAllowEditAllContacts());
 
+    conf.setNoGroupAllowed(getNoGroupAllowed());
+    conf.setAdminGroupsIdPrefix(getAdminGroupsIdPrefix());
+
     return conf;
   }
 }

Modified: trunk/calFacade/src/org/bedework/calfacade/configs/CalDAVConfig.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/configs/CalDAVConfig.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calFacade/src/org/bedework/calfacade/configs/CalDAVConfig.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -30,6 +30,9 @@
  * @author Mike Douglass
  */
 public class CalDAVConfig extends ConfigCommon {
+  /* System interface implementation */
+  private String sysintfImpl;
+
   /* Real time service uri - null for no real time service */
   private String realTimeServiceURI;
 
@@ -39,6 +42,22 @@
   /* Web calendar service uri - null for no web calendar service */
   private String webcalServiceURI;
 
+  /** Set the System interface implementation
+   *
+   * @param val    String
+   */
+  public void setSysintfImpl(String val) {
+    sysintfImpl = val;
+  }
+
+  /** get the System interface implementation
+   *
+   * @return String
+   */
+  public String getSysintfImpl() {
+    return sysintfImpl;
+  }
+
   /** Set the Real time service uri - null for no real time service
    *
    * @param val    String

Modified: trunk/calFacade/src/org/bedework/calfacade/configs/ConfigCommon.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/configs/ConfigCommon.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calFacade/src/org/bedework/calfacade/configs/ConfigCommon.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -44,6 +44,12 @@
 
   private String appType;
 
+  private boolean publicAdmin;
+
+  private boolean guestMode;
+
+  private String runAsUser;
+
   /** Constructor
    *
    */
@@ -78,6 +84,50 @@
     return appType;
   }
 
+  /** True for a public admin client.
+   *
+   * @param val
+   */
+  public void setPublicAdmin(boolean val) {
+    publicAdmin = val;
+  }
+
+  /**
+   * @return boolean
+   */
+  public boolean getPublicAdmin() {
+    return publicAdmin;
+  }
+
+  /** True for a guest mode (non-auth) client.
+   *
+   * @param val
+   */
+  public void setGuestMode(boolean val) {
+    guestMode = val;
+  }
+
+  /**
+   * @return boolean
+   */
+  public boolean getGuestMode() {
+    return guestMode;
+  }
+
+  /**
+   * @param val
+   */
+  public void setRunAsUser(String val) {
+    runAsUser = val;
+  }
+
+  /**
+   * @return String
+   */
+  public String getRunAsUser() {
+    return runAsUser;
+  }
+
   /** Copy this object to val.
    *
    * @param val
@@ -86,6 +136,9 @@
     super.copyTo(val);
     val.setLogPrefix(getLogPrefix());
     val.setAppType(getAppType());
+    val.setPublicAdmin(getPublicAdmin());
+    val.setGuestMode(getGuestMode());
+    val.setRunAsUser(getRunAsUser());
   }
 
   public Object clone() {

Deleted: trunk/calFacade/src/org/bedework/calfacade/env/CalEnvFactory.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/env/CalEnvFactory.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calFacade/src/org/bedework/calfacade/env/CalEnvFactory.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -1,71 +0,0 @@
-/*
- 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.
- */
-package org.bedework.calfacade.env;
-
-import org.bedework.calfacade.exc.CalEnvException;
-
-/** Obtain a CalEnv object.
- *
- */
-public class CalEnvFactory {
-  private final static String envclass = "org.bedework.calenv.CalEnv";
-
-  /** Obtain and initialise a caldav object using the given prefix.
-  *
-  * @param appPrefix
-  * @param debug
-   * @return CalEnvI
-  * @throws CalEnvException
-  */
-  public static CalEnvI getEnv(String appPrefix, boolean debug) throws CalEnvException {
-    try {
-      Object o = Class.forName(envclass).newInstance();
-
-      if (o == null) {
-        throw new CalEnvException("Class " + envclass + " not found");
-      }
-
-      if (!(o instanceof CalEnvI)) {
-        throw new CalEnvException("Class " + envclass +
-                                  " is not a subclass of " +
-                                  CalEnvI.class.getName());
-      }
-
-      CalEnvI env = (CalEnvI)o;
-
-      env.init(appPrefix, debug);
-
-      return env;
-    } catch (CalEnvException ce) {
-      throw ce;
-    } catch (Throwable t) {
-      throw new CalEnvException(t);
-    }
-  }
-}

Deleted: trunk/calFacade/src/org/bedework/calfacade/env/CalEnvI.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/env/CalEnvI.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calFacade/src/org/bedework/calfacade/env/CalEnvI.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -1,217 +0,0 @@
-/*
- 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 2006 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.env;
-
-import org.bedework.calfacade.exc.CalEnvException;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-/** An interface to the outside world - the methods here provide access to
- * properties and resources supplied by the environment. The concrete class
- * is site specific and its name is defined in the build time properties.
- *
- * <p>The name of the supplied concrete class will be built into the
- * resource "/properties/calendar/env.properties".
- *
- * <p>This is required as a minimum to get the system going. Other properties
- * may be stored elsewhere and can be initialised through a call to one of
- * the abstract init methods, either from the web conetxt or from the ejb
- * context for example.
- *
- * <p>Alternatively, put all the properties in that file.
- *
- * <p>This approach needs revisiting to split out core parameters, those
- * that affect the back end only and those that are client only.
- */
-public interface CalEnvI extends Serializable {
-  /** Called after object is created
-   *
-   * @param appPrefix
-   * @param debug
-   * @throws CalEnvException
-   */
-  public void init (String appPrefix, boolean debug) throws CalEnvException;
-
-  /** Return current app prefix
-   *
-   * @return String app prefix
-   */
-  public String getAppPrefix();
-
-  /** Return all properties from the global environment.
-   *
-   * @return Properties    global properties object
-   * @throws CalEnvException
-   */
-  public Properties getProperties() throws CalEnvException;
-
-  /** Get required property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getProperty(String name) throws CalEnvException;
-
-  /** Get optional property.
-   *
-   * @param name String property name
-   * @return String value or null
-   * @throws CalEnvException
-   */
-  public String getOptProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property.
-   *
-   * @param name String property name
-   * @return boolean value of property
-   * @throws CalEnvException
-   */
-  public boolean getBoolProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property.
-   *
-   * @param name String property name
-   * @return int value of property
-   * @throws CalEnvException
-   */
-  public int getIntProperty(String name) throws CalEnvException;
-
-  /* ====================================================================
-   *                 Methods returning global properties.
-   * ==================================================================== */
-
-  /** Get required global property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getGlobalProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property or false if absent.
-   *
-   * @param name String unprefixed name
-   * @return boolean value of global property
-   * @throws CalEnvException
-   */
-  public boolean getGlobalBoolProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
-   */
-  public int getGlobalIntProperty(String name) throws CalEnvException;
-
-  /** Given a global property (hence the "Global" in the 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 name String unprefixed name
-   * @param cl   Class expected
-   * @return     Object checked to be an instance of that class
-   * @throws CalEnvException
-   */
-  public Object getGlobalObject(String name, Class cl) throws CalEnvException;
-
-  /* ====================================================================
-   *                 Methods returning application properties.
-   * ==================================================================== */
-
-  /** Get required app property, throw exception if absent
-   *
-   * @param name String property name
-   * @return String value
-   * @throws CalEnvException
-   */
-  public String getAppProperty(String name) throws CalEnvException;
-
-  /** Get optional app property.
-   *
-   * @param name String property name
-   * @return String value or null
-   * @throws CalEnvException
-   */
-  public String getAppOptProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property or false if absent.
-   *
-   * @param name String unprefixed name
-   * @return boolean value of global property
-   * @throws CalEnvException
-   */
-  public boolean getAppBoolProperty(String name) throws CalEnvException;
-
-  /** Return the value of the named property.
-   *
-   * @param name String unprefixed name
-   * @return int value of global property
-   * @throws CalEnvException
-   */
-  public int getAppIntProperty(String name) throws CalEnvException;
-
-  /** Given an application property (hence the "App" in the 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 name String unprefixed name
-   * @param cl   Class expected
-   * @return     Object checked to be an instance of that class
-   * @throws CalEnvException
-   */
-  public Object getAppObject(String name, Class cl) throws CalEnvException;
-}

Modified: trunk/calsvc/src/org/bedework/calsvc/AutoScheduler.java
===================================================================
--- trunk/calsvc/src/org/bedework/calsvc/AutoScheduler.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calsvc/src/org/bedework/calsvc/AutoScheduler.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -74,17 +74,14 @@
 
   private Queue<AsEntry> asq = new LinkedList<AsEntry>();
 
-  private String envPrefix;
   private boolean debug;
 
   private transient Logger log;
 
   /**
-   * @param envPrefix
    * @param debug
    */
-  public AutoScheduler(String envPrefix, boolean debug) {
-    this.envPrefix = envPrefix;
+  public AutoScheduler(boolean debug) {
     this.debug = debug;
   }
 
@@ -366,7 +363,6 @@
     CalSvcIPars runAsPars = new CalSvcIPars(account,
                                             runAsUser,
                                             null,    // calsuite
-                                            envPrefix,
                                             false,   // publicAdmin
                                             allowSuperUser,
                                             false,  // adminCanEditAllPublicCategories

Modified: trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
===================================================================
--- trunk/calsvc/src/org/bedework/calsvc/CalSvc.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calsvc/src/org/bedework/calsvc/CalSvc.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -69,8 +69,8 @@
 import org.bedework.calfacade.BwSystem;
 import org.bedework.calfacade.BwUser;
 import org.bedework.calfacade.RecurringRetrievalMode;
-import org.bedework.calfacade.env.CalEnvFactory;
-import org.bedework.calfacade.env.CalEnvI;
+import org.bedework.calfacade.env.CalOptionsFactory;
+import org.bedework.calfacade.env.CalOptionsI;
 import org.bedework.calfacade.exc.CalFacadeException;
 import org.bedework.calfacade.ifs.Directories;
 import org.bedework.calfacade.mail.MailerIntf;
@@ -286,8 +286,6 @@
 
   private transient Logger log;
 
-  private CalEnvI env;
-
   /* (non-Javadoc)
    * @see org.bedework.calsvci.CalSvcI#init(org.bedework.calsvci.CalSvcIPars)
    */
@@ -298,8 +296,8 @@
 
     debug = pars.getDebug();
 
-    env = CalEnvFactory.getEnv(pars.getEnvPrefix(), debug);
-    systemName = env.getGlobalProperty("system.name");
+    CalOptionsI opts = CalOptionsFactory.getOptions(null, debug);
+    systemName = (String)opts.getGlobalProperty("systemName");
 
     try {
       open();
@@ -637,7 +635,7 @@
    */
   public SchedulingI getScheduler() throws CalFacadeException {
     if (sched == null) {
-      sched = new Scheduling(this, getUser(), pars.getEnvPrefix(), debug);
+      sched = new Scheduling(this, getUser(), debug);
       handlers.add((CalSvcDb)sched);
     }
 

Modified: trunk/calsvc/src/org/bedework/calsvc/Scheduling.java
===================================================================
--- trunk/calsvc/src/org/bedework/calsvc/Scheduling.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calsvc/src/org/bedework/calsvc/Scheduling.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -97,13 +97,12 @@
    *
    * @param svci
    * @param user
-   * @param envPrefix
    * @param debug
    */
-  Scheduling(CalSvc svci, BwUser user, String envPrefix, boolean debug) {
+  Scheduling(CalSvc svci, BwUser user, boolean debug) {
     super(svci, user, debug);
 
-    autoSchedule = new AutoScheduler(envPrefix, debug);
+    autoSchedule = new AutoScheduler(debug);
   }
 
   void processAutoResponses() throws CalFacadeException {

Modified: trunk/calsvci/src/org/bedework/calsvci/CalSvcIPars.java
===================================================================
--- trunk/calsvci/src/org/bedework/calsvci/CalSvcIPars.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/calsvci/src/org/bedework/calsvci/CalSvcIPars.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -75,10 +75,6 @@
    */
   private String calSuite;
 
-  /** Environment properties prefix - e.g. "org.bedework.webpersonal."
-   */
-  private String envPrefix;
-
   /** True if this is for public admin
    */
   private boolean publicAdmin;
@@ -114,7 +110,6 @@
    * @param authUser    String authenticated user of the application
    * @param user        String user to act as
    * @param calSuite    String calSuite name
-   * @param envPrefix   String Environment properties prefix
    * @param publicAdmin true for admin
    * @param allowSuperUser  true to allow superuser mode in non-admin mode
    * @param adminCanEditAllPublicCategories
@@ -129,7 +124,6 @@
   public CalSvcIPars(String authUser,
                      String user,
                      String calSuite,
-                     String envPrefix,
 
                      boolean publicAdmin,
                      boolean allowSuperUser,
@@ -145,7 +139,6 @@
     this.authUser = authUser;
     this.user = user;
     this.calSuite = calSuite;
-    this.envPrefix = envPrefix;
     this.publicAdmin = publicAdmin;
     this.allowSuperUser = allowSuperUser;
     this.adminCanEditAllPublicCategories = adminCanEditAllPublicCategories;
@@ -200,20 +193,6 @@
   }
 
   /**
-   * @param val String envPrefix
-   */
-  public void setEnvPrefix(String  val) {
-    envPrefix = val;
-  }
-
-  /**
-   * @return String current envPrefix
-   */
-  public String getEnvPrefix() {
-    return envPrefix;
-  }
-
-  /**
    * @return boolean true if this is a public admin object.
    */
   public boolean getPublicAdmin() {
@@ -336,7 +315,6 @@
     CalSvcIPars pars = new CalSvcIPars(getAuthUser(),
                                        getUser(),
                                        getCalSuite(),
-                                       getEnvPrefix(),
                                        getPublicAdmin(),
                                        getAllowSuperUser(),
                                        getAdminCanEditAllPublicCategories(),

Modified: trunk/logging/src/org/bedework/logging/BwlogFactory.java
===================================================================
--- trunk/logging/src/org/bedework/logging/BwlogFactory.java	2008-10-07 23:09:21 UTC (rev 725)
+++ trunk/logging/src/org/bedework/logging/BwlogFactory.java	2008-10-28 14:12:24 UTC (rev 726)
@@ -28,7 +28,8 @@
  */
 package org.bedework.logging;
 
-import org.bedework.calfacade.env.CalEnvFactory;
+import org.bedework.calfacade.env.CalOptionsFactory;
+import org.bedework.calfacade.util.CalFacadeUtil;
 
 /** This package is intended for logging of activity in the bedework calendar
     allowing tracking of changes.
@@ -46,7 +47,11 @@
     BwLog logger = null;
 
     try {
-      logger = (BwLog)CalEnvFactory.getEnv(null, false).getGlobalObject("loggerclass", BwLog.class);
+      String loggerClassName =
+        CalOptionsFactory.getOptions(null,
+                                     false).getGlobalStringProperty("loggerClass");
+
+      logger = (BwLog)CalFacadeUtil.getObject(loggerClassName, BwLog.class);
     } catch (Throwable t) {
       logger = new BwLogImpl();
     }



More information about the Bedework-commit mailing list