diff --git a/src/com/silverwrist/venice/core/impl/CommunityCoreData.java b/src/com/silverwrist/venice/core/impl/CommunityCoreData.java
index bc22d53..1d9feec 100644
--- a/src/com/silverwrist/venice/core/impl/CommunityCoreData.java
+++ b/src/com/silverwrist/venice/core/impl/CommunityCoreData.java
@@ -28,9 +28,12 @@ import com.silverwrist.venice.core.*;
import com.silverwrist.venice.core.internals.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.security.AuditRecord;
+import com.silverwrist.venice.security.SecurityMonitor;
import com.silverwrist.venice.svc.*;
+import com.silverwrist.venice.svc.internal.GlobalSite;
+import com.silverwrist.venice.util.PropertyProvider;
-class CommunityCoreData implements CommunityData, CommunityDataBackend
+class CommunityCoreData implements CommunityData, PropertyProvider
{
/*--------------------------------------------------------------------------------
* Internal class that creates new ConferenceCommunityContextImpl objects
@@ -69,6 +72,9 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
// Property indices
private static final int PROP_FLAGS = 0; // flags
+ // Boolean property indexes
+ private static final int BP_POSTPICTURES = 0; // pictures in posts?
+
private static final BitSet ALL_PROPS; // BitSet representing all properties
private static Category logger = Category.getInstance(CommunityCoreData.class);
@@ -78,6 +84,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
*--------------------------------------------------------------------------------
*/
+ private GlobalSite globalsite; // the global site
private EnvCommunityData env; // the environment
private int cid; // ID of this community
private java.util.Date created; // date/time of database creation
@@ -112,10 +119,11 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
*--------------------------------------------------------------------------------
*/
- CommunityCoreData(EnvEngine env, int cid) throws DataException
+ CommunityCoreData(GlobalSite globalsite, EnvEngine env, int cid) throws DataException
{
if (logger.isDebugEnabled())
logger.debug("new CommunityCoreData for community " + cid);
+ this.globalsite = globalsite;
this.env = new EnvCommunityData(env,this);
this.cid = cid;
@@ -124,7 +132,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection from this object
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// get the community basic data from the database
stmt = conn.createStatement();
@@ -186,7 +194,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
} // end constructor
- protected CommunityCoreData(EnvEngine env, int cid, java.util.Date creation,
+ protected CommunityCoreData(GlobalSite globalsite, EnvEngine env, int cid, java.util.Date creation,
String name, String alias, int host_uid, String language, String synopsis,
String rules, String joinkey, boolean hide_dir, boolean hide_search,
int[] levels, Set services)
@@ -194,6 +202,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
if (logger.isDebugEnabled())
logger.debug("new CommunityCoreData for BRAND NEW COMMUNITY " + cid);
EnvCommunityData new_env = new EnvCommunityData(env,this);
+ this.globalsite = globalsite;
this.env = new_env;
this.cid = cid;
this.created = creation;
@@ -324,7 +333,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a connection and create a statement
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer();
@@ -465,7 +474,8 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
{
if (deleted)
throw new DataException("This community has been deleted.");
- if (env.testPermission(EnvCommunityData.PERM_NOJOINREQUIRED,level))
+ SecurityMonitor smon = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class,"Community"));
+ if (smon.testPermission(EnvCommunityData.PERM_NOJOINREQUIRED,level))
return;
if (members_only && !is_member)
{ // the membership test failed
@@ -480,7 +490,8 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
{
if (deleted)
return false;
- if (env.testPermission(EnvCommunityData.PERM_NOJOINREQUIRED,level))
+ SecurityMonitor smon = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class,"Community"));
+ if (smon.testPermission(EnvCommunityData.PERM_NOJOINREQUIRED,level))
return true;
return !members_only || is_member;
@@ -528,7 +539,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// check to see if the UID is listed in "sigban" table...
@@ -565,7 +576,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
Stashable obj = (Stashable)ci;
// save the contact information
@@ -657,7 +668,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES sigftrs WRITE;");
@@ -721,7 +732,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET signame = '");
sql.append(SQLUtil.encodeString(name)).append("', lastupdate = '");
@@ -760,7 +771,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET alias = '");
sql.append(alias).append("', lastupdate = '");
@@ -799,7 +810,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET catid = ");
sql.append(catid).append(", lastupdate = '");
@@ -837,7 +848,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET synopsis = ");
sql.append(SQLUtil.encodeStringArg(synopsis)).append(", lastupdate = '");
@@ -873,7 +884,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET language = '");
sql.append(SQLUtil.encodeString(language)).append("', lastupdate = '");
@@ -909,7 +920,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET rules = ");
sql.append(SQLUtil.encodeStringArg(rules)).append(", lastupdate = '");
@@ -945,7 +956,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET lastaccess = '");
java.util.Date now = new java.util.Date();
@@ -993,7 +1004,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET hide_dir = ");
sql.append(directory ? '1' : '0').append(", hide_search = ").append(search ? '1' : '0');
@@ -1040,7 +1051,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET membersonly = ");
sql.append(flag ? '1' : '0').append(", lastupdate = '");
@@ -1084,7 +1095,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET init_ftr = ");
sql.append(token.getIndex()).append(", lastupdate = '");
@@ -1120,7 +1131,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT joinkey FROM sigs WHERE sigid = ");
sql.append(cid).append(';');
@@ -1161,7 +1172,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigs SET joinkey = ");
sql.append(SQLUtil.encodeStringArg(key)).append(", lastupdate = '");
@@ -1231,7 +1242,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// create the SQL statement
stmt = conn.createStatement();
@@ -1291,7 +1302,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES sigmember WRITE;");
boolean did_it = false;
@@ -1375,7 +1386,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection and create the appropriate SELECT statement
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM sigmember WHERE sigid = ");
sql.append(cid);
@@ -1456,8 +1467,8 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
if (deleted)
throw new DataException("This community has been deleted.");
- ReturnConfSeq rcs = ConferenceCoreData.createConference(outer,env,name,alias,description,pvt,hide_list,
- host_uid);
+ ReturnConfSeq rcs = ConferenceCoreData.createConference(outer,globalsite,env,name,alias,
+ description,pvt,hide_list,host_uid);
ConferenceData cdata = rcs.getConference();
if (outer.getUserID()!=host_uid) // make the creating user a conference host too
cdata.setMembership(outer,outer.getUserID(),
@@ -1490,7 +1501,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create a new SQL statement
@@ -1595,7 +1606,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM users u, contacts c, sigmember m WHERE "
+ "u.contactid = c.contactid AND u.uid = m.uid AND m.sigid = ");
@@ -1688,7 +1699,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create a new SQL statement
@@ -1748,7 +1759,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// a relatively simple search
@@ -1793,7 +1804,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// lock the tables we need to reference immediately
@@ -1906,7 +1917,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create the SQL statement
@@ -1943,30 +1954,45 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
} // end getMassMailList
/*--------------------------------------------------------------------------------
- * Implementations from interface CommunityDataBackend
+ * Implementations from interface PropertyProvider
*--------------------------------------------------------------------------------
*/
- public int realCommunityID()
+ public String propGet(String identifier)
{
- return cid;
+ if (identifier.equals("id"))
+ return String.valueOf(cid);
+ if (identifier.equals("post.pictures"))
+ return String.valueOf(flags.get(BP_POSTPICTURES));
+ throw new PropertyNotFoundException("CommunityCoreData",identifier);
- } // end realCommunityID
+ } // end propGet
- public boolean getParamBoolean(int selector)
+ public int propGetInt(String identifier)
{
- return flags.get(selector);
+ if (identifier.equals("id"))
+ return cid;
+ throw new PropertyNotFoundException("CommunityCoreData",identifier);
- } // end getParamBoolean
+ } // end propGetInt
+
+ public boolean propGetBoolean(String identifier)
+ {
+ if (identifier.equals("post.pictures"))
+ return flags.get(BP_POSTPICTURES);
+ throw new PropertyNotFoundException("CommunityCoreData",identifier);
+
+ } // end propGetBoolean
/*--------------------------------------------------------------------------------
* External static operations (usable only from within package)
*--------------------------------------------------------------------------------
*/
- static CommunityData createCommunity(EnvUser env, String name, String alias, int host_uid, String language,
- String synopsis, String rules, String joinkey, boolean hide_dir,
- boolean hide_search) throws DataException, AccessError
+ static CommunityData createCommunity(GlobalSite globalsite, EnvUser env, String name, String alias,
+ int host_uid, String language, String synopsis, String rules,
+ String joinkey, boolean hide_dir, boolean hide_search)
+ throws DataException, AccessError
{
Connection conn = null; // database connection
Statement stmt = null;
@@ -1974,10 +2000,11 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
java.util.Date creation; // creation date!
AuditRecord ar = null; // the audit record
CommunityCoreData comm; // the new community that gets returned
+ SecurityMonitor smon_comm = (SecurityMonitor)(globalsite.queryService(SecurityMonitor.class,"Community"));
try
{ // get a database connection and create the appropriate SELECT statement
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES sigs WRITE, sigftrs WRITE, propcomm WRITE, sigmember WRITE;");
@@ -1998,11 +2025,11 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
creation = new java.util.Date();
String creation_str = SQLUtil.encodeDate(creation);
int[] levels = new int[5];
- levels[0] = env.getCommunityDefaultRole("Community.Read").getLevel();
- levels[1] = env.getCommunityDefaultRole("Community.Write").getLevel();
- levels[2] = env.getCommunityDefaultRole("Community.Create").getLevel();
- levels[3] = env.getCommunityDefaultRole("Community.Delete").getLevel();
- levels[4] = env.getCommunityDefaultRole("Community.Join").getLevel();
+ levels[0] = smon_comm.getDefaultRole("Community.Read").getLevel();
+ levels[1] = smon_comm.getDefaultRole("Community.Write").getLevel();
+ levels[2] = smon_comm.getDefaultRole("Community.Create").getLevel();
+ levels[3] = smon_comm.getDefaultRole("Community.Delete").getLevel();
+ levels[4] = smon_comm.getDefaultRole("Community.Join").getLevel();
sql.append(creation).append("', '").append(creation).append("', '").append(creation).append("', ");
sql.append(levels[0]).append(", ").append(levels[1]).append(", ").append(levels[2]).append(", ");
sql.append(levels[3]).append(", ").append(levels[4]).append(", ").append(host_uid).append(", ");
@@ -2061,15 +2088,15 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
sql.setLength(0);
sql.append("INSERT INTO sigmember(sigid, uid, granted_lvl, locked) VALUES (").append(new_cid);
sql.append(", ").append(host_uid).append(", ");
- sql.append(env.getCommunityDefaultRole("Community.Creator").getLevel()).append(", 1);");
+ sql.append(smon_comm.getDefaultRole("Community.Creator").getLevel()).append(", 1);");
if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString());
stmt.executeUpdate(sql.toString());
// Create the CommunityCoreData object representing this community and register it with the engine's
// community data object cache.
- comm = new CommunityCoreData(env,new_cid,creation,name,alias,host_uid,language,synopsis,rules,joinkey,
- hide_dir,hide_search,levels,default_service);
+ comm = new CommunityCoreData(globalsite,env,new_cid,creation,name,alias,host_uid,language,synopsis,
+ rules,joinkey,hide_dir,hide_search,levels,default_service);
comm.newProperties(conn);
} // end try
diff --git a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
index f480fef..627b396 100644
--- a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java
@@ -1595,12 +1595,6 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
} // end userCanDeleteSubobjects
- public CommunityDataBackend getDataBackend() throws DataException
- {
- return (CommunityDataBackend)(getData());
-
- } // end getDataBackend
-
public boolean env_testPermission(String symbol)
{
if (deleted)
diff --git a/src/com/silverwrist/venice/core/impl/ConferenceCoreData.java b/src/com/silverwrist/venice/core/impl/ConferenceCoreData.java
index 670749c..b4cf9aa 100644
--- a/src/com/silverwrist/venice/core/impl/ConferenceCoreData.java
+++ b/src/com/silverwrist/venice/core/impl/ConferenceCoreData.java
@@ -27,6 +27,7 @@ import com.silverwrist.venice.core.internals.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.security.AuditRecord;
+import com.silverwrist.venice.svc.internal.GlobalSite;
class ConferenceCoreData implements ConferenceData
{
@@ -50,6 +51,7 @@ class ConferenceCoreData implements ConferenceData
*--------------------------------------------------------------------------------
*/
+ private GlobalSite globalsite; // global site
private EnvConferenceData env; // the environment
private int confid; // ID of this conference
private java.util.Date create_date; // creation date of this conference
@@ -77,10 +79,11 @@ class ConferenceCoreData implements ConferenceData
*--------------------------------------------------------------------------------
*/
- ConferenceCoreData(EnvEngine env, int confid) throws DataException
+ ConferenceCoreData(GlobalSite globalsite, EnvEngine env, int confid) throws DataException
{
if (logger.isDebugEnabled())
logger.debug("new ConferenceCoreData for conference " + confid);
+ this.globalsite = globalsite;
this.env = new EnvConferenceData(env);
this.confid = confid;
@@ -89,7 +92,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection from this object
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// get the conference basic data from the database
stmt = conn.createStatement();
@@ -121,11 +124,12 @@ class ConferenceCoreData implements ConferenceData
} // end constructor
- protected ConferenceCoreData(EnvCommunityData env, int confid, java.util.Date created, int[] levels,
- String name, String descr)
+ protected ConferenceCoreData(GlobalSite globalsite, EnvCommunityData env, int confid,
+ java.util.Date created, int[] levels, String name, String descr)
{
if (logger.isDebugEnabled())
logger.debug("new ConferenceCoreData for NEW conference " + confid);
+ this.globalsite = globalsite;
this.env = new EnvConferenceData(env);
this.confid = confid;
this.create_date = created;
@@ -141,7 +145,7 @@ class ConferenceCoreData implements ConferenceData
this.name = name;
this.description = descr;
this.flags = new OptionSet();
- if (env.getCommunityData().getParamBoolean(CommunityDataBackend.BP_POSTPICTURES))
+ if (env.getCommunityProperties().propGetBoolean("post.pictures"))
flags.set(BP_POSTPICTURES);
} // end constructor
@@ -300,7 +304,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a connection and create a statement
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
StringBuffer sql = new StringBuffer();
@@ -400,7 +404,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection from this object
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// get a list of all aliases
stmt = conn.createStatement();
@@ -441,7 +445,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection from this object
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// get a list of all hosts (with user info)
stmt = conn.createStatement();
@@ -566,7 +570,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// create the SQL statement
stmt = conn.createStatement();
@@ -621,7 +625,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// create the SQL statement
stmt = conn.createStatement();
@@ -667,7 +671,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
// create the SQL statement
stmt = conn.createStatement();
@@ -709,7 +713,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES confalias WRITE;");
@@ -774,7 +778,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
boolean did_it = false;
stmt = conn.createStatement();
@@ -854,7 +858,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
boolean did_it = false;
stmt = conn.createStatement();
@@ -947,7 +951,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create the SQL statement and execute it
@@ -990,7 +994,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// lock the tables we need to use so we can update them
@@ -1177,7 +1181,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create a new SQL statement
@@ -1231,7 +1235,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// create the statement
@@ -1287,7 +1291,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a database connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// lock tables on the critical stuff that MUST be deleted now
@@ -1410,7 +1414,7 @@ class ConferenceCoreData implements ConferenceData
Connection conn = null;
try
{ // load the custom information
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
loadCustom(conn);
// set up the return value
@@ -1456,7 +1460,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// build the right SQL command
@@ -1520,7 +1524,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // get a connection
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
// execute the delete statement
@@ -1555,8 +1559,9 @@ class ConferenceCoreData implements ConferenceData
*--------------------------------------------------------------------------------
*/
- static ReturnConfSeq createConference(EnvCommunity outer, EnvCommunityData env, String name, String alias,
- String description, boolean pvt, boolean hide_list, int host_uid)
+ static ReturnConfSeq createConference(EnvCommunity outer, GlobalSite globalsite, EnvCommunityData env,
+ String name, String alias, String description, boolean pvt,
+ boolean hide_list, int host_uid)
throws DataException
{
Connection conn = null; // database connection
@@ -1572,7 +1577,7 @@ class ConferenceCoreData implements ConferenceData
try
{ // start by locking all the tables we need
- conn = env.getConnection();
+ conn = globalsite.getConnection(null);
stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES confs WRITE, sigtoconf WRITE, confalias WRITE, confmember WRITE, "
+ "propconf WRITE;");
@@ -1670,7 +1675,7 @@ class ConferenceCoreData implements ConferenceData
// Create a new ConferenceCoreData object representing this conference and register it with the
// engine's conference data object cache.
- conf = new ConferenceCoreData(env,new_confid,created,levels,name,description);
+ conf = new ConferenceCoreData(globalsite,env,new_confid,created,levels,name,description);
conf.newProperties(conn);
} // end try
diff --git a/src/com/silverwrist/venice/core/impl/UserContextImpl.java b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
index 33e8463..938171d 100644
--- a/src/com/silverwrist/venice/core/impl/UserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
@@ -245,7 +245,9 @@ class UserContextImpl implements UserContext, UserBackend
// Figure out which of those communities we haven't joined yet and set up to autojoin them.
sql.setLength(0);
- int new_level = env.getCommunityDefaultRole("Community.NewUser").getLevel();
+ SecurityMonitor smon =
+ (SecurityMonitor)(env.getGlobalSite().queryService(SecurityMonitor.class,"Community"));
+ int new_level = smon.getDefaultRole("Community.NewUser").getLevel();
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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.venice.core.internals;
-
-public interface CommunityDataBackend
-{
- // Boolean parameter indexes
- public static final int BP_POSTPICTURES = 0;
-
- public abstract int realCommunityID();
-
- public abstract boolean getParamBoolean(int selector);
-
-} // end interface CommunityDataBackend
diff --git a/src/com/silverwrist/venice/core/internals/EnvCommunity.java b/src/com/silverwrist/venice/core/internals/EnvCommunity.java
index ad9e470..b14dcee 100644
--- a/src/com/silverwrist/venice/core/internals/EnvCommunity.java
+++ b/src/com/silverwrist/venice/core/internals/EnvCommunity.java
@@ -181,7 +181,7 @@ public class EnvCommunity extends EnvUser
SecurityMonitor smon = (SecurityMonitor)(getGlobalSite().queryService(SecurityMonitor.class,"Conference"));
return smon.getDefaultRole(symbol);
- } // end getCommunityDefaultRole
+ } // end getConferenceDefaultRole
public final String getCommunityName()
{
diff --git a/src/com/silverwrist/venice/core/internals/EnvCommunityData.java b/src/com/silverwrist/venice/core/internals/EnvCommunityData.java
index fd67f86..b95f5f2 100644
--- a/src/com/silverwrist/venice/core/internals/EnvCommunityData.java
+++ b/src/com/silverwrist/venice/core/internals/EnvCommunityData.java
@@ -19,6 +19,7 @@ package com.silverwrist.venice.core.internals;
import com.silverwrist.venice.except.AccessError;
import com.silverwrist.venice.security.SecurityMonitor;
+import com.silverwrist.venice.util.PropertyProvider;
public class EnvCommunityData extends EnvEngine
{
@@ -34,24 +35,24 @@ public class EnvCommunityData extends EnvEngine
*--------------------------------------------------------------------------------
*/
- private CommunityDataBackend comm;
+ private PropertyProvider comm_props;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
- public EnvCommunityData(EnvEngine parent, CommunityDataBackend comm)
+ public EnvCommunityData(EnvEngine parent, PropertyProvider comm_props)
{
super(parent);
- this.comm = comm;
+ this.comm_props = comm_props;
} // end constructor
protected EnvCommunityData(EnvCommunityData other)
{
super(other);
- this.comm = other.comm;
+ this.comm_props = other.comm_props;
} // end EnvCommunityData
@@ -71,15 +72,15 @@ public class EnvCommunityData extends EnvEngine
*--------------------------------------------------------------------------------
*/
- public final CommunityDataBackend getCommunityData()
+ public final PropertyProvider getCommunityProperties()
{
- return comm;
+ return comm_props;
- } // end getCommunityData
+ } // end getCommunityProperties
public final int getCommunityID()
{
- return comm.realCommunityID();
+ return comm_props.propGetInt("id");
} // end getCommunityID
diff --git a/src/com/silverwrist/venice/core/internals/EnvUser.java b/src/com/silverwrist/venice/core/internals/EnvUser.java
index 4cf758e..8527d00 100644
--- a/src/com/silverwrist/venice/core/internals/EnvUser.java
+++ b/src/com/silverwrist/venice/core/internals/EnvUser.java
@@ -211,11 +211,4 @@ public class EnvUser extends EnvEngine
} // end getUserBaseLevel
- public final Role getCommunityDefaultRole(String symbol)
- {
- SecurityMonitor smon = (SecurityMonitor)(getGlobalSite().queryService(SecurityMonitor.class,"Community"));
- return smon.getDefaultRole(symbol);
-
- } // end getCommunityDefaultRole
-
} // end class EnvUser
diff --git a/src/com/silverwrist/venice/except/PropertyNotFoundException.java b/src/com/silverwrist/venice/except/PropertyNotFoundException.java
new file mode 100644
index 0000000..90f33b2
--- /dev/null
+++ b/src/com/silverwrist/venice/except/PropertyNotFoundException.java
@@ -0,0 +1,47 @@
+/*
+ * 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.except;
+
+/**
+ * An exception thrown by objects that implement PropertyProvider
when they
+ * don't implement a specified property.
+ *
+ * @author Eric J. Bowersox <erbo@silcom.com>
+ * @version X
+ * @see com.silverwrist.venice.util.PropertyProvider
+ */
+public class PropertyNotFoundException extends VeniceRuntimeException
+{
+ /*--------------------------------------------------------------------------------
+ * Constructors
+ *--------------------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a new PropertyNotFoundException
.
+ *
+ * @param context Context for the generated exception.
+ * @param identifier Identifier of the property that was searched for.
+ */
+ public PropertyNotFoundException(String context, String identifier)
+ {
+ super(context + ": no property with identifier " + identifier);
+
+ } // end constructor
+
+} // end class PropertyNotFoundException
diff --git a/src/com/silverwrist/venice/util/PropertyProvider.java b/src/com/silverwrist/venice/util/PropertyProvider.java
new file mode 100644
index 0000000..c7b0e2f
--- /dev/null
+++ b/src/com/silverwrist/venice/util/PropertyProvider.java
@@ -0,0 +1,58 @@
+/*
+ * 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.util;
+
+/**
+ * An interface that is implemented by objects that wish to provide data values as read-only properties.
+ *
+ * @author Eric J. Bowersox <erbo@silcom.com>
+ * @version X
+ */
+public interface PropertyProvider
+{
+ /**
+ * Queries this object for a specified property value. All properties can be expressed as strings.
+ *
+ * @param identifier The property of the object that should be returned.
+ * @return The string value of the property.
+ * @exception com.silverwrist.venice.except.PropertyNotFoundException If no such property is available in
+ * the specified class.
+ */
+ public abstract String propGet(String identifier);
+
+ /**
+ * Queries this object for a specified property value as an integer.
+ *
+ * @param identifier The property of the object that should be returned.
+ * @return The integer value of the property.
+ * @exception com.silverwrist.venice.except.PropertyNotFoundException If no such property is available in
+ * the specified class, or the value cannot be expressed as an integer.
+ */
+ public abstract int propGetInt(String identifier);
+
+ /**
+ * Queries this object for a specified property value as a Boolean.
+ *
+ * @param identifier The property of the object that should be returned.
+ * @return The Boolean value of the property.
+ * @exception com.silverwrist.venice.except.PropertyNotFoundException If no such property is available in
+ * the specified class, or the value cannot be expressed as a Boolean.
+ */
+ public abstract boolean propGetBoolean(String identifier);
+
+} // end interface PropertyProvider