--
CREATE TABLE "images" (
- "image_data" oid,
- "icon_data" oid,
+ "image_data" bytea,
+ "icon_data" bytea,
"year" character varying(40),
"img_width" smallint,
"img_height" smallint,
import mir.config.MirPropertiesConfiguration;
import mir.log.LoggerWrapper;
-import mir.storage.StorageObject;
import mir.storage.StorageObjectExc;
import mir.storage.StorageObjectFailure;
+import mir.storage.Database;
/**
* Base class the entities are derived from. Provides base functionality of
* an entity.
*
- * @version $Id: AbstractEntity.java,v 1.8.2.4 2005/01/09 20:37:07 zapata Exp $
+ * @version $Id: AbstractEntity.java,v 1.8.2.5 2005/01/23 15:36:02 zapata Exp $
*/
public class AbstractEntity implements Entity {
protected static MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
protected Map values;
- protected StorageObject storageObject;
+ protected Database database;
protected LoggerWrapper logger;
public AbstractEntity() {
values = new HashMap();
}
- public void setStorage(StorageObject aStorageObject) {
- storageObject = aStorageObject;
+ public void setStorage(Database aDatabase) {
+ database = aDatabase;
}
/** {@inheritDoc} */
/** {@inheritDoc} */
public String getId() {
- return getFieldValue(storageObject.getIdName());
+ return getFieldValue(database.getIdFieldName());
}
/** {@inheritDoc} */
public void setId(String id) {
- setFieldValue(storageObject.getIdName(), id);
+ setFieldValue(database.getIdFieldName(), id);
}
/** {@inheritDoc} */
public String insert() throws StorageObjectExc {
logger.debug("Entity: trying to insert ...");
- if (storageObject != null) {
- return storageObject.insert(this);
+ if (database != null) {
+ return database.insert(this);
}
else
- throw new StorageObjectExc("storageObject == null!");
+ throw new StorageObjectExc("database == null!");
}
/** {@inheritDoc} */
public void update() throws StorageObjectFailure {
- storageObject.update(this);
+ database.update(this);
}
/** {@inheritDoc} */
* Returns the field names of the Entity
*/
public List getFieldNames() throws StorageObjectFailure {
- return storageObject.getFieldNames();
+ return database.getFieldNames();
}
/** Returns whether fieldName is a valid field name of this Entity.
* An <code>Entity</code> represents a persistent data object, typically
* stored in a database.<p>
*
- * @version $Id: Entity.java,v 1.21.2.9 2005/01/09 20:37:07 zapata Exp $
+ * @version $Id: Entity.java,v 1.21.2.10 2005/01/23 15:36:02 zapata Exp $
*/
public interface Entity {
public String getId();
/**
- * Defines the primary key of the Entity (only to be set by the StorageObject)
+ * Defines the primary key of the Entity (only to be set by the Database)
* @param id
*/
public void setId(String id);
/**
- * Insers Entity into the database via StorageObject
+ * Insers Entity into the database via Database
* @return Primary Key of the Entity
* @exception StorageObjectExc
*/
package mir.entity;
-import java.util.List;
-
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
import mir.util.RewindableIterator;
+import java.util.List;
+
+import multex.Failure;
+
public class EntityBrowser implements RewindableIterator {
- private StorageObject storage;
+ private Database database;
private String mainTablePrefix;
private List extraTables;
private String whereClause;
private int batchPosition;
private int positionInBatch;
- public EntityBrowser(StorageObject aStorage, String aMainTablePrefix, List someExtraTables,
+ public EntityBrowser(Database aDatabase, String aMainTablePrefix, List someExtraTables,
String aWhereClause, String anOrderByClause,
int aBatchSize, int aLimit, int aSkip) throws StorageObjectFailure {
- storage=aStorage;
+ database=aDatabase;
mainTablePrefix=aMainTablePrefix;
extraTables=someExtraTables;
whereClause=aWhereClause;
rewind();
}
- public EntityBrowser(StorageObject aStorage, String aWhereClause, String anOrderByClause,
+ public EntityBrowser(Database aDatabase, String aWhereClause, String anOrderByClause,
int aBatchSize, int aLimit, int aSkip) throws StorageObjectFailure {
- this(aStorage, "", null, aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip);
+ this(aDatabase, "", null, aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip);
}
- public EntityBrowser(StorageObject aStorage,
+ public EntityBrowser(Database aDatabase,
String aWhereClause, String anOrderByClause,
int aBatchSize) throws StorageObjectFailure {
- this(aStorage, aWhereClause, anOrderByClause, aBatchSize, -1, 0);
+ this(aDatabase, aWhereClause, anOrderByClause, aBatchSize, -1, 0);
}
public void readCurrentBatch(int aSkip) throws StorageObjectFailure {
- currentBatch = storage.selectByWhereClause(mainTablePrefix, extraTables,
+ currentBatch = database.selectByWhereClause(mainTablePrefix, extraTables,
whereClause, orderByClause, aSkip, batchSize);
batchPosition = aSkip;
positionInBatch = 0;
readCurrentBatch(skip);
}
catch (Throwable t) {
- throw new RuntimeException(t.getMessage());
+ throw new Failure("Error while rewinging", t);
}
}
*/
package mir.entity;
-import java.util.ArrayList;
-import java.util.Set;
-
import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.log.LoggerWrapper;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.store.StorableObject;
import mir.storage.store.StoreContainerType;
import mir.storage.store.StoreIdentifier;
import mir.storage.store.StoreUtil;
+import java.util.ArrayList;
+import java.util.Set;
+
/**
*
* Container class for lists of Entities.
- * Now implements @see mir.storage.store.StorableObject.
+ * Now implements @see mir.database.store.StorableObject.
*
* @author <RK>
* first version 27.6.1999
protected LoggerWrapper logger;
private ArrayList theEntityArrayList = new ArrayList();
private String whereClause, orderClause;
- private StorageObject storage;
+ private Database storage;
private int offset, limit;
private int nextOffset = -1;
- private int previousOffset = -1;
public EntityList(){
logger = new LoggerWrapper("Entity.List");
}
/* get/set EntityClass of Objects stored in EntityList */
- public void setStorage(StorageObject aStorage) {
+ public void setStorage(Database aStorage) {
storage=aStorage;
}
- public StorageObject getStorage() {
+ public Database getStorage() {
return storage;
}
}
/**
- * Sets the offset of the previous batch.
- *
- * @param i the previous offset
- */
- public void setPrevBatch(int i) {
- previousOffset = i;
- }
-
- /**
* Inserts an Entity into the EntityList.
*
* @param anEntity The entity to be inserted.
*/
public StoreIdentifier getStoreIdentifier() {
String id = getId();
- if ( id!=null && storageObject!= null )
- return new StoreIdentifier(this, id+"@"+storageObject.getTableName());
+ if ( id!=null && database!= null )
+ return new StoreIdentifier(this, id+"@"+database.getTableName());
return null;
}
public static final StoreIdentifier getStoreIdentifier(Database theStorage,
Class theEntityClass, ResultSet rs) throws SQLException {
- String idcol = theStorage.getIdName();
+ String idcol = theStorage.getIdFieldName();
String idval = rs.getObject(idcol).toString();
if (idval != null) {
*/
static public List retrieveAdapterList(EntityAdapterModel aModel, String aDefinition, String aQualifier, String anOrder, int aLimit, int anOffset) {
try {
- EntityBrowser browser = new EntityBrowser(aModel.getMappingForName(aDefinition).getStorage(), aQualifier, anOrder, 30, aLimit, anOffset);
+ EntityBrowser browser = new EntityBrowser(aModel.getMappingForName(aDefinition).getDatabase(), aQualifier, anOrder, 30, aLimit, anOffset);
return new EntityListAdapter(aModel, aDefinition, browser, aLimit);
}
*/
package mir.entity.adapter;
+import mir.entity.Entity;
+import mir.storage.Database;
+
import java.util.HashMap;
import java.util.Map;
-import mir.entity.Entity;
-import mir.storage.StorageObject;
-
public class EntityAdapterModel {
private Map entityAdapterMappings;
public EntityAdapter createNewEntity( String aName ) throws EntityAdapterExc {
try {
Mapping mapping = getMappingForName(aName);
- Entity entity = mapping.storage.createNewEntity();
+ Entity entity = mapping.database.createNewEntity();
return mapping.getDefinition().makeEntityAdapter(entity, this);
}
}
}
- public void addMapping( String aName, StorageObject aStorage, EntityAdapterDefinition aDefinition ) {
- entityAdapterMappings.put( aName, new Mapping( aStorage, aDefinition ) );
+ public void addMapping(String aName, Database aDatabase, EntityAdapterDefinition aDefinition ) {
+ entityAdapterMappings.put(aName, new Mapping(aDatabase, aDefinition));
}
public Mapping getMappingForName( String aName ) {
}
public class Mapping {
- private StorageObject storage;
+ private Database database;
private EntityAdapterDefinition definition;
- public Mapping( StorageObject aStorage, EntityAdapterDefinition aDefinition ) {
- storage = aStorage;
+ public Mapping(Database aDatabase, EntityAdapterDefinition aDefinition ) {
+ database = aDatabase;
definition = aDefinition;
}
- public StorageObject getStorage() {
- return storage;
+ public Database getDatabase() {
+ return database;
}
public EntityAdapterDefinition getDefinition() {
public EntityIteratorAdapter(String aWhereClause, String anOrderByClause,
int aBatchSize, EntityAdapterModel aModel, String aDefinitionName )
throws StorageObjectFailure {
- this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getStorage(), aWhereClause, anOrderByClause, aBatchSize), aModel, aDefinitionName);
+ this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getDatabase(), aWhereClause, anOrderByClause, aBatchSize), aModel, aDefinitionName);
}
public EntityIteratorAdapter(String aWhereClause, String anOrderByClause,
int aBatchSize, EntityAdapterModel aModel, String aDefinitionName,
int aLimit, int aSkip) throws StorageObjectFailure {
- this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getStorage(), aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip), aModel, aDefinitionName);
+ this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getDatabase(), aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip), aModel, aDefinitionName);
}
public EntityIteratorAdapter(String aMainTablePrefix, List someExtraTables,
String aWhereClause, String anOrderByClause,
int aBatchSize, EntityAdapterModel aModel, String aDefinitionName,
int aLimit, int aSkip) throws StorageObjectFailure {
- this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getStorage(), aMainTablePrefix, someExtraTables, aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip), aModel, aDefinitionName);
+ this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getDatabase(), aMainTablePrefix, someExtraTables, aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip), aModel, aDefinitionName);
}
* content-type map for this....).
* <p>
* The "mime_type" field is the most important as it does maps the type to Java
- * classes (the storage and media_handler name). We call those classes using
+ * classes (the database and media_handler name). We call those classes using
* reflection. This way, once a Handler for a specific media type is implemented
* and entered into the media_type table, no other Mir code needs to be modified.
* <p>
* The "classname" field is the name of the media handler (e.g MediaHandlerAudio)
* we use it to call the MediaHandler methods via reflection.
* <p>
- * The "tablename" is the name of the database storage classes (e.g DatabaseImages
- * and EntityImages). We use this to fetch/storage the media (meta)data in the db.
+ * The "tablename" is the name of the database database classes (e.g DatabaseImages
+ * and EntityImages). We use this to fetch/database the media (meta)data in the db.
* <p?
* The "dcname" field is as of yet unused. Do search for "Dublin Core" on google
* to learn more.
* ) and just override the things that need to be specific. see MediaHandlerAudio
*
* @author <mh@nadir.org>, the Mir-coders group
- * @version $Id: MediaHandler.java,v 1.1.2.4 2005/01/09 20:37:08 zapata Exp $
+ * @version $Id: MediaHandler.java,v 1.1.2.5 2005/01/23 15:36:03 zapata Exp $
*/
public interface MediaHandler {
public void produce(Entity aMedia, Entity aMediaType ) throws MediaExc, MediaFailure;
/**
- * Get's the media data from storage and returns it as an InputStream
+ * Get's the media data from database and returns it as an InputStream
* Not very useful for most media types as they are stored in a file,
* but very usefull for ones stored in the DB as it is necessary to get
* it first before making a file out of it (in Producer*).
import mir.entity.Entity;
import mir.entity.EntityList;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
*/
public class AbstractModule {
- protected StorageObject storage;
+ protected Database database;
- public AbstractModule(StorageObject aStorageObject) {
- storage = aStorageObject;
+ public AbstractModule(Database aDatabase) {
+ database = aDatabase;
}
/**
- * Returns the storage object associated with this module
+ * Returns the database object associated with this module
*/
- public StorageObject getStorageObject () {
- return storage;
+ public Database getStorageObject () {
+ return database;
}
public Entity getById (String id) throws ModuleExc, ModuleFailure {
try {
- if (storage == null)
- throw new ModuleExc("AbstractModule.getById: No StorageObject set!");
- Entity entity = storage.selectById(id);
+ if (database == null)
+ throw new ModuleExc("AbstractModule.getById: No Database set!");
+ Entity entity = database.selectById(id);
if (entity == null)
throw new ModuleExc("AbstractModule.getById: No object for id = " + id);
public EntityList getByWhereClause (String whereClause, int offset) throws ModuleExc, ModuleFailure {
try {
- if (storage == null)
- throw new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");
+ if (database == null)
+ throw new ModuleExc("AbstractModule.getByWhereClause: No Database set!");
- return storage.selectByWhereClause(whereClause, offset);
+ return database.selectByWhereClause(whereClause, offset);
}
catch (Throwable e) {
throw new ModuleFailure(e);
}
/**
- * * Standardfunktion, um einen Datensatz via StorageObject einzuf?gen
+ * * Standardfunktion, um einen Datensatz via Database einzuf?gen
* @param theValues Hash mit Spalte/Wert-Paaren
* @return Id des eingef?gten Objekts
* @exception ModuleExc
*/
public String add(Map theValues) throws ModuleExc, ModuleFailure {
try {
- Entity entity = storage.createNewEntity();
+ Entity entity = database.createNewEntity();
entity.setFieldValues(theValues);
return entity.insert();
}
/**
- * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren
+ * Standardfunktion, um einen Datensatz via Database zu aktualisieren
* @param theValues Hash mit Spalte/Wert-Paaren
* @return Id des eingef?gten Objekts
* @exception ModuleExc
*/
public String set (Map theValues) throws ModuleExc, ModuleFailure {
try {
- Entity theEntity = storage.selectById((String) theValues.get("id"));
+ Entity theEntity = database.selectById((String) theValues.get("id"));
if (theEntity == null)
throw new ModuleExc("No object found with id " + theValues.get("id"));
theEntity.setFieldValues(theValues);
*/
public void deleteById (String idParam) throws ModuleExc, ModuleFailure {
try {
- storage.delete(idParam);
+ database.delete(idParam);
}
catch (Throwable e) {
throw new ModuleFailure(e);
*/
public int getSize(String where) throws ModuleExc, ModuleFailure {
try {
- return storage.getSize(where);
+ return database.getSize(where);
}
catch (SQLException e) {
throw new ModuleFailure("Can't retrieve number of entities: " + e.toString(), e);
batchesData = new ArrayList();
batchLocations = new ArrayList();
- nrEntities = model.getMappingForName(definition).getStorage().getSize(
+ nrEntities = model.getMappingForName(definition).getDatabase().getSize(
mainTablePrefix, extraTableList, expandedWhereClause)-nrEntitiesToSkip;
nrEntitiesInFirstBatch = nrEntities % nrEntitiesPerBatch;
while (nrEntitiesInFirstBatch<minNrEntitiesInFirstBatch && nrEntities-nrEntitiesInFirstBatch>=nrEntitiesPerBatch)
try {
EntityAdapterModel.Mapping mapping = model.getMappingForName(definition);
- mapping.getStorage().deleteByWhereClause(ParameterExpander.expandExpression( aValueMap, whereClause ));
+ mapping.getDatabase().deleteByWhereClause(ParameterExpander.expandExpression( aValueMap, whereClause ));
}
catch (Throwable t) {
aLogger.error("Error while deleting entities: " + t.toString());
import mir.log.LoggerWrapper;
import mir.module.AbstractModule;
import mir.module.ModuleExc;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.util.HTTPRequestParser;
import mir.util.URLBuilder;
import mircoders.global.MirGlobal;
/**
* Gets the fields from a httprequest and matches them with the metadata from
- * the storage object. Returns the keys that match, with their values.
+ * the database object. Returns the keys that match, with their values.
*
* @return Map with the values
*/
- public Map getIntersectingValues(HttpServletRequest aRequest, StorageObject theStorage)
+ public Map getIntersectingValues(HttpServletRequest aRequest, Database theStorage)
throws ServletModuleExc, ServletModuleFailure {
HTTPRequestParser parser;
import mir.util.JDBCStringRoutines;
import mircoders.global.MirGlobal;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.*;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import org.apache.commons.dbcp.DelegatingConnection;
+import org.postgresql.PGConnection;
+import org.postgresql.largeobject.LargeObjectManager;
+import org.postgresql.largeobject.LargeObject;
+
/**
* Implements database access.
*
- * @version $Id: Database.java,v 1.44.2.25 2005/01/09 22:07:45 zapata Exp $
+ * @version $Id: Database.java,v 1.44.2.26 2005/01/23 15:36:03 zapata Exp $
* @author rk
*
*/
-public class Database implements StorageObject {
+public class Database {
private static Class GENERIC_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;
protected static final ObjectStore o_store = ObjectStore.getInstance();
private static final int _millisPerHour = 60 * 60 * 1000;
protected List fieldNames;
protected int[] fieldTypes;
+ protected Map fieldNameToType;
protected Class entityClass;
private int defaultLimit;
}
}
- /**
- * Liefert die Entity-Klasse zur?ck, in der eine Datenbankzeile gewrappt
- * wird. Wird die Entity-Klasse durch die erbende Klasse nicht ?berschrieben,
- * wird eine mir.entity.GenericEntity erzeugt.
- *
- * @return Class-Objekt der Entity
- */
public java.lang.Class getEntityClass() {
return entityClass;
}
return defaultLimit;
}
- /**
- * Liefert den Namen des Primary-Keys zur?ck. Wird die Variable nicht von
- * der erbenden Klasse ?berschrieben, so ist der Wert <code>PKEY</code>
- * @return Name des Primary-Keys
- */
- public String getIdName() {
+ public String getIdFieldName() {
return primaryKeyField;
}
}
/**
- * {@inheritDoc}
+ * Returns a list of field names for this <code>Database</code>
*/
public List getFieldNames() throws StorageObjectFailure {
if (fieldNames == null) {
- retrieveMetaData();
+ acquireMetaData();
}
return fieldNames;
theReturnList.setStorage(this);
theReturnList.setLimit(aLimit);
- if (anOffset >= aLimit) {
- theReturnList.setPrevBatch(anOffset - aLimit);
- }
-
if (hasMore) {
theReturnList.setNextBatch(anOffset + aLimit);
}
/**
* Deletes entities based on a where clause
- *
- * @param aWhereClause
- * @return
- * @throws StorageObjectFailure
*/
public int deleteByWhereClause(String aWhereClause) throws StorageObjectFailure {
invalidateStore();
}
}
+ /**
+ * Executes 1 sql statement and returns the results as a <code>List</code> of
+ * <code>Map</code>s
+ */
public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc {
Connection connection = null;
Statement statement = null;
}
};
+ /**
+ * Executes 1 sql statement and returns the first result row as a <code>Map</code>s
+ * (<code>null</code> if there wasn't any row)
+ */
public Map executeFreeSingleRowSql(String anSqlStatement) throws StorageObjectFailure, StorageObjectExc {
try {
List resultList = executeFreeSql(anSqlStatement, 1);
}
};
+ /**
+ * Executes 1 sql statement and returns the first column of the first result row as a <code>String</code>s
+ * (<code>null</code> if there wasn't any row)
+ */
public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc {
Map row = executeFreeSingleRowSql(sql);
*/
private void processMetaData(ResultSetMetaData aMetaData) throws StorageObjectFailure {
fieldNames = new ArrayList();
+ fieldNameToType = new HashMap();
try {
int numFields = aMetaData.getColumnCount();
for (int i = 1; i <= numFields; i++) {
fieldNames.add(aMetaData.getColumnName(i));
fieldTypes[i - 1] = aMetaData.getColumnType(i);
+ fieldNameToType.put(aMetaData.getColumnName(i), new Integer(aMetaData.getColumnType(i)));
}
}
catch (SQLException e) {
/**
* Retrieves metadata from the table this Database object represents
*/
- private void retrieveMetaData() throws StorageObjectFailure {
+ private void acquireMetaData() throws StorageObjectFailure {
Connection connection = null;
PreparedStatement statement = null;
String sql = "select * from " + mainTable + " where 0=1";
}
}
catch (SQLException e) {
- throwSQLException(e, "retrieveMetaData");
+ throwSQLException(e, "acquireMetaData");
}
finally {
freeConnection(connection, statement);
if(resultSet!=null) {
if (resultSet.next()) {
- inputStream = resultSet.getBlob(1).getBinaryStream();
- imageInputStream = new BinaryFieldInputStream(inputStream, connection, statement);
+ if (resultSet.getMetaData().getColumnType(1) == java.sql.Types.BINARY) {
+ byte[] data = resultSet.getBytes(1);
+ imageInputStream = new ByteArrayInputStream(data);
+ }
+ else {
+ inputStream = resultSet.getBlob(1).getBinaryStream();
+ imageInputStream = new BinaryFieldInputStream(inputStream, connection, statement);
+ }
}
resultSet.close();
}
}
/**
- * Sets a binary value. The query is supposed to contain 1 ? denoting where the
- * binary value should be inserted.
- *
- * e.g. <code>update images set image_data = ? where id= 22</code>
+ * Sets a binary value for a particular field in a record specified by its identifier
*/
- public void setBinaryField(String aQuery, byte aData[]) throws StorageObjectFailure, SQLException {
+ public void setBinaryField(String aFieldName, String anObjectId, byte aData[]) throws StorageObjectFailure, SQLException {
PreparedStatement statement = null;
Connection connection = obtainConnection();
+
try {
connection.setAutoCommit(false);
try {
- statement = connection.prepareStatement(aQuery);
- statement.setBinaryStream(1, new ByteArrayInputStream(aData), aData.length);
- statement.execute();
- connection.commit();
+ // are we using bytea ?
+ if (getFieldType(aFieldName) == java.sql.Types.BINARY) {
+ statement = connection.prepareStatement(
+ "update " + mainTable + " set " + aFieldName + " = ? where " + getIdFieldName() + "=" + Integer.parseInt(anObjectId));
+ statement.setBytes(1, aData);
+ statement.execute();
+ connection.commit();
+ }
+ // or the old oid's
+ else {
+ PGConnection postgresqlConnection = (org.postgresql.PGConnection) ((DelegatingConnection) connection).getDelegate();
+ LargeObjectManager lobManager = postgresqlConnection.getLargeObjectAPI();
+ int oid = lobManager.create(LargeObjectManager.READ | LargeObjectManager.WRITE);
+ LargeObject obj = lobManager.open(oid, LargeObjectManager.WRITE); // Now open the file File file =
+ obj.write(aData);
+ obj.close();
+ statement = connection.prepareStatement(
+ "update " + mainTable + " set " + aFieldName + " = ? where " + getIdFieldName() + "=" + Integer.parseInt(anObjectId));
+ statement.setInt(1, oid);
+ statement.execute();
+ connection.commit();
+ }
}
finally {
connection.setAutoCommit(true);
logger.error("QUERY " + aQuery + " took " + aTime + "ms, but threw exception " + anException.toString());
}
+ private int getFieldType(String aFieldName) {
+ if (fieldNameToType == null) {
+ acquireMetaData();
+ }
+
+ return ((Integer) fieldNameToType.get(aFieldName)).intValue();
+ }
+
+
/**
* a small wrapper class that allows us to store the DB connection resources
* that the BlobInputStream is using and free them upon closing of the stream
+++ /dev/null
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, but you are not obligated to do so.
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mir.storage;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
-import java.util.Map;
-import java.io.InputStream;
-
-import mir.entity.Entity;
-import mir.entity.EntityList;
-
-/**
- * Interface for low-level database actions.
- */
-
-public interface StorageObject {
- public Entity selectById(String id) throws StorageObjectExc;
-
- public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure;
-
- public EntityList selectByWhereClause(String whereClause) throws StorageObjectFailure;
-
- public EntityList selectByWhereClause(String whereClause, int offset) throws StorageObjectFailure;
-
- public EntityList selectByWhereClause(String whereClause, String orderBy, int offset) throws StorageObjectFailure;
-
- public EntityList selectByWhereClause(String whereClause, String orderBy, int offset, int limit) throws StorageObjectFailure;
-
- public EntityList selectByWhereClause(String mainTablePrefix, List extraTables, String aWhereClause, String anOrderByClause, int offset, int limit) throws StorageObjectFailure;
-
- public boolean delete(String id) throws StorageObjectFailure;
-
- /**
- * Deletes entities based on a where clause
- */
- public int deleteByWhereClause(String aWhereClause) throws StorageObjectFailure;
-
- /**
- * Returns a list of field names for this <code>StorageObject</code>
- */
- public List getFieldNames() throws StorageObjectFailure;
-
- public void update(Entity a) throws StorageObjectFailure;
-
- public String insert(Entity a) throws StorageObjectFailure;
-
- public Class getEntityClass();
-
- public Entity createNewEntity() throws StorageObjectFailure;
-
- public String getIdName();
-
- public String getTableName();
-
- public Connection obtainConnection() throws StorageObjectFailure;
-
- public ResultSet executeSql(Statement a, String sql) throws StorageObjectFailure, SQLException;
-
- /**
- * Executes 1 sql statement and returns the results as a <code>List</code> of
- * <code>Map</code>s
- */
- public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc;
-
- /**
- * Executes 1 sql statement and returns the first result row as a <<code>Map</code>s
- * (<code>null</code> if there wasn't any row)
- */
- public Map executeFreeSingleRowSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
-
- /**
- * Executes 1 sql statement and returns the first column of the first result row as a <<code>String</code>s
- * (<code>null</code> if there wasn't any row)
- */
- public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
-
- public void freeConnection(Connection con, Statement stmt) throws StorageObjectFailure;
-
- public int executeUpdate(Statement a, String sql) throws StorageObjectFailure, SQLException;
-
- public int executeUpdate(String sql) throws StorageObjectFailure, SQLException;
-
- public int getSize(String where) throws SQLException, StorageObjectFailure;
-
- public int getSize(String mainTablePrefix, List extraTables, String where) throws SQLException, StorageObjectFailure;
-
- public InputStream getBinaryField(String aQuery) throws SQLException, StorageObjectFailure;
-
- public void setBinaryField(String aQuery, byte aData[]) throws StorageObjectFailure, SQLException;
-}
/**
- * Exception for all occuring failures in the storage-layer
+ * Exception for all occuring failures in the database-layer
* @author idefix
*/
public class StorageObjectFailure extends Failure {
import java.util.Map;
/**
- * This class handles storage of audio data and meta data
+ * This class handles database of audio data and meta data
*
* @author mh
- * @version $Id: EntityAudio.java,v 1.11.2.2 2005/01/09 20:37:10 zapata Exp $
+ * @version $Id: EntityAudio.java,v 1.11.2.3 2005/01/23 15:36:04 zapata Exp $
*/
* this class implements mapping of one line of the database table content
* to a java object
*
- * @version $Id: EntityContent.java,v 1.19.2.8 2005/01/09 20:37:10 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19.2.9 2005/01/23 15:36:04 zapata Exp $
* @author mir-coders group
*
*/
Connection con=null;Statement stmt=null;
String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
try {
- con = storageObject.obtainConnection();
+ con = database.obtainConnection();
/** todo should be preparedStatement: faster!! */
stmt = con.createStatement();
- storageObject.executeUpdate(stmt,sql);
+ database.executeUpdate(stmt,sql);
}
catch (StorageObjectFailure e) {
throw e;
throw new StorageObjectFailure(e);
}
finally {
- storageObject.freeConnection(con,stmt);
+ database.freeConnection(con,stmt);
}
}
/**
*
* @author RK, mh, mir-coders
- * @version $Id: EntityImages.java,v 1.21.2.6 2005/01/09 20:37:10 zapata Exp $
+ * @version $Id: EntityImages.java,v 1.21.2.7 2005/01/23 15:36:04 zapata Exp $
*/
*/
public InputStream getImage() throws StorageObjectFailure {
try {
- return storageObject.getBinaryField("select image_data from images where id="+getId());
+ return database.getBinaryField("select image_data from images where id="+getId());
}
catch (SQLException e) {
throw new StorageObjectFailure(e);
* Processes and saves image data
*/
public void setImage(InputStream anInputStream, String type) throws StorageObjectFailure {
- // todo: failures should be treated anInputStream a better way: exception -> rollback instead
- // of commit
if (anInputStream != null) {
try {
ByteArrayOutputStream inputData = new ByteArrayOutputStream();
ByteArrayOutputStream imageData = new ByteArrayOutputStream();
processor.writeScaledData(imageData, type);
- storageObject.setBinaryField("update images set image_data = ? where id = "+getId(), imageData.toByteArray());
+ database.setBinaryField("image_data", getId(), imageData.toByteArray());
setFieldValue("img_height", new Integer(processor.getScaledHeight()).toString());
setFieldValue("img_width", new Integer(processor.getScaledWidth()).toString());
imageData.reset();
processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction);
processor.writeScaledData(imageData, type);
- storageObject.setBinaryField("update images set icon_data = ? where id = "+getId(), imageData.toByteArray());
+ database.setBinaryField("icon_data", getId(), imageData.toByteArray());
setFieldValue("icon_height", new Integer(processor.getScaledHeight()).toString());
setFieldValue("icon_width", new Integer(processor.getScaledWidth()).toString());
*/
public InputStream getIcon() throws StorageObjectFailure {
try {
- return storageObject.getBinaryField("select icon_data from images where id="+getId());
+ return database.getBinaryField("select icon_data from images where id="+getId());
}
catch (SQLException e) {
throw new StorageObjectFailure(e);
import java.util.Map;
/**
- * This class handles storage of other data and meta data
+ * This class handles database of other data and meta data
*
* @author mh
* @version 11.11.2000
/**
*
* @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.26.2.9 2005/01/09 20:37:10 zapata Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.26.2.10 2005/01/23 15:36:04 zapata Exp $
*/
public class EntityUploadedMedia extends AbstractEntity {
super.update();
try {
- storageObject.executeUpdate(
+ database.executeUpdate(
"update content " +
"set is_produced='0' " +
"from content_x_media cxm " +
" cxm.content_id=content.id and cxm.media_id=" + getId()
);
- storageObject.executeUpdate(
+ database.executeUpdate(
"update content " +
"set is_produced='0' " +
"from comment_x_media cxm, comment c "+
/**
* Interface to allow for customization of the way Mir handles media publication,
- * manipulation and storage
+ * manipulation and database
*/
public interface MirMediaLocalizer {
import mir.session.SessionHandler;
import mir.session.UploadedFile;
import mir.session.ValidationError;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.util.ExceptionFunctions;
import mir.util.FileFunctions;
import mircoders.global.MirGlobal;
/**
* Method to filter the attributes and their values of a request
- * based on the fields of a storage object.
+ * based on the fields of a database object.
*/
- protected static final Map getIntersectingValues(Request aRequest, StorageObject aStorage) throws SessionFailure {
+ protected static final Map getIntersectingValues(Request aRequest, Database aStorage) throws SessionFailure {
Map result = new HashMap();
Iterator i = aStorage.getFieldNames().iterator();
}
catch (Throwable t) {
logger.error("initializeGenerationValueSet: Exception while collecting comment statuses" + t.getMessage());
- throw new RuntimeException(t.getMessage());
+
+ throw new MirLocalizerFailure(t);
}
};
*
* @see mir.media.MediaHandler
* @author mh
- * @version $Id: MediaHandlerImages.java,v 1.23.2.6 2005/01/09 20:37:12 zapata Exp $
+ * @version $Id: MediaHandlerImages.java,v 1.23.2.7 2005/01/23 15:36:04 zapata Exp $
*/
InputStream inputStream;
try {
- inputStream = ((EntityImages)ent).getImage();
+ inputStream = ((EntityImages) ent).getImage();
}
catch (Throwable e) {
logger.error("MediaHandlerImages.getImage: " + e.toString());
((EntityImages) ent).setImage(in, getType());
}
catch (Throwable e) {
- logger.error("MediaHandlerImages.store: "+e.toString());
- e.printStackTrace(logger.asPrintWriter(LoggerWrapper.ERROR_MESSAGE));
+ logger.error("MediaHandlerImages.store", e);
- throw new MediaExc("A problem has occurred processing the media file: " + e.toString());
+ throw new MediaFailure("A problem has occurred processing the media file", e);
}
}
if (aTable.equals("Other"))
return DatabaseOther.getInstance();
- throw new MediaExc("Unknown storage specification: " + aTable);
+ throw new MediaExc("Unknown database specification: " + aTable);
}
}
public String articleTypeIdForName(String aName) throws ModuleExc, ModuleFailure {
try {
- return storage.executeFreeSingleValueSql("select id from article_type where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+ return database.executeFreeSingleValueSql("select id from article_type where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
}
catch (Throwable t) {
throw new ModuleFailure(t);
public void deleteById (String anId) throws ModuleExc, ModuleFailure {
try {
- Entity theEntity = storage.selectById((String)anId);
+ Entity theEntity = database.selectById((String)anId);
if (theEntity != null)
DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getFieldValue("to_media"));
public String set(Map theValues) throws ModuleExc, ModuleFailure {
try {
- Entity theEntity = storage.selectById((String)theValues.get("id"));
+ Entity theEntity = database.selectById((String)theValues.get("id"));
if (theEntity == null)
throw new ModuleExc("No Object in the database with id " + theValues.get("id"));
DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getFieldValue("to_media"));
public String commentStatusIdForName(String aName) throws ModuleExc, ModuleFailure {
try {
- return storage.executeFreeSingleValueSql("select id from comment_status where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+ return database.executeFreeSingleValueSql("select id from comment_status where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
}
catch (Throwable t) {
throw new ModuleFailure(t);
if (!aForce)
query = query + " and to_locking_user is null";
- return storage.executeUpdate(query) > 0;
+ return database.executeUpdate(query) > 0;
}
catch (Throwable t) {
return false;
if (!aForce)
query = query + " and to_locking_user = "+JDBCStringRoutines.escapeStringLiteral(aUserId);
- return storage.executeUpdate(query) > 0;
+ return database.executeUpdate(query) > 0;
}
catch (Throwable t) {
return false;
*/
public String queryArticleLock(String anId) {
try {
- String result = storage.executeFreeSingleValueSql("select to_locking_user from content where id = " + JDBCStringRoutines.escapeStringLiteral(anId));
+ String result = database.executeFreeSingleValueSql("select to_locking_user from content where id = " + JDBCStringRoutines.escapeStringLiteral(anId));
if (result!=null && !MirGlobal.isUserLoggedIn(result)) {
expireArticleLock(anId, result);
public String languageIdForCode(String aCode) throws ModuleExc, ModuleFailure {
try {
- return storage.executeFreeSingleValueSql("select id from language where code = '" + JDBCStringRoutines.escapeStringLiteral(aCode) + "'");
+ return database.executeFreeSingleValueSql("select id from language where code = '" + JDBCStringRoutines.escapeStringLiteral(aCode) + "'");
}
catch (Throwable t) {
throw new ModuleFailure(t);
public Entity languageForCode(String aCode) throws ModuleExc, ModuleFailure {
try {
- EntityList list = storage.selectByFieldValue("code", aCode);
+ EntityList list = database.selectByFieldValue("code", aCode);
if (list.size()>0) {
return list.elementAt(0);
public String mediaFolderIdForName(String aName) throws ModuleExc, ModuleFailure {
try {
- return storage.executeFreeSingleValueSql("select id from media_folder where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+ return database.executeFreeSingleValueSql("select id from media_folder where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
}
catch (Throwable t) {
throw new ModuleFailure(t);
import mir.log.LoggerWrapper;
import mir.module.AbstractModule;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
*
{
static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia");
- public ModuleUploadedMedia(StorageObject aStorage) {
+ public ModuleUploadedMedia(Database aStorage) {
super(aStorage);
}
}
\ No newline at end of file
try {
String sql = "update webdb_users set lastlogin=now() where id = " + aUser.getId();
- storage.executeUpdate(sql);
+ database.executeUpdate(sql);
}
catch (Throwable t) {
// no propagation of this error for now, to allow mir to still function
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.13 2005/01/09 20:37:14 zapata Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.14 2005/01/23 15:36:05 zapata Exp $
*
*/
throw new ServletModuleExc("Please let me sort by something!(missing search_sort)");
}
- // here is where the documents will go for storage across sessions
+ // here is where the documents will go for database across sessions
ArrayList theDocumentsSorted = new ArrayList();
if (sortBy.equals("score")) {
if (idParam!=null && !idParam.equals("")) {
try {
- EntityUploadedMedia entity = (EntityUploadedMedia)mainModule.getById(idParam);
+ EntityUploadedMedia entity = (EntityUploadedMedia) mainModule.getById(idParam);
Entity mediaType = entity.getMediaType();
MediaHandler mediaHandler;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
-public class DatabaseArticleType extends Database implements StorageObject{
+public class DatabaseArticleType extends Database {
private static DatabaseArticleType instance;
*/
package mircoders.storage;
-import java.util.GregorianCalendar;
-
import mir.entity.Entity;
import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
import mir.storage.Database;
-import mir.storage.StorageObject;
import mir.storage.StorageObjectFailure;
-public class DatabaseAudio extends Database implements StorageObject{
+import java.util.GregorianCalendar;
+
+public class DatabaseAudio extends Database {
private static DatabaseAudio instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
*
*/
-public class DatabaseBreaking extends Database implements StorageObject{
+public class DatabaseBreaking extends Database {
private static DatabaseBreaking instance;
public synchronized static DatabaseBreaking getInstance() throws StorageObjectFailure {
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
*
*/
-public class DatabaseComment extends Database implements StorageObject{
+public class DatabaseComment extends Database {
private static DatabaseComment instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
-public class DatabaseCommentStatus extends Database implements StorageObject{
+public class DatabaseCommentStatus extends Database {
private static DatabaseCommentStatus instance;
import mir.entity.EntityList;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectExc;
import mir.storage.StorageObjectFailure;
import mircoders.entity.EntityComment;
* <b>implements abstract DB connection to the comment_x_media SQL table
*
* @author RK, mir-coders group
- * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.8 2005/01/09 20:37:15 zapata Exp $
+ * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.9 2005/01/23 15:36:05 zapata Exp $
*
*/
-public class DatabaseCommentToMedia extends Database implements StorageObject{
+public class DatabaseCommentToMedia extends Database {
private static DatabaseCommentToMedia instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
*
*/
-public class DatabaseContent extends Database implements StorageObject {
+public class DatabaseContent extends Database {
private static DatabaseContent instance;
import mir.entity.EntityList;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectExc;
import mir.storage.StorageObjectFailure;
import mircoders.entity.EntityContent;
* <b>implements abstract DB connection to the content_x_media SQL table
*
* @author RK, mir-coders group
- * @version $Id: DatabaseContentToMedia.java,v 1.19.2.7 2005/01/09 20:37:15 zapata Exp $
+ * @version $Id: DatabaseContentToMedia.java,v 1.19.2.8 2005/01/23 15:36:05 zapata Exp $
*
*/
-public class DatabaseContentToMedia extends Database implements StorageObject{
+public class DatabaseContentToMedia extends Database {
private static DatabaseContentToMedia instance;
import mir.entity.EntityList;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
import mircoders.entity.EntityContent;
import mircoders.entity.EntityTopics;
*
*/
-public class DatabaseContentToTopics extends Database implements StorageObject{
+public class DatabaseContentToTopics extends Database {
private static DatabaseContentToTopics instance;
\r
import mir.log.LoggerWrapper;\r
import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
+import mir.storage.Database;\r
\r
-public class DatabaseFilter extends Database implements StorageObject{\r
+public class DatabaseFilter extends Database {\r
private static DatabaseFilter instance;\r
\r
public synchronized static DatabaseFilter getInstance() {\r
\r
import mir.log.LoggerWrapper;\r
import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
+import mir.storage.Database;\r
\r
-public class DatabaseFilterGroup extends Database implements StorageObject {\r
+public class DatabaseFilterGroup extends Database {\r
private static DatabaseFilterGroup instance;\r
\r
public synchronized static DatabaseFilterGroup getInstance() {\r
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
* <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
*
*/
-public class DatabaseImageColor extends Database implements StorageObject{
+public class DatabaseImageColor extends Database {
private static DatabaseImageColor instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
* <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
*
*/
-public class DatabaseImageFormat extends Database implements StorageObject{
+public class DatabaseImageFormat extends Database {
private static DatabaseImageFormat instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
* <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
*
*/
-public class DatabaseImageLayout extends Database implements StorageObject{
+public class DatabaseImageLayout extends Database {
private static DatabaseImageLayout instance;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
*
* @version 1.0
*/
-public class DatabaseImageType extends Database implements StorageObject{
+public class DatabaseImageType extends Database {
private static DatabaseImageType instance;
public synchronized static DatabaseImageType getInstance() {
import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
*
*/
-public class DatabaseImages extends Database implements StorageObject{
+public class DatabaseImages extends Database {
private static DatabaseImages instance;
import mir.entity.EntityBrowser;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
-public class DatabaseLanguage extends Database implements StorageObject{
+public class DatabaseLanguage extends Database {
private static DatabaseLanguage instance;
// the following *has* to be sychronized cause this static method
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
*
*/
-public class DatabaseMediaType extends Database implements StorageObject{
+public class DatabaseMediaType extends Database {
private static DatabaseMediaType instance;
public synchronized static DatabaseMediaType getInstance() {
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
-public class DatabaseMediafolder extends Database implements StorageObject{
+public class DatabaseMediafolder extends Database {
private static DatabaseMediafolder instance;
public synchronized static DatabaseMediafolder getInstance() {
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
/**
*/
-public class DatabaseMessages extends Database implements StorageObject{
+public class DatabaseMessages extends Database {
private static DatabaseMessages instance;
public synchronized static DatabaseMessages getInstance() {
import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
* @version 1.0
*/
-public class DatabaseOther extends Database implements StorageObject{
+public class DatabaseOther extends Database {
private static DatabaseOther instance;
// the following *has* to be sychronized cause this static method
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
* @version 1.0
*/
-public class DatabaseRights extends Database implements StorageObject{
+public class DatabaseRights extends Database {
private static DatabaseRights instance;
public synchronized static DatabaseRights getInstance() {
import mir.entity.EntityBrowser;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
* @version 1.0
*/
-public class DatabaseTopics extends Database implements StorageObject{
+public class DatabaseTopics extends Database {
private static DatabaseTopics instance;
public synchronized static DatabaseTopics getInstance() {
import mir.entity.EntityBrowser;
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
-public class DatabaseUploadedMedia extends Database implements StorageObject {
+public class DatabaseUploadedMedia extends Database {
private static DatabaseUploadedMedia instance;
public synchronized static DatabaseUploadedMedia getInstance() {
import mir.log.LoggerWrapper;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
* @version 1.0
*/
-public class DatabaseUsers extends Database implements StorageObject{
+public class DatabaseUsers extends Database {
private static DatabaseUsers instance;
import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
import mir.storage.Database;
-import mir.storage.StorageObject;
+import mir.storage.Database;
import mir.storage.StorageObjectFailure;
/**
* @version 1.0
*/
-public class DatabaseVideo extends Database implements StorageObject{
+public class DatabaseVideo extends Database {
private static DatabaseVideo instance;