gave the "top" page the makeover it so richly deserved - now, instead of an
array of content panels, we have a big content panel (use to come later) plus a set of configurable "sideboxes" that look kind of like Slashboxes...
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* 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 Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
|
||||
+9
-11
@@ -7,7 +7,7 @@
|
||||
* 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 Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -17,20 +17,18 @@
|
||||
*/
|
||||
package com.silverwrist.venice.core;
|
||||
|
||||
public interface FrontPageViewConfig
|
||||
public interface SideBoxDescriptor
|
||||
{
|
||||
public abstract int getNumRows();
|
||||
public abstract int getID();
|
||||
|
||||
public abstract int getNumColumns();
|
||||
public abstract int getSequence();
|
||||
|
||||
public abstract String getPartID(int row, int column);
|
||||
public abstract String getParameter();
|
||||
|
||||
public abstract void setPartID(int row, int column, String partid);
|
||||
public abstract String getDescription();
|
||||
|
||||
public abstract String getParameter(int row, int column);
|
||||
public abstract String getParamDescription();
|
||||
|
||||
public abstract void setParameter(int row, int column, String param);
|
||||
public abstract String getClassname();
|
||||
|
||||
public abstract boolean getModified();
|
||||
|
||||
} // end interface FrontPageViewConfig
|
||||
} // end interface SideBoxDescriptor
|
||||
@@ -7,7 +7,7 @@
|
||||
* 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 Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -52,10 +52,6 @@ public interface UserContext extends SearchMode
|
||||
|
||||
public abstract void setDescription(String new_descr) throws DataException;
|
||||
|
||||
public abstract FrontPageViewConfig getFrontPageViewConfig(int max_cols) throws DataException;
|
||||
|
||||
public abstract void putFrontPageViewConfig(FrontPageViewConfig cfg) throws DataException;
|
||||
|
||||
public abstract List getMemberSIGs() throws DataException;
|
||||
|
||||
public abstract SIGContext getSIGContext(int sigid) throws DataException;
|
||||
@@ -89,4 +85,6 @@ public interface UserContext extends SearchMode
|
||||
|
||||
public abstract boolean canCreateSIG();
|
||||
|
||||
public abstract List getSideBoxList() throws DataException;
|
||||
|
||||
} // end interface UserContext
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* 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 Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -71,4 +71,6 @@ public interface VeniceEngine extends SearchMode
|
||||
|
||||
public abstract int getMaxNumSIGMembersDisplay();
|
||||
|
||||
public abstract List getMasterSideBoxList();
|
||||
|
||||
} // end interface VeniceEngine
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
import com.silverwrist.venice.htmlcheck.HTMLChecker;
|
||||
import com.silverwrist.venice.core.DataException;
|
||||
import com.silverwrist.venice.core.SideBoxDescriptor;
|
||||
|
||||
public interface EngineBackend
|
||||
{
|
||||
@@ -80,4 +81,6 @@ public interface EngineBackend
|
||||
|
||||
public abstract void forceParamReload() throws DataException;
|
||||
|
||||
public abstract SideBoxDescriptor getMasterSideBoxDescriptor(int id);
|
||||
|
||||
} // end interface EngineBackend
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* 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 Community System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* 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.impl;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
|
||||
class FrontPageViewConfigImpl implements FrontPageViewConfig, Stashable
|
||||
{
|
||||
private int my_uid;
|
||||
private int num_cols;
|
||||
private Vector v_parts = new Vector();
|
||||
private Vector v_params = new Vector();
|
||||
private boolean is_modified = false;
|
||||
|
||||
FrontPageViewConfigImpl(Connection conn, int uid, int max_cols) throws DataException, SQLException
|
||||
{
|
||||
my_uid = uid;
|
||||
num_cols = max_cols;
|
||||
StringBuffer sql = new StringBuffer("SELECT row, col, partid, param FROM topconfig WHERE uid = ");
|
||||
sql.append(uid).append(';');
|
||||
|
||||
Statement stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
while (rs.next())
|
||||
{ // make sure the column is in range first
|
||||
int col = rs.getInt("col");
|
||||
if ((col>=0) && (col<num_cols))
|
||||
{ // get the row and find out how far down we have to go in the vector
|
||||
int row = rs.getInt("row");
|
||||
if (row>=0)
|
||||
{ // now look for the right arrays to store into
|
||||
String[] a_part = null;
|
||||
String[] a_param = null;
|
||||
|
||||
if (row>=v_parts.size())
|
||||
{ // need to extend the vector contents
|
||||
while (row>=v_parts.size())
|
||||
{ // append new arrays onto the config
|
||||
a_part = new String[num_cols];
|
||||
a_param = new String[num_cols];
|
||||
for (int i=0; i<num_cols; i++)
|
||||
{ // nuke the new arrays
|
||||
a_part[i] = null;
|
||||
a_param[i] = null;
|
||||
|
||||
} // end for
|
||||
|
||||
v_parts.addElement(a_part);
|
||||
v_params.addElement(a_param);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // just fetch the existing arrays
|
||||
a_part = (String[])(v_parts.elementAt(row));
|
||||
a_param = (String[])(v_params.elementAt(row));
|
||||
|
||||
} // end else
|
||||
|
||||
// and now save off the recordset data
|
||||
a_part[col] = rs.getString("partid");
|
||||
a_param[col] = rs.getString("param");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
} // end while
|
||||
|
||||
} // end constructor
|
||||
|
||||
public int getNumRows()
|
||||
{
|
||||
return v_parts.size();
|
||||
|
||||
} // end getNumRows
|
||||
|
||||
public int getNumColumns()
|
||||
{
|
||||
return num_cols;
|
||||
|
||||
} // end getNumCols
|
||||
|
||||
public String getPartID(int row, int column)
|
||||
{
|
||||
if ((row<0) || (row>=v_parts.size()))
|
||||
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.getPartID");
|
||||
if ((column<0) || (column>=num_cols))
|
||||
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.getPartID");
|
||||
|
||||
String[] array = (String[])(v_parts.elementAt(row));
|
||||
return array[column];
|
||||
|
||||
} // end getPartID
|
||||
|
||||
public void setPartID(int row, int column, String partid)
|
||||
{
|
||||
if (row<0)
|
||||
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.setPartID");
|
||||
if ((column<0) || (column>=num_cols))
|
||||
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.setPartID");
|
||||
|
||||
String[] a_part = null;
|
||||
String[] a_param = null;
|
||||
|
||||
if (row>=v_parts.size())
|
||||
{ // need to extend the vector contents
|
||||
while (row>=v_parts.size())
|
||||
{ // append new arrays onto the config
|
||||
a_part = new String[num_cols];
|
||||
a_param = new String[num_cols];
|
||||
for (int i=0; i<num_cols; i++)
|
||||
{ // nuke the new arrays
|
||||
a_part[i] = null;
|
||||
a_param[i] = null;
|
||||
|
||||
} // end for
|
||||
|
||||
v_parts.addElement(a_part);
|
||||
v_params.addElement(a_param);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
else // just fetch the existing array
|
||||
a_part = (String[])(v_parts.elementAt(row));
|
||||
|
||||
a_part[column] = partid;
|
||||
is_modified = true;
|
||||
|
||||
} // end setPartID
|
||||
|
||||
public String getParameter(int row, int column)
|
||||
{
|
||||
if ((row<0) || (row>=v_params.size()))
|
||||
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.getParameter");
|
||||
if ((column<0) || (column>=num_cols))
|
||||
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.getParameter");
|
||||
|
||||
String[] array = (String[])(v_params.elementAt(row));
|
||||
return array[column];
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public void setParameter(int row, int column, String param)
|
||||
{
|
||||
if (row<0)
|
||||
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.setParameter");
|
||||
if ((column<0) || (column>=num_cols))
|
||||
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.setParameter");
|
||||
|
||||
String[] a_part = null;
|
||||
String[] a_param = null;
|
||||
|
||||
if (row>=v_parts.size())
|
||||
{ // need to extend the vector contents
|
||||
while (row>=v_parts.size())
|
||||
{ // append new arrays onto the config
|
||||
a_part = new String[num_cols];
|
||||
a_param = new String[num_cols];
|
||||
for (int i=0; i<num_cols; i++)
|
||||
{ // nuke the new arrays
|
||||
a_part[i] = null;
|
||||
a_param[i] = null;
|
||||
|
||||
} // end for
|
||||
|
||||
v_parts.addElement(a_part);
|
||||
v_params.addElement(a_param);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
else // just fetch the existing array
|
||||
a_param = (String[])(v_params.elementAt(row));
|
||||
|
||||
a_param[column] = param;
|
||||
is_modified = true;
|
||||
|
||||
} // end setParameter
|
||||
|
||||
public boolean getModified()
|
||||
{
|
||||
return is_modified;
|
||||
|
||||
} // end getModified
|
||||
|
||||
public int getStashableUID()
|
||||
{
|
||||
return my_uid;
|
||||
|
||||
} // end getStashableUID
|
||||
|
||||
public void stash(Connection conn) throws SQLException
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int row=0; row<v_parts.size(); row++)
|
||||
{ // retrieve the row arrays first
|
||||
String[] a_part = (String[])(v_parts.elementAt(row));
|
||||
String[] a_param = (String[])(v_params.elementAt(row));
|
||||
|
||||
for (int col=0; col<num_cols; col++)
|
||||
{ // add to the list as long as the part isn't NULL
|
||||
if (a_part[col]!=null)
|
||||
{ // append this set of values to the INSERT we're going to make later
|
||||
if (buf.length()==0)
|
||||
buf.append("INSERT INTO topconfig (uid, row, col, partid, param) VALUES ");
|
||||
else
|
||||
buf.append(", ");
|
||||
buf.append('(').append(my_uid).append(", ").append(row).append(", ").append(col).append(", ");
|
||||
buf.append(SQLUtil.encodeStringArg(a_part[col])).append(", ");
|
||||
buf.append(SQLUtil.encodeStringArg(a_param[col])).append(')');
|
||||
|
||||
} // end if
|
||||
|
||||
} // end for (each column)
|
||||
|
||||
} // end for (each row)
|
||||
|
||||
String insert_cmd = null;
|
||||
if (buf.length()>0)
|
||||
{ // we've got the insert command
|
||||
buf.append(';');
|
||||
insert_cmd = buf.toString();
|
||||
buf.setLength(0);
|
||||
|
||||
} // end if
|
||||
|
||||
// now create the DELETE command
|
||||
buf.append("DELETE FROM topconfig WHERE uid = ").append(my_uid).append(';');
|
||||
|
||||
// we need to lock the topconfig table while we do this
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.executeUpdate("LOCK TABLES topconfig WRITE;");
|
||||
|
||||
try
|
||||
{ // delete all existing records
|
||||
stmt.executeUpdate(buf.toString());
|
||||
|
||||
// now insert the new records
|
||||
if (insert_cmd!=null)
|
||||
stmt.executeUpdate(insert_cmd);
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // make sure to unlock the tables when we're done
|
||||
Statement ulk_stmt = conn.createStatement();
|
||||
ulk_stmt.executeUpdate("UNLOCK TABLES;");
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end stash
|
||||
|
||||
} // end class FrontPageViewConfigImpl
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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 <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* 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 <erbo@silcom.com>,
|
||||
* 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.impl;
|
||||
|
||||
import com.silverwrist.venice.core.SideBoxDescriptor;
|
||||
|
||||
class SideBoxDescriptorImpl implements SideBoxDescriptor
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private SideBoxDescriptor parent;
|
||||
private int sequence;
|
||||
private String param;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SideBoxDescriptorImpl(SideBoxDescriptor parent, int sequence, String param)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.sequence = sequence;
|
||||
this.param = param;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface SideBoxDescriptor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return parent.getID();
|
||||
|
||||
} // end getID
|
||||
|
||||
public int getSequence()
|
||||
{
|
||||
return sequence;
|
||||
|
||||
} // end getSequence
|
||||
|
||||
public String getParameter()
|
||||
{
|
||||
return param;
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return parent.getDescription();
|
||||
|
||||
} // end getDescription
|
||||
|
||||
public String getParamDescription()
|
||||
{
|
||||
return parent.getParamDescription();
|
||||
|
||||
} // end getParamDescription
|
||||
|
||||
public String getClassname()
|
||||
{
|
||||
return parent.getClassname();
|
||||
|
||||
} // end getClassname
|
||||
|
||||
} // end class SideBoxDescriptorImpl
|
||||
@@ -7,7 +7,7 @@
|
||||
* 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 Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -710,76 +710,6 @@ class UserContextImpl implements UserContext, UserBackend
|
||||
|
||||
} // end setDescription
|
||||
|
||||
public FrontPageViewConfig getFrontPageViewConfig(int max_cols) throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = datapool.getConnection();
|
||||
|
||||
// create new object
|
||||
return new FrontPageViewConfigImpl(conn,uid,max_cols);
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
{ // turn SQLException into data exception
|
||||
logger.error("DB error getting front page view config: " + e.getMessage(),e);
|
||||
throw new DataException("unable to retrieve front page view config: " + e.getMessage(),e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure the connection is released before we go
|
||||
if (conn!=null)
|
||||
datapool.releaseConnection(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end getFrontPageViewConfig
|
||||
|
||||
public void putFrontPageViewConfig(FrontPageViewConfig cfg) throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
|
||||
try
|
||||
{ // coerce the value to a Stashable first
|
||||
Stashable obj = (Stashable)cfg;
|
||||
if (obj.getStashableUID()!=uid)
|
||||
{ // wrong UID for configuration - this is bogus
|
||||
logger.error("invalid ownership of FrontPageViewConfig (was "
|
||||
+ String.valueOf(obj.getStashableUID()) + ", should be " + String.valueOf(uid) + ")");
|
||||
throw new DataException("invalid front page view config record");
|
||||
|
||||
} // end if
|
||||
|
||||
// retrieve a connection from the data pool
|
||||
conn = datapool.getConnection();
|
||||
|
||||
// stash the object
|
||||
obj.stash(conn);
|
||||
|
||||
} // end try
|
||||
catch (ClassCastException cce)
|
||||
{ // we need to be able to coerce the FrontPageViewConfig to a Stashable
|
||||
logger.error("FrontPageViewConfig was not a Stashable");
|
||||
throw new DataException("improper front page view config record");
|
||||
|
||||
} // end catch
|
||||
catch (SQLException e)
|
||||
{ // turn SQLException into data exception
|
||||
logger.error("DB error saving front page view config: " + e.getMessage(),e);
|
||||
throw new DataException("unable to save front page view config: " + e.getMessage(),e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure the connection is released before we go
|
||||
if (conn!=null)
|
||||
datapool.releaseConnection(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end putFrontPageViewConfig
|
||||
|
||||
public List getMemberSIGs() throws DataException
|
||||
{
|
||||
return SIGUserContextImpl.getMemberSIGEntries(engine,this,datapool);
|
||||
@@ -893,6 +823,45 @@ class UserContextImpl implements UserContext, UserBackend
|
||||
|
||||
} // end canCreateSIG
|
||||
|
||||
public List getSideBoxList() throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
conn = datapool.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
// retrieve the necessary rows from the sideboxes table
|
||||
ResultSet rs = stmt.executeQuery("SELECT boxid, sequence, param FROM sideboxes WHERE uid = " + uid
|
||||
+ " ORDER BY sequence;");
|
||||
while (rs.next())
|
||||
{ // create the implementation objects and return them all
|
||||
SideBoxDescriptor sbd = new SideBoxDescriptorImpl(engine.getMasterSideBoxDescriptor(rs.getInt(1)),
|
||||
rs.getInt(2),rs.getString(3));
|
||||
rc.add(sbd);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
{ // turn SQLException into data exception
|
||||
logger.error("DB error getting side box config: " + e.getMessage(),e);
|
||||
throw new DataException("unable to retrieve side box config: " + e.getMessage(),e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure the connection is released before we go
|
||||
if (conn!=null)
|
||||
datapool.releaseConnection(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
|
||||
} // end getSideBoxList
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface UserBackend
|
||||
*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -190,6 +190,94 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
} // end class VeniceFeatureDef
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal class storing side box information.
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class MasterSideBox implements SideBoxDescriptor
|
||||
{
|
||||
private int id;
|
||||
private String description;
|
||||
private String param_descr;
|
||||
private String classname;
|
||||
|
||||
MasterSideBox(ResultSet rs) throws SQLException
|
||||
{
|
||||
this.id = rs.getInt("boxid");
|
||||
this.description = rs.getString("description");
|
||||
this.param_descr = rs.getString("param_descr");
|
||||
this.classname = rs.getString("classname");
|
||||
|
||||
} // end constructor
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return id;
|
||||
|
||||
} // end getID
|
||||
|
||||
public int getSequence()
|
||||
{
|
||||
return -1;
|
||||
|
||||
} // end getSequence
|
||||
|
||||
public String getParameter()
|
||||
{
|
||||
return null;
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
|
||||
} // end getDescription
|
||||
|
||||
public String getParamDescription()
|
||||
{
|
||||
return param_descr;
|
||||
|
||||
} // end getParamDescription
|
||||
|
||||
public String getClassname()
|
||||
{
|
||||
return classname;
|
||||
|
||||
} // end getClassname
|
||||
|
||||
} // end class MasterSideBox
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal class for returning side box information.
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static class MasterSideBoxList extends AbstractList
|
||||
{
|
||||
private MasterSideBox[] array;
|
||||
|
||||
MasterSideBoxList(MasterSideBox[] array)
|
||||
{
|
||||
this.array = array;
|
||||
|
||||
} // end constructor
|
||||
|
||||
public Object get(int index)
|
||||
{
|
||||
return array[index];
|
||||
|
||||
} // end get
|
||||
|
||||
public int size()
|
||||
{
|
||||
return array.length;
|
||||
|
||||
} // end size
|
||||
|
||||
} // end class MasterSideBoxList
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data values
|
||||
*--------------------------------------------------------------------------------
|
||||
@@ -214,6 +302,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
private Hashtable conf_objects = new Hashtable(); // holder for ConferenceCoreData objects
|
||||
private HTMLCheckerConfig[] html_configs; // holder for HTML checker configurations
|
||||
private int[] gp_ints; // global integer parameters
|
||||
private MasterSideBox[] sideboxes; // master sidebox table
|
||||
private Hashtable sidebox_ids = new Hashtable(); // maps sidebox IDs to MasterSideBox objects
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
@@ -274,6 +364,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
*/
|
||||
public void initialize(Document config) throws ConfigException, DataException
|
||||
{
|
||||
int i; // loop counter
|
||||
|
||||
if (this.config!=null)
|
||||
{ // already configured!
|
||||
logger.error("Venice engine already initialized");
|
||||
@@ -345,10 +437,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
// Retrieve the list of dictionary files to load into the spellchecker.
|
||||
dictionary_tmp = new Vector();
|
||||
NodeList dict_nodes = dict_sect.getChildNodes();
|
||||
int j;
|
||||
for (j=0; j<dict_nodes.getLength(); j++)
|
||||
for (i=0; i<dict_nodes.getLength(); i++)
|
||||
{ // scan the <dictionary> element looking for <file> elements
|
||||
Node dn = dict_nodes.item(j);
|
||||
Node dn = dict_nodes.item(i);
|
||||
if ((dn.getNodeType()==Node.ELEMENT_NODE) && (dn.getNodeName().equals("file")))
|
||||
{ // store the file name as a vector element
|
||||
Element del = (Element)dn;
|
||||
@@ -370,9 +461,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
// Initialize the stock messages list.
|
||||
stock_messages = new Hashtable();
|
||||
NodeList msg_nodes = msg_sect.getChildNodes();
|
||||
for (j=0; j<msg_nodes.getLength(); j++)
|
||||
for (i=0; i<msg_nodes.getLength(); i++)
|
||||
{ // examine all subnodes to add them to the message text
|
||||
Node msgn = msg_nodes.item(j);
|
||||
Node msgn = msg_nodes.item(i);
|
||||
if (msgn.getNodeType()==Node.ELEMENT_NODE)
|
||||
{ // add it to the hash table by its tag name
|
||||
Element msgel = (Element)msgn;
|
||||
@@ -426,6 +517,19 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(max_value + " features loaded from database");
|
||||
|
||||
// load the master sidebox table
|
||||
Vector sidebox_tmp = new Vector();
|
||||
rs = stmt.executeQuery("SELECT * FROM refsidebox ORDER BY boxid;");
|
||||
while (rs.next())
|
||||
sidebox_tmp.add(new MasterSideBox(rs));
|
||||
|
||||
// store the real master sidebox table as an array
|
||||
sideboxes = new MasterSideBox[sidebox_tmp.size()];
|
||||
for (i=0; i<sidebox_tmp.size(); i++)
|
||||
sideboxes[i] = (MasterSideBox)(sidebox_tmp.get(i));
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(sideboxes.length + " sidebox definitions loaded from database");
|
||||
|
||||
// load the global defaults
|
||||
loadDefaults(stmt);
|
||||
|
||||
@@ -443,9 +547,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
} // end finally
|
||||
|
||||
for (int i=0; i<features.length; i++) // insert feature symbols into hashtable
|
||||
for (i=0; i<features.length; i++) // insert feature symbols into hashtable
|
||||
feature_syms.put(features[i].getSymbol(),features[i]);
|
||||
|
||||
for (i=0; i<sideboxes.length; i++) // insert sideboxes into hashtable
|
||||
sidebox_ids.put(new Integer(sideboxes[i].getID()),sideboxes[i]);
|
||||
|
||||
// Here is where we create the HTML Checker and all the goodies it relies on.
|
||||
// Start by creating some of the subsidiary objects that get added to HTML Checker configs.
|
||||
EmailRewriter email_rewriter = new EmailRewriter();
|
||||
@@ -458,7 +565,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
// Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter.
|
||||
String[] dictfiles = new String[dictionary_tmp.size()];
|
||||
for (int i=0; i<dictionary_tmp.size(); i++)
|
||||
for (i=0; i<dictionary_tmp.size(); i++)
|
||||
dictfiles[i] = (String)(dictionary_tmp.get(i));
|
||||
LazyTreeLexicon lex = new LazyTreeLexicon(dictfiles);
|
||||
spell_rewriter.addDictionary(lex);
|
||||
@@ -767,7 +874,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
{ // look to see if the user name is already present
|
||||
conn = datapool.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, topconfig WRITE;");
|
||||
stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, sideboxes WRITE;");
|
||||
try
|
||||
{ // make sure the user name isn't there already
|
||||
ResultSet rs = stmt.executeQuery("SELECT uid FROM users WHERE username = '" + encode_username + "';");
|
||||
@@ -835,20 +942,18 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...loaded default SIG memberships");
|
||||
|
||||
// get the "top" configuration for this user
|
||||
rs = stmt.executeQuery("SELECT topconfig.row, topconfig.col, topconfig.partid, topconfig.param "
|
||||
+ "FROM topconfig, users WHERE topconfig.uid = users.uid AND "
|
||||
+ "users.is_anon = 1;");
|
||||
// get the sidebox configuration for this user
|
||||
rs = stmt.executeQuery("SELECT sideboxes.boxid, sideboxes.sequence, sideboxes.param FROM sideboxes, "
|
||||
+ "users WHERE sideboxes.uid = users.uid AND users.is_anon = 1;");
|
||||
sql.setLength(0);
|
||||
while (rs.next())
|
||||
{ // set up to insert into the topconfig table
|
||||
{ // set up to insert into the sideboxes table
|
||||
if (sql.length()==0)
|
||||
sql.append("INSERT INTO topconfig (uid, row, col, partid, param) VALUES ");
|
||||
sql.append("INSERT INTO sideboxes (uid, boxid, sequence, param) VALUES ");
|
||||
else
|
||||
sql.append(", ");
|
||||
sql.append("(").append(new_uid).append(", ").append(rs.getInt(1)).append(", ");
|
||||
sql.append(rs.getInt(2)).append(", ").append(SQLUtil.encodeStringArg(rs.getString(3)));
|
||||
sql.append(", ").append(SQLUtil.encodeStringArg(rs.getString(4))).append(')');
|
||||
sql.append(rs.getInt(2)).append(", ").append(SQLUtil.encodeStringArg(rs.getString(3))).append(')');
|
||||
|
||||
} // end while
|
||||
|
||||
@@ -860,7 +965,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
} // end if
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...loaded default top view config");
|
||||
logger.debug("...loaded default sidebox config");
|
||||
|
||||
} // end try
|
||||
finally
|
||||
@@ -1255,6 +1360,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
} // end getMaxNumSIGMembersDisplay
|
||||
|
||||
public List getMasterSideBoxList()
|
||||
{
|
||||
return new MasterSideBoxList(sideboxes);
|
||||
|
||||
} // end getMasterSideBoxList
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface EngineBackend
|
||||
*--------------------------------------------------------------------------------
|
||||
@@ -1663,4 +1774,10 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
} // end forceParamReload
|
||||
|
||||
public SideBoxDescriptor getMasterSideBoxDescriptor(int id)
|
||||
{
|
||||
return (SideBoxDescriptor)(sidebox_ids.get(new Integer(id)));
|
||||
|
||||
} // end getMasterSideBoxDescriptor
|
||||
|
||||
} // end class VeniceEngineImpl
|
||||
|
||||
Reference in New Issue
Block a user