added community find page and some necessary patches to the framework, fixed
bugs
This commit is contained in:
@@ -185,6 +185,8 @@ class CommunityImpl implements VeniceCommunity
|
||||
*/
|
||||
public Object getObject(String namespace, String name)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("CommunityImpl.getObject: namespace = " + namespace + ", name = " + name);
|
||||
try
|
||||
{ // convert the namespace name to an ID here
|
||||
PropertyKey key = new PropertyKey(m_nscache.namespaceNameToId(namespace),name);
|
||||
@@ -196,19 +198,31 @@ class CommunityImpl implements VeniceCommunity
|
||||
{ // no use - need to try the database
|
||||
rc = m_ops.getProperty(m_id,key);
|
||||
if (rc!=null)
|
||||
{ // found in the database
|
||||
m_properties.put(key,rc);
|
||||
logger.debug("value found in database");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
else
|
||||
logger.debug("value found in cache");
|
||||
|
||||
} // end synchronized block
|
||||
|
||||
if (rc==null)
|
||||
{ // the object was not found
|
||||
logger.debug("value not found");
|
||||
throw new NoSuchObjectException(this.toString(),namespace,name);
|
||||
|
||||
} // end if
|
||||
|
||||
return rc;
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException e)
|
||||
{ // translate into our NoSuchObjectException but retain the DatabaseException
|
||||
logger.debug("Database exception while doing find",e);
|
||||
throw new NoSuchObjectException(this.toString(),namespace,name,e);
|
||||
|
||||
} // end catch
|
||||
|
||||
@@ -150,7 +150,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
conn = getConnection();
|
||||
|
||||
// look up the property
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
@@ -209,10 +209,10 @@ class CommunityOps_mysql extends CommunityOps
|
||||
|
||||
// lock the table
|
||||
stmt2 = conn.createStatement();
|
||||
stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
|
||||
stmt2.executeUpdate("LOCK TABLES commprops 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 = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
@@ -225,7 +225,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
|
||||
if (old_value!=null)
|
||||
{ // prepare the statement to update the existing record
|
||||
stmt = conn.prepareStatement("UPDATE commprop SET prop_value = ? WHERE cid = ? AND nsid = ? "
|
||||
stmt = conn.prepareStatement("UPDATE commprops SET prop_value = ? WHERE cid = ? AND nsid = ? "
|
||||
+ "AND prop_name = ?;");
|
||||
stmt.setString(1,serialized_value);
|
||||
stmt.setInt(2,cid);
|
||||
@@ -235,7 +235,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
} // 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 = conn.prepareStatement("INSERT INTO commprops (cid, nsid, prop_name, prop_value) VALUES (?, ?, ?, ?);");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
@@ -293,10 +293,10 @@ class CommunityOps_mysql extends CommunityOps
|
||||
|
||||
// lock the table
|
||||
stmt2 = conn.createStatement();
|
||||
stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
|
||||
stmt2.executeUpdate("LOCK TABLES commprops 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 = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
@@ -311,7 +311,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
SQLUtils.shutdown(stmt);
|
||||
|
||||
// delete the database row
|
||||
stmt = conn.prepareStatement("DELETE FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("DELETE FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
@@ -358,7 +358,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
conn = getConnection();
|
||||
|
||||
// execute the query!
|
||||
stmt = conn.prepareStatement("SELECT DISTINCT nsid FROM commprop WHERE cid = ?;");
|
||||
stmt = conn.prepareStatement("SELECT DISTINCT nsid FROM commprops WHERE cid = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
@@ -400,7 +400,7 @@ class CommunityOps_mysql extends CommunityOps
|
||||
conn = getConnection();
|
||||
|
||||
// execute the query!
|
||||
stmt = conn.prepareStatement("SELECT prop_name, prop_value FROM commprop WHERE cid = ? AND nsid = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_name, prop_value FROM commprops WHERE cid = ? AND nsid = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,namespace);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
Reference in New Issue
Block a user