diff --git a/conf-sso/sp/dynamo.xml b/conf-sso/sp/dynamo.xml
index ce6483e..90b04c6 100644
--- a/conf-sso/sp/dynamo.xml
+++ b/conf-sso/sp/dynamo.xml
@@ -169,6 +169,13 @@
+
+
+
+
diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql
index 68a1174..ab64df7 100644
--- a/conf/venice-db-init-mysql.sql
+++ b/conf/venice-db-init-mysql.sql
@@ -336,85 +336,90 @@ INSERT INTO namespaces (nsid, namespace) VALUES
(10, 'http://www.silverwrist.com/NS/venice/2002/12/31/user.settings' ),
(11, 'http://www.silverwrist.com/NS/venice/2002/12/31/user.profile' ),
(12, 'http://www.silverwrist.com/NS/venice/2003/01/03/system.mail.messages' ),
- (13, 'http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions' );
+ (13, 'http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions' ),
+ (14, 'http://www.silverwrist.com/NS/venice/2003/05/28/community.permissions'),
+ (15, 'http://www.silverwrist.com/NS/venice/2003/05/29/community.profile' );
# Initial global properties setup
INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
- (1, 'site.title', '!Venice Test' ),
- (1, 'optionset', '_OS:AC' ),
- (1, 'site.url', '!http://localhost:8080/venice/' ),
- (1, 'site.logo.url', '!temp/site-logo.jpg' ),
- (1, 'site.logo.url.type', '!IMAGE' ),
- (1, 'site.logo.width', 'I140' ),
- (1, 'site.logo.height', 'I80' ),
- (1, 'frame.template', '!frame.vm' ),
- (1, 'footer.logo.scale', 'I100' ),
- (1, 'page.icon.url', '!venice-icon.png' ),
- (1, 'page.icon.url.type', '!IMAGE' ),
- (1, 'page.icon.type', '!image/png' ),
- (1, 'page.favicon.url', '!venice-favicon.ico' ),
- (1, 'page.favicon.url.type', '!IMAGE' ),
- (1, 'frontpage.title', '!My Front Page' ),
- (1, 'left.bar.width', 'I120' ),
- (2, 'sheet.base.normal', '!stylesheets/normal_base.vm' ),
- (2, 'sheet.adv.normal', '!stylesheets/adv_base.vm' ),
- (5, 'smtp.host', '!localhost' ),
- (5, 'system.mail.from.addr', '!nobody@delenn.silverwrist.internal'),
- (5, 'system.mail.from.name', '!Venice Mail System' ),
- (5, 'mailer.name', '!Venice AutoMail System' ),
- (5, 'user.info.header', '!X-Venice-User-Info' ),
- (6, 'subdir.buttons', '!buttons/classic' ),
- (6, 'std.button.width', 'I80' ),
- (6, 'std.button.height', 'I24' ),
- (6, 'bn.0transparent', '!transparent.gif' ),
- (6, 'bnc.0transparent', '!' ),
- (6, 'bn.cancel', '!cancel.jpg' ),
- (6, 'bnc.cancel', '!Cancel' ),
- (6, 'bn.configure', '!configure.jpg' ),
- (6, 'bnc.configure', '!Configure' ),
- (6, 'bn.create', '!create.jpg' ),
- (6, 'bnc.create', '!Create' ),
- (6, 'bn.i.accept', '!user_accept.jpg' ),
- (6, 'bnc.i.accept', '!I Accept' ),
- (6, 'bn.i.decline', '!user_decline.jpg' ),
- (6, 'bnc.i.decline', '!I Decline' ),
- (6, 'bn.login', '!login.jpg' ),
- (6, 'bnc.login', '!Log In' ),
- (6, 'bn.next', '!arrow_next.jpg' ),
- (6, 'bnc.next', '!Next' ),
- (6, 'bn.ok', '!ok.jpg' ),
- (6, 'bnc.ok', '!OK' ),
- (6, 'bn.previous', '!arrow_previous.jpg' ),
- (6, 'bnc.previous', '!Previous' ),
- (6, 'bn.reminder', '!reminder.jpg' ),
- (6, 'bnc.reminder', '!Reminder' ),
- (6, 'bn.search', '!search.jpg' ),
- (6, 'bnc.search', '!Search' ),
- (6, 'bn.send.again', '!send_again.jpg' ),
- (6, 'bnc.send.again', '!Send Again' ),
- (6, 'bn.send.email', '!send_email.jpg' ),
- (6, 'bnc.send.email', '!Send E-Mail' ),
- (6, 'bn.set', '!set.jpg' ),
- (6, 'bnc.set', '!Set' ),
- (6, 'bn.update', '!update.jpg' ),
- (6, 'bnc.update', '!Update' ),
- (6, 'user.agreement.title', '!Venice User Agreement' ),
- (6, 'user.photo.width', 'I100' ),
- (6, 'user.photo.height', 'I100' ),
- (6, 'user.nophoto.url', '!photo_not_avail.gif' ),
- (6, 'user.nophoto.url.type', '!IMAGE' ),
- (7, 'session.init.script', '!/util/session_init.js' ),
- (7, 'login.cookie', '!VeniceAuth' ),
- (7, 'login.cookie.maxage', 'I365' ),
- (7, 'password.recovery.time', 'I60' ),
- (10, 'timezone', '_TZ:UTC' ),
- (10, 'locale', '_LOC:en_US' ),
- (10, 'admin.flags', '_OS:' ),
- (10, 'search.result.count', 'I20' ),
- (11, 'privacy', '_OS:' ),
- (12, 'confirm.message.title', '!Venice E-Mail Confirmation' ),
- (12, 'password.change.message.title', '!Venice Password Changed' ),
- (12, 'reminder.message.title', '!Venice Password Reminder Message' );
+ (1, 'site.title', '!Venice Test' ),
+ (1, 'optionset', '_OS:AC' ),
+ (1, 'site.url', '!http://localhost:8080/venice/' ),
+ (1, 'site.logo.url', '!temp/site-logo.jpg' ),
+ (1, 'site.logo.url.type', '!IMAGE' ),
+ (1, 'site.logo.width', 'I140' ),
+ (1, 'site.logo.height', 'I80' ),
+ (1, 'frame.template', '!frame.vm' ),
+ (1, 'footer.logo.scale', 'I100' ),
+ (1, 'page.icon.url', '!venice-icon.png' ),
+ (1, 'page.icon.url.type', '!IMAGE' ),
+ (1, 'page.icon.type', '!image/png' ),
+ (1, 'page.favicon.url', '!venice-favicon.ico' ),
+ (1, 'page.favicon.url.type', '!IMAGE' ),
+ (1, 'frontpage.title', '!My Front Page' ),
+ (1, 'left.bar.width', 'I120' ),
+ (2, 'sheet.base.normal', '!stylesheets/normal_base.vm' ),
+ (2, 'sheet.adv.normal', '!stylesheets/adv_base.vm' ),
+ (5, 'smtp.host', '!localhost' ),
+ (5, 'system.mail.from.addr', '!nobody@delenn.silverwrist.internal' ),
+ (5, 'system.mail.from.name', '!Venice Mail System' ),
+ (5, 'mailer.name', '!Venice AutoMail System' ),
+ (5, 'user.info.header', '!X-Venice-User-Info' ),
+ (6, 'subdir.buttons', '!buttons/classic' ),
+ (6, 'std.button.width', 'I80' ),
+ (6, 'std.button.height', 'I24' ),
+ (6, 'bn.0transparent', '!transparent.gif' ),
+ (6, 'bnc.0transparent', '!' ),
+ (6, 'bn.cancel', '!cancel.jpg' ),
+ (6, 'bnc.cancel', '!Cancel' ),
+ (6, 'bn.configure', '!configure.jpg' ),
+ (6, 'bnc.configure', '!Configure' ),
+ (6, 'bn.create', '!create.jpg' ),
+ (6, 'bnc.create', '!Create' ),
+ (6, 'bn.i.accept', '!user_accept.jpg' ),
+ (6, 'bnc.i.accept', '!I Accept' ),
+ (6, 'bn.i.decline', '!user_decline.jpg' ),
+ (6, 'bnc.i.decline', '!I Decline' ),
+ (6, 'bn.login', '!login.jpg' ),
+ (6, 'bnc.login', '!Log In' ),
+ (6, 'bn.next', '!arrow_next.jpg' ),
+ (6, 'bnc.next', '!Next' ),
+ (6, 'bn.ok', '!ok.jpg' ),
+ (6, 'bnc.ok', '!OK' ),
+ (6, 'bn.previous', '!arrow_previous.jpg' ),
+ (6, 'bnc.previous', '!Previous' ),
+ (6, 'bn.reminder', '!reminder.jpg' ),
+ (6, 'bnc.reminder', '!Reminder' ),
+ (6, 'bn.search', '!search.jpg' ),
+ (6, 'bnc.search', '!Search' ),
+ (6, 'bn.send.again', '!send_again.jpg' ),
+ (6, 'bnc.send.again', '!Send Again' ),
+ (6, 'bn.send.email', '!send_email.jpg' ),
+ (6, 'bnc.send.email', '!Send E-Mail' ),
+ (6, 'bn.set', '!set.jpg' ),
+ (6, 'bnc.set', '!Set' ),
+ (6, 'bn.update', '!update.jpg' ),
+ (6, 'bnc.update', '!Update' ),
+ (6, 'user.agreement.title', '!Venice User Agreement' ),
+ (6, 'user.photo.width', 'I100' ),
+ (6, 'user.photo.height', 'I100' ),
+ (6, 'user.nophoto.url', '!photo_not_avail.gif' ),
+ (6, 'user.nophoto.url.type', '!IMAGE' ),
+ (7, 'session.init.script', '!/util/session_init.js' ),
+ (7, 'login.cookie', '!VeniceAuth' ),
+ (7, 'login.cookie.maxage', 'I365' ),
+ (7, 'password.recovery.time', 'I60' ),
+ (10, 'timezone', '_TZ:UTC' ),
+ (10, 'locale', '_LOC:en_US' ),
+ (10, 'admin.flags', '_OS:' ),
+ (10, 'search.result.count', 'I20' ),
+ (11, 'privacy', '_OS:' ),
+ (12, 'confirm.message.title', '!Venice E-Mail Confirmation' ),
+ (12, 'password.change.message.title', '!Venice Password Changed' ),
+ (12, 'reminder.message.title', '!Venice Password Reminder Message' ),
+ (15, 'rules', '!Please treat one another with courtesy and respect.'),
+ (15, 'language', '_LANG:en-US' ),
+ (15, 'country', '_CTRY:US' );
# Initial global blocks setup
INSERT INTO globalblock (nsid, block_name, block) VALUES
@@ -579,24 +584,27 @@ INSERT INTO aclowner (aclid, ownerid, flags) VALUES (2, 2, 0);
INSERT INTO ace (aceid, pri, flags) VALUES (2, 1, 1);
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 0, 2);
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
- (2, 1, 'set.property' ),
- (2, 1, 'set.block' ),
- (2, 2, 'set.property' ),
- (2, 3, 'edit.all' ),
- (2, 3, 'bypass.email.verify'),
- (2, 3, 'view.all' ),
- (2, 5, 'set.property' ),
- (2, 5, 'set.block' ),
- (2, 6, 'set.property' ),
- (2, 6, 'set.block' ),
- (2, 7, 'set.property' ),
- (2, 10, 'set.property' ),
- (2, 10, 'remove.property' ),
- (2, 11, 'set.property' ),
- (2, 11, 'remove.property' ),
- (2, 12, 'set.property' ),
- (2, 12, 'set.block' ),
- (2, 13, 'show.admin.menu' );
+ (2, 1, 'set.property' ),
+ (2, 1, 'set.block' ),
+ (2, 2, 'set.property' ),
+ (2, 3, 'edit.all' ),
+ (2, 3, 'bypass.email.verify' ),
+ (2, 3, 'view.all' ),
+ (2, 5, 'set.property' ),
+ (2, 5, 'set.block' ),
+ (2, 6, 'set.property' ),
+ (2, 6, 'set.block' ),
+ (2, 7, 'set.property' ),
+ (2, 10, 'set.property' ),
+ (2, 10, 'remove.property' ),
+ (2, 11, 'set.property' ),
+ (2, 11, 'remove.property' ),
+ (2, 12, 'set.property' ),
+ (2, 12, 'set.block' ),
+ (2, 13, 'show.admin.menu' ),
+ (2, 14, 'see.member.community.lists'),
+ (2, 14, 'community.directory.all' ),
+ (2, 14, 'community.search.all' );
INSERT INTO ace (aceid, pri, flags) VALUES (3, 2, 0);
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 1, 3);
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
@@ -631,6 +639,68 @@ INSERT INTO auditevent (eventid, event_nsid, event_name, descr) VALUES
INSERT INTO imagetype (typecode, nsid, name) VALUES
(1, 11, 'user.photo');
+# Create the "members" group for the initial community.
+# (GID 4)
+INSERT INTO groups (gid, groupname) VALUES (4, 'Members:piazza');
+INSERT INTO groupmembers (gid, uid) VALUES (4, 1), (4, 2);
+
+# Create the "hosts" group for the initial community.
+# (GID 5)
+INSERT INTO groups (gid, groupname) VALUES (5, 'Hosts:piazza');
+INSERT INTO groupmembers (gid, uid) VALUES (5, 2);
+
+# Create the ACL for the initial community members group. Only the community hosts and
+# system administrators can add or remove members (without going through the "join" process).
+# (ACL 3, ACEs 4 and 5)
+INSERT INTO acl (aclid, aclname) VALUES (3, 'Members:piazza');
+INSERT INTO aclowner (aclid, ownerid, flags) VALUES (3, 2, 0);
+INSERT INTO ace (aceid, pri, flags) VALUES (4, 5, 1);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 0, 4);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (4, 4, 'add.member' ),
+ (4, 4, 'remove.member');
+INSERT INTO ace (aceid, pri, flags) VALUES (5, 1, 1);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 1, 5);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (5, 4, 'add.member' ),
+ (5, 4, 'remove.member');
+UPDATE groups SET gaclid = 3 WHERE gid = 4;
+
+# Create the ACL for the initial community hosts group. Only the community "main host"
+# and system administrators can add or remove members.
+# (ACL 4, ACEs 6 and 7)
+INSERT INTO acl (aclid, aclname) VALUES (4, 'Hosts:piazza');
+INSERT INTO aclowner (aclid, ownerid, flags) VALUES (4, 2, 0);
+INSERT INTO ace (aceid, pri, flags) VALUES (6, 2, 0);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 0, 6);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (6, 4, 'add.member' ),
+ (6, 4, 'remove.member');
+INSERT INTO ace (aceid, pri, flags) VALUES (7, 1, 1);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 1, 7);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (7, 4, 'add.member' ),
+ (7, 4, 'remove.member');
+UPDATE groups SET gaclid = 4 WHERE gid = 5;
+
+# Create the ACL for the initial community.
+# (ACL 5, ACEs 8, 9)
+INSERT INTO acl (aclid, aclname) VALUES (5, 'ACL:piazza');
+INSERT INTO aclowner (aclid, ownerid, flags) VALUES (5, 5, 1);
+INSERT INTO ace (aceid, pri, flags) VALUES (8, 2, 0);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 0, 8);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (8, 15, 'remove.property');
+INSERT INTO ace (aceid, pri, flags) VALUES (9, 5, 1);
+INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 1, 9);
+INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
+ (9, 14, 'grant.revoke.access'),
+ (9, 15, 'set.category' ),
+ (9, 15, 'set.visibility' ),
+ (9, 15, 'set.name' ),
+ (9, 15, 'set.alias' ),
+ (9, 15, 'set.property' );
+
#### following this line is initialization of Venice-specific tables ####
# Populate the Category table.
@@ -1005,6 +1075,22 @@ INSERT INTO refcategory (catid, parent, symlink, name) VALUES
UPDATE refcategory SET dontuse = 1 WHERE catid = 15;
+# Create the initial community entry.
+# (CID 1)
+INSERT INTO communities (cid, member_gid, host_gid, host_uid, aclid, name, alias, createdate)
+ VALUES (1, 4, 5, 2, 5, 'La Piazza', 'piazza', '05-27-2003 09:00:00');
+
+# Create the properties for the initial community.
+INSERT INTO commprops (cid, nsid, prop_name, prop_value) VALUES
+ (1, 15, 'synopsis', '!A gathering place for Venice users.' ),
+ (1, 15, 'rules', '!Please treat one another with courtesy and respect.'),
+ (1, 15, 'language', '_LANG:en-US' ),
+ (1, 15, 'locality', '!Anywhere' ),
+ (1, 15, 'region', '!XX' ),
+ (1, 15, 'postal.code', '!00000' ),
+ (1, 15, 'country', '_CTRY:US' ),
+ (1, 15, 'url.homepage', '!http://venice.sourceforge.net' );
+
# Create the "global" menu. (ID #1)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (1, 1, 'fixed.menu', 'About This Site', NULL);
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/db/DefaultHashAuthenticator.java b/src/dynamo-framework/com/silverwrist/dynamo/db/DefaultHashAuthenticator.java
index b0767b3..e82f831 100644
--- a/src/dynamo-framework/com/silverwrist/dynamo/db/DefaultHashAuthenticator.java
+++ b/src/dynamo-framework/com/silverwrist/dynamo/db/DefaultHashAuthenticator.java
@@ -11,7 +11,7 @@
*
* The Initial Developer of the Original Code is Eric J. Bowersox ,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ * Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@@ -33,7 +33,7 @@ class DefaultHashAuthenticator implements Authenticator
} // end constructor
/*--------------------------------------------------------------------------------
- * IMplementations from interface Authenticator
+ * Implementations from interface Authenticator
*--------------------------------------------------------------------------------
*/
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/db/UserManagerObject.java b/src/dynamo-framework/com/silverwrist/dynamo/db/UserManagerObject.java
index 6b84b3b..a0da146 100644
--- a/src/dynamo-framework/com/silverwrist/dynamo/db/UserManagerObject.java
+++ b/src/dynamo-framework/com/silverwrist/dynamo/db/UserManagerObject.java
@@ -11,7 +11,7 @@
*
* The Initial Developer of the Original Code is Eric J. Bowersox ,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ * Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@@ -30,7 +30,7 @@ import com.silverwrist.dynamo.util.*;
public class UserManagerObject
implements NamedObject, ComponentInitialize, ComponentShutdown, UserManagement, UserProxyManagement,
- AuthenticatorRegistration, UserInfoNamespace, UserPropertyTranslatorInstall
+ AuthenticatorLookup, AuthenticatorRegistration, UserInfoNamespace, UserPropertyTranslatorInstall
{
/*--------------------------------------------------------------------------------
* Internal class implementing user proxies
@@ -341,6 +341,7 @@ public class UserManagerObject
private Object m_groups_sync = new Object(); // synchronization for group HashMaps
private Hashtable m_authenticators = new Hashtable(); // authenticators list
private ComponentShutdown m_hook_init; // hook for init service provider
+ private ComponentShutdown m_hook_rt; // hook for runtime service provider
private ComponentShutdown m_pszreg; // property serializer registration
private ComponentShutdown m_evt_user; // event registration
@@ -443,10 +444,15 @@ public class UserManagerObject
// Add us to the initialization services.
HookServiceProviders hooker = (HookServiceProviders)(services.queryService(HookServiceProviders.class));
- SingletonServiceProvider ssp = new SingletonServiceProvider("UserManagerObject",
- AuthenticatorRegistration.class,
- (AuthenticatorRegistration)this);
- m_hook_init = hooker.hookInitServiceProvider(ssp);
+ SimpleServiceProvider esp = new SimpleServiceProvider("UserManagerObject");
+ esp.addService(AuthenticatorRegistration.class,(AuthenticatorRegistration)this);
+ esp.addService(AuthenticatorLookup.class,(AuthenticatorLookup)this);
+ m_hook_init = hooker.hookInitServiceProvider(esp);
+
+ // Add us to the runtime services as well.
+ SingletonServiceProvider ssp = new SingletonServiceProvider("UserManagerObject",AuthenticatorLookup.class,
+ (AuthenticatorLookup)this);
+ m_hook_rt = hooker.hookRuntimeServiceProvider(ssp);
} // end initialize
@@ -461,6 +467,8 @@ public class UserManagerObject
m_evt_user = null;
m_pszreg.shutdown();
m_pszreg = null;
+ m_hook_rt.shutdown();
+ m_hook_rt = null;
m_hook_init.shutdown();
m_hook_init = null;
m_authenticators.clear();
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/util/DateObjectPair.java b/src/dynamo-framework/com/silverwrist/dynamo/util/DateObjectPair.java
new file mode 100644
index 0000000..5044b50
--- /dev/null
+++ b/src/dynamo-framework/com/silverwrist/dynamo/util/DateObjectPair.java
@@ -0,0 +1,61 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.dynamo.util;
+
+import java.util.*;
+
+public final class DateObjectPair
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private Object m_object;
+ private java.util.Date m_date;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public DateObjectPair(Object obj, java.util.Date date)
+ {
+ m_object = obj;
+ m_date = date;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Public getters
+ *--------------------------------------------------------------------------------
+ */
+
+ public Object getObject()
+ {
+ return m_object;
+
+ } // end getObject
+
+ public java.util.Date getDate()
+ {
+ return m_date;
+
+ } // end getDate
+
+} // end class DateObjectPair
diff --git a/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java b/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java
index c35bac3..e44904f 100644
--- a/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java
+++ b/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java
@@ -58,4 +58,10 @@ public interface VeniceNamespaces
public static final String SYSTEM_PERMS_NAMESPACE =
"http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions";
+ public static final String COMMUNITY_PERMS_NAMESPACE =
+ "http://www.silverwrist.com/NS/venice/2003/05/28/community.permissions";
+
+ public static final String COMMUNITY_PROFILE_NAMESPACE =
+ "http://www.silverwrist.com/NS/venice/2003/05/29/community.profile";
+
} // end interface VeniceNamespaces
diff --git a/src/venice-base/com/silverwrist/venice/community/CategoryManager.java b/src/venice-base/com/silverwrist/venice/community/CategoryManager.java
index 836b168..9bf68ba 100644
--- a/src/venice-base/com/silverwrist/venice/community/CategoryManager.java
+++ b/src/venice-base/com/silverwrist/venice/community/CategoryManager.java
@@ -146,7 +146,7 @@ public class CategoryManager implements NamedObject, ComponentInitialize, Compon
} // end try
catch (XMLLoadException e)
{ // error loading XML config data
- logger.fatal("XML loader exception in StandardContentSupplier",e);
+ logger.fatal("XML loader exception in CategoryManager",e);
throw new ConfigException(e);
} // end catch
@@ -167,6 +167,7 @@ public class CategoryManager implements NamedObject, ComponentInitialize, Compon
public void shutdown()
{
m_categories.clear();
+ m_ops.dispose();
m_ops = null;
} // end shutdown
diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityImpl.java b/src/venice-base/com/silverwrist/venice/community/CommunityImpl.java
new file mode 100644
index 0000000..5d0cc7d
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/community/CommunityImpl.java
@@ -0,0 +1,541 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.security.Principal;
+import java.security.acl.AclNotFoundException;
+import java.util.*;
+import org.apache.commons.collections.*;
+import org.apache.log4j.Logger;
+import com.silverwrist.dynamo.db.NamespaceCache;
+import com.silverwrist.dynamo.db.UserManagement;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
+import com.silverwrist.dynamo.util.*;
+import com.silverwrist.venice.CommunityVisibility;
+import com.silverwrist.venice.VeniceNamespaces;
+import com.silverwrist.venice.event.*;
+import com.silverwrist.venice.iface.*;
+
+class CommunityImpl implements VeniceCommunity
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static Logger logger = Logger.getLogger(CommunityImpl.class);
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private CommunityOps m_ops; // community operations object
+ private NamespaceCache m_nscache; // namespace cache object
+ private SecurityReferenceMonitor m_srm; // security reference monitor
+ private UserManagement m_users; // user management object
+ private AuthenticatorLookup m_alook; // authenticator lookup object
+ private PostDynamicUpdate m_post; // where we post dynamic update events
+ private CategoryService m_cats; // category service object
+ private int m_id; // community ID
+ private int m_member_gid; // member group ID
+ private int m_host_gid; // hosts group ID
+ private int m_host_uid; // primary host UID
+ private int m_aclid; // ID of the community ACL
+ private int m_catid; // category ID for the community
+ private CommunityVisibility m_visibility; // community visibility
+ private String m_name; // community name
+ private String m_alias; // community alias
+ private java.util.Date m_created; // date created
+ private java.util.Date m_lastaccessed; // date last accessed
+ private java.util.Date m_lastupdate; // date last updated
+ private ReferenceMap m_properties; // properties cache
+
+ /*--------------------------------------------------------------------------------
+ * Constructors
+ *--------------------------------------------------------------------------------
+ */
+
+ CommunityImpl(CommunityOps ops, NamespaceCache nscache, SecurityReferenceMonitor srm, UserManagement users,
+ AuthenticatorLookup alook, PostDynamicUpdate post, CategoryService cats, Map data)
+ {
+ m_ops = ops;
+ m_nscache = nscache;
+ m_srm = srm;
+ m_users = users;
+ m_alook = alook;
+ m_post = post;
+ m_cats = cats;
+ m_id = ((Integer)(data.get(CommunityManagerOps.KEY_CID))).intValue();
+ m_member_gid = ((Integer)(data.get(CommunityManagerOps.KEY_MEMBER_GID))).intValue();
+ m_host_gid = ((Integer)(data.get(CommunityManagerOps.KEY_HOST_GID))).intValue();
+ m_host_uid = ((Integer)(data.get(CommunityManagerOps.KEY_HOST_UID))).intValue();
+ m_aclid = ((Integer)(data.get(CommunityManagerOps.KEY_ACLID))).intValue();
+ m_catid = ((Integer)(data.get(CommunityManagerOps.KEY_CATID))).intValue();
+ m_visibility = (CommunityVisibility)(data.get(CommunityManagerOps.KEY_VISIBILITY));
+ m_name = (String)(data.get(CommunityManagerOps.KEY_NAME));
+ m_alias = (String)(data.get(CommunityManagerOps.KEY_ALIAS));
+ m_created = (java.util.Date)(data.get(CommunityManagerOps.KEY_CREATE));
+ m_lastaccessed = (java.util.Date)(data.get(CommunityManagerOps.KEY_ACCESS));
+ m_lastupdate = (java.util.Date)(data.get(CommunityManagerOps.KEY_UPDATE));
+ m_properties = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private final void testPermission(DynamoUser caller, String perm_namespace, String perm_name,
+ String fail_message) throws DatabaseException, DynamoSecurityException
+ {
+ try
+ { // perform security tests...
+ if (caller.equals(m_srm.getAdminUser()))
+ return; // Administrator can do anything
+ if (m_srm.getAcl(m_aclid).testPermission(caller,perm_namespace,perm_name))
+ return; // we have the right permission in the community ACL
+ if (m_srm.getGlobalAcl().testPermission(caller,perm_namespace,perm_name))
+ return; // or we can be authorized by the global ACL
+
+ } // end try
+ catch (AclNotFoundException e)
+ { // just fall through and throw the exception
+ } // end catch
+
+ // throw the DynamoSecurityException
+ DynamoSecurityException d = new DynamoSecurityException(CommunityImpl.class,"CommunityMessages",fail_message);
+ d.setParameter(0,m_name);
+ throw d;
+
+ } // end testPermission
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class Object
+ *--------------------------------------------------------------------------------
+ */
+
+ public boolean equals(Object o)
+ {
+ if (o==null)
+ return false;
+ if (o instanceof VeniceCommunity)
+ return (((VeniceCommunity)o).getCID()==m_id);
+ return false;
+
+ } // end equals
+
+ public int hashCode()
+ {
+ return m_id;
+
+ } // end hashCode
+
+ public String toString()
+ {
+ return "Community \"" + m_name + "\"";
+
+ } // end toString
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface NamedObject
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the name of this community.
+ *
+ * @return The name of this community.
+ */
+ public String getName()
+ {
+ return m_name;
+
+ } // end getName
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface ObjectProvider
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Retrieves an object from this ObjectProvider
.
+ *
+ * @param namespace The namespace to interpret the name relative to.
+ * @param name The name of the object to be retrieved.
+ * @return The object reference specified.
+ */
+ public Object getObject(String namespace, String name)
+ {
+ try
+ { // convert the namespace name to an ID here
+ PropertyKey key = new PropertyKey(m_nscache.namespaceNameToId(namespace),name);
+ Object rc = null;
+ synchronized (this)
+ { // start by looking in the properties map
+ rc = m_properties.get(key);
+ if (rc==null)
+ { // no use - need to try the database
+ rc = m_ops.getProperty(m_id,key);
+ if (rc!=null)
+ m_properties.put(key,rc);
+
+ } // end if
+
+ } // end synchronized block
+
+ if (rc==null)
+ throw new NoSuchObjectException(this.toString(),namespace,name);
+ return rc;
+
+ } // end try
+ catch (DatabaseException e)
+ { // translate into our NoSuchObjectException but retain the DatabaseException
+ throw new NoSuchObjectException(this.toString(),namespace,name,e);
+
+ } // end catch
+
+ } // end getObject
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface SecureObjectStore
+ *--------------------------------------------------------------------------------
+ */
+
+ public Object setObject(DynamoUser caller, String namespace, String name, Object value)
+ throws DatabaseException, DynamoSecurityException
+ {
+ testPermission(caller,namespace,"set.property","auth.setProperty");
+ DateObjectPair rc = null;
+
+ // convert the namespace name to an ID here
+ PropertyKey key = new PropertyKey(m_nscache.namespaceNameToId(namespace),name);
+ synchronized (this)
+ { // start by setting the database value
+ rc = m_ops.setProperty(m_id,key,value);
+
+ // and cache it, too
+ m_properties.put(key,value);
+
+ // and save off the update date/time
+ m_lastaccessed = m_lastupdate = rc.getDate();
+
+ } // end synchronized block
+
+ m_post.postUpdate(new CommunityPropertyUpdateEvent(this,namespace,name));
+ return rc.getObject();
+
+ } // end setObject
+
+ public Object removeObject(DynamoUser caller, String namespace, String name)
+ throws DatabaseException, DynamoSecurityException
+ {
+ testPermission(caller,namespace,"remove.property","sec.removeGlobalProperty");
+ DateObjectPair rc = null;
+
+ // convert the namespace name to an ID here
+ PropertyKey key = new PropertyKey(m_nscache.namespaceNameToId(namespace),name);
+ synchronized (this)
+ { // start by killing the database value
+ rc = m_ops.removeProperty(m_id,key);
+
+ // and remove the cached value, too
+ m_properties.remove(key);
+
+ if (rc!=null) // save off update date.time
+ m_lastaccessed = m_lastupdate = rc.getDate();
+
+ } // end synchronized block
+
+ m_post.postUpdate(new CommunityPropertyUpdateEvent(this,namespace,name));
+ return (rc==null) ? null : rc.getObject();
+
+ } // end removeObject
+
+ public Collection getNamespaces() throws DatabaseException
+ {
+ // call through to the database to get the list of namespace IDs
+ int[] ids = m_ops.getPropertyNamespaceIDs(m_id);
+
+ ArrayList rc = new ArrayList(ids.length);
+ for (int i=0; i.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.util.*;
+import org.apache.commons.collections.*;
+import org.apache.log4j.Logger;
+import org.w3c.dom.*;
+import com.silverwrist.util.*;
+import com.silverwrist.util.xml.*;
+import com.silverwrist.dynamo.db.NamespaceCache;
+import com.silverwrist.dynamo.db.UserManagement;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
+import com.silverwrist.dynamo.util.*;
+import com.silverwrist.venice.CommunitySearchField;
+import com.silverwrist.venice.SearchMode;
+import com.silverwrist.venice.VeniceNamespaces;
+import com.silverwrist.venice.iface.*;
+
+public class CommunityManager implements NamedObject, ComponentInitialize, ComponentShutdown, CommunityService
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static Logger logger = Logger.getLogger(CommunityManager.class);
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String m_name; // this object's name
+ private CommunityManagerOps m_ops; // database operations object
+ private NamespaceCache m_ns_cache; // namespace cache object
+ private SecurityReferenceMonitor m_srm; // security reference monitor
+ private UserManagement m_users; // user management object
+ private AuthenticatorLookup m_alook; // authenticator lookup
+ private PostDynamicUpdate m_post; // where we post dynamic updates
+ private CategoryService m_cats; // category service object
+ private ReferenceMap m_id_to_comm; // ReferenceMap of community IDs to communities
+ private ReferenceMap m_alias_to_comm; // ReferenceMap of community aliases to communities
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public CommunityManager()
+ {
+ m_id_to_comm = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
+ m_alias_to_comm = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private final List translateCIDArray(int[] array) throws DatabaseException
+ {
+ if (array.length==0)
+ return Collections.EMPTY_LIST;
+ ArrayList rc = new ArrayList(array.length);
+ for (int i=0; i.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.util.*;
+import com.silverwrist.dynamo.db.OpsBase;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.venice.SearchMode;
+
+abstract class CommunityManagerOps extends OpsBase
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ static final String KEY_CID = "cid";
+ static final String KEY_MEMBER_GID = "member_gid";
+ static final String KEY_HOST_GID = "host_gid";
+ static final String KEY_HOST_UID = "host_uid";
+ static final String KEY_ACLID = "aclid";
+ static final String KEY_CATID = "catid";
+ static final String KEY_VISIBILITY = "visibility";
+ static final String KEY_NAME = "name";
+ static final String KEY_ALIAS = "alias";
+ static final String KEY_CREATE = "created";
+ static final String KEY_ACCESS = "access";
+ static final String KEY_UPDATE = "update";
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ protected CommunityManagerOps(DBConnectionPool pool)
+ {
+ super(pool);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Abstract operations
+ *--------------------------------------------------------------------------------
+ */
+
+ abstract CommunityOps getCommunityOps();
+
+ abstract Map lookupCommunity(int cid) throws DatabaseException;
+
+ abstract Map lookupCommunity(String alias) throws DatabaseException;
+
+ abstract int[] getMemberCommunityIDs(int uid) throws DatabaseException;
+
+ abstract int[] getCommunityIDsInCategory(int catid, boolean show_all, int offset, int count)
+ throws DatabaseException;
+
+ abstract int getNumCommunityIDsInCategory(int catid, boolean show_all) throws DatabaseException;
+
+ abstract int[] searchProperty(int nsid, String name, SearchMode mode, String term, boolean show_all, int offset,
+ int count) throws DatabaseException;
+
+ abstract int searchPropertyCount(int nsid, String name, SearchMode mode, String term, boolean show_all)
+ throws DatabaseException;
+
+ abstract int[] searchName(SearchMode mode, String term, boolean show_all, int offset, int count)
+ throws DatabaseException;
+
+ abstract int searchNameCount(SearchMode mode, String term, boolean show_all) throws DatabaseException;
+
+ /*--------------------------------------------------------------------------------
+ * External static operations
+ *--------------------------------------------------------------------------------
+ */
+
+ static CommunityManagerOps get(DBConnectionPool pool) throws ConfigException
+ {
+ return (CommunityManagerOps)get(pool,CommunityManagerOps.class.getClassLoader(),
+ CommunityManagerOps.class.getName() + "_","CommunityManagerOps");
+
+ } // end get
+
+} // end class CommunityManagerOps
diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityManagerOps_mysql.java b/src/venice-base/com/silverwrist/venice/community/CommunityManagerOps_mysql.java
new file mode 100644
index 0000000..609c2b9
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/community/CommunityManagerOps_mysql.java
@@ -0,0 +1,546 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.sql.*;
+import java.util.*;
+import com.silverwrist.util.*;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.venice.CommunityVisibility;
+import com.silverwrist.venice.SearchMode;
+
+public class CommunityManagerOps_mysql extends CommunityManagerOps
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private DBUtilities m_utils;
+ private CommunityOps m_cops = null;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public CommunityManagerOps_mysql(DBConnectionPool pool)
+ {
+ super(pool);
+ m_utils = (DBUtilities)(pool.queryService(DBUtilities.class));
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private final String preparePropertySearchTerm(SearchMode mode, String term)
+ {
+ StringBuffer buf = new StringBuffer();
+ if (SearchMode.PREFIX.equals(mode))
+ buf.append("LIKE '!").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.SUBSTRING.equals(mode))
+ buf.append("LIKE '!%").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.REGEXP.equals(mode))
+ { // for regular expressions, if we're matching the start of the string, we have to inlcude the ! prefix
+ buf.append("REGEXP '");
+ if (term.startsWith("^"))
+ buf.append("^!").append(m_utils.encodeString(term.substring(1)));
+ else
+ buf.append(m_utils.encodeString(term));
+ buf.append('\'');
+
+ } // end else if
+
+ return buf.toString();
+
+ } // end preparePropertySearchTerm
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class OpsBase
+ *--------------------------------------------------------------------------------
+ */
+
+ public void dispose()
+ {
+ if (m_cops!=null)
+ { // dispose the subobject
+ m_cops.dispose();
+ m_cops = null;
+
+ } // end if
+
+ m_utils = null;
+ super.dispose();
+
+ } // end dispose
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class CommunityManagerOps
+ *--------------------------------------------------------------------------------
+ */
+
+ synchronized CommunityOps getCommunityOps()
+ {
+ if (m_cops==null)
+ m_cops = new CommunityOps_mysql(getPool());
+ return m_cops;
+
+ } // end getCommunityOps
+
+ Map lookupCommunity(int cid) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute the query
+ stmt = conn.prepareStatement("SELECT member_gid, host_gid, host_uid, aclid, catid, hide_dir, hide_search, name, "
+ + "alias, createdate, lastaccess, lastupdate FROM communities WHERE cid = ?;");
+ stmt.setInt(1,cid);
+ rs = stmt.executeQuery();
+ if (!(rs.next()))
+ return null;
+
+ // create and return the data structure
+ HashMap rc = new HashMap();
+ rc.put(KEY_CID,new Integer(cid));
+ rc.put(KEY_MEMBER_GID,new Integer(rs.getInt(1)));
+ rc.put(KEY_HOST_GID,new Integer(rs.getInt(2)));
+ rc.put(KEY_HOST_UID,new Integer(rs.getInt(3)));
+ rc.put(KEY_ACLID,new Integer(rs.getInt(4)));
+ rc.put(KEY_CATID,new Integer(rs.getInt(5)));
+ if (rs.getInt(6)==0)
+ rc.put(KEY_VISIBILITY,CommunityVisibility.SEARCHDIR);
+ else if (rs.getInt(7)==0)
+ rc.put(KEY_VISIBILITY,CommunityVisibility.SEARCHONLY);
+ else
+ rc.put(KEY_VISIBILITY,CommunityVisibility.NONE);
+ rc.put(KEY_NAME,rs.getString(8));
+ rc.put(KEY_ALIAS,rs.getString(9));
+ rc.put(KEY_CREATE,m_utils.getDateTime(rs,10));
+ rc.put(KEY_ACCESS,m_utils.getDateTime(rs,11));
+ rc.put(KEY_UPDATE,m_utils.getDateTime(rs,12));
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end lookupCommunity
+
+ Map lookupCommunity(String alias) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute the query
+ stmt = conn.prepareStatement("SELECT cid, member_gid, host_gid, host_uid, aclid, catid, hide_dir, hide_search, "
+ + "name, createdate, lastaccess, lastupdate FROM communities WHERE alias = ?;");
+ stmt.setString(1,alias);
+ rs = stmt.executeQuery();
+ if (!(rs.next()))
+ return null;
+
+ // create and return the data structure
+ HashMap rc = new HashMap();
+ rc.put(KEY_CID,new Integer(rs.getInt(1)));
+ rc.put(KEY_MEMBER_GID,new Integer(rs.getInt(2)));
+ rc.put(KEY_HOST_GID,new Integer(rs.getInt(3)));
+ rc.put(KEY_HOST_UID,new Integer(rs.getInt(4)));
+ rc.put(KEY_ACLID,new Integer(rs.getInt(5)));
+ rc.put(KEY_CATID,new Integer(rs.getInt(6)));
+ if (rs.getInt(7)==0)
+ rc.put(KEY_VISIBILITY,CommunityVisibility.SEARCHDIR);
+ else if (rs.getInt(8)==0)
+ rc.put(KEY_VISIBILITY,CommunityVisibility.SEARCHONLY);
+ else
+ rc.put(KEY_VISIBILITY,CommunityVisibility.NONE);
+ rc.put(KEY_NAME,rs.getString(9));
+ rc.put(KEY_ALIAS,alias);
+ rc.put(KEY_CREATE,m_utils.getDateTime(rs,10));
+ rc.put(KEY_ACCESS,m_utils.getDateTime(rs,11));
+ rc.put(KEY_UPDATE,m_utils.getDateTime(rs,12));
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end lookupCommunity
+
+ int[] getMemberCommunityIDs(int uid) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute the statement
+ stmt = conn.prepareStatement("SELECT c.cid FROM communities c, groupmembers g WHERE c.member_gid = g.gid "
+ + "AND g.uid = ? ORDER BY c.name;");
+ stmt.setInt(1,uid);
+ rs = stmt.executeQuery();
+
+ // Since we don't know how many communities we need to allocate slots for, we allocate smaller arrays
+ // in blocks and stash the small blocks in a LinkedList, keeping track of the total size.
+ LinkedList olist = new LinkedList();
+ int[] current = new int[16];
+ int curptr = 0;
+ int total = 0;
+ while (rs.next())
+ { // fill array segments with community IDs
+ if (curptr==16)
+ { // stack the filled array segment and begin a new one
+ olist.addLast(current);
+ curptr = 0;
+ current = new int[16];
+
+ } // end if
+
+ current[curptr++] = rs.getInt(1);
+ total++;
+
+ } // end while
+
+ olist.addLast(current); // add last array to list
+
+ // allocate and copy the return array
+ int rc[] = new int[total];
+ curptr = 0;
+ while (total>0)
+ { // get each segment and copy it into return array
+ current = (int[])(olist.removeFirst());
+ int ct = Math.min(current.length,total);
+ System.arraycopy(current,0,rc,curptr,ct);
+ curptr += ct;
+ total -= ct;
+
+ } // end while
+
+ olist.clear();
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end getMemberCommunityIDs
+
+ int[] getCommunityIDsInCategory(int catid, boolean show_all, int offset, int count) throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute the statement (note that we assemble it in SQL form);
+ StringBuffer sql = new StringBuffer("SELECT cid FROM communities WHERE catid = ");
+ sql.append(catid);
+ if (!show_all)
+ sql.append(" AND hide_dir = 0");
+ sql.append(" ORDER BY name LIMIT ").append(offset).append(", ").append(count+1).append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+
+ // We *know* the maximum number of indexes that can be returned, so allocate a temporary array big
+ // enough to hold them all.
+ int[] tmp = new int[count+1];
+ int ct = 0;
+ while (rs.next())
+ tmp[ct++] = rs.getInt(1);
+
+ // Create the actual return array and fill it.
+ int[] rc = new int[ct];
+ System.arraycopy(tmp,0,rc,0,ct);
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end getCommunityIDsInCategory
+
+ int getNumCommunityIDsInCategory(int catid, boolean show_all) throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute the statement (note that we assemble it in SQL form);
+ StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM communities WHERE catid = ");
+ sql.append(catid);
+ if (!show_all)
+ sql.append(" AND hide_dir = 0");
+ sql.append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+ return SQLUtils.getReturnCountInt(rs,1);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end getNumCommunityIDsInCategory
+
+ int[] searchProperty(int nsid, String name, SearchMode mode, String term, boolean show_all, int offset, int count)
+ throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute a query (note that we assemble it in SQL form)
+ StringBuffer sql = new StringBuffer("SELECT c.cid FROM communities c, commprops p WHERE c.cid = p.cid "
+ + "AND p.nsid = ");
+ sql.append(nsid).append(" AND p.prop_name = '").append(m_utils.encodeString(name)).append("' AND p.prop_value ");
+ sql.append(preparePropertySearchTerm(mode,term));
+ if (!show_all)
+ sql.append(" AND c.hide_search = 0");
+ sql.append(" ORDER BY c.name LIMIT ").append(offset).append(", ").append(count+1).append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+
+ // We *know* the maximum number of indexes that can be returned, so allocate a temporary array big
+ // enough to hold them all.
+ int[] tmp = new int[count+1];
+ int ct = 0;
+ while (rs.next())
+ tmp[ct++] = rs.getInt(1);
+
+ // Create the actual return array and fill it.
+ int[] rc = new int[ct];
+ System.arraycopy(tmp,0,rc,0,ct);
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end searchProperty
+
+ int searchPropertyCount(int nsid, String name, SearchMode mode, String term, boolean show_all)
+ throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute a query (note that we assemble it in SQL form)
+ StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM communities c, commprops p WHERE c.cid = p.cid "
+ + "AND p.nsid = ");
+ sql.append(nsid).append(" AND p.prop_name = '").append(m_utils.encodeString(name)).append("' AND p.prop_value ");
+ sql.append(preparePropertySearchTerm(mode,term));
+ if (!show_all)
+ sql.append(" AND c.hide_search = 0");
+ sql.append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+ return SQLUtils.getReturnCountInt(rs,1);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end searchPropertyCount
+
+ int[] searchName(SearchMode mode, String term, boolean show_all, int offset, int count) throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute a query (note that we assemble it in SQL form)
+ StringBuffer sql = new StringBuffer("SELECT cid FROM communities WHERE name ");
+ if (SearchMode.PREFIX.equals(mode))
+ sql.append("LIKE '").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.SUBSTRING.equals(mode))
+ sql.append("LIKE '%").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.REGEXP.equals(mode))
+ sql.append("REGEXP '").append(m_utils.encodeString(term)).append('\'');
+ if (!show_all)
+ sql.append(" AND hide_search = 0");
+ sql.append(" ORDER BY name LIMIT ").append(offset).append(", ").append(count+1).append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+
+ // We *know* the maximum number of indexes that can be returned, so allocate a temporary array big
+ // enough to hold them all.
+ int[] tmp = new int[count+1];
+ int ct = 0;
+ while (rs.next())
+ tmp[ct++] = rs.getInt(1);
+
+ // Create the actual return array and fill it.
+ int[] rc = new int[ct];
+ System.arraycopy(tmp,0,rc,0,ct);
+ return rc;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end searchName
+
+ int searchNameCount(SearchMode mode, String term, boolean show_all) throws DatabaseException
+ {
+ Connection conn = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // prepare and execute a query (note that we assemble it in SQL form)
+ StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM communities WHERE name ");
+ if (SearchMode.PREFIX.equals(mode))
+ sql.append("LIKE '").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.SUBSTRING.equals(mode))
+ sql.append("LIKE '%").append(m_utils.encodeStringWildcards(term)).append("%'");
+ else if (SearchMode.REGEXP.equals(mode))
+ sql.append("REGEXP '").append(m_utils.encodeString(term)).append('\'');
+ if (!show_all)
+ sql.append(" AND hide_search = 0");
+ sql.append(';');
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql.toString());
+ return SQLUtils.getReturnCountInt(rs,1);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end searchNameCount
+
+} // end class CommunityManagerOps_mysql
diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityMessages.properties b/src/venice-base/com/silverwrist/venice/community/CommunityMessages.properties
index 61e4490..81ea55d 100644
--- a/src/venice-base/com/silverwrist/venice/community/CommunityMessages.properties
+++ b/src/venice-base/com/silverwrist/venice/community/CommunityMessages.properties
@@ -16,3 +16,16 @@
# ---------------------------------------------------------------------------------
# This file has been localized for the en_US locale
cat.notfound=The category with ID#{0} does not exist in the database.
+cid.notfound=The community with ID#{0} does not exist in the database.
+alias.notfound=The community with alias "{0}" does not exist in the database.
+auth.getCommList=You are not authorized to get the member community list for user "{0}."
+auth.setCategory=You are not authorized to set the category for community "{0}."
+property.serialize=The value of property "{0}" could not be serialized.
+property.deserialize=The value of property "{0}" could not be deserialized.
+auth.setProperty=You are not authorized to set properties on the community "{0}."
+auth.removeProperty=You are not authorized to remove properties from the community "{0}."
+auth.setVisibility=You are not authorized to set the visibility for community "{0}."
+auth.setName=You are not authorized to change the name of community "{0}."
+auth.setAlias=You are not authorized to change the alias of community "{0}."
+auth.grantAccess=You are not authorized to grant access to community "{0}."
+auth.revokeAccess=You are not authorized to revoke access grants in community "{0}."
diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityOps.java b/src/venice-base/com/silverwrist/venice/community/CommunityOps.java
new file mode 100644
index 0000000..3afddfc
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/community/CommunityOps.java
@@ -0,0 +1,72 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.util.*;
+import com.silverwrist.dynamo.db.OpsBase;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.dynamo.util.*;
+import com.silverwrist.venice.CommunityVisibility;
+
+abstract class CommunityOps extends OpsBase
+{
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ protected CommunityOps(DBConnectionPool pool)
+ {
+ super(pool);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Abstract operations
+ *--------------------------------------------------------------------------------
+ */
+
+ abstract java.util.Date setCategoryID(int cid, int catid) throws DatabaseException;
+
+ abstract Object getProperty(int cid, PropertyKey key) throws DatabaseException;
+
+ abstract DateObjectPair setProperty(int cid, PropertyKey key, Object value) throws DatabaseException;
+
+ abstract DateObjectPair removeProperty(int cid, PropertyKey key) throws DatabaseException;
+
+ abstract int[] getPropertyNamespaceIDs(int cid) throws DatabaseException;
+
+ abstract Map getAllProperties(int cid, int namespace) throws DatabaseException;
+
+ abstract java.util.Date setVisibility(int cid, CommunityVisibility visibility) throws DatabaseException;
+
+ abstract java.util.Date setName(int cid, String name) throws DatabaseException;
+
+ abstract java.util.Date setAlias(int cid, String alias) throws DatabaseException;
+
+ abstract void setLastAccessDate(int cid, java.util.Date date) throws DatabaseException;
+
+ abstract void setLastUpdateDate(int cid, java.util.Date date) throws DatabaseException;
+
+ abstract java.util.Date grantAccess(int cid, int ugid, boolean is_group, boolean single_use, int auth_nsid,
+ String auth_name, String source_data, String auth_data) throws DatabaseException;
+
+ abstract java.util.Date revokeAccess(int cid, int ugid, boolean is_group) throws DatabaseException;
+
+} // end class CommunityOps
diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityOps_mysql.java b/src/venice-base/com/silverwrist/venice/community/CommunityOps_mysql.java
new file mode 100644
index 0000000..11f1df9
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/community/CommunityOps_mysql.java
@@ -0,0 +1,733 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.community;
+
+import java.sql.*;
+import java.util.*;
+import com.silverwrist.util.*;
+import com.silverwrist.dynamo.except.*;
+import com.silverwrist.dynamo.iface.*;
+import com.silverwrist.dynamo.util.*;
+import com.silverwrist.venice.CommunityVisibility;
+
+class CommunityOps_mysql extends CommunityOps
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private DBUtilities m_utils; // reference to utilities object
+ private PropertySerializer m_psz; // reference to property serializer
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ CommunityOps_mysql(DBConnectionPool pool)
+ {
+ super(pool);
+ m_utils = (DBUtilities)(pool.queryService(DBUtilities.class));
+ m_psz = (PropertySerializer)(pool.queryService(PropertySerializer.class));
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private final java.util.Date touchCommunity(Connection conn, int cid, java.util.Date date) throws SQLException
+ {
+ PreparedStatement stmt = null;
+ try
+ { // prepare and execute the update statement
+ stmt = conn.prepareStatement("UPDATE communities SET lastaccess = ?, lastupdate = ? WHERE cid = ?;");
+ m_utils.setDateTime(stmt,1,date);
+ m_utils.setDateTime(stmt,2,date);
+ stmt.setInt(3,cid);
+ stmt.executeUpdate();
+ return date;
+
+ } // end try
+ finally
+ { // make sure and close out the statement
+ SQLUtils.shutdown(stmt);
+
+ } // end finally
+
+ } // end touchCommunity
+
+ private final java.util.Date touchCommunity(Connection conn, int cid) throws SQLException
+ {
+ return this.touchCommunity(conn,cid,new java.util.Date());
+
+ } // end touchCommunity
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class OpsBase
+ *--------------------------------------------------------------------------------
+ */
+
+ public void dispose()
+ {
+ m_psz = null;
+ m_utils = null;
+ super.dispose();
+
+ } // end dispose
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class CommunityOps
+ *--------------------------------------------------------------------------------
+ */
+
+ java.util.Date setCategoryID(int cid, int catid) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ Statement stmt2 = null;
+ java.util.Date lastupd = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // lock the table
+ stmt2 = conn.createStatement();
+ stmt2.executeUpdate("LOCK TABLES communities WRITE;");
+
+ // prepare and execute the statement
+ stmt = conn.prepareStatement("UPDATE communities SET catid = ?, lastaccess = ?, lastupdate = ? WHERE cid = ?;");
+ stmt.setInt(1,catid);
+ lastupd = new java.util.Date();
+ m_utils.setDateTime(stmt,2,lastupd);
+ m_utils.setDateTime(stmt,3,lastupd);
+ stmt.setInt(4,cid);
+ stmt.executeUpdate();
+ return lastupd;
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ MySQLUtils.unlockTables(conn);
+ SQLUtils.shutdown(stmt2);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ } // end setCategoryID
+
+ Object getProperty(int cid, PropertyKey key) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ String rc_str = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // look up the property
+ stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
+ stmt.setInt(1,cid);
+ stmt.setInt(2,key.getNamespaceID());
+ stmt.setString(3,key.getName());
+ rs = stmt.executeQuery();
+ if (!(rs.next()))
+ return null; // property not found
+
+ rc_str = rs.getString(1);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ // Deserialize the property value.
+ Object rc = m_psz.deserializeProperty(rc_str);
+ if (rc!=null)
+ return rc;
+
+ // deserialization exception - throw it
+ DatabaseException de = new DatabaseException(CommunityOps_mysql.class,"CommunityMessages","property.deserialize");
+ de.setParameter(0,key.getName());
+ throw de;
+
+ } // end getProperty
+
+ DateObjectPair setProperty(int cid, PropertyKey key, Object value) throws DatabaseException
+ {
+ String serialized_value = m_psz.serializeProperty(value);
+ if (serialized_value==null)
+ { // serialization exception - throw it
+ DatabaseException de = new DatabaseException(CommunityOps_mysql.class,"CommunityMessages","property.serialize");
+ de.setParameter(0,key.getName());
+ throw de;
+
+ } // end if
+
+ String old_value = null;
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ Statement stmt2 = null;
+ ResultSet rs = null;
+ java.util.Date update = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // lock the table
+ stmt2 = conn.createStatement();
+ stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
+
+ // look to see if the property value is already there
+ stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
+ stmt.setInt(1,cid);
+ stmt.setInt(2,key.getNamespaceID());
+ stmt.setString(3,key.getName());
+ rs = stmt.executeQuery();
+ if (rs.next())
+ old_value = rs.getString(1);
+ SQLUtils.shutdown(rs);
+ rs = null;
+ SQLUtils.shutdown(stmt);
+
+ if (old_value!=null)
+ { // prepare the statement to update the existing record
+ stmt = conn.prepareStatement("UPDATE commprop SET prop_value = ? WHERE cid = ? AND nsid = ? "
+ + "AND prop_name = ?;");
+ stmt.setString(1,serialized_value);
+ stmt.setInt(2,cid);
+ stmt.setInt(3,key.getNamespaceID());
+ stmt.setString(4,key.getName());
+
+ } // end if
+ else
+ { // prepare the statement to insert a new record
+ stmt = conn.prepareStatement("INSERT INTO commprop (cid, nsid, prop_name, prop_value) VALUES (?, ?, ?, ?);");
+ stmt.setInt(1,cid);
+ stmt.setInt(2,key.getNamespaceID());
+ stmt.setString(3,key.getName());
+ stmt.setString(4,serialized_value);
+
+ } // end else
+
+ stmt.executeUpdate(); // execute it!
+
+ // Touch the community entry.
+ update = touchCommunity(conn,cid);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ MySQLUtils.unlockTables(conn);
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(stmt2);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ if (old_value==null)
+ return new DateObjectPair(null,update); // no previous value
+
+ // Deserialize the property value.
+ Object rc = m_psz.deserializeProperty(old_value);
+ if (rc!=null)
+ return new DateObjectPair(rc,update);
+
+ // deserialization exception - throw it
+ DatabaseException de = new DatabaseException(CommunityOps_mysql.class,"CommunityMessages","property.deserialize");
+ de.setParameter(0,key.getName());
+ throw de;
+
+ } // end setProperty
+
+ DateObjectPair removeProperty(int cid, PropertyKey key) throws DatabaseException
+ {
+ String old_value = null;
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ Statement stmt2 = null;
+ ResultSet rs = null;
+ java.util.Date update = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // lock the table
+ stmt2 = conn.createStatement();
+ stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
+
+ // look to see if the property value is already there
+ stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
+ stmt.setInt(1,cid);
+ stmt.setInt(2,key.getNamespaceID());
+ stmt.setString(3,key.getName());
+ rs = stmt.executeQuery();
+ if (rs.next())
+ old_value = rs.getString(1);
+ else
+ return null; // no need to remove anything
+
+ SQLUtils.shutdown(rs);
+ rs = null;
+ SQLUtils.shutdown(stmt);
+
+ // delete the database row
+ stmt = conn.prepareStatement("DELETE FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
+ stmt.setInt(1,cid);
+ stmt.setInt(2,key.getNamespaceID());
+ stmt.setString(3,key.getName());
+ stmt.executeUpdate();
+
+ // Touch the community entry.
+ update = touchCommunity(conn,cid);
+
+ } // end try
+ catch (SQLException e)
+ { // translate to a general DatabaseException
+ throw generalException(e);
+
+ } // end catch
+ finally
+ { // shut everything down
+ MySQLUtils.unlockTables(conn);
+ SQLUtils.shutdown(rs);
+ SQLUtils.shutdown(stmt);
+ SQLUtils.shutdown(stmt2);
+ SQLUtils.shutdown(conn);
+
+ } // end finally
+
+ // Deserialize the property value.
+ Object rc = m_psz.deserializeProperty(old_value);
+ if (rc!=null)
+ return new DateObjectPair(rc,update);
+
+ // deserialization exception - throw it
+ DatabaseException de = new DatabaseException(CommunityOps_mysql.class,"DatabaseMessages","property.deserialize");
+ de.setParameter(0,key.getName());
+ throw de;
+
+ } // end removeProperty
+
+ int[] getPropertyNamespaceIDs(int cid) throws DatabaseException
+ {
+ Connection conn = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try
+ { // get a connection
+ conn = getConnection();
+
+ // execute the query!
+ stmt = conn.prepareStatement("SELECT DISTINCT nsid FROM commprop WHERE cid = ?;");
+ stmt.setInt(1,cid);
+ rs = stmt.executeQuery();
+
+ // read out a list of the namespace IDs
+ ArrayList tmp = new ArrayList();
+ while (rs.next())
+ tmp.add(new Integer(rs.getInt(1)));
+
+ // create and return the array
+ int[] rc = new int[tmp.size()];
+ for (int i=0; i.
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.event;
+
+import com.silverwrist.venice.iface.VeniceCommunity;
+
+public class CommunityBaseUpdateEvent extends CommunityUpdateEvent
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private transient String m_what;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public CommunityBaseUpdateEvent(VeniceCommunity src, String what)
+ {
+ super(src);
+ m_what = what;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class CommunityUpdateEvent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String toString()
+ {
+ return "CommunityBaseUpdateEvent: community = \"" + ((VeniceCommunity)source).getName() + "\", what = " + m_what;
+
+ } // end toString
+
+ /*--------------------------------------------------------------------------------
+ * External operations
+ *--------------------------------------------------------------------------------
+ */
+
+ public String getUpdatedItem()
+ {
+ return m_what;
+
+ } // end getUpdatedItem
+
+} // end class CommunityBaseUpdateEvent
diff --git a/src/venice-base/com/silverwrist/venice/event/CommunityPropertyUpdateEvent.java b/src/venice-base/com/silverwrist/venice/event/CommunityPropertyUpdateEvent.java
new file mode 100644
index 0000000..a55dbe8
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/event/CommunityPropertyUpdateEvent.java
@@ -0,0 +1,74 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.event;
+
+import com.silverwrist.venice.iface.VeniceCommunity;
+
+public class CommunityPropertyUpdateEvent extends CommunityUpdateEvent
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private transient String m_namespace;
+ private transient String m_name;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public CommunityPropertyUpdateEvent(VeniceCommunity src, String namespace, String name)
+ {
+ super(src);
+ m_namespace = namespace;
+ m_name = name;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class CommunityUpdateEvent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String toString()
+ {
+ return "CommunityPropertyUpdateEvent: community = \"" + ((VeniceCommunity)source).getName() + "\", namespace = "
+ + m_namespace + ", name = " + m_name;
+
+ } // end toString
+
+ /*--------------------------------------------------------------------------------
+ * External operations
+ *--------------------------------------------------------------------------------
+ */
+
+ public String getPropertyNamespace()
+ {
+ return m_namespace;
+
+ } // end getPropertyNamespace
+
+ public String getPropertyName()
+ {
+ return m_name;
+
+ } // end getPropertyName
+
+} // end class CommunityPropertyUpdateEvent
diff --git a/src/venice-base/com/silverwrist/venice/event/CommunityUpdateEvent.java b/src/venice-base/com/silverwrist/venice/event/CommunityUpdateEvent.java
new file mode 100644
index 0000000..a6a445a
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/event/CommunityUpdateEvent.java
@@ -0,0 +1,46 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.event;
+
+import com.silverwrist.venice.iface.VeniceCommunity;
+
+public class CommunityUpdateEvent extends VeniceUpdateEvent
+{
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public CommunityUpdateEvent(VeniceCommunity src)
+ {
+ super(src);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class VeniceUpdateEvent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String toString()
+ {
+ return "CommunityUpdateEvent: community = \"" + ((VeniceCommunity)source).getName() + "\"";
+
+ } // end toString
+
+} // end class CommunityUpdateEvent
diff --git a/src/venice-base/com/silverwrist/venice/event/VeniceUpdateEvent.java b/src/venice-base/com/silverwrist/venice/event/VeniceUpdateEvent.java
new file mode 100644
index 0000000..c9b4620
--- /dev/null
+++ b/src/venice-base/com/silverwrist/venice/event/VeniceUpdateEvent.java
@@ -0,0 +1,46 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * The Original Code is the Venice Web Communities System.
+ *
+ * The Initial Developer of the Original Code is Eric J. Bowersox ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.event;
+
+import com.silverwrist.dynamo.event.DynamicUpdateEvent;
+
+public class VeniceUpdateEvent extends DynamicUpdateEvent
+{
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public VeniceUpdateEvent(Object src)
+ {
+ super(src);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class DynamicUpdateEvent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String toString()
+ {
+ return "VeniceUpdateEvent: source = " + source;
+
+ } // end toString
+
+} // end class VeniceUpdateEvent
diff --git a/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java b/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java
index 9593404..677859b 100644
--- a/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java
+++ b/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java
@@ -17,12 +17,14 @@
*/
package com.silverwrist.venice.frame;
+import java.text.MessageFormat;
import java.util.*;
import java.util.regex.*;
import org.apache.log4j.Logger;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.util.xml.*;
+import com.silverwrist.dynamo.DynamoVersion;
import com.silverwrist.dynamo.RequestType;
import com.silverwrist.dynamo.event.*;
import com.silverwrist.dynamo.except.*;
@@ -32,6 +34,7 @@ import com.silverwrist.dynamo.util.*;
import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
import com.silverwrist.dynamo.velocity.VelocityRendererConfig;
import com.silverwrist.venice.VeniceNamespaces;
+import com.silverwrist.venice.VeniceVersion;
import com.silverwrist.venice.iface.*;
import com.silverwrist.venice.session.SessionInfoParams;
@@ -140,7 +143,13 @@ public class FrameAssembler
*/
public FrameAssembler()
- { // do nothing
+ {
+ // Load the "generator" text output as a META tag.
+ ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.venice.frame.FrameMessages",Locale.getDefault(),
+ FrameAssembler.class.getClassLoader());
+ String[] args = new String[] { VeniceVersion.VERSION, DynamoVersion.VERSION };
+ m_globals.put("generator",MessageFormat.format(b.getString("generator"),args));
+
} // end constructor
/*--------------------------------------------------------------------------------
diff --git a/src/venice-base/com/silverwrist/venice/frame/FrameMessages.properties b/src/venice-base/com/silverwrist/venice/frame/FrameMessages.properties
index 5ad224f..3b3fe21 100644
--- a/src/venice-base/com/silverwrist/venice/frame/FrameMessages.properties
+++ b/src/venice-base/com/silverwrist/venice/frame/FrameMessages.properties
@@ -21,3 +21,4 @@ property.wrongClass=Value of property "{0}" is not of class "{1}".
ss.noPrefix=Configuration error: no stylesheet prefix configured for servlet path {0}.
ss.noTemplate=No stylesheet template name found for property "{0}".
ss.renderFail=Unable to render stylesheet template {0}: {1}
+generator=Venice Web Communities System {0}; Dynamo Application Framework {1}
diff --git a/src/venice-base/com/silverwrist/venice/iface/VeniceCommunity.java b/src/venice-base/com/silverwrist/venice/iface/VeniceCommunity.java
index c977ac4..4e3474f 100644
--- a/src/venice-base/com/silverwrist/venice/iface/VeniceCommunity.java
+++ b/src/venice-base/com/silverwrist/venice/iface/VeniceCommunity.java
@@ -20,6 +20,7 @@ package com.silverwrist.venice.iface;
import java.security.Principal;
import java.security.acl.AclNotFoundException;
import java.util.Date;
+import com.silverwrist.dynamo.except.AuthenticationException;
import com.silverwrist.dynamo.except.DatabaseException;
import com.silverwrist.dynamo.except.DynamoSecurityException;
import com.silverwrist.dynamo.iface.DynamoAcl;
@@ -80,7 +81,7 @@ public interface VeniceCommunity extends NamedObject, SecureObjectStore
public void grantAccess(DynamoUser caller, Principal subject, String auth_namespace, String auth_name,
String source_info, String auth_info, boolean single_use)
- throws DatabaseException, DynamoSecurityException;
+ throws AuthenticationException, DatabaseException, DynamoSecurityException;
public void revokeAccess(DynamoUser caller, Principal subject) throws DatabaseException, DynamoSecurityException;
diff --git a/venice-data/velocity/frame.vm b/venice-data/velocity/frame.vm
index a34a2a5..44d44be 100644
--- a/venice-data/velocity/frame.vm
+++ b/venice-data/velocity/frame.vm
@@ -39,12 +39,14 @@
favicon_url = URL to the MSIE-style FAVICON
favicon_ltyp = Linkage type of the MSIE-style FAVICON
lbar_width = Left bar width in pixels
- ms_copyright_violations = True to prevent adding anti-Smart Tags META tag
+ ms_copyright_violations = True to prevent adding anti-Microsoft Smart Tags META tag
+ generator = Page generator (Venice and Dynamo versions)
*#
#encodeHTML( $pagetitle ) - #encodeHTML( $sitetitle )
+
#if( $pgicon_url && $pgicon_ltyp && $pgicon_mime )
#end