began database table definition and interface definition for the Universal
Message Store (UniStore)
This commit is contained in:
parent
e164b7d06f
commit
a96eee5056
|
@ -240,7 +240,80 @@ CREATE TABLE dictionary (
|
|||
word VARCHAR(128) NOT NULL PRIMARY KEY # the word
|
||||
);
|
||||
|
||||
#### following this line are Venice-specific tables ####
|
||||
# UniStore: Message headers
|
||||
CREATE TABLE us_head (
|
||||
msgid BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, # the message ID
|
||||
parent BIGINT NOT NULL DEFAULT 0, # parent message (optional)
|
||||
seq INT NOT NULL DEFAULT 0, # message sequence under parent (optional)
|
||||
creator INT NOT NULL, # UID of person who created the message
|
||||
posted DATETIME NOT NULL, # date/time message was posted
|
||||
aclid INT NULL, # optional ACL ID for message
|
||||
INDEX by_date (posted),
|
||||
INDEX by_child (parent, seq)
|
||||
);
|
||||
|
||||
# UniStore: Message properties
|
||||
CREATE TABLE us_prop (
|
||||
msgid BIGINT NOT NULL, # message ID
|
||||
nsid INT NOT NULL, # property namespace ID
|
||||
prop_name VARCHAR(255) BINARY NOT NULL, # property name
|
||||
prop_value VARCHAR(255), # property value
|
||||
PRIMARY KEY (msgid, nsid, prop_name)
|
||||
);
|
||||
|
||||
# UniStore: Text message parts
|
||||
CREATE TABLE us_text (
|
||||
msgid BIGINT NOT NULL, # message ID
|
||||
part INT NOT NULL, # index of text part
|
||||
ident_nsid INT NOT NULL, # identity namespace ID
|
||||
ident_name VARCHAR(255) BINARY NOT NULL, # identity name
|
||||
mimetype VARCHAR(128), # MIME type of text
|
||||
charcount INT, # number of characters in text
|
||||
linecount INT, # number of lines in text
|
||||
reads INT NOT NULL DEFAULT 0, # number of times this part has been read
|
||||
last_read DATETIME, # timestamp of when it was last read
|
||||
data MEDIUMTEXT, # the text (16 Mb available)
|
||||
PRIMARY KEY (msgid, part),
|
||||
INDEX by_name (msgid, ident_nsid, ident_name)
|
||||
);
|
||||
|
||||
# UniStore: Text message part properties
|
||||
CREATE TABLE us_text_prop (
|
||||
msgid BIGINT NOT NULL, # message ID
|
||||
part INT NOT NULL, # index of text part
|
||||
nsid INT NOT NULL, # property namespace ID
|
||||
prop_name VARCHAR(255) BINARY NOT NULL, # property name
|
||||
prop_value VARCHAR(255), # property value
|
||||
PRIMARY KEY (msgid, part, nsid, prop_name)
|
||||
);
|
||||
|
||||
# UniStore: Binary message parts
|
||||
CREATE TABLE us_binary (
|
||||
msgid BIGINT NOT NULL, # message ID
|
||||
part INT NOT NULL, # index of binary part
|
||||
ident_nsid INT NOT NULL, # identity namespace ID
|
||||
ident_name VARCHAR(255) BINARY NOT NULL, # identity name
|
||||
mimetype VARCHAR(128), # MIME type of data
|
||||
datalen INT, # data length in bytes
|
||||
filename VARCHAR(255), # original source filename
|
||||
reads INT NOT NULL DEFAULT 0, # number of times this part has been read
|
||||
last_read DATETIME, # timestamp of when it was last read
|
||||
data MEDIUMBLOB, # the actual data (16 Mb of space available)
|
||||
PRIMARY KEY (msgid, part),
|
||||
INDEX by_name (msgid, ident_nsid, ident_name)
|
||||
);
|
||||
|
||||
# UniStore: Binary message part properties
|
||||
CREATE TABLE us_binary_prop (
|
||||
msgid BIGINT NOT NULL, # message ID
|
||||
part INT NOT NULL, # index of binary part
|
||||
nsid INT NOT NULL, # property namespace ID
|
||||
prop_name VARCHAR(255) BINARY NOT NULL, # property name
|
||||
prop_value VARCHAR(255), # property value
|
||||
PRIMARY KEY (msgid, part, nsid, prop_name)
|
||||
);
|
||||
|
||||
############################ following this line are Venice-specific tables ############################
|
||||
|
||||
# The table which defines menus.
|
||||
CREATE TABLE menus (
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MySQLUtils extends SQLUtils
|
|||
|
||||
/**
|
||||
* Gets the ID of the most recent insert made to a table with an AUTO_INCREMENT column. This assumes that the
|
||||
* column is of integer type. Executes the MySQL statement "SELECT LAST_INSERT_ID();" and returns the value
|
||||
* column is of integer (INT) type. Executes the MySQL statement "SELECT LAST_INSERT_ID();" and returns the value
|
||||
* that that statement returns.
|
||||
*
|
||||
* @param conn Database connection on which to perform the operation.
|
||||
|
@ -117,4 +117,36 @@ public class MySQLUtils extends SQLUtils
|
|||
|
||||
} // end getLastInsertInt
|
||||
|
||||
/**
|
||||
* Gets the ID of the most recent insert made to a table with an AUTO_INCREMENT column. This assumes that the
|
||||
* column is of long (BIGINT) type. Executes the MySQL statement "SELECT LAST_INSERT_ID();" and returns the value
|
||||
* that that statement returns.
|
||||
*
|
||||
* @param conn Database connection on which to perform the operation.
|
||||
* @return The value of the last inserted ID on this connection.
|
||||
* @exception java.sql.SQLException If an error occurred in the execution, or if the SELECT statement returned
|
||||
* no rows (which it should not do).
|
||||
*/
|
||||
public static final long getLastInsertLong(Connection conn) throws SQLException
|
||||
{
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{ // perform the operation
|
||||
stmt = conn.createStatement();
|
||||
rs = stmt.executeQuery("SELECT LAST_INSERT_ID();");
|
||||
if (!(rs.next()))
|
||||
throw new SQLException("internal error - getLastInsertLong SELECT should have returned OK");
|
||||
return rs.getLong(1);
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // shut down the objects before we go
|
||||
shutdown(rs);
|
||||
shutdown(stmt);
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end getLastInsertInt
|
||||
|
||||
} // end class MySQLUtils
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.dynamo.iface;
|
||||
|
||||
public interface UniStoreBinaryPart extends UniStorePart, DataItem
|
||||
{
|
||||
// no additional methods
|
||||
|
||||
} // end interface UniStoreBinaryPart
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.dynamo.iface;
|
||||
|
||||
import java.security.acl.AclNotFoundException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.silverwrist.dynamo.except.DatabaseException;
|
||||
import com.silverwrist.dynamo.except.DynamoSecurityException;
|
||||
|
||||
public interface UniStoreMessage extends SecureObjectStore
|
||||
{
|
||||
public long getMessageID();
|
||||
|
||||
public long getParentMessageID();
|
||||
|
||||
public void setParentMessageID(DynamoUser caller, long id) throws DatabaseException, DynamoSecurityException;
|
||||
|
||||
public int getSequence();
|
||||
|
||||
public void setSequence(DynamoUser caller, int seq) throws DatabaseException, DynamoSecurityException;
|
||||
|
||||
public int getCreatorUID();
|
||||
|
||||
public DynamoUser getCreator() throws DatabaseException;
|
||||
|
||||
public java.util.Date getPostDate();
|
||||
|
||||
public DynamoAcl getAcl() throws DatabaseException, AclNotFoundException;
|
||||
|
||||
public void setAcl(DynamoUser caller, DynamoAcl acl) throws DatabaseException, DynamoSecurityException;
|
||||
|
||||
public int getNumTextParts() throws DatabaseException;
|
||||
|
||||
public int getNumBinaryParts() throws DatabaseException;
|
||||
|
||||
public UniStoreTextPart getTextPart(int index) throws DatabaseException;
|
||||
|
||||
public UniStoreTextPart getTextPart(String namespace, String name) throws DatabaseException;
|
||||
|
||||
public UniStoreBinaryPart getBinaryPart(int index) throws DatabaseException;
|
||||
|
||||
public UniStoreBinaryPart getBinaryPart(String namespace, String name) throws DatabaseException;
|
||||
|
||||
public List getTextParts() throws DatabaseException;
|
||||
|
||||
public List getBinaryParts() throws DatabaseException;
|
||||
|
||||
} // end interface UniStoreMessage
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.dynamo.iface;
|
||||
|
||||
import java.util.Date;
|
||||
import com.silverwrist.dynamo.except.DatabaseException;
|
||||
import com.silverwrist.dynamo.util.QualifiedNameKey;
|
||||
|
||||
public interface UniStorePart extends SecureObjectStore
|
||||
{
|
||||
public long getMessageID();
|
||||
|
||||
public int getPartIndex();
|
||||
|
||||
public QualifiedNameKey getPartIdentity();
|
||||
|
||||
public String getMimeType();
|
||||
|
||||
public int getSize();
|
||||
|
||||
public int getNumReads();
|
||||
|
||||
public java.util.Date getLastReadDate();
|
||||
|
||||
public void touchRead() throws DatabaseException;
|
||||
|
||||
} // end interface UniStorePart
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.dynamo.iface;
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
public interface UniStoreTextPart extends UniStorePart
|
||||
{
|
||||
public int getLineCount();
|
||||
|
||||
public String getText();
|
||||
|
||||
public Reader getTextAsReader();
|
||||
|
||||
} // end interface UniStoreTextPart
|
Loading…
Reference in New Issue
Block a user