began database table definition and interface definition for the Universal

Message Store (UniStore)
This commit is contained in:
Eric J. Bowersox
2003-06-09 18:39:59 +00:00
parent e164b7d06f
commit a96eee5056
6 changed files with 267 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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