Author: glandais Date: 2008-02-04 14:34:43 +0000 (Mon, 04 Feb 2008) New Revision: 625 Added: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java Removed: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java Log: StorageException renamed SimExplorerStorageException Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:34:43 UTC (rev 625) @@ -17,7 +17,7 @@ * ##% */ package fr.cemagref.simexplorer.is.service; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl; @@ -31,7 +31,7 @@ } @Override - protected StorageEngine getStorageEngine() throws StorageException { + protected StorageEngine getStorageEngine() throws SimExplorerStorageException { if (storageEngine == null) { storageEngine = new StorageEngineImpl(); storageEngine.open(); Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:34:43 UTC (rev 625) @@ -44,7 +44,7 @@ import fr.cemagref.simexplorer.is.factories.BaseEntityFactory; import fr.cemagref.simexplorer.is.factories.MetaDataFactory; import fr.cemagref.simexplorer.is.factories.XmlConstants; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.util.ZipStreamEncoder; @@ -53,7 +53,7 @@ private static final String KEY_XML = "_xml"; - protected abstract StorageEngine getStorageEngine() throws StorageException; + protected abstract StorageEngine getStorageEngine() throws SimExplorerStorageException; public void close() throws Exception { getStorageEngine().close(); @@ -62,7 +62,7 @@ public void commit() throws SimExplorerServiceException { try { getStorageEngine().commit(); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -102,7 +102,7 @@ throws SimExplorerServiceException { try { return getStorageEngine().getMetadata(token, uuid); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -112,7 +112,7 @@ try { return getStorageEngine().getMetadata(token, uuid, new Version(version)); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -123,7 +123,7 @@ try { return getStorageEngine().findFullText(token, query, onlyLatest, indexStart, count, dateOrder); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -133,7 +133,7 @@ try { return getStorageEngine().findFullTextCount(token, query, onlyLatest); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -143,7 +143,7 @@ try { return getStorageEngine().findElementsByTypeCount(token, VALUE_METADATA_TYPE_EA, onlyLatest); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -155,7 +155,7 @@ return getStorageEngine() .findElementsByType(token, VALUE_METADATA_TYPE_EA, onlyLatest, start, count, dateOrder); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -240,7 +240,7 @@ RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream( stream); return remoteStream.export(); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } catch (RemoteException e) { throw new SimExplorerServiceException(e); @@ -256,7 +256,7 @@ RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream( xmlStream); return remoteStream.export(); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } catch (IOException e) { throw new SimExplorerServiceException(e); @@ -295,7 +295,7 @@ RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream( pipedIn); return remoteStream.export(); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } catch (IOException e) { throw new SimExplorerServiceException(e); @@ -414,7 +414,7 @@ Set<MetaData> versions = getStorageEngine().getElementVersions( token, uuid); return versions.toArray(new MetaData[versions.size()]); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -423,7 +423,7 @@ throws SimExplorerServiceException { try { getStorageEngine().deleteElement(token, uuid, new Version(version)); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } @@ -432,7 +432,7 @@ throws SimExplorerServiceException { try { getStorageEngine().deleteElements(token, uuid); - } catch (StorageException e) { + } catch (SimExplorerStorageException e) { throw new SimExplorerServiceException(e); } } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:34:43 UTC (rev 625) @@ -23,7 +23,7 @@ import org.jboss.annotation.ejb.RemoteBinding; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl; @@ -45,7 +45,7 @@ } @Override - protected StorageEngine getStorageEngine() throws StorageException { + protected StorageEngine getStorageEngine() throws SimExplorerStorageException { storageEngine.open(); return storageEngine; } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:34:43 UTC (rev 625) @@ -29,7 +29,7 @@ import fr.cemagref.simexplorer.is.entities.metadata.Version; import fr.cemagref.simexplorer.is.security.credentials.CredentialManager; import fr.cemagref.simexplorer.is.security.entities.Permission; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; @Stateless(name = "StorageEngine") @Local(StorageEngine.class) @@ -40,32 +40,32 @@ @Override public void deleteElement(String token, String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { Permission permission = credentialManager.getPermission(token, uuid); // TODO check candelete = canadmin if (permission != null && permission.isCanAdmin()) { super.deleteElement(token, uuid, version); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } } @Override public void deleteElements(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { Permission permission = credentialManager.getPermission(token, uuid); // TODO check candelete = canadmin if (permission != null && permission.isCanAdmin()) { super.deleteElements(token, uuid); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } } @Override public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { MetaData[] list; list = super.findElementsByType(token, type, onlyLatest, start, count, dateOrder); @@ -75,7 +75,7 @@ @Override public int findElementsByTypeCount(String token, String type, - boolean onlyLatest) throws StorageException { + boolean onlyLatest) throws SimExplorerStorageException { // TODO how to filter without losing pagination? return super.findElementsByTypeCount(token, type, onlyLatest); } @@ -83,7 +83,7 @@ @Override public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { // TODO how to filter without losing pagination? return super.findFullText(token, query, onlyLatest, indexStart, count, dateOrder); @@ -91,74 +91,74 @@ @Override public int findFullTextCount(String token, String query, boolean onlyLatest) - throws StorageException { + throws SimExplorerStorageException { // TODO how to filter without losing pagination? return super.findFullTextCount(token, query, onlyLatest); } @Override public MetaData getMetadata(String token, String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { MetaData mde; Permission permission = credentialManager.getPermission(token, uuid); if (permission != null && permission.isCanRead()) { mde = super.getMetadata(token, uuid, version); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } return mde; } @Override public MetaData getMetadata(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { MetaData mde; Permission permission = credentialManager.getPermission(token, uuid); if (permission != null && permission.isCanRead()) { mde = super.getMetadata(token, uuid); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } return mde; } @Override public List<Version> getVersions(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { List<Version> versions; Permission permission = credentialManager.getPermission(token, uuid); if (permission != null && permission.isCanRead()) { versions = super.getVersions(token, uuid); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } return versions; } @Override public InputStream retrieveData(String token, MetaData entity, - String field) throws StorageException { + String field) throws SimExplorerStorageException { InputStream stream; Permission permission = credentialManager.getPermission(token, entity .getUuid()); if (permission != null && permission.isCanRead()) { stream = super.retrieveData(token, entity, field); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } return stream; } @Override public void saveElement(String token, MetaData element, - Map<String, InputStream> attachments) throws StorageException { + Map<String, InputStream> attachments) throws SimExplorerStorageException { Permission permission = credentialManager.getPermission(token, element .getUuid()); if (permission != null && permission.isCanWrite()) { super.saveElement(token, element, attachments); credentialManager.saveElement(token, element.getUuid()); } else { - throw new StorageException("Permission denied"); + throw new SimExplorerStorageException("Permission denied"); } } Copied: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java (from rev 611, trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java) =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java (rev 0) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-04 14:34:43 UTC (rev 625) @@ -0,0 +1,40 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program 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. +* +* This program 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 this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.storage; + +public class SimExplorerStorageException extends Exception { + + private static final long serialVersionUID = 4405447107690074844L; + + public SimExplorerStorageException() { + super(); + } + + public SimExplorerStorageException(String message) { + super(message); + } + + public SimExplorerStorageException(Throwable cause) { + super(cause); + } + + public SimExplorerStorageException(String message, Throwable cause) { + super(message, cause); + } + +} Deleted: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java 2008-02-04 14:34:43 UTC (rev 625) @@ -1,40 +0,0 @@ -/* -* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais -* -* This program 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. -* -* This program 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 this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* ##% */ -package fr.cemagref.simexplorer.is.storage; - -public class StorageException extends Exception { - - private static final long serialVersionUID = 4405447107690074844L; - - public StorageException() { - super(); - } - - public StorageException(String message) { - super(message); - } - - public StorageException(Throwable cause) { - super(cause); - } - - public StorageException(String message, Throwable cause) { - super(message, cause); - } - -} Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-04 14:34:43 UTC (rev 625) @@ -20,7 +20,7 @@ import java.io.InputStream; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; /** * Store, retrieve and delete content @@ -39,10 +39,10 @@ * Unique field for content * @param is * Content - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract void storeData(MetaData entity, String field, - InputStream is) throws StorageException; + InputStream is) throws SimExplorerStorageException; /** * Retrieve content @@ -52,10 +52,10 @@ * @param field * Unique field for content * @return Content - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract InputStream retrieveData(MetaData entity, String field) - throws StorageException; + throws SimExplorerStorageException; /** * Delete content @@ -64,9 +64,9 @@ * DataEntity related to content * @param field * Unique field for content - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract void deleteData(MetaData entity, String field) - throws StorageException; + throws SimExplorerStorageException; } \ No newline at end of file Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-04 14:34:43 UTC (rev 625) @@ -27,7 +27,7 @@ import java.io.InputStream; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.util.Config; /** @@ -79,20 +79,20 @@ @Override public InputStream retrieveData(MetaData entity, String field) - throws StorageException { + throws SimExplorerStorageException { // Simple stream on file FileInputStream fis = null; try { fis = new FileInputStream(getFile(entity, field)); } catch (FileNotFoundException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } return fis; } @Override public void storeData(MetaData entity, String field, InputStream is) - throws StorageException { + throws SimExplorerStorageException { // Simple stream on file @@ -115,15 +115,15 @@ // Close file fos.close(); } catch (FileNotFoundException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } catch (IOException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } @Override public void deleteData(MetaData entity, String field) - throws StorageException { + throws SimExplorerStorageException { // Simple delete on file getFile(entity, field).delete(); } Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-04 14:34:43 UTC (rev 625) @@ -25,7 +25,7 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.entities.metadata.Version; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; /** * Interface of a database able to manage metadata elements @@ -38,9 +38,9 @@ /** * Open database connection * - * @throws StorageException + * @throws SimExplorerStorageException */ - public void open() throws StorageException { + public void open() throws SimExplorerStorageException { open(false); } @@ -49,23 +49,23 @@ * * @param create * Create database - * @throws StorageException + * @throws SimExplorerStorageException */ - public abstract void open(boolean create) throws StorageException; + public abstract void open(boolean create) throws SimExplorerStorageException; /** * Close database connection * - * @throws StorageException + * @throws SimExplorerStorageException */ - public abstract void close() throws StorageException; + public abstract void close() throws SimExplorerStorageException; /** * Commit pending modifications * - * @throws StorageException + * @throws SimExplorerStorageException */ - public abstract void commit() throws StorageException; + public abstract void commit() throws SimExplorerStorageException; // Create / Update @@ -76,10 +76,10 @@ * @param element * Element to insert * @param readers - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract void insertElement(MetaData element, - List<Reader> readers) throws StorageException; + List<Reader> readers) throws SimExplorerStorageException; // Read @@ -91,10 +91,10 @@ * @param version * version * @return Fund element, null if not fund - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract MetaData getElement(String uuid, Version version) - throws StorageException; + throws SimExplorerStorageException; /** * Get all version of an element thanks to its id <br> @@ -103,9 +103,9 @@ * @param uuid * Id * @return Versions - * @throws StorageException + * @throws SimExplorerStorageException */ - public abstract List<Version> getVersions(String uuid) throws StorageException; + public abstract List<Version> getVersions(String uuid) throws SimExplorerStorageException; /** * Retrieve all elements by id Empty list if no element with this id @@ -114,10 +114,10 @@ * Id * @param onlyLatest * @return Element list - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract Set<MetaData> findElementsById(String uuid, - boolean onlyLatest) throws StorageException; + boolean onlyLatest) throws SimExplorerStorageException; /** * Retrieve elements with specific properties<br> @@ -126,10 +126,10 @@ * @param properties * Matching properties needed * @return Element list - * @throws StorageException + * @throws SimExplorerStorageException */ public Set<MetaData> findElementsByProperties( - Map<String, String> properties) throws StorageException { + Map<String, String> properties) throws SimExplorerStorageException { return findElementsByProperties(properties, 0, -1, 0); } @@ -145,11 +145,11 @@ * Number of elements to return * @param dateOrder * @return Element list - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract Set<MetaData> findElementsByProperties( Map<String, String> properties, int start, int count, int dateOrder) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve element count specific properties @@ -157,10 +157,10 @@ * @param properties * Matching properties needed * @return Number of elements fund - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract int findElementsByPropertiesCount( - Map<String, String> properties) throws StorageException; + Map<String, String> properties) throws SimExplorerStorageException; /** * Prepare properties for query @@ -195,11 +195,11 @@ * @param dateOrder * Sorting * @return Element list - * @throws StorageException + * @throws SimExplorerStorageException */ public Set<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { return findElementsByProperties(getPropertiesByType(type, onlyLatest), start, count, dateOrder); } @@ -212,10 +212,10 @@ * @param onlyLatest * Only latest elements * @return Number of elements - * @throws StorageException + * @throws SimExplorerStorageException */ public int findElementsByTypeCount(String type, boolean onlyLatest) - throws StorageException { + throws SimExplorerStorageException { return findElementsByPropertiesCount(getPropertiesByType(type, onlyLatest)); } @@ -233,11 +233,11 @@ * Number of elements to return * @param dateOrder * @return Element list - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract Set<MetaData> findElementsByContentSearch( String queryText, boolean onlyLatest, int start, int count, - int dateOrder) throws StorageException; + int dateOrder) throws SimExplorerStorageException; /** * Retrieve element count with specific content @@ -246,10 +246,10 @@ * Searched text * @param onlyLatest * @return Number of elements fund - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract int findElementsByContentSearchCount(String queryText, - boolean onlyLatest) throws StorageException; + boolean onlyLatest) throws SimExplorerStorageException; // Delete @@ -258,9 +258,9 @@ * * @param element * Element to delete - * @throws StorageException + * @throws SimExplorerStorageException */ - public void deleteElement(MetaData element) throws StorageException { + public void deleteElement(MetaData element) throws SimExplorerStorageException { deleteElement(element.getUuid(), element.getVersion()); } @@ -271,9 +271,9 @@ * Id * @param version * Version - * @throws StorageException + * @throws SimExplorerStorageException */ public abstract void deleteElement(String uuid, Version version) - throws StorageException; + throws SimExplorerStorageException; } Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-04 14:34:43 UTC (rev 625) @@ -58,7 +58,7 @@ import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.entities.metadata.Version; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.database.Database; import fr.cemagref.simexplorer.is.storage.util.Config; import fr.cemagref.simexplorer.is.storage.util.KeyValue; @@ -167,7 +167,7 @@ } @Override - public void open(boolean create) throws StorageException { + public void open(boolean create) throws SimExplorerStorageException { if (writer == null) { // Create an analyzer Analyzer analyzer = new SimpleAnalyzer(); @@ -196,13 +196,13 @@ commit(); } } catch (IOException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } } @Override - public void close() throws StorageException { + public void close() throws SimExplorerStorageException { try { synchronized (writerSynchronizer) { // Close writer and invalidate reader @@ -211,7 +211,7 @@ } resetReader(); } catch (IOException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } searcherPool = null; } @@ -240,18 +240,18 @@ } @Override - public void commit() throws StorageException { + public void commit() throws SimExplorerStorageException { try { // Allows concurent access synchedCommit(); } catch (IOException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } @Override public void insertElement(MetaData element, List<Reader> readers) - throws StorageException { + throws SimExplorerStorageException { // Save element to a Lucene document Document document = saveLuceneElement(element, readers); @@ -270,13 +270,13 @@ writer.addDocument(document); } } catch (IOException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } @Override public MetaData getElement(String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { MetaData result = null; try { @@ -293,7 +293,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } return result; @@ -320,7 +320,7 @@ } @Override - public List<Version> getVersions(String uuid) throws StorageException { + public List<Version> getVersions(String uuid) throws SimExplorerStorageException { // Retrieve all document corresponding to id Map<String, String> properties = new HashMap<String, String>(); properties.put(KEY_UUID, uuid); @@ -346,7 +346,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } return versions; @@ -354,7 +354,7 @@ @Override public Set<MetaData> findElementsById(String uuid, boolean onlyLatest) - throws StorageException { + throws SimExplorerStorageException { // Create hash map with id Map<String, String> properties = new HashMap<String, String>(); properties.put(KEY_UUID, uuid); @@ -375,7 +375,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } // Return all elements parsed from documents fund @@ -384,7 +384,7 @@ @Override public int findElementsByPropertiesCount(Map<String, String> properties) - throws StorageException { + throws SimExplorerStorageException { int result = 0; try { @@ -398,7 +398,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } // Return all elements parsed from documents fund @@ -408,7 +408,7 @@ @Override public Set<MetaData> findElementsByProperties( Map<String, String> properties, int start, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { Set<MetaData> result = null; try { @@ -422,7 +422,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } // Return all elements parsed from documents fund @@ -431,12 +431,12 @@ @Override public int findElementsByContentSearchCount(String queryText, - boolean onlyLatest) throws StorageException { + boolean onlyLatest) throws SimExplorerStorageException { Query query = null; try { query = getQueryByContentSearch(queryText, onlyLatest); } catch (ParseException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } int result = 0; @@ -454,7 +454,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } return result; @@ -482,12 +482,12 @@ @Override public Set<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { Query query = null; try { query = getQueryByContentSearch(queryText, onlyLatest); } catch (ParseException e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } Set<MetaData> result = null; @@ -505,7 +505,7 @@ releaseSearcher(searcher); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } return result; @@ -549,7 +549,7 @@ @Override public void deleteElement(String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { // Delete element in db with term search Term[] terms = new Term[2]; terms[0] = new Term(KEY_UUID, uuid); @@ -560,7 +560,7 @@ writer.deleteDocuments(terms); } } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-04 14:34:43 UTC (rev 625) @@ -26,7 +26,7 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.entities.metadata.Version; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; @Local public interface StorageEngine { @@ -36,21 +36,21 @@ * * @throws Exception */ - public abstract void open() throws StorageException; + public abstract void open() throws SimExplorerStorageException; /** * Close storage * * @throws Exception */ - public abstract void close() throws StorageException; + public abstract void close() throws SimExplorerStorageException; /** * Commit changes to storage * * @throws Exception */ - public abstract void commit() throws StorageException; + public abstract void commit() throws SimExplorerStorageException; /** * Save an element to storage @@ -62,7 +62,7 @@ * @throws Exception */ public abstract void saveElement(String token, MetaData element, - Map<String, InputStream> attachments) throws StorageException; + Map<String, InputStream> attachments) throws SimExplorerStorageException; /** * Retrieve an element @@ -73,7 +73,7 @@ * @throws Exception */ public abstract MetaData getMetadata(String token, String uuid) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve versions of an element<br> @@ -86,7 +86,7 @@ * @throws Exception */ public abstract List<Version> getVersions(String token, String uuid) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve all version of a metadata @@ -96,7 +96,7 @@ * @return */ public abstract Set<MetaData> getElementVersions(String token, - String uuid) throws StorageException; + String uuid) throws SimExplorerStorageException; /** * Retrieve an element in a specific version @@ -107,7 +107,7 @@ * @throws Exception */ public abstract MetaData getMetadata(String token, String uuid, - Version version) throws StorageException; + Version version) throws SimExplorerStorageException; /** * Get data associated to an element @@ -120,7 +120,7 @@ * @throws Exception */ public abstract InputStream retrieveData(String token, - MetaData entity, String field) throws StorageException; + MetaData entity, String field) throws SimExplorerStorageException; /** * Get number of items corresponding to query @@ -131,7 +131,7 @@ * @throws Exception */ public abstract int findFullTextCount(String token, String query, - boolean onlyLatest) throws StorageException; + boolean onlyLatest) throws SimExplorerStorageException; /** * Retrieve list of items corresponding to query @@ -146,7 +146,7 @@ */ public abstract MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve list of items of type wanted @@ -161,7 +161,7 @@ */ public abstract MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count, int dateOrder) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve number of items of type wanted @@ -172,7 +172,7 @@ * @throws Exception */ public abstract int findElementsByTypeCount(String token, String type, - boolean onlyLatest) throws StorageException; + boolean onlyLatest) throws SimExplorerStorageException; /** * Delete elements @@ -181,7 +181,7 @@ * @throws Exception */ public abstract void deleteElements(String token, String uuid) - throws StorageException; + throws SimExplorerStorageException; /** * Delete one element @@ -191,7 +191,7 @@ * @throws Exception */ public abstract void deleteElement(String token, String uuid, - Version version) throws StorageException; + Version version) throws SimExplorerStorageException; /** * Store temporary data, for stream duplication @@ -202,7 +202,7 @@ * @throws Exception */ public abstract String storeTempData(InputStream stream) - throws StorageException; + throws SimExplorerStorageException; /** * Retrieve temporary data @@ -213,7 +213,7 @@ * @throws Exception */ public abstract InputStream retrieveTempData(String id) - throws StorageException; + throws SimExplorerStorageException; /** * Delete temporary data @@ -221,6 +221,6 @@ * @param id * @throws Exception */ - public abstract void deleteTempData(String id) throws StorageException; + public abstract void deleteTempData(String id) throws SimExplorerStorageException; } \ No newline at end of file Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java =================================================================== --- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-04 14:32:52 UTC (rev 624) +++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-04 14:34:43 UTC (rev 625) @@ -30,7 +30,7 @@ import fr.cemagref.simexplorer.is.attachment.ContentType; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.entities.metadata.Version; -import fr.cemagref.simexplorer.is.storage.StorageException; +import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler; import fr.cemagref.simexplorer.is.storage.attachment.FileSystemAttachmentHandler; import fr.cemagref.simexplorer.is.storage.database.Database; @@ -79,7 +79,7 @@ /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#open() */ - public void open() throws StorageException { + public void open() throws SimExplorerStorageException { if (!opened) { database.open(); opened = true; @@ -89,14 +89,14 @@ /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#close() */ - public void close() throws StorageException { + public void close() throws SimExplorerStorageException { database.close(); } /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#commit() */ - public void commit() throws StorageException { + public void commit() throws SimExplorerStorageException { database.commit(); } @@ -106,7 +106,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#saveElement(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.Map) */ public void saveElement(String token, MetaData element, - Map<String, InputStream> attachments) throws StorageException { + Map<String, InputStream> attachments) throws SimExplorerStorageException { // Save all attachments in system for (Map.Entry<String, InputStream> entry : attachments.entrySet()) { @@ -130,7 +130,7 @@ .renderToText(content); readers.add(reader); } catch (Exception e) { - throw new StorageException(e); + throw new SimExplorerStorageException(e); } } } @@ -165,7 +165,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String) */ public MetaData getMetadata(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { MetaData mde = null; Set<MetaData> set = database.findElementsById(uuid, true); if (!set.isEmpty()) { @@ -178,7 +178,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getVersions(java.lang.String) */ public List<Version> getVersions(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { return database.getVersions(uuid); } @@ -186,7 +186,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version) */ public MetaData getMetadata(String token, String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { MetaData mde = database.getElement(uuid, version); return mde; } @@ -195,7 +195,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String) */ public InputStream retrieveData(String token, MetaData entity, String field) - throws StorageException { + throws SimExplorerStorageException { InputStream result = attachmentHandler.retrieveData(entity, field); return result; } @@ -204,7 +204,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean) */ public int findFullTextCount(String token, String query, boolean onlyLatest) - throws StorageException { + throws SimExplorerStorageException { return database.findElementsByContentSearchCount(query, onlyLatest); } @@ -213,7 +213,7 @@ */ public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { MetaData[] result = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, dateOrder).toArray( new MetaData[0]); @@ -225,7 +225,7 @@ */ public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count, int dateOrder) - throws StorageException { + throws SimExplorerStorageException { MetaData[] result = database.findElementsByType(type, onlyLatest, start, count, dateOrder).toArray(new MetaData[0]); return result; @@ -235,7 +235,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findElementsByTypeCount(java.lang.String, boolean) */ public int findElementsByTypeCount(String token, String type, - boolean onlyLatest) throws StorageException { + boolean onlyLatest) throws SimExplorerStorageException { return database.findElementsByTypeCount(type, onlyLatest); } @@ -245,7 +245,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElements(java.lang.String) */ public void deleteElements(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { List<Version> versions = getVersions(token, uuid); for (Version version : versions) { deleteElement(token, uuid, version); @@ -256,7 +256,7 @@ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version) */ public void deleteElement(String token, String uuid, Version version) - throws StorageException { + throws SimExplorerStorageException { MetaData element = getMetadata(token, uuid, version); List<Attachment> attachments = element.getAttachments(); for (Attachment attachment : attachments) { @@ -270,7 +270,7 @@ /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.io.InputStream) */ - public String storeTempData(InputStream stream) throws StorageException { + public String storeTempData(InputStream stream) throws SimExplorerStorageException { String id = UUID.randomUUID().toString(); attachmentHandler.storeData(mdTmp, id, stream); return id; @@ -279,7 +279,7 @@ /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveTempData(java.lang.String) */ - public InputStream retrieveTempData(String id) throws StorageException { + public InputStream retrieveTempData(String id) throws SimExplorerStorageException { InputStream is = attachmentHandler.retrieveData(mdTmp, id); return is; } @@ -287,12 +287,12 @@ /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteTempData(java.lang.String) */ - public void deleteTempData(String id) throws StorageException { + public void deleteTempData(String id) throws SimExplorerStorageException { attachmentHandler.deleteData(mdTmp, id); } public Set<MetaData> getElementVersions(String token, String uuid) - throws StorageException { + throws SimExplorerStorageException { return database.findElementsById(uuid, false); }