Index: trunk/calendar3/common/src/edu/rpi/sss/util/Util.java =================================================================== --- trunk/calendar3/common/src/edu/rpi/sss/util/Util.java (revision 2) +++ trunk/calendar3/common/src/edu/rpi/sss/util/Util.java (revision 302) @@ -60,6 +60,9 @@ import java.text.MessageFormat; import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; import java.util.Properties; import java.util.Random; +import java.util.StringTokenizer; /** @@ -403,3 +406,38 @@ return checkNull(val) != null; } + + /** Turn a comma separated list into a List. + * Throws exception for invalid list. + * + * @param val String comma separated list + * @param emptyOk Empty elements are OK + * @return List of elements, never null + * @throws Throwable for invalid list + */ + public static List getList(String val, boolean emptyOk) throws Throwable { + List l = new LinkedList(); + + if ((val == null) || (val.length() == 0)) { + return l; + } + + StringTokenizer st = new StringTokenizer(val, ",", false); + while (st.hasMoreTokens()) { + String token = st.nextToken().trim(); + + if ((token == null) || (token.length() == 0)) { + if (!emptyOk) { + // No empty strings + + throw new Exception("List has an empty element."); + } + l.add(""); + } else { + // Got non-empty element + l.add(token); + } + } + + return l; + } } Index: trunk/calendar3/common/src/edu/rpi/sss/util/jsp/SessionListener.java =================================================================== --- trunk/calendar3/common/src/edu/rpi/sss/util/jsp/SessionListener.java (revision 2) +++ trunk/calendar3/common/src/edu/rpi/sss/util/jsp/SessionListener.java (revision 302) @@ -61,4 +61,6 @@ import java.util.Enumeration; +import java.util.HashMap; + import org.apache.log4j.Logger; @@ -67,8 +69,11 @@ */ public class SessionListener implements HttpSessionListener { - private static volatile int activeSessions = 0; - private static volatile long totalSessions = 0; + private static class Counts { + int activeSessions = 0; + long totalSessions = 0; + } + + private static volatile HashMap countsMap = new HashMap(); private static boolean logActive = true; - private static String id = ""; /** Name of the init parameter holding our name */ @@ -83,14 +88,17 @@ */ public void sessionCreated(HttpSessionEvent se) { - activeSessions++; - totalSessions++; HttpSession session = se.getSession(); ServletContext sc = session.getServletContext(); + String appname = getAppName(session); + Counts ct = getCounts(appname); + + ct.activeSessions++; + ct.totalSessions++; if (logActive) { logSessionCounts(session, true); - sc.log("========= New session(" + id + - "): " + activeSessions + " active, " + - totalSessions + " total. vm(used, max)=(" + + sc.log("========= New session(" + appname + + "): " + ct.activeSessions + " active, " + + ct.totalSessions + " total. vm(used, max)=(" + Runtime.getRuntime().freeMemory()/(1024 * 1024) + "M, " + Runtime.getRuntime().totalMemory()/(1024 * 1024) + "M)"); @@ -111,13 +119,17 @@ /* Session Invalidation Event */ public void sessionDestroyed(HttpSessionEvent se) { - if (activeSessions > 0) { - activeSessions--; - } HttpSession session = se.getSession(); ServletContext sc = session.getServletContext(); + String appname = getAppName(session); + Counts ct = getCounts(appname); + + if (ct.activeSessions > 0) { + ct.activeSessions--; + } + if (logActive) { logSessionCounts(session, false); - sc.log("========= Session destroyed(" + id + - "): " + activeSessions + " active. vm(used, max)=(" + + sc.log("========= Session destroyed(" + appname + + "): " + ct.activeSessions + " active. vm(used, max)=(" + Runtime.getRuntime().freeMemory()/(1024 * 1024) + "M, " + Runtime.getRuntime().totalMemory()/(1024 * 1024) + "M)"); @@ -130,29 +142,4 @@ public static void setLogActive(boolean val) { logActive = val; - } - - /** - * @return int num active sessions - */ - public static int getActiveSessions() { - return activeSessions; - } - - /** - * @return long total sessions - */ - public static long getTotalSessions() { - return totalSessions; - } - - /** - * @param val String id - */ - public static void setId(String val) { - if (val != null) { - id = val; - } else { - id = ""; - } } @@ -166,10 +153,6 @@ Logger log = Logger.getLogger(this.getClass()); StringBuffer sb; - ServletContext sc = sess.getServletContext(); - - String appname = sc.getInitParameter(appNameInitParameter); - if (appname == null) { - appname = "?"; - } + String appname = getAppName(sess); + Counts ct = getCounts(appname); if (start) { @@ -183,7 +166,7 @@ sb.append(appname); sb.append(":"); - sb.append(activeSessions); - sb.append(":"); - sb.append(totalSessions); + sb.append(ct.activeSessions); + sb.append(":"); + sb.append(ct.totalSessions); sb.append(":"); sb.append(Runtime.getRuntime().freeMemory()/(1024 * 1024)); @@ -193,4 +176,32 @@ log.info(sb.toString()); + } + + private Counts getCounts(String name) { + try { + synchronized (countsMap) { + Counts c = (Counts)countsMap.get(name); + + if (c == null) { + c = new Counts(); + countsMap.put(name, c); + } + + return c; + } + } catch (Throwable t) { + return new Counts(); + } + } + + private String getAppName(HttpSession sess) { + ServletContext sc = sess.getServletContext(); + + String appname = sc.getInitParameter(appNameInitParameter); + if (appname == null) { + appname = "?"; + } + + return appname; } Index: trunk/calendar3/config/configs/democal.properties =================================================================== --- trunk/calendar3/config/configs/democal.properties (revision 297) +++ trunk/calendar3/config/configs/democal.properties (revision 302) @@ -13,9 +13,4 @@ # Global options # -org.bedework.install.admin.web=true -org.bedework.install.public.web=true -org.bedework.install.personal.web=true -org.bedework.install.public.caldav=true -org.bedework.install.personal.caldav=true # Define the names of the applications we want to build Index: trunk/calendar3/config/properties/default-bedework.properties =================================================================== --- trunk/calendar3/config/properties/default-bedework.properties (revision 2) +++ trunk/calendar3/config/properties/default-bedework.properties (revision 302) @@ -1,3 +1,2 @@ -org.bedework.webadmin.app.transport.guarantee=NONE # # -------------------------------------------------------------------- @@ -14,9 +13,9 @@ # Global options # -org.bedework.install.admin.web=true -org.bedework.install.public.web=true -org.bedework.install.personal.web=true -org.bedework.install.public.caldav=true -org.bedework.install.personal.caldav=true + +# Define the names of the applications we want to build +org.bedework.install.app.names=bwconfig,CalAdmin,Events,UserCal,Pubcaldav,Usercaldav +org.bedework.install.app.types=webconfig,webadmin,webpublic,webuser,publiccaldav,usercaldav + # # -------------------------------------------------------------------- @@ -24,22 +23,41 @@ # 'environment' options used globally by the system. # -org.bedework.global.version=3.0 org.bedework.global.hibernate.dialect=org.hibernate.dialect.HSQLDialect -org.bedework.global.systemid=demobedework@mysite.edu +org.bedework.global.system.name=bedework +org.bedework.global.calintfclass=org.bedework.calcore.hibernate.CalintfImpl org.bedework.global.directory.browsing.disallowed=false - -org.bedework.global.public.calroot=public -org.bedework.global.user.calroot=user -org.bedework.global.default.user.calendar=calendar -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.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.build.standalone.app=true + +# uris to cross link apps - of dubious usefulness +org.bedework.global.public.admin.uri=/caladmin +org.bedework.global.public.calendar.uri=/cal +org.bedework.global.personal.calendar.uri=/ucal + +# +# -------------------------------------------------------------------- +# +# System parameters used globally by the system and read from the db. +# +org.bedework.syspar.tzid=America/New_York +org.bedework.syspar.systemid=demobedework@mysite.edu + +org.bedework.syspar.public.calroot=public +org.bedework.syspar.user.calroot=user +org.bedework.syspar.default.user.calendar=calendar +org.bedework.syspar.default.trash.calendar=Trash +org.bedework.syspar.default.user.inbox=Inbox +org.bedework.syspar.default.user.outbox=Outbox +org.bedework.syspar.default.user.view=All + +org.bedework.syspar.public.user=public-user + +org.bedework.syspar.http.connections.peruser=10 +org.bedework.syspar.http.connections.perhost=50 +org.bedework.syspar.http.connections=200 + +org.bedework.syspar.userauthclass=org.bedework.calcore.hibernate.UserAuthUWDbImpl +org.bedework.syspar.mailerclass=org.bedework.mail.DummyMailer +org.bedework.syspar.admingroupsclass=org.bedework.calcore.hibernate.AdminGroupsDbImpl +org.bedework.syspar.usergroupsclass=org.bedework.calcore.hibernate.GroupsDbImpl # # ------------------------------------------------------------------- @@ -47,119 +65,126 @@ # Bedework config web client # -org.bedework.webconfig.app.default.contenttype=text/xml -org.bedework.webconfig.build.standalone.app=true -org.bedework.webconfig.war.name=bwconfig -org.bedework.webconfig.context.root=bwconfig -org.bedework.webconfig.app.root=/bwconfigrsrc -org.bedework.webconfig.app.resources.dir=/webapps/ROOT/bwconfigrsrc -org.bedework.webconfig.deploy.dir=/webapps -org.bedework.webconfig.env.prefix=org.bedework.webconfig. - -org.bedework.webconfig.app.description=Bedework properties config application -org.bedework.webconfig.app.display.name=Bedework Config -org.bedework.webconfig.app.name=bwconfig - -# -# -------------------------------------------------------------------- -# -# Standalone Admin Web Client -# -org.bedework.webadmin.app.default.contenttype=text/xml -org.bedework.webadmin.build.standalone.app=true -org.bedework.webadmin.war.name=caladmin -org.bedework.webadmin.deploy.j2ee=false -org.bedework.webadmin.ear.name=caladmin -org.bedework.webadmin.context.root=caladmin -org.bedework.webadmin.app.root=/caladminrsrc -org.bedework.webadmin.app.resources.dir=/webapps/ROOT/caladminrsrc -org.bedework.webadmin.deploy.dir=/webapps -org.bedework.webadmin.env.prefix=org.bedework.webadmin. - -org.bedework.webadmin.app.security.domain=demo -org.bedework.webadmin.app.security.prefix=demo -org.bedework.webadmin.app.transport.guarantee=NONE - -org.bedework.webadmin.app.description=Struts based version of the Bedework calendar public events admin client. -org.bedework.webadmin.app.display.name=Public Events Administration -org.bedework.webadmin.app.name=DemoCalAdmin - -org.bedework.webadmin.app.nogroupallowed=false - -org.bedework.webadmin.app.autocreatesponsors=false -org.bedework.webadmin.app.autodeletesponsors=false -org.bedework.webadmin.app.autocreatelocations=false -org.bedework.webadmin.app.autodeletelocations=false -org.bedework.webadmin.app.allowEditAllCategories=false -org.bedework.webadmin.app.allowEditAllLocations=false -org.bedework.webadmin.app.allowEditAllSponsors=false -org.bedework.webadmin.app.categoryOptional=true - -org.bedework.webadmin.app.hour24=true -org.bedework.webadmin.app.minincrement=5 -org.bedework.webadmin.app.admingroupsidprefix=agrp_ - -# -# -------------------------------------------------------------------- -# -# Standalone Public Web Client -# -org.bedework.webpubevents.app.default.contenttype=text/xml -org.bedework.webpubevents.build.standalone.app=true -org.bedework.webpubevents.war.name=cal -org.bedework.webpubevents.deploy.j2ee=false -org.bedework.webpubevents.ear.name=cal -org.bedework.webpubevents.context.root=cal -org.bedework.webpubevents.app.root=/calrsrc -org.bedework.webpubevents.app.resources.dir=/webapps/ROOT/calrsrc -org.bedework.webpubevents.deploy.dir=/webapps -org.bedework.webpubevents.env.prefix=org.bedework.webpubevents. - -org.bedework.webpubevents.app.web.xml=guest/web.xml - -org.bedework.webpubevents.app.description=Struts based XML version of the Bedework calendar client. It may have many skins, determined by the XSLT. -org.bedework.webpubevents.app.display.name=Demo calendar -org.bedework.webpubevents.app.name=DemoCal - -org.bedework.webpubevents.app.hour24=true -org.bedework.webpubevents.app.minincrement=5 -org.bedework.webpubevents.app.skinset.name=demoskins -org.bedework.webpubevents.app.showyeardata=false -org.bedework.webpubevents.app.default.view=week -org.bedework.webpubevents.app.refresh.interval=300 -org.bedework.webpubevents.app.refresh.action=setup.do - -# -# -------------------------------------------------------------------- -# -# Standalone Personal Web Client -# -org.bedework.webpersonal.app.default.contenttype=text/xml -org.bedework.webpersonal.build.standalone.app=true -org.bedework.webpersonal.war.name=ucal -org.bedework.webpersonal.deploy.j2ee=false -org.bedework.webpersonal.ear.name=ucal -org.bedework.webpersonal.context.root=ucal -org.bedework.webpersonal.app.root=/ucalrsrc -org.bedework.webpersonal.app.resources.dir=/webapps/ROOT/ucalrsrc -org.bedework.webpersonal.deploy.dir=/webapps -org.bedework.webpersonal.env.prefix=org.bedework.webpersonal. - -org.bedework.webpersonal.app.web.xml=user/web.xml - -org.bedework.webpersonal.app.security.domain=demo -org.bedework.webpersonal.app.security.prefix=demo -org.bedework.webpersonal.app.transport.guarantee=NONE - -org.bedework.webpersonal.app.description=XML/XSLT version of the Bedework calendar client. -org.bedework.webpersonal.app.display.name=Bedework -org.bedework.webpersonal.app.name=DemoUserCal - -org.bedework.webpersonal.app.hour24=true -org.bedework.webpersonal.app.minincrement=5 -org.bedework.webpersonal.app.skinset.name=demoskins -org.bedework.webpersonal.app.showyeardata=false -org.bedework.webpersonal.app.default.view=day -org.bedework.webpersonal.app.refresh.interval=300 -org.bedework.webpersonal.app.refresh.action=setup.do +org.bedework.app.bwconfig.version=3.0 +org.bedework.app.bwconfig.default.contenttype=text/xml +org.bedework.app.bwconfig.war.name=bwconfig +org.bedework.app.bwconfig.context.root=bwconfig +org.bedework.app.bwconfig.root=/bwconfigrsrc +org.bedework.app.bwconfig.resources.dir=/webapps/ROOT/bwconfigrsrc +org.bedework.app.bwconfig.deploy.dir=/webapps +org.bedework.app.bwconfig.description=Bedework properties config application +org.bedework.app.bwconfig.display.name=Bedework Config +org.bedework.app.bwconfig.name=bwconfig +org.bedework.app.bwconfig.guestmode=true +org.bedework.app.bwconfig.publicadmin=false +org.bedework.app.bwconfig.logprefix=BwConfig + +# +# -------------------------------------------------------------------- +# +# Admin Web Client +# +org.bedework.app.CalAdmin.version=3.0 +org.bedework.app.CalAdmin.default.contenttype=text/xml +org.bedework.app.CalAdmin.nogroupallowed=false + +org.bedework.app.CalAdmin.war.name=caladmin +org.bedework.app.CalAdmin.ear.name=caladmin +org.bedework.app.CalAdmin.context.root=caladmin +org.bedework.app.CalAdmin.root=/caladminrsrc +org.bedework.app.CalAdmin.resources.dir=/webapps/ROOT/caladminrsrc +org.bedework.app.CalAdmin.deploy.dir=/webapps + +org.bedework.app.CalAdmin.security.domain=demo +org.bedework.app.CalAdmin.security.prefix=demo +org.bedework.app.CalAdmin.transport.guarantee=NONE + +org.bedework.app.CalAdmin.description=Struts based version of the Bedework calendar public events admin client. +org.bedework.app.CalAdmin.display.name=Public Events Administration +org.bedework.app.CalAdmin.name=DemoCalAdmin + +org.bedework.app.CalAdmin.autocreatesponsors=false +org.bedework.app.CalAdmin.autodeletesponsors=false +org.bedework.app.CalAdmin.autocreatelocations=false +org.bedework.app.CalAdmin.autodeletelocations=false +org.bedework.app.CalAdmin.allowEditAllCategories=false +org.bedework.app.CalAdmin.allowEditAllLocations=false +org.bedework.app.CalAdmin.allowEditAllSponsors=false +org.bedework.app.CalAdmin.categoryOptional=true + +org.bedework.app.CalAdmin.hour24=true +org.bedework.app.CalAdmin.minincrement=5 +org.bedework.app.CalAdmin.admingroupsidprefix=agrp_ +org.bedework.app.CalAdmin.guestmode=false +org.bedework.app.CalAdmin.publicadmin=true +org.bedework.app.CalAdmin.logprefix=PubEventsAdmin +org.bedework.app.CalAdmin.run.as.user=public-user + +# +# -------------------------------------------------------------------- +# +# Public Web Client +# +org.bedework.app.Events.version=3.0 +org.bedework.app.Events.default.contenttype=text/xml +org.bedework.app.Events.web.xml=guest/web.xml + +org.bedework.app.Events.war.name=cal +org.bedework.app.Events.ear.name=cal +org.bedework.app.Events.context.root=cal +org.bedework.app.Events.root=/calrsrc +org.bedework.app.Events.resources.dir=/webapps/ROOT/calrsrc +org.bedework.app.Events.deploy.dir=/webapps + +org.bedework.app.Events.description=Struts based XML version of the Bedework calendar client. It may have many skins, determined by the XSLT. +org.bedework.app.Events.display.name=Demo calendar +org.bedework.app.Events.name=DemoCal +org.bedework.app.Events.run.as.user=public-user + +org.bedework.app.Events.hour24=true +org.bedework.app.Events.minincrement=5 +org.bedework.app.Events.skinset.name=demoskins +org.bedework.app.Events.showyeardata=false +org.bedework.app.Events.default.view=week +org.bedework.app.Events.refresh.interval=300 +org.bedework.app.Events.refresh.action=setup.do +org.bedework.app.Events.guestmode=true +org.bedework.app.Events.publicadmin=false +org.bedework.app.Events.logprefix=PubEvents + +# +# -------------------------------------------------------------------- +# +# Personal Web Client +# +org.bedework.app.UserCal.version=3.0 +org.bedework.app.UserCal.default.contenttype=text/xml +org.bedework.app.UserCal.web.xml=user/web.xml + +org.bedework.app.UserCal.war.name=ucal +org.bedework.app.UserCal.deploy.j2ee=false +org.bedework.app.UserCal.ear.name=ucal +org.bedework.app.UserCal.context.root=ucal +org.bedework.app.UserCal.root=/ucalrsrc +org.bedework.app.UserCal.resources.dir=/webapps/ROOT/ucalrsrc +org.bedework.app.UserCal.deploy.dir=/webapps + +org.bedework.app.UserCal.security.domain=demo +org.bedework.app.UserCal.security.prefix=demo +org.bedework.app.UserCal.transport.guarantee=NONE + +org.bedework.app.UserCal.description=XML/XSLT version of the Bedework calendar client. +org.bedework.app.UserCal.display.name=Bedework +org.bedework.app.UserCal.name=DemoUserCal + +org.bedework.app.UserCal.hour24=true +org.bedework.app.UserCal.minincrement=5 +org.bedework.app.UserCal.skinset.name=demoskins +org.bedework.app.UserCal.showyeardata=false +org.bedework.app.UserCal.default.view=day +org.bedework.app.UserCal.refresh.interval=300 +org.bedework.app.UserCal.refresh.action=setup.do +org.bedework.app.UserCal.guestmode=false +org.bedework.app.UserCal.publicadmin=false +org.bedework.app.UserCal.logprefix=PersonalCalendar # @@ -168,14 +193,16 @@ # Public Caldav Server # -org.bedework.caldav.public.war.name=pubcaldav -org.bedework.caldav.public.deploy.j2ee=false -org.bedework.caldav.public.ear.name=pubcaldav -org.bedework.caldav.public.context.root=pubcaldav -org.bedework.caldav.public.deploy.dir=/webapps -org.bedework.caldav.public.env.prefix=org.bedework.caldav.public. - -org.bedework.caldav.public.app.description=Bedework calendar caldav server. -org.bedework.caldav.public.app.display.name=UW Calendar -org.bedework.caldav.public.app.name=DemoPubcaldav +org.bedework.app.Pubcaldav.war.name=pubcaldav +org.bedework.app.Pubcaldav.ear.name=pubcaldav +org.bedework.app.Pubcaldav.context.root=pubcaldav + +org.bedework.app.Pubcaldav.description=Bedework public caldav server. +org.bedework.app.Pubcaldav.display.name=Bedework public caldav +org.bedework.app.Pubcaldav.name=DemoPubcaldav +org.bedework.app.Pubcaldav.deploy.dir=/webapps +org.bedework.app.Pubcaldav.guestmode=true +org.bedework.app.Pubcaldav.publicadmin=false +org.bedework.app.Pubcaldav.run.as.user=public-user +org.bedework.app.Pubcaldav.logprefix=PubCalDav # @@ -184,18 +211,19 @@ # Personal Caldav Server # -org.bedework.caldav.user.war.name=ucaldav -org.bedework.caldav.user.deploy.j2ee=false -org.bedework.caldav.user.ear.name=ucaldav -org.bedework.caldav.user.context.root=ucaldav -org.bedework.caldav.user.deploy.dir=/webapps -org.bedework.caldav.user.env.prefix=org.bedework.caldav.user. - -org.bedework.caldav.user.app.security.domain=null -org.bedework.caldav.user.app.security.prefix=null -org.bedework.caldav.user.app.transport.guarantee=NONE - -org.bedework.caldav.user.app.description=Bedework calendar caldav server. -org.bedework.caldav.user.app.display.name=UW Calendar -org.bedework.caldav.user.app.name=DemoUsrcaldav +org.bedework.app.Usercaldav.war.name=ucaldav +org.bedework.app.Usercaldav.ear.name=ucaldav +org.bedework.app.Usercaldav.context.root=ucaldav + +org.bedework.app.Usercaldav.security.domain=null +org.bedework.app.Usercaldav.security.prefix=null +org.bedework.app.Usercaldav.transport.guarantee=NONE + +org.bedework.app.Usercaldav.description=Bedework user caldav server. +org.bedework.app.Usercaldav.display.name=Bedework usercaldav +org.bedework.app.Usercaldav.name=DemoUsrcaldav +org.bedework.app.Usercaldav.deploy.dir=/webapps +org.bedework.app.Usercaldav.guestmode=false +org.bedework.app.Usercaldav.publicadmin=false +org.bedework.app.Usercaldav.logprefix=UserCalDav # @@ -205,8 +233,8 @@ # -org.bedework.dumprestore.zip.name=bwdumpres -org.bedework.dumprestore.description=Bedework dump/restore utility -org.bedework.dumprestore.version=3.0 -org.bedework.dumprestore.jdbcdriver.jar=${appserver.jdbcdriver.jar} +org.bedework.app.dumprestore.zip.name=bwdumpres +org.bedework.app.dumprestore.description=Bedework dump/restore utility +org.bedework.app.dumprestore.version=3.0 +org.bedework.app.dumprestore.jdbcdriver.jar=${appserver.jdbcdriver.jar} # -------------- dump parameters ------------------ @@ -214,5 +242,4 @@ org.bedework.dump.arg.dumpfile=${user.home}/.bedework/caldata.xml org.bedework.dump.arg.debug=-debug -org.bedework.restore.arg.hib=-nhib org.bedework.dump.arg.hibernate.dialect=org.hibernate.dialect.HSQLDialect org.bedework.dump.arg.jdbcdriver=org.hsqldb.jdbcDriver @@ -223,11 +250,9 @@ # -------------- restore parameters ------------------ -org.bedework.restore.arg.dumpfile=${calendar.dir}/db/initcaldata.xml -org.bedework.restore.arg.fixowner= +org.bedework.restore.arg.dumpfile=${calendar.dir}/dumprestore/initcaldata.xml org.bedework.restore.arg.debug=-debug -org.bedework.restore.arg.hib=-nhib +org.bedework.restore.arg.from2p3px= org.bedework.restore.arg.fixcals=-nfixcals -org.bedework.restore.arg.calowner=caladmin -org.bedework.restore.arg.jdbc=-jdbc +org.bedework.restore.arg.defaultpubliccal= org.bedework.restore.arg.hibernate.dialect=org.hibernate.dialect.HSQLDialect org.bedework.restore.arg.jdbcdriver=org.hsqldb.jdbcDriver @@ -235,3 +260,4 @@ org.bedework.restore.arg.jdbcid=sa org.bedework.restore.arg.jdbcpw= - +org.bedework.restore.arg.timezones= + Index: trunk/calendar3/config/src/org/bedework/webconfig/AbstractAction.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/AbstractAction.java (revision 293) +++ trunk/calendar3/config/src/org/bedework/webconfig/AbstractAction.java (revision 302) @@ -68,9 +68,9 @@ import org.bedework.webconfig.collections.Webpersonal; import org.bedework.webconfig.collections.Webpublic; -import org.bedework.webconfig.props.BooleanProperty; import org.bedework.webconfig.props.ConfigProperty; +import org.bedework.webconfig.props.OrderedListProperty; +import org.bedework.webconfig.props.OrderedMultiListProperty; import edu.rpi.sss.util.Util; -import edu.rpi.sss.util.jsp.JspUtil; import edu.rpi.sss.util.jsp.UtilAbstractAction; import edu.rpi.sss.util.jsp.UtilActionForm; @@ -170,10 +170,46 @@ form.addPropertyCollection(modules); form.addPropertyCollection(new Globals()); - form.addPropertyCollection(new Webconfig()); - form.addPropertyCollection(new Webadmin((BooleanProperty)modules.findProperty("adminwebclient"))); - form.addPropertyCollection(new Webpublic((BooleanProperty)modules.findProperty("publicwebclient"))); - form.addPropertyCollection(new Webpersonal((BooleanProperty)modules.findProperty("personalwebclient"))); - form.addPropertyCollection(new Caldavpublic((BooleanProperty)modules.findProperty("publiccaldav"))); - form.addPropertyCollection(new Caldavpersonal((BooleanProperty)modules.findProperty("personalcaldav"))); + + /* Ensure module names and types same size */ + + OrderedListProperty moduleNames = + (OrderedListProperty)modules.findProperty("app.names"); + + OrderedMultiListProperty moduleTypes = + (OrderedMultiListProperty)modules.findProperty("app.types"); + + debugMsg("sizes - names=" + moduleNames.size() + " types=" + moduleTypes.size()); + + if (moduleNames.size() != moduleTypes.size()) { + form.getErr().emit("org.bedework.config.error.badmodulenames", + moduleNames.getValue(), moduleTypes.getValue()); + return; + } + + Iterator nmit = moduleNames.iterateValues(); + Iterator typeit = moduleTypes.iterateValues(); + + while (nmit.hasNext()) { + String nm = (String)nmit.next(); + String type = (String)typeit.next(); + + debugMsg("generate app properties - name=" + nm + " type=" + type); + + if (type.equals(webconfigType)) { + form.addPropertyCollection(new Webconfig(nm)); + } else if (type.equals(webadminType)) { + form.addPropertyCollection(new Webadmin(nm)); + } else if (type.equals(webpublicType)) { + form.addPropertyCollection(new Webpublic(nm)); + } else if (type.equals(webuserType)) { + form.addPropertyCollection(new Webpersonal(nm)); + } else if (type.equals(publiccaldavType)) { + form.addPropertyCollection(new Caldavpublic(nm)); + } else if (type.equals(usercaldavType)) { + form.addPropertyCollection(new Caldavpersonal(nm)); + } else { + form.getErr().emit("org.bedework.config.error.application", type); + } + } if (pr != null) { @@ -278,7 +314,4 @@ } - String envPrefix = JspUtil.getReqProperty(frm.getMres(), - "org.bedework.envprefix"); - env = new CalEnv(envPrefix, debug); frm.assignEnv(env); Index: trunk/calendar3/config/src/org/bedework/webconfig/Defs.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/Defs.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/Defs.java (revision 302) @@ -60,4 +60,24 @@ */ public interface Defs { + /** This prefix never changes */ + public static final String envPrefix = "org.bedework.app.bwconfig."; + + public static final String webconfigType = "webconfig"; + public static final String webadminType = "webadmin"; + public static final String webpublicType = "webpublic"; + public static final String webuserType = "webuser"; + public static final String publiccaldavType = "publiccaldav"; + public static final String usercaldavType = "usercaldav"; + + /** Valid types of application */ + public static final String[] appTypes = { + webconfigType, + webadminType, + webpublicType, + webuserType, + publiccaldavType, + usercaldavType + }; + /** Default properties file (built in to application) */ public final static String defaultProperties = "/properties/calendar/default-bedework.properties"; @@ -79,3 +99,6 @@ /** Multi-value property - radio or select */ public final static int typeMultiple = 4; + + /** Comment */ + public final static int typeComment = 5; } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpersonal.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpersonal.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpersonal.java (revision 302) @@ -55,7 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Caldav public events server properties. * @@ -68,35 +65,27 @@ * @throws Throwable */ - public Caldavpersonal(BooleanProperty onlyIf) throws Throwable { - super("calDAV-personal", "caldav.user", onlyIf); + public Caldavpersonal(String name) throws Throwable { + super(name, "app." + name); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("war", "war.name"); - BooleanProperty j2ee = new BooleanProperty("j2ee.deploy", "deploy.j2ee", true); + requiredText("context.root", "context.root"); - addProperty(j2ee); + requiredText("deploy.dir", "deploy.dir"); - addProperty(new ConfigProperty("ear", "ear.name", true, j2ee)); + requiredText("security.domain", "app.security.domain"); - addProperty(new ConfigProperty("context.root", "context.root", true)); + requiredText("security.prefix", "app.security.prefix"); - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); - - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); - - addProperty(new ConfigProperty("security.domain", "app.security.domain", true)); - - addProperty(new ConfigProperty("security.prefix", "app.security.prefix", true)); - - addProperty(new ConfigProperty("transport.guarantee", "app.transport.guarantee", true)); + requiredText("transport.guarantee", "app.transport.guarantee"); // We really want this to set the value of the above to NONE or CONFIDENTIAL //addProperty(new BooleanProperty("ssl", "use.ssl", true)); - addProperty(new ConfigProperty("description", "app.description", true)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("display.name", "app.display.name", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("name", "app.name", true)); + requiredText("name", "app.name"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpublic.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpublic.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Caldavpublic.java (revision 302) @@ -55,7 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Caldav public events server properties. * @@ -68,26 +65,18 @@ * @throws Throwable */ - public Caldavpublic(BooleanProperty onlyIf) throws Throwable { - super("calDAV-public", "caldav.public", onlyIf); + public Caldavpublic(String name) throws Throwable { + super(name, "app." + name); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("war", "war.name"); - BooleanProperty j2ee = new BooleanProperty("j2ee.deploy", "deploy.j2ee", true); + requiredText("context.root", "context.root"); - addProperty(j2ee); + requiredText("deploy.dir", "deploy.dir"); - addProperty(new ConfigProperty("ear", "ear.name", true, j2ee)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("context.root", "context.root", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); - - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); - - addProperty(new ConfigProperty("description", "app.description", true)); - - addProperty(new ConfigProperty("display.name", "app.display.name", true)); - - addProperty(new ConfigProperty("name", "app.name", true)); + requiredText("name", "app.name"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/ConfigCollection.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/ConfigCollection.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/ConfigCollection.java (revision 302) @@ -55,6 +55,11 @@ package org.bedework.webconfig.collections; +import org.bedework.webconfig.Defs; import org.bedework.webconfig.props.BooleanProperty; +import org.bedework.webconfig.props.CommentProperty; import org.bedework.webconfig.props.ConfigProperty; +import org.bedework.webconfig.props.IntProperty; +import org.bedework.webconfig.props.OrderedListProperty; +import org.bedework.webconfig.props.OrderedMultiListProperty; import edu.rpi.sss.util.log.MessageEmit; @@ -77,5 +82,5 @@ * @author Mike Douglass */ -public class ConfigCollection implements Serializable { +public class ConfigCollection implements Defs, Serializable { private String name; private String prefix; @@ -160,4 +165,119 @@ return properties; } + + /** Add a required boolean property to the collection + * + * @param name + * @param suffix + * @return BooleanProperty + * @throws Throwable + */ + public BooleanProperty requiredBoolean(String name, String suffix) throws Throwable { + BooleanProperty prop = new BooleanProperty(name, suffix, true); + addProperty(prop); + + return prop; + } + + /** Add an optional boolean property to the collection + * + * @param name + * @param suffix + * @return BooleanProperty + * @throws Throwable + */ + public BooleanProperty optBoolean(String name, String suffix) throws Throwable { + BooleanProperty prop = new BooleanProperty(name, suffix, false); + addProperty(prop); + + return prop; + } + + /** Add a required int property to the collection + * + * @param name + * @param suffix + * @return IntProperty + * @throws Throwable + */ + public IntProperty requiredInt(String name, String suffix) throws Throwable { + IntProperty prop = new IntProperty(name, suffix, true); + addProperty(prop); + + return prop; + } + + /** Add a required text property to the collection + * + * @param name + * @param suffix + * @return ConfigProperty + * @throws Throwable + */ + public ConfigProperty requiredText(String name, String suffix) throws Throwable { + ConfigProperty prop = new ConfigProperty(name, suffix, true); + addProperty(prop); + + return prop; + } + + /** Add a required text property to the collection + * + * @param name + * @param suffix + * @param onlyIf BooleanProperty - if true this field is displayed and used + * @return ConfigProperty + * @throws Throwable + */ + public ConfigProperty requiredText(String name, String suffix, + BooleanProperty onlyIf) throws Throwable { + ConfigProperty prop = new ConfigProperty(name, suffix, true, onlyIf); + addProperty(prop); + + return prop; + } + + /** Add a required ordered list property to the collection + * + * @param name + * @param suffix + * @return + * @throws Throwable + */ + public OrderedListProperty requiredOrderedList(String name, + String suffix) throws Throwable { + OrderedListProperty prop = new OrderedListProperty(name, suffix, true); + addProperty(prop); + + return prop; + } + + /** Add a required ordered multi list property to the collection + * + * @param name + * @param suffix + * @param possibleValues String[] array of allowable values + * @return + * @throws Throwable + */ + public OrderedMultiListProperty requiredOrderedMultiList(String name, + String suffix, + String[] possibleValues) + throws Throwable { + OrderedMultiListProperty prop = new OrderedMultiListProperty(name, suffix, true, + possibleValues); + addProperty(prop); + + return prop; + } + + /** Add a comment to the collection + * + * @param val + * @throws Throwable + */ + public void comment(String val) throws Throwable { + addProperty(new CommentProperty(val)); + } /** Add a property to the collection Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Globals.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Globals.java (revision 64) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Globals.java (revision 302) @@ -52,9 +52,7 @@ to the maximum extent the law permits. */ - package org.bedework.webconfig.collections; import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.ConfigProperty; /** Global properties. @@ -70,13 +68,30 @@ super("globals", "global"); - addProperty(new ConfigProperty("system.name", "system.name", true)); + requiredText("system.name", "system.name"); - addProperty(new ConfigProperty("hibernate.dialect", "hibernate.dialect", true)); + requiredText("hibernate.dialect", "hibernate.dialect"); - addProperty(new ConfigProperty("calintfclass", "calintfclass", true)); + requiredText("calintfclass", "calintfclass"); - addProperty(new BooleanProperty("dirbrowsingDisallowed", - "directory.browsing.disallowed", - true)); + requiredBoolean("dirbrowsingDisallowed", "directory.browsing.disallowed"); + + optBoolean("buildStandaloneApp", "build.standalone.app"); + + BooleanProperty jetspeedportlet = optBoolean("jetspeedPortlet", + "build.jetspeed.portlet"); + + requiredText("jetspeed2.roles", "app.jetspeed2.roles", jetspeedportlet); + + optBoolean("uportalPortlet", "build.uportal.portlet"); + + BooleanProperty j2ee = optBoolean("j2ee.deploy", "deploy.j2ee"); + + requiredText("ear", "ear.name", j2ee); + + comment("uris to cross link apps - of dubious usefulness"); + + requiredText("public.admin.uri", "public.admin.uri"); + requiredText("public.calendar.uri", "public.calendar.uri"); + requiredText("personal.calendar.uri", "personal.calendar.uri"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Modules.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Modules.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Modules.java (revision 302) @@ -55,6 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; - /** The modules to build. * @@ -69,16 +67,7 @@ super("modules", "install"); - addProperty(new BooleanProperty("adminwebclient", "admin.web", true)); + requiredOrderedList("app.names", "app.names"); - addProperty(new BooleanProperty("publicwebclient", "public.web", true)); - - addProperty(new BooleanProperty("personalwebclient", "personal.web", true)); - - addProperty(new BooleanProperty("publiccaldav", "public.caldav", true)); - - addProperty(new BooleanProperty("personalcaldav", "personal.caldav", true)); - - addProperty(new BooleanProperty("advanced", "advanced", true)); + requiredOrderedMultiList("app.types", "app.types", appTypes); } } - Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Syspars.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Syspars.java (revision 64) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Syspars.java (revision 302) @@ -55,7 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.IntProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Global properties. * @@ -70,44 +67,42 @@ super("syspar", "syspar"); - addProperty(new ConfigProperty("tzid", "tzid", true)); + requiredText("tzid", "tzid"); - addProperty(new ConfigProperty("systemid", "systemid", true)); + requiredText("systemid", "systemid"); - addProperty(new ConfigProperty("public.calroot", "public.calroot", - true, true)); + requiredText("public.calroot", "public.calroot"); - addProperty(new ConfigProperty("user.calroot", "user.calroot", - true, true)); + requiredText("user.calroot", "user.calroot"); - addProperty(new ConfigProperty("default.user.calendar", - "default.user.calendar", true)); + requiredText("default.user.calendar", + "default.user.calendar"); - addProperty(new ConfigProperty("default.trash.calendar", - "default.trash.calendar", true)); + requiredText("default.trash.calendar", + "default.trash.calendar"); - addProperty(new ConfigProperty("default.user.inbox", - "default.user.inbox", true)); + requiredText("default.user.inbox", + "default.user.inbox"); - addProperty(new ConfigProperty("default.user.outbox", - "default.user.outbox", true)); + requiredText("default.user.outbox", + "default.user.outbox"); - addProperty(new ConfigProperty("default.user.view", - "default.user.view", true)); + requiredText("default.user.view", + "default.user.view"); - addProperty(new ConfigProperty("public.user", "public.user", true, true)); + requiredText("public.user", "public.user"); - addProperty(new IntProperty("http.connections.peruser", "http connections per user", true, true)); + requiredInt("http.connections.peruser", "http connections per user"); - addProperty(new IntProperty("http.connections.perhost", "http connections per host", true, true)); + requiredInt("http.connections.perhost", "http connections per host"); - addProperty(new IntProperty("http.connections", "http connections", true, true)); + requiredInt("http.connections", "http connections"); - addProperty(new ConfigProperty("userauthclass", "userauthclass", true)); + requiredText("userauthclass", "userauthclass"); - addProperty(new ConfigProperty("mailerclass", "mailerclass", true)); + requiredText("mailerclass", "mailerclass"); - addProperty(new ConfigProperty("admingroupsclass", "admingroupsclass", true)); + requiredText("admingroupsclass", "admingroupsclass"); - addProperty(new ConfigProperty("usergroupsclass", "usergroupsclass", true)); + requiredText("usergroupsclass", "usergroupsclass"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Webadmin.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Webadmin.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Webadmin.java (revision 302) @@ -55,8 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.IntProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Web admin client properties. * @@ -69,76 +65,57 @@ * @throws Throwable */ - public Webadmin(BooleanProperty onlyIf) throws Throwable { - super("Webadmin", "webadmin", onlyIf); + public Webadmin(String name) throws Throwable { + super(name, "app." + name); - addProperty(new ConfigProperty("defaultContentType", "app.default.contenttype", true)); + requiredText("defaultContentType", "app.default.contenttype"); - addProperty(new BooleanProperty("standalone.app", "build.standalone.app", true)); + requiredText("war", "war.name"); - BooleanProperty jetspeedportlet = new BooleanProperty("jetspeedPortlet", "build.jetspeed.portlet", true); - addProperty(jetspeedportlet); + requiredText("context.root", "context.root"); - addProperty(new ConfigProperty("jetspeed2.roles", "app.jetspeed2.roles", true, jetspeedportlet)); + requiredText("app.root", "app.root"); - BooleanProperty uportalportlet = new BooleanProperty("uportalPortlet", "build.uportal.portlet", true); - addProperty(uportalportlet); + requiredText("resources.dir", "app.resources.dir"); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("deploy.dir", "deploy.dir"); - BooleanProperty j2ee = new BooleanProperty("j2ee.deploy", "deploy.j2ee", true); + requiredText("security.domain", "app.security.domain"); - addProperty(j2ee); + requiredText("security.prefix", "app.security.prefix"); - addProperty(new ConfigProperty("ear", "ear.name", true, j2ee)); - - addProperty(new ConfigProperty("context.root", "context.root", true)); - - addProperty(new ConfigProperty("app.root", "app.root", true)); - - addProperty(new ConfigProperty("resources.dir", "app.resources.dir", true)); - - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); - - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); - - addProperty(new ConfigProperty("security.domain", "app.security.domain", true)); - - addProperty(new ConfigProperty("security.prefix", "app.security.prefix", true)); - - addProperty(new ConfigProperty("transport.guarantee", "app.transport.guarantee", true)); + requiredText("transport.guarantee", "app.transport.guarantee"); // We really want this to set the value of the above to NONE or CONFIDENTIAL //addProperty(new BooleanProperty("ssl", "use.ssl", true)); - addProperty(new ConfigProperty("description", "app.description", true)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("display.name", "app.display.name", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("name", "app.name", true)); + requiredText("name", "app.name"); - addProperty(new BooleanProperty("noGroupAllowed", "app.nogroupallowed", true)); + requiredBoolean("noGroupAllowed", "app.nogroupallowed"); - addProperty(new BooleanProperty("autocreatesponsors", "app.autocreatesponsors", true)); + requiredBoolean("autocreatesponsors", "app.autocreatesponsors"); - addProperty(new BooleanProperty("autodeletesponsors", "app.autodeletesponsors", true)); + requiredBoolean("autodeletesponsors", "app.autodeletesponsors"); - addProperty(new BooleanProperty("autocreatelocations", "app.autocreatelocations", true)); + requiredBoolean("autocreatelocations", "app.autocreatelocations"); - addProperty(new BooleanProperty("autodeletelocations", "app.autodeletelocations", true)); + requiredBoolean("autodeletelocations", "app.autodeletelocations"); - addProperty(new BooleanProperty("allowEditAllCategories", "app.allowEditAllCategories", true)); + requiredBoolean("allowEditAllCategories", "app.allowEditAllCategories"); - addProperty(new BooleanProperty("allowEditAllLocations", "app.allowEditAllLocations", true)); + requiredBoolean("allowEditAllLocations", "app.allowEditAllLocations"); - addProperty(new BooleanProperty("allowEditAllSponsors", "app.allowEditAllSponsors", true)); + requiredBoolean("allowEditAllSponsors", "app.allowEditAllSponsors"); - addProperty(new BooleanProperty("categoryOptional", "app.categoryOptional", true)); + requiredBoolean("categoryOptional", "app.categoryOptional"); - addProperty(new BooleanProperty("hour24", "app.hour24", true)); + requiredBoolean("hour24", "app.hour24"); - addProperty(new IntProperty("minincrement", "app.minincrement", true)); + requiredInt("minincrement", "app.minincrement"); - addProperty(new ConfigProperty("admingroupsidprefix", "app.admingroupsidprefix", true)); + requiredText("admingroupsidprefix", "app.admingroupsidprefix"); } } - Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Webconfig.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Webconfig.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Webconfig.java (revision 302) @@ -55,7 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Web config client properties. * @@ -67,28 +64,26 @@ * @throws Throwable */ - public Webconfig() throws Throwable { - super("Webconfig", "webconfig", false); + public Webconfig(String name) throws Throwable { + super(name, "app." + name, false); - addProperty(new ConfigProperty("defaultContentType", "app.default.contenttype", true)); + requiredText("defaultContentType", "app.default.contenttype"); - addProperty(new BooleanProperty("standalone.app", "build.standalone.app", true)); + requiredText("war", "war.name"); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("context.root", "context.root"); - addProperty(new ConfigProperty("context.root", "context.root", true)); + requiredText("app.root", "app.root"); - addProperty(new ConfigProperty("app.root", "app.root", true)); + requiredText("resources.dir", "app.resources.dir"); - addProperty(new ConfigProperty("resources.dir", "app.resources.dir", true)); + requiredText("deploy.dir", "deploy.dir"); - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); + requiredText("envprefix", "env.prefix"); - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("description", "app.description", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("display.name", "app.display.name", true)); - - addProperty(new ConfigProperty("name", "app.name", true)); + requiredText("name", "app.name"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpersonal.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpersonal.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpersonal.java (revision 302) @@ -55,8 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.IntProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Web personal client properties. * @@ -69,65 +65,49 @@ * @throws Throwable */ - public Webpersonal(BooleanProperty onlyIf) throws Throwable { - super("webpersonal", "webpersonal", onlyIf); + public Webpersonal(String name) throws Throwable { + super(name, "app." + name); - addProperty(new ConfigProperty("defaultContentType", "app.default.contenttype", true)); + requiredText("defaultContentType", "app.default.contenttype"); - addProperty(new BooleanProperty("standalone.app", "build.standalone.app", true)); + requiredText("war", "war.name"); - BooleanProperty jetspeedportlet = new BooleanProperty("jetspeedPortlet", "build.jetspeed.portlet", true); - addProperty(jetspeedportlet); + requiredText("context.root", "context.root"); - BooleanProperty uportalportlet = new BooleanProperty("uportalPortlet", "build.uportal.portlet", true); - addProperty(uportalportlet); + requiredText("app.root", "app.root"); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("resources.dir", "app.resources.dir"); - BooleanProperty j2ee = new BooleanProperty("j2ee.deploy", "deploy.j2ee", true); + requiredText("deploy.dir", "deploy.dir"); - addProperty(j2ee); + requiredText("web.xml", "app.web.xml"); - addProperty(new ConfigProperty("ear", "ear.name", true, j2ee)); + requiredText("security.domain", "app.security.domain"); - addProperty(new ConfigProperty("context.root", "context.root", true)); + requiredText("security.prefix", "app.security.prefix"); - addProperty(new ConfigProperty("app.root", "app.root", true)); - - addProperty(new ConfigProperty("resources.dir", "app.resources.dir", true)); - - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); - - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); - - addProperty(new ConfigProperty("web.xml", "app.web.xml", true)); - - addProperty(new ConfigProperty("security.domain", "app.security.domain", true)); - - addProperty(new ConfigProperty("security.prefix", "app.security.prefix", true)); - - addProperty(new ConfigProperty("transport.guarantee", "app.transport.guarantee", true)); + requiredText("transport.guarantee", "app.transport.guarantee"); // We really want this to set the value of the above to NONE or CONFIDENTIAL - //addProperty(new BooleanProperty("ssl", "use.ssl", true)); + //addProperty(new BooleanProperty("ssl", "use.ssl"); - addProperty(new ConfigProperty("description", "app.description", true)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("display.name", "app.display.name", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("name", "app.name", true)); + requiredText("name", "app.name"); - addProperty(new BooleanProperty("hour24", "app.hour24", true)); + requiredBoolean("hour24", "app.hour24"); - addProperty(new IntProperty("minincrement", "app.minincrement", true)); + requiredInt("minincrement", "app.minincrement"); - addProperty(new ConfigProperty("skinset.name", "app.skinset.name", true)); + requiredText("skinset.name", "app.skinset.name"); - addProperty(new BooleanProperty("showyeardata", "app.showyeardata", true)); + requiredBoolean("showyeardata", "app.showyeardata"); - addProperty(new ConfigProperty("default.view", "app.default.view", true)); + requiredText("default.view", "app.default.view"); - addProperty(new IntProperty("refresh.interval", "app.refresh.interval", true)); + requiredInt("refresh.interval", "app.refresh.interval"); - addProperty(new ConfigProperty("refresh.action", "app.refresh.action", true)); + requiredText("refresh.action", "app.refresh.action"); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpublic.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpublic.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/collections/Webpublic.java (revision 302) @@ -55,8 +55,4 @@ package org.bedework.webconfig.collections; -import org.bedework.webconfig.props.BooleanProperty; -import org.bedework.webconfig.props.IntProperty; -import org.bedework.webconfig.props.ConfigProperty; - /** Global properties. * @@ -69,59 +65,42 @@ * @throws Throwable */ - public Webpublic(BooleanProperty onlyIf) throws Throwable { - super("webpublic", "webpubevents", onlyIf); + public Webpublic(String name) throws Throwable { + super(name, "app." + name); - addProperty(new ConfigProperty("defaultContentType", "app.default.contenttype", true)); + requiredText("defaultContentType", "app.default.contenttype"); - addProperty(new BooleanProperty("standalone.app", "build.standalone.app", true)); + requiredText("war", "war.name"); - BooleanProperty jetspeedportlet = new BooleanProperty("jetspeedPortlet", "build.jetspeed.portlet", true); - addProperty(jetspeedportlet); + requiredText("context.root", "context.root"); - BooleanProperty uportalportlet = new BooleanProperty("uportalPortlet", "build.uportal.portlet", true); - addProperty(uportalportlet); + requiredText("app.root", "app.root"); - addProperty(new ConfigProperty("war", "war.name", true)); + requiredText("resources.dir", "app.resources.dir"); - BooleanProperty j2ee = new BooleanProperty("j2ee.deploy", "deploy.j2ee", true); + requiredText("deploy.dir", "deploy.dir"); - addProperty(j2ee); + requiredText("web.xml", "app.web.xml"); - addProperty(new ConfigProperty("ear", "ear.name", true, j2ee)); + requiredText("description", "app.description"); - addProperty(new ConfigProperty("context.root", "context.root", true)); + requiredText("display.name", "app.display.name"); - addProperty(new ConfigProperty("app.root", "app.root", true)); + requiredText("name", "app.name"); - addProperty(new ConfigProperty("resources.dir", "app.resources.dir", true)); + requiredText("run-as", "run.as.user"); - addProperty(new ConfigProperty("deploy.dir", "deploy.dir", true)); + requiredBoolean("hour24", "app.hour24"); - addProperty(new ConfigProperty("envprefix", "env.prefix", true)); + requiredInt("minincrement", "app.minincrement"); - addProperty(new ConfigProperty("web.xml", "app.web.xml", true)); + requiredText("skinset.name", "app.skinset.name"); - addProperty(new ConfigProperty("description", "app.description", true)); + requiredBoolean("showyeardata", "app.showyeardata"); - addProperty(new ConfigProperty("display.name", "app.display.name", true)); + requiredText("default.view", "app.default.view"); - addProperty(new ConfigProperty("name", "app.name", true)); + requiredInt("refresh.interval", "app.refresh.interval"); - addProperty(new ConfigProperty("run-as", "run.as.user", true)); - - addProperty(new BooleanProperty("hour24", "app.hour24", true)); - - addProperty(new IntProperty("minincrement", "app.minincrement", true)); - - addProperty(new ConfigProperty("skinset.name", "app.skinset.name", true)); - - addProperty(new BooleanProperty("showyeardata", "app.showyeardata", true)); - - addProperty(new ConfigProperty("default.view", "app.default.view", true)); - - addProperty(new IntProperty("refresh.interval", "app.refresh.interval", true)); - - addProperty(new ConfigProperty("refresh.action", "app.refresh.action", true)); + requiredText("refresh.action", "app.refresh.action"); } } - Index: trunk/calendar3/config/src/org/bedework/webconfig/props/CommentProperty.java =================================================================== --- (revision ) +++ trunk/calendar3/config/src/org/bedework/webconfig/props/CommentProperty.java (revision 302) @@ -1,0 +1,106 @@ +/* + 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.webconfig.props; + +/** A property has a name - used by the web application for the tag, a value + * and a suffix which is appended to the prefix defined by the collection of + * which the property is a member. + * + *
For example the property defining the app root for the web admin client + * has an internal tag name "approot" and a suffix of "app.root". The prefix for + * the collection of webadmin properties would be "org.bedework.webadmin" + * giving a property name of "org.bedework.webadmin.app.root" + * + *
A comment propert is just that - text to be inserted as a comment in the + * resulting properties file. + * + * @author Mike Douglass + */ +public class CommentProperty extends ConfigProperty { + private String value; + + /** Constructor + * + * @param value String + */ + public CommentProperty(String val) { + super("comment", "comment", true, false); + value = val; + } + + /** Other property types override this + * + * @return int type of property + */ + public int getType() { + return typeComment; + } + + /** This is overrridden for validity checking + * + * @param val String value + */ + public void setValue(String val) { + value = val; + } + + /** Get the name + * + * @return String name used for tags. + */ + public String getValue() { + return value; + } +} Index: trunk/calendar3/config/src/org/bedework/webconfig/props/MultiProperty.java =================================================================== --- trunk/calendar3/config/src/org/bedework/webconfig/props/MultiProperty.java (revision 2) +++ trunk/calendar3/config/src/org/bedework/webconfig/props/MultiProperty.java (revision 302) @@ -55,4 +55,10 @@ package org.bedework.webconfig.props; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import edu.rpi.sss.util.log.MessageEmit; + /** A property has a name - used by the web application for the tag, a value * and a suffix which is appended to the prefix defined by the collection of @@ -67,5 +73,5 @@ */ public class MultiProperty extends ConfigProperty { - private String[] possibleValues; + private List possibleValues; /** Constructor @@ -79,13 +85,33 @@ String[] possibleValues) { super(name, suffix, required, false); - this.possibleValues = possibleValues; + this.possibleValues = Arrays.asList(possibleValues); } - /** Get the allowable values + /** Called at update to set the error flag and emit a message * - * @return String[] array of allowable values + * @param err MessageEmit object for error messages + * @return boolean true for ok */ - public String[] getPossibleValues() { - return possibleValues; + public boolean validate(MessageEmit err) { + goodValue = true; + + if (!getShow()) { + return true; + } + + if (!possibleValues.contains(getValue())) { + err.emit("org.bedework.config.error.badvalue", getName(), getValue()); + goodValue = false; + } + + return goodValue; + } + + /** Iterate over the allowable values + * + * @return Iterator over allowable values + */ + public Iterator getPossibleValues() { + return possibleValues.iterator(); } } Index: trunk/calendar3/config/src/org/bedework/webconfig/props/OrderedListProperty.java =================================================================== --- (revision ) +++ trunk/calendar3/config/src/org/bedework/webconfig/props/OrderedListProperty.java (revision 302) @@ -1,0 +1,153 @@ +/* + 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.webconfig.props; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import edu.rpi.sss.util.Util; +import edu.rpi.sss.util.log.MessageEmit; + +/** A property has a name - used by the web application for the tag, a value + * and a suffix which is appended to the prefix defined by the collection of + * which the property is a member. + * + *
For example the property defining the app root for the web admin client + * has an internal tag name "approot" and a suffix of "app.app-name.root". The prefix for + * the collection of a webadmin set of properties would be "org.bedework." + * giving a property name of "org.bedework.app.Caladmin.root" + * + *
This type is an ordered list of arbitrary text values + * + * @author Mike Douglass + */ +public class OrderedListProperty extends ConfigProperty { + private List listValues; + + /** Constructor + * + * @param name String name + * @param suffix String suffix + * @param required boolean true for a required field + */ + public OrderedListProperty(String name, String suffix, boolean required) { + super(name, suffix, required, false); + } + + /** This is overrridden for validity checking + * + * @param val String value + */ + public void setValue(String val) { + super.setValue(val); + listValues = null; + } + + /** Get the values + * + * @return Collection of values + */ + public Collection getValues() { + if (listValues == null) { + try { + listValues = Util.getList(getValue(), false); + } catch (Throwable t) { + goodValue = false; + listValues = new LinkedList(); + } + } + + return listValues; + } + + /** Get an iterator over the values + * + * @return iterator over values + */ + public Iterator iterateValues() { + return getValues().iterator(); + } + + /** + * @return int size of list + */ + public int size() { + return getValues().size(); + } + + /** Called at update to set the error flag and emit a message + * + * @param err MessageEmit object for error messages + * @return boolean true for ok + */ + public boolean validate(MessageEmit err) { + goodValue = true; + + if (!getShow()) { + return true; + } + + try { + listValues = Util.getList(getValue(), false); + } catch (Throwable t) { + err.emit("org.bedework.config.error.badvalue", getName(), getValue()); + goodValue = false; + } + + return goodValue; + } +} Index: trunk/calendar3/config/src/org/bedework/webconfig/props/OrderedMultiListProperty.java =================================================================== --- (revision ) +++ trunk/calendar3/config/src/org/bedework/webconfig/props/OrderedMultiListProperty.java (revision 302) @@ -1,0 +1,184 @@ +/* + 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.webconfig.props; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import edu.rpi.sss.util.Util; +import edu.rpi.sss.util.log.MessageEmit; + +/** A property has a name - used by the web application for the tag, a value + * and a suffix which is appended to the prefix defined by the collection of + * which the property is a member. + * + *
For example the property defining the app root for the web admin client + * has an internal tag name "approot" and a suffix of "app.app-name.root". The prefix for + * the collection of a webadmin set of properties would be "org.bedework." + * giving a property name of "org.bedework.app.Caladmin.root" + * + *
This type is an ordered list of specified text values
+ *
+ * @author Mike Douglass
+ */
+public class OrderedMultiListProperty extends ConfigProperty {
+ private List listValues;
+
+ private List possibleValues;
+
+ /** Constructor
+ *
+ * @param name String name
+ * @param suffix String suffix
+ * @param required boolean true for a required field
+ * @param possibleValues String[] array of allowable values
+ */
+ public OrderedMultiListProperty(String name, String suffix, boolean required,
+ String[] possibleValues) {
+ super(name, suffix, required, false);
+ this.possibleValues = Arrays.asList(possibleValues);
+ }
+
+ /** This is overrridden for validity checking
+ *
+ * @param val String value
+ */
+ public void setValue(String val) {
+ super.setValue(val);
+ listValues = null;
+ }
+
+ /** Called at update to set the error flag and emit a message
+ *
+ * @param err MessageEmit object for error messages
+ * @return boolean true for ok
+ */
+ public boolean validate(MessageEmit err) {
+ goodValue = true;
+
+ if (!getShow()) {
+ return true;
+ }
+
+ try {
+ listValues = Util.getList(getValue(), false);
+ } catch (Throwable t) {
+ err.emit("org.bedework.config.error.badvalue", getName(), getValue());
+ goodValue = false;
+ return goodValue;
+ }
+
+ Iterator it = iterateValues();
+ while (it.hasNext()) {
+ if (!possibleValues.contains(it.next())) {
+ err.emit("org.bedework.config.error.badvalue", getName(), getValue());
+ goodValue = false;
+ }
+ }
+
+ return goodValue;
+ }
+
+ /** Get the values
+ *
+ * @return Collection of values
+ */
+ public Collection getValues() {
+ if (listValues == null) {
+ try {
+ listValues = Util.getList(getValue(), false);
+ } catch (Throwable t) {
+ goodValue = false;
+ listValues = new LinkedList();
+ }
+ }
+
+ return listValues;
+ }
+
+ /** Get an iterator over the values
+ *
+ * @return iterator over values
+ */
+ public Iterator iterateValues() {
+ return getValues().iterator();
+ }
+
+ /**
+ * @return int size of list
+ */
+ public int size() {
+ return getValues().size();
+ }
+
+ /** Get the allowable values
+ *
+ * @return Collection of possible values
+ */
+ public Collection getPossibleValues() {
+ return possibleValues;
+ }
+
+ /** Iterate over the allowable values
+ *
+ * @return Iterator over allowable values
+ */
+ public Iterator iteratePossibleValues() {
+ return possibleValues.iterator();
+ }
+}
Index: trunk/calendar3/config/war/WEB-INF/classes/servlet.properties
===================================================================
--- trunk/calendar3/config/war/WEB-INF/classes/servlet.properties (revision 2)
+++ trunk/calendar3/config/war/WEB-INF/classes/servlet.properties (revision 302)
@@ -34,5 +34,2 @@
org.bedework.message.cancelled=Cancelled
-# This value is defined in CalEnv - don't lose the '.' on the end
-org.bedework.envprefix=@ENV-PREFIX@
-
Index: trunk/calendar3/config/war/docs/main.jsp
===================================================================
--- trunk/calendar3/config/war/docs/main.jsp (revision 2)
+++ trunk/calendar3/config/war/docs/main.jsp (revision 302)
@@ -15,38 +15,43 @@
This class represents a session for the UWCal web interface. + *
This class represents a session for the Bedework web interface. * Some user state will be retained here. * We also provide a number of methods which act as the interface between * the web world and the calendar world. * - *
The UW web interface has session support that may not be applicable - * to all potential users of this application. We should try to interface to - * it through this. - * * @author Mike Douglass douglm@rpi.edu */ public class BwSessionImpl implements BwSession { - /** Not valid in the j2ee world but it's only used to count sessions. - */ - private static int sessionNum = 0; + /** Not completely valid in the j2ee world but it's only used to count sessions. + */ + private static class Counts { + long totalSessions = 0; + } + + private static volatile HashMap countsMap = new HashMap(); + private long sessionNum = 0; /** True if we want debugging output @@ -102,5 +104,5 @@ private PresentationState ps; - /** Constructor for a UWCalSession + /** Constructor for a Session * * @param user String user id @@ -161,5 +163,5 @@ } - sessionNum++; + setSessionNum(appName); } @@ -169,14 +171,7 @@ /* (non-Javadoc) - * @see org.bedework.webcommon.BwSession#setSessionNum(int) - */ - public void setSessionNum(int val) { - sessionNum = val; - } - - /* (non-Javadoc) * @see org.bedework.webcommon.BwSession#getSessionNum() */ - public int getSessionNum() { + public long getSessionNum() { return sessionNum; } @@ -268,3 +263,20 @@ } } + + private void setSessionNum(String name) { + try { + synchronized (countsMap) { + Counts c = (Counts)countsMap.get(name); + + if (c == null) { + c = new Counts(); + countsMap.put(name, c); + } + + sessionNum = c.totalSessions; + c.totalSessions++; + } + } catch (Throwable t) { + } + } }