Simexplorer-si-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- 1607 discussions
r505 - in trunk: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-sto
by glandais@users.labs.libre-entreprise.org 24 Jan '08
by glandais@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: glandais
Date: 2008-01-24 18:00:48 +0000 (Thu, 24 Jan 2008)
New Revision: 505
Added:
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java
Modified:
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
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/util/Config.java
Log:
StorageException
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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -27,6 +27,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;
public class StorageEngineSecuImpl extends StorageEngineImpl {
@@ -35,27 +36,32 @@
@Override
public void deleteElement(String token, String uuid, Version version)
- throws Exception {
+ throws StorageException {
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");
}
}
@Override
- public void deleteElements(String token, String uuid) throws Exception {
+ public void deleteElements(String token, String uuid)
+ throws StorageException {
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");
}
}
@Override
public MetaDataEntity[] findElementsByType(String token, String type,
boolean onlyLatest, int start, int count, int dateOrder)
- throws Exception {
+ throws StorageException {
MetaDataEntity[] list = super.findElementsByType(token, type,
onlyLatest, start, count, dateOrder);
// TODO how to filter without losing pagination?
@@ -64,7 +70,7 @@
@Override
public int findElementsByTypeCount(String token, String type,
- boolean onlyLatest) throws Exception {
+ boolean onlyLatest) throws StorageException {
// TODO how to filter without losing pagination?
return super.findElementsByTypeCount(token, type, onlyLatest);
}
@@ -72,7 +78,7 @@
@Override
public MetaDataEntity[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws Exception {
+ throws StorageException {
// TODO how to filter without losing pagination?
return super.findFullText(token, query, onlyLatest, indexStart, count,
dateOrder);
@@ -80,64 +86,74 @@
@Override
public int findFullTextCount(String token, String query, boolean onlyLatest)
- throws Exception {
+ throws StorageException {
// TODO how to filter without losing pagination?
return super.findFullTextCount(token, query, onlyLatest);
}
@Override
public MetaDataEntity getMetadata(String token, String uuid, Version version)
- throws Exception {
+ throws StorageException {
MetaDataEntity mde = null;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid, version);
+ } else {
+ throw new StorageException("Permission denied");
}
return mde;
}
@Override
public MetaDataEntity getMetadata(String token, String uuid)
- throws Exception {
+ throws StorageException {
MetaDataEntity mde = null;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid);
+ } else {
+ throw new StorageException("Permission denied");
}
return mde;
}
@Override
public List<Version> getVersions(String token, String uuid)
- throws Exception {
+ throws StorageException {
List<Version> versions = null;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
versions = super.getVersions(token, uuid);
+ } else {
+ throw new StorageException("Permission denied");
}
return versions;
}
@Override
public InputStream retrieveData(String token, MetaDataEntity entity,
- String field) throws Exception {
+ String field) throws StorageException {
InputStream stream = null;
Permission permission = credentialManager.getPermission(token, entity
.getUuid());
if (permission.isCanRead()) {
stream = super.retrieveData(token, entity, field);
+ } else {
+ throw new StorageException("Permission denied");
}
return stream;
}
@Override
public void saveElement(String token, MetaDataEntity element,
- Map<String, InputStream> attachments) throws Exception {
+ Map<String, InputStream> attachments) throws StorageException {
Permission permission = credentialManager.getPermission(token, element
.getUuid());
if (permission.isCanWrite()) {
super.saveElement(token, element, attachments);
credentialManager.saveElement(token, element.getUuid());
+ } else {
+ throw new StorageException("Permission denied");
}
}
Added: 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 (rev 0)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -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 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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -20,6 +20,7 @@
import java.io.InputStream;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
+import fr.cemagref.simexplorer.is.storage.StorageException;
/**
* Store, retrieve and delete content
@@ -38,10 +39,10 @@
* Unique field for content
* @param is
* Content
- * @throws Exception
+ * @throws StorageException
*/
public abstract void storeData(MetaDataEntity entity, String field,
- InputStream is) throws Exception;
+ InputStream is) throws StorageException;
/**
* Retrieve content
@@ -51,10 +52,10 @@
* @param field
* Unique field for content
* @return Content
- * @throws Exception
+ * @throws StorageException
*/
public abstract InputStream retrieveData(MetaDataEntity entity, String field)
- throws Exception;
+ throws StorageException;
/**
* Delete content
@@ -63,9 +64,9 @@
* DataEntity related to content
* @param field
* Unique field for content
- * @throws Exception
+ * @throws StorageException
*/
public abstract void deleteData(MetaDataEntity entity, String field)
- throws Exception;
+ throws StorageException;
}
\ 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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -21,10 +21,13 @@
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
+import fr.cemagref.simexplorer.is.storage.StorageException;
import fr.cemagref.simexplorer.is.storage.util.Config;
/**
@@ -49,7 +52,6 @@
* @param field
* Unique field for content
* @return Instance of file
- * @throws Exception
*/
private File getFile(MetaDataEntity entity, String field) {
String resultPath = baseFolder;
@@ -77,37 +79,48 @@
@Override
public InputStream retrieveData(MetaDataEntity entity, String field)
- throws Exception {
+ throws StorageException {
// Simple stream on file
- FileInputStream fis = new FileInputStream(getFile(entity, field));
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(getFile(entity, field));
+ } catch (FileNotFoundException e) {
+ throw new StorageException(e);
+ }
return fis;
}
@Override
public void storeData(MetaDataEntity entity, String field, InputStream is)
- throws Exception {
+ throws StorageException {
// Simple stream on file
- FileOutputStream fos = new FileOutputStream(getFile(entity, field));
+ try {
+ FileOutputStream fos = new FileOutputStream(getFile(entity, field));
- // Buffer copy stream to stream
- BufferedInputStream bin = new BufferedInputStream(is);
- BufferedOutputStream bout = new BufferedOutputStream(fos);
+ // Buffer copy stream to stream
+ BufferedInputStream bin = new BufferedInputStream(is);
+ BufferedOutputStream bout = new BufferedOutputStream(fos);
- while (true) {
- int datum = bin.read();
- if (datum == -1)
- break;
- bout.write(datum);
+ while (true) {
+ int datum = bin.read();
+ if (datum == -1)
+ break;
+ bout.write(datum);
+ }
+ bout.flush();
+
+ // Close file
+ fos.close();
+ } catch (FileNotFoundException e) {
+ throw new StorageException(e);
+ } catch (IOException e) {
+ throw new StorageException(e);
}
- bout.flush();
-
- // Close file
- fos.close();
}
@Override
public void deleteData(MetaDataEntity entity, String field)
- throws Exception {
+ throws StorageException {
// 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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -25,6 +25,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.storage.StorageException;
/**
* Interface of a database able to manage metadata elements
@@ -37,9 +38,9 @@
/**
* Open database connection
*
- * @throws Exception
+ * @throws StorageException
*/
- public void open() throws Exception {
+ public void open() throws StorageException {
open(false);
}
@@ -48,23 +49,23 @@
*
* @param create
* Create database
- * @throws Exception
+ * @throws StorageException
*/
- public abstract void open(boolean create) throws Exception;
+ public abstract void open(boolean create) throws StorageException;
/**
* Close database connection
*
- * @throws Exception
+ * @throws StorageException
*/
- public abstract void close() throws Exception;
+ public abstract void close() throws StorageException;
/**
* Commit pending modifications
*
- * @throws Exception
+ * @throws StorageException
*/
- public abstract void commit() throws Exception;
+ public abstract void commit() throws StorageException;
// Create / Update
@@ -74,10 +75,11 @@
*
* @param element
* Element to insert
- * @throws Exception
+ * @param readers
+ * @throws StorageException
*/
public abstract void insertElement(MetaDataEntity element,
- List<Reader> readers) throws Exception;
+ List<Reader> readers) throws StorageException;
// Read
@@ -89,10 +91,10 @@
* @param version
* version
* @return Fund element, null if not fund
- * @throws Exception
+ * @throws StorageException
*/
public abstract MetaDataEntity getElement(String uuid, Version version)
- throws Exception;
+ throws StorageException;
/**
* Get all version of an element thanks to its id <br>
@@ -101,20 +103,21 @@
* @param uuid
* Id
* @return Versions
- * @throws Exception
+ * @throws StorageException
*/
- public abstract List<Version> getVersions(String uuid) throws Exception;
+ public abstract List<Version> getVersions(String uuid) throws StorageException;
/**
* Retrieve all elements by id Empty list if no element with this id
*
* @param uuid
* Id
+ * @param onlyLatest
* @return Element list
- * @throws Exception
+ * @throws StorageException
*/
public abstract Set<MetaDataEntity> findElementsById(String uuid,
- boolean onlyLatest) throws Exception;
+ boolean onlyLatest) throws StorageException;
/**
* Retrieve elements with specific properties<br>
@@ -123,10 +126,10 @@
* @param properties
* Matching properties needed
* @return Element list
- * @throws Exception
+ * @throws StorageException
*/
public Set<MetaDataEntity> findElementsByProperties(
- Map<String, String> properties) throws Exception {
+ Map<String, String> properties) throws StorageException {
return findElementsByProperties(properties, 0, -1, 0);
}
@@ -140,12 +143,13 @@
* Index of first element returned
* @param count
* Number of elements to return
+ * @param dateOrder
* @return Element list
- * @throws Exception
+ * @throws StorageException
*/
public abstract Set<MetaDataEntity> findElementsByProperties(
Map<String, String> properties, int start, int count, int dateOrder)
- throws Exception;
+ throws StorageException;
/**
* Retrieve element count specific properties
@@ -153,10 +157,10 @@
* @param properties
* Matching properties needed
* @return Number of elements fund
- * @throws Exception
+ * @throws StorageException
*/
public abstract int findElementsByPropertiesCount(
- Map<String, String> properties) throws Exception;
+ Map<String, String> properties) throws StorageException;
/**
* Prepare properties for query
@@ -191,11 +195,11 @@
* @param dateOrder
* Sorting
* @return Element list
- * @throws Exception
+ * @throws StorageException
*/
public Set<MetaDataEntity> findElementsByType(String type,
boolean onlyLatest, int start, int count, int dateOrder)
- throws Exception {
+ throws StorageException {
return findElementsByProperties(getPropertiesByType(type, onlyLatest),
start, count, dateOrder);
}
@@ -208,10 +212,10 @@
* @param onlyLatest
* Only latest elements
* @return Number of elements
- * @throws Exception
+ * @throws StorageException
*/
public int findElementsByTypeCount(String type, boolean onlyLatest)
- throws Exception {
+ throws StorageException {
return findElementsByPropertiesCount(getPropertiesByType(type,
onlyLatest));
}
@@ -222,27 +226,30 @@
*
* @param queryText
* Searched text
+ * @param onlyLatest
* @param start
* Index of first element returned
* @param count
* Number of elements to return
+ * @param dateOrder
* @return Element list
- * @throws Exception
+ * @throws StorageException
*/
public abstract Set<MetaDataEntity> findElementsByContentSearch(
String queryText, boolean onlyLatest, int start, int count,
- int dateOrder) throws Exception;
+ int dateOrder) throws StorageException;
/**
* Retrieve element count with specific content
*
* @param queryText
* Searched text
+ * @param onlyLatest
* @return Number of elements fund
- * @throws Exception
+ * @throws StorageException
*/
public abstract int findElementsByContentSearchCount(String queryText,
- boolean onlyLatest) throws Exception;
+ boolean onlyLatest) throws StorageException;
// Delete
@@ -251,9 +258,9 @@
*
* @param element
* Element to delete
- * @throws Exception
+ * @throws StorageException
*/
- public void deleteElement(MetaDataEntity element) throws Exception {
+ public void deleteElement(MetaDataEntity element) throws StorageException {
deleteElement(element.getUuid(), element.getVersion());
}
@@ -264,9 +271,9 @@
* Id
* @param version
* Version
- * @throws Exception
+ * @throws StorageException
*/
public abstract void deleteElement(String uuid, Version version)
- throws Exception;
+ throws StorageException;
}
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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -57,6 +57,7 @@
import fr.cemagref.simexplorer.is.contenttype.ContentTypeFactory;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.storage.StorageException;
import fr.cemagref.simexplorer.is.storage.database.Database;
import fr.cemagref.simexplorer.is.storage.util.Config;
@@ -114,15 +115,14 @@
}
return searcherPool;
}
-
+
/**
* Retrieve searcher for a new query
*
* @return Searcher
- * @throws CorruptIndexException
* @throws IOException
*/
- private Searcher getSearcher() throws CorruptIndexException, IOException {
+ private Searcher getSearcher() throws IOException {
synchronized (searcherSynchronizer) {
// If cached searcher is null (as after an index write)
if (cachedSearcher == null) {
@@ -165,7 +165,7 @@
}
@Override
- public void open(boolean create) throws Exception {
+ public void open(boolean create) throws StorageException {
if (writer == null) {
// Create an analyzer
Analyzer analyzer = new SimpleAnalyzer();
@@ -177,43 +177,49 @@
resultFolder.mkdirs();
}
- // Base directory index
- directory = FSDirectory.getDirectory(indexDir, lockFactory);
+ try {
+ // Base directory index
+ directory = FSDirectory.getDirectory(indexDir, lockFactory);
+ // force creation if index doesn't exist
+ boolean realCreate = create;
+ if (!IndexReader.indexExists(directory)) {
+ realCreate = true;
+ }
- // force creation if index doesn't exist
- boolean realCreate = create;
- if (!IndexReader.indexExists(directory)) {
- realCreate = true;
- }
+ // Instanciate unique writer
+ writer = new IndexWriter(directory, true, analyzer, realCreate);
- // Instanciate unique writer
- writer = new IndexWriter(directory, true, analyzer, realCreate);
-
- // Write index on create
- if (realCreate) {
- commit();
+ // Write index on create
+ if (realCreate) {
+ commit();
+ }
+ } catch (IOException e) {
+ throw new StorageException(e);
}
}
}
@Override
- public void close() throws Exception {
- synchronized (writerSynchronizer) {
- // Close writer and invalidate reader
- writer.close();
- writer = null;
+ public void close() throws StorageException {
+ try {
+ synchronized (writerSynchronizer) {
+ // Close writer and invalidate reader
+ writer.close();
+ writer = null;
+ }
+ resetReader();
+ } catch (IOException e) {
+ throw new StorageException(e);
}
- resetReader();
searcherPool = null;
}
/**
* Push commit to db
*
- * @throws CorruptIndexException
* @throws IOException
*/
- private void synchedCommit() throws CorruptIndexException, IOException {
+ private void synchedCommit() throws IOException {
synchronized (writerSynchronizer) {
// Flush in ram data
writer.flush();
@@ -221,7 +227,8 @@
Date now = new Date();
long elapsed = now.getTime() - lastOptimize.getTime();
// One optimize per period, if readers are closed
- if (elapsed > optimizePeriod * 1000 && getSearcherPool().allClosed()) {
+ if (elapsed > optimizePeriod * 1000
+ && getSearcherPool().allClosed()) {
writer.optimize();
lastOptimize = new Date();
}
@@ -231,14 +238,18 @@
}
@Override
- public void commit() throws Exception {
- // Allows concurent access
- synchedCommit();
+ public void commit() throws StorageException {
+ try {
+ // Allows concurent access
+ synchedCommit();
+ } catch (IOException e) {
+ throw new StorageException(e);
+ }
}
@Override
public void insertElement(MetaDataEntity element, List<Reader> readers)
- throws Exception {
+ throws StorageException {
// Save element to a Lucene document
Document document = saveLuceneElement(element, readers);
@@ -251,28 +262,36 @@
deleteElement(element);
}
- synchronized (writerSynchronizer) {
- // add document to index
- writer.addDocument(document);
+ try {
+ synchronized (writerSynchronizer) {
+ // add document to index
+ writer.addDocument(document);
+ }
+ } catch (IOException e) {
+ throw new StorageException(e);
}
}
@Override
public MetaDataEntity getElement(String uuid, Version version)
- throws Exception {
+ throws StorageException {
MetaDataEntity result = null;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- Hits hits = getHitsByIdVersion(uuid, version, searcher);
- if (hits != null && hits.length() != 0) {
- // convert first document to element
- result = loadLuceneElement(hits.doc(0));
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ Hits hits = getHitsByIdVersion(uuid, version, searcher);
+ if (hits != null && hits.length() != 0) {
+ // convert first document to element
+ result = loadLuceneElement(hits.doc(0));
+ }
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
}
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ } catch (Exception e) {
+ throw new StorageException(e);
}
return result;
@@ -298,28 +317,33 @@
}
@Override
- public List<Version> getVersions(String uuid) throws Exception {
+ public List<Version> getVersions(String uuid) throws StorageException {
// Retrieve all document corresponding to id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
List<Version> versions = null;
- // Get current searcher instance
- Searcher searcher = getSearcher();
+
try {
- Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
- // Add all versions to a list
- versions = new ArrayList<Version>();
- if (hits != null) {
- for (int i = 0; i < hits.length(); i++) {
- Document doc = hits.doc(i);
- versions.add(new Version(doc.get(KEY_VERSION)));
+ // Add all versions to a list
+ versions = new ArrayList<Version>();
+ if (hits != null) {
+ for (int i = 0; i < hits.length(); i++) {
+ Document doc = hits.doc(i);
+ versions.add(new Version(doc.get(KEY_VERSION)));
+ }
}
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
}
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ } catch (Exception e) {
+ throw new StorageException(e);
}
return versions;
@@ -327,7 +351,7 @@
@Override
public Set<MetaDataEntity> findElementsById(String uuid, boolean onlyLatest)
- throws Exception {
+ throws StorageException {
// Create hash map with id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
@@ -337,14 +361,18 @@
Set<MetaDataEntity> result = null;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
- result = convertHitsToElements(hits, 0, -1);
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
+ result = convertHitsToElements(hits, 0, -1);
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new StorageException(e);
}
// Return all elements parsed from documents fund
@@ -353,17 +381,21 @@
@Override
public int findElementsByPropertiesCount(Map<String, String> properties)
- throws Exception {
+ throws StorageException {
int result = 0;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
- result = hits.length();
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ Hits hits = findHits(properties, searcher, SORT_DATE_NONE);
+ result = hits.length();
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new StorageException(e);
}
// Return all elements parsed from documents fund
@@ -373,17 +405,21 @@
@Override
public Set<MetaDataEntity> findElementsByProperties(
Map<String, String> properties, int start, int count, int dateOrder)
- throws Exception {
+ throws StorageException {
Set<MetaDataEntity> result = null;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- Hits hits = findHits(properties, searcher, dateOrder);
- result = convertHitsToElements(hits, start, count);
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ Hits hits = findHits(properties, searcher, dateOrder);
+ result = convertHitsToElements(hits, start, count);
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new StorageException(e);
}
// Return all elements parsed from documents fund
@@ -392,21 +428,30 @@
@Override
public int findElementsByContentSearchCount(String queryText,
- boolean onlyLatest) throws Exception {
- Query query = getQueryByContentSearch(queryText, onlyLatest);
+ boolean onlyLatest) throws StorageException {
+ Query query = null;
+ try {
+ query = getQueryByContentSearch(queryText, onlyLatest);
+ } catch (ParseException e) {
+ throw new StorageException(e);
+ }
int result = 0;
Hits hits;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- hits = searcher.search(query);
- // Return hits length
- result = hits.length();
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ hits = searcher.search(query);
+ // Return hits length
+ result = hits.length();
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new StorageException(e);
}
return result;
@@ -434,21 +479,30 @@
@Override
public Set<MetaDataEntity> findElementsByContentSearch(String queryText,
boolean onlyLatest, int start, int count, int dateOrder)
- throws Exception {
- Query query = getQueryByContentSearch(queryText, onlyLatest);
+ throws StorageException {
+ Query query = null;
+ try {
+ query = getQueryByContentSearch(queryText, onlyLatest);
+ } catch (ParseException e) {
+ throw new StorageException(e);
+ }
Set<MetaDataEntity> result = null;
Hits hits;
- // Get current searcher instance
- Searcher searcher = getSearcher();
try {
- hits = searcher.search(query, getSortDate(dateOrder));
- // Convert hits to elements
- result = convertHitsToElements(hits, start, count);
- } finally {
- // Release searcher instance
- releaseSearcher(searcher);
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ hits = searcher.search(query, getSortDate(dateOrder));
+ // Convert hits to elements
+ result = convertHitsToElements(hits, start, count);
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new StorageException(e);
}
return result;
@@ -491,14 +545,19 @@
}
@Override
- public void deleteElement(String uuid, Version version) throws Exception {
+ public void deleteElement(String uuid, Version version)
+ throws StorageException {
// Delete element in db with term search
Term[] terms = new Term[2];
terms[0] = new Term(KEY_UUID, uuid);
terms[1] = new Term(KEY_VERSION, version.toString());
- synchronized (writerSynchronizer) {
- writer.deleteDocuments(terms);
+ try {
+ synchronized (writerSynchronizer) {
+ writer.deleteDocuments(terms);
+ }
+ } catch (Exception e) {
+ throw new StorageException(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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -24,6 +24,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.storage.StorageException;
public interface StorageEngine {
@@ -32,21 +33,21 @@
*
* @throws Exception
*/
- public abstract void open() throws Exception;
+ public abstract void open() throws StorageException;
/**
* Close storage
*
* @throws Exception
*/
- public abstract void close() throws Exception;
+ public abstract void close() throws StorageException;
/**
* Commit changes to storage
*
* @throws Exception
*/
- public abstract void commit() throws Exception;
+ public abstract void commit() throws StorageException;
/**
* Save an element to storage
@@ -58,7 +59,7 @@
* @throws Exception
*/
public abstract void saveElement(String token, MetaDataEntity element,
- Map<String, InputStream> attachments) throws Exception;
+ Map<String, InputStream> attachments) throws StorageException;
/**
* Retrieve an element
@@ -69,7 +70,7 @@
* @throws Exception
*/
public abstract MetaDataEntity getMetadata(String token, String uuid)
- throws Exception;
+ throws StorageException;
/**
* Retrieve versions of an element<br>
@@ -82,7 +83,7 @@
* @throws Exception
*/
public abstract List<Version> getVersions(String token, String uuid)
- throws Exception;
+ throws StorageException;
/**
* Retrieve all version of a metadata
@@ -92,7 +93,7 @@
* @return
*/
public abstract Set<MetaDataEntity> getElementVersions(String token,
- String uuid) throws Exception;
+ String uuid) throws StorageException;
/**
* Retrieve an element in a specific version
@@ -103,7 +104,7 @@
* @throws Exception
*/
public abstract MetaDataEntity getMetadata(String token, String uuid,
- Version version) throws Exception;
+ Version version) throws StorageException;
/**
* Get data associated to an element
@@ -116,7 +117,7 @@
* @throws Exception
*/
public abstract InputStream retrieveData(String token,
- MetaDataEntity entity, String field) throws Exception;
+ MetaDataEntity entity, String field) throws StorageException;
/**
* Get number of items corresponding to query
@@ -127,7 +128,7 @@
* @throws Exception
*/
public abstract int findFullTextCount(String token, String query,
- boolean onlyLatest) throws Exception;
+ boolean onlyLatest) throws StorageException;
/**
* Retrieve list of items corresponding to query
@@ -142,7 +143,7 @@
*/
public abstract MetaDataEntity[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws Exception;
+ throws StorageException;
/**
* Retrieve list of items of type wanted
@@ -157,7 +158,7 @@
*/
public abstract MetaDataEntity[] findElementsByType(String token,
String type, boolean onlyLatest, int start, int count, int dateOrder)
- throws Exception;
+ throws StorageException;
/**
* Retrieve number of items of type wanted
@@ -168,7 +169,7 @@
* @throws Exception
*/
public abstract int findElementsByTypeCount(String token, String type,
- boolean onlyLatest) throws Exception;
+ boolean onlyLatest) throws StorageException;
/**
* Delete elements
@@ -177,7 +178,7 @@
* @throws Exception
*/
public abstract void deleteElements(String token, String uuid)
- throws Exception;
+ throws StorageException;
/**
* Delete one element
@@ -187,7 +188,7 @@
* @throws Exception
*/
public abstract void deleteElement(String token, String uuid,
- Version version) throws Exception;
+ Version version) throws StorageException;
/**
* Store temporary data, for stream duplication
@@ -197,7 +198,7 @@
* @return id for retrieval
* @throws Exception
*/
- public abstract String storeTempData(InputStream stream) throws Exception;
+ public abstract String storeTempData(InputStream stream) throws StorageException;
/**
* Retrieve temporary data
@@ -207,7 +208,7 @@
* @return Data stream
* @throws Exception
*/
- public abstract InputStream retrieveTempData(String id) throws Exception;
+ public abstract InputStream retrieveTempData(String id) throws StorageException;
/**
* Delete temporary data
@@ -215,6 +216,6 @@
* @param id
* @throws Exception
*/
- public abstract void deleteTempData(String id) throws Exception;
+ public abstract void deleteTempData(String id) throws StorageException;
}
\ 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-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -29,6 +29,7 @@
import fr.cemagref.simexplorer.is.contenttype.ContentType;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.storage.StorageException;
import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler;
import fr.cemagref.simexplorer.is.storage.attachment.FileSystemAttachmentHandler;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -75,21 +76,21 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#open()
*/
- public void open() throws Exception {
+ public void open() throws StorageException {
database.open();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#close()
*/
- public void close() throws Exception {
+ public void close() throws StorageException {
database.close();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#commit()
*/
- public void commit() throws Exception {
+ public void commit() throws StorageException {
database.commit();
}
@@ -99,7 +100,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#saveElement(fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity, java.util.Map)
*/
public void saveElement(String token, MetaDataEntity element,
- Map<String, InputStream> attachments) throws Exception {
+ Map<String, InputStream> attachments) throws StorageException {
// Save all attachments in system
for (Map.Entry<String, InputStream> entry : attachments.entrySet()) {
@@ -116,9 +117,13 @@
if (element.getAttachments() != null) {
ContentType contentType = element.getAttachments().get(field);
if (contentType != null) {
- // Transform stream into indexable text
- Reader reader = contentType.renderToText(content);
- readers.add(reader);
+ try {
+ // Transform stream into indexable text
+ Reader reader = contentType.renderToText(content);
+ readers.add(reader);
+ } catch (Exception e) {
+ throw new StorageException(e);
+ }
}
}
}
@@ -141,7 +146,8 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String)
*/
- public MetaDataEntity getMetadata(String token, String uuid) throws Exception {
+ public MetaDataEntity getMetadata(String token, String uuid)
+ throws StorageException {
MetaDataEntity mde = null;
Set<MetaDataEntity> set = database.findElementsById(uuid, true);
if (!set.isEmpty()) {
@@ -153,7 +159,8 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getVersions(java.lang.String)
*/
- public List<Version> getVersions(String token, String uuid) throws Exception {
+ public List<Version> getVersions(String token, String uuid)
+ throws StorageException {
return database.getVersions(uuid);
}
@@ -161,7 +168,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
public MetaDataEntity getMetadata(String token, String uuid, Version version)
- throws Exception {
+ throws StorageException {
MetaDataEntity mde = database.getElement(uuid, version);
return mde;
}
@@ -169,8 +176,8 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveData(fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity, java.lang.String)
*/
- public InputStream retrieveData(String token, MetaDataEntity entity, String field)
- throws Exception {
+ public InputStream retrieveData(String token, MetaDataEntity entity,
+ String field) throws StorageException {
InputStream result = attachmentHandler.retrieveData(entity, field);
return result;
}
@@ -179,15 +186,16 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean)
*/
public int findFullTextCount(String token, String query, boolean onlyLatest)
- throws Exception {
+ throws StorageException {
return database.findElementsByContentSearchCount(query, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullText(java.lang.String, boolean, int, int, int)
*/
- public MetaDataEntity[] findFullText(String token, String query, boolean onlyLatest,
- int indexStart, int count, int dateOrder) throws Exception {
+ public MetaDataEntity[] findFullText(String token, String query,
+ boolean onlyLatest, int indexStart, int count, int dateOrder)
+ throws StorageException {
MetaDataEntity[] result = database.findElementsByContentSearch(query,
onlyLatest, indexStart, count, dateOrder).toArray(
new MetaDataEntity[0]);
@@ -197,8 +205,9 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findElementsByType(java.lang.String, boolean, int, int, int)
*/
- public MetaDataEntity[] findElementsByType(String token, String type, boolean onlyLatest,
- int start, int count, int dateOrder) throws Exception {
+ public MetaDataEntity[] findElementsByType(String token, String type,
+ boolean onlyLatest, int start, int count, int dateOrder)
+ throws StorageException {
MetaDataEntity[] result = database.findElementsByType(type, onlyLatest,
start, count, dateOrder).toArray(new MetaDataEntity[0]);
return result;
@@ -207,8 +216,8 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findElementsByTypeCount(java.lang.String, boolean)
*/
- public int findElementsByTypeCount(String token, String type, boolean onlyLatest)
- throws Exception {
+ public int findElementsByTypeCount(String token, String type,
+ boolean onlyLatest) throws StorageException {
return database.findElementsByTypeCount(type, onlyLatest);
}
@@ -217,7 +226,8 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElements(java.lang.String)
*/
- public void deleteElements(String token, String uuid) throws Exception {
+ public void deleteElements(String token, String uuid)
+ throws StorageException {
List<Version> versions = getVersions(token, uuid);
for (Version version : versions) {
deleteElement(token, uuid, version);
@@ -227,7 +237,8 @@
/* (non-Javadoc)
* @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 Exception {
+ public void deleteElement(String token, String uuid, Version version)
+ throws StorageException {
MetaDataEntity element = getMetadata(token, uuid, version);
Map<String, ContentType> attachments = element.getAttachments();
for (Map.Entry<String, ContentType> entry : attachments.entrySet()) {
@@ -241,7 +252,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.io.InputStream)
*/
- public String storeTempData(InputStream stream) throws Exception {
+ public String storeTempData(InputStream stream) throws StorageException {
String id = UUID.randomUUID().toString();
attachmentHandler.storeData(mdTmp, id, stream);
return id;
@@ -250,7 +261,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveTempData(java.lang.String)
*/
- public InputStream retrieveTempData(String id) throws Exception {
+ public InputStream retrieveTempData(String id) throws StorageException {
InputStream is = attachmentHandler.retrieveData(mdTmp, id);
return is;
}
@@ -258,11 +269,12 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteTempData(java.lang.String)
*/
- public void deleteTempData(String id) throws Exception {
+ public void deleteTempData(String id) throws StorageException {
attachmentHandler.deleteData(mdTmp, id);
}
- public Set<MetaDataEntity> getElementVersions(String token, String uuid) throws Exception {
+ public Set<MetaDataEntity> getElementVersions(String token, String uuid)
+ throws StorageException {
return database.findElementsById(uuid, false);
}
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/util/Config.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/util/Config.java 2008-01-24 18:00:06 UTC (rev 504)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/util/Config.java 2008-01-24 18:00:48 UTC (rev 505)
@@ -26,7 +26,6 @@
public class Config {
- /** to use log facility, just put in your code: log.info(\"...\"); */
private static final Log log = LogFactory.getLog(Config.class);
private static Properties properties = null;
@@ -34,7 +33,7 @@
private static void initProperties() throws IOException {
log.info("Loading properties");
-
+
properties = new Properties();
URL inClasspath = ClassLoader.getSystemClassLoader().getResource(
1
0
r504 - trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service
by glandais@users.labs.libre-entreprise.org 24 Jan '08
by glandais@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: glandais
Date: 2008-01-24 18:00:06 +0000 (Thu, 24 Jan 2008)
New Revision: 504
Modified:
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
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
Log:
retrieve data & get versions
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-01-24 17:58:21 UTC (rev 503)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-01-24 18:00:06 UTC (rev 504)
@@ -18,19 +18,20 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
import com.healthmarketscience.rmiio.RemoteInputStream;
import com.healthmarketscience.rmiio.RemoteOutputStream;
+
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
/** @author tony */
public class MockStorageServiceImpl implements StorageService {
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-01-24 17:58:21 UTC (rev 503)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-01-24 18:00:06 UTC (rev 504)
@@ -26,6 +26,7 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
+import fr.cemagref.simexplorer.is.entities.metadata.Version;
/**
* Service interface
@@ -205,4 +206,17 @@
*/
MetaDataEntity[] getVersions(String token, String uuid) throws Exception;
+ /**
+ * @param token
+ * @param uuid
+ * @param version
+ */
+// void deleteElement(String token, String uuid, Version version);
+
+ /**
+ * @param token
+ * @param uuid
+ */
+// void deleteElement(String token, String uuid);
+
}
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-01-24 17:58:21 UTC (rev 503)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-01-24 18:00:06 UTC (rev 504)
@@ -32,14 +32,4 @@
return null;
}
- public RemoteInputStream retrieveData(String token, String uuid, String version, String dataKey) throws Exception {
- //TODO
- return null;
- }
-
- public MetaDataEntity[] getVersions(String token, String uuid) throws Exception {
- //TODO
- return new MetaDataEntity[0];
- }
-
}
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-01-24 17:58:21 UTC (rev 503)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-01-24 18:00:06 UTC (rev 504)
@@ -29,14 +29,15 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.healthmarketscience.rmiio.RemoteInputStream;
import com.healthmarketscience.rmiio.RemoteInputStreamClient;
+import com.healthmarketscience.rmiio.RemoteInputStreamServer;
import com.healthmarketscience.rmiio.RemoteOutputStream;
import com.healthmarketscience.rmiio.RemoteOutputStreamClient;
+import com.healthmarketscience.rmiio.SimpleRemoteInputStream;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
@@ -172,6 +173,15 @@
return saveElement(token, idxml, idsattachment);
}
+ public RemoteInputStream retrieveData(String token, String uuid,
+ String version, String dataKey) throws Exception {
+ MetaDataEntity mde = getMetadata(token, uuid, version);
+ InputStream stream = storageEngine.retrieveData(token, mde, dataKey);
+ RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream(
+ stream);
+ return remoteStream.export();
+ }
+
public void exportElement(String token, RemoteOutputStream xmlOutputStream, String uuid,
String version) throws Exception {
MetaDataEntity mde = getMetadata(token, uuid, version);
@@ -340,4 +350,8 @@
}
+ public MetaDataEntity[] getVersions(String token, String uuid) throws Exception {
+ Set<MetaDataEntity> versions = storageEngine.getElementVersions(token, uuid);
+ return versions.toArray(new MetaDataEntity[versions.size()]);
+ }
}
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-01-24 17:58:21 UTC (rev 503)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-01-24 18:00:06 UTC (rev 504)
@@ -54,14 +54,4 @@
return token;
}
- public RemoteInputStream retrieveData(String token, String uuid, String version, String dataKey) throws Exception {
- //TODO
- return null;
- }
-
- public MetaDataEntity[] getVersions(String token, String uuid) throws Exception {
- //TODO
- return new MetaDataEntity[0];
- }
-
}
1
0
Author: glandais
Date: 2008-01-24 17:58:21 +0000 (Thu, 24 Jan 2008)
New Revision: 503
Modified:
trunk/simexplorer-is-ear/pom.xml
Log:
WAR in EAR
Modified: trunk/simexplorer-is-ear/pom.xml
===================================================================
--- trunk/simexplorer-is-ear/pom.xml 2008-01-24 14:43:26 UTC (rev 502)
+++ trunk/simexplorer-is-ear/pom.xml 2008-01-24 17:58:21 UTC (rev 503)
@@ -48,6 +48,12 @@
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
</dependency>
+ <dependency>
+ <groupId>simexplorer-is</groupId>
+ <artifactId>simexplorer-is-web</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
</dependencies>
</project>
1
0
r502 - trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 14:43:26 +0000 (Thu, 24 Jan 2008)
New Revision: 502
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java
Log:
implantation des actions de recherche et de reset de recherche
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java 2008-01-24 14:42:09 UTC (rev 501)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java 2008-01-24 14:43:26 UTC (rev 502)
@@ -19,7 +19,13 @@
package fr.cemagref.simexplorer.is.ui.swing.action.application;
import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab;
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
/**
* Action pour réinitialiser une recherche d'application
*
@@ -39,13 +45,40 @@
private static final long serialVersionUID = -155773498930710467L;
+
public ResetSearchApplicationAction(String name) {
super(name);
}
@Override
- public void actionPerformed(java.awt.event.ActionEvent e) {
- super.actionPerformed(e);
- //TODO
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ ListTabModel model = (ListTabModel) getModel();
+ String query = model.getQuery();
+ // only reset search if something was previously search
+ return query != null && !query.isEmpty();
}
+
+ @Override
+ protected void doAction(ActionEvent e) throws Exception {
+ super.doAction(e);
+ ListTabModel model = (ListTabModel) getModel();
+
+ // reset query in model
+ model.setQuery(null);
+
+ // a new search begins always on first page
+ model.getPagination().setFirstIndex(0);
+
+ // get data from service
+ model.updateTabModel(isRemote(), getContext());
+
+ // update table model in ui
+ JApplicationListTab container = (JApplicationListTab) getUI();
+ JTable table = container.getTable();
+ JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
+ modelTab.setData(model.getList());
+
+ // refresh ui
+ getMainUI().refreshListTabUI(model, container);
+ }
}
\ No newline at end of file
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java 2008-01-24 14:42:09 UTC (rev 501)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java 2008-01-24 14:43:26 UTC (rev 502)
@@ -18,9 +18,15 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.application;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab;
+import javax.swing.JTextField;
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
/**
* Action pour lancer une recherche d'application
*
@@ -39,9 +45,45 @@
public class SearchApplicationAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = -8537587629478588257L;
+ String query;
public SearchApplicationAction(String name) {
super(name);
}
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ JTextField uiObject = (JTextField) getUIObject("searchText");
+ query = uiObject.getText();
+ ListTabModel model = (ListTabModel) getModel();
+ return !query.isEmpty() && !query.equals(model.getQuery());
+ }
+
+ @Override
+ protected void doAction(ActionEvent e) throws Exception {
+ super.doAction(e);
+ ListTabModel model = (ListTabModel) getModel();
+ model.setQuery(query);
+
+ // a new search begins always on first page
+ model.getPagination().setFirstIndex(0);
+
+ // get data from service
+ model.updateTabModel(isRemote(), getContext());
+
+ // update table model in ui
+ JApplicationListTab container = (JApplicationListTab) getUI();
+ JTable table = container.getTable();
+ JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
+ modelTab.setData(model.getList());
+
+ // refresh ui
+ getMainUI().refreshListTabUI(model, container);
+ }
+
+ @Override
+ protected void clear() {
+ super.clear();
+ query = null;
+ }
}
\ No newline at end of file
1
0
r501 - trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 14:42:09 +0000 (Thu, 24 Jan 2008)
New Revision: 501
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
Log:
rename variable
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 14:41:52 UTC (rev 500)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 14:42:09 UTC (rev 501)
@@ -86,8 +86,8 @@
// update table model
JApplicationListTab container = (JApplicationListTab) getUI();
- JTable jApplicationTable = container.getTable();
- JApplicationTableModel modelTab = (JApplicationTableModel) jApplicationTable.getModel();
+ JTable table = container.getTable();
+ JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
modelTab.setData(model.getList());
// refresh ui
1
0
r500 - trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 14:41:52 +0000 (Thu, 24 Jan 2008)
New Revision: 500
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java
Log:
refresh search text
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java 2008-01-24 14:14:35 UTC (rev 499)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java 2008-01-24 14:41:52 UTC (rev 500)
@@ -87,6 +87,9 @@
SwingUtilities.invokeLater(new Runnable() {
public void run() {
+ // refresh search text
+ ui.getSearchText().setText(model.getQuery());
+
// refresh changePage combobox
refreshChangePageCombo(ui, model);
1
0
r499 - in trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action: . application pagination
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 14:14:35 +0000 (Thu, 24 Jan 2008)
New Revision: 499
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/AdvancedSearchApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/CollapseAllAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/DownloadAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExpandAllAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExportApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ImportApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/LaunchSynchronizeAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java
Log:
utilisation de deux constructeurs :
un pour les actions tab sp?\195?\169cique ?\195?\160 un tab (les listes typiquement)
un pour les actions tab non sp?\195?\169cifique ?\195?\160 un tab (rechercher, pagination,...)
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -45,23 +45,30 @@
protected SimExplorerAbstractTabAction(String name, String prefixPatternName) {
super(name);
- if (prefixPatternName != null) {
- Pattern patternName = Pattern.compile(prefixPatternName + "_(\\w+)");
- Matcher matcher = patternName.matcher(name);
- if (!matcher.matches()) {
- throw new IllegalArgumentException(I18n._("{0} should have a name like this {1}, but was {2}", getClass().getName(), patternName, name));
- }
+ if (prefixPatternName == null) {
+ throw new IllegalArgumentException("prefixPatternName can not be null, but was.");
+ }
- param = prefixPatternName;
+ Pattern patternName = Pattern.compile(prefixPatternName + "_(\\w+)");
+ Matcher matcher = patternName.matcher(name);
+ if (!matcher.matches()) {
+ throw new IllegalArgumentException(I18n._("{0} should have a name like this {1}, but was {2}", getClass().getName(), patternName, name));
+ }
- Converter convertorLanguage = ConverterUtil.getConverter(SimExplorerTab.class);
- tab = (SimExplorerTab) convertorLanguage.convert(SimExplorerTab.class, matcher.group(1));
- } else {
- param = name;
- }
+ param = prefixPatternName;
+
+ Converter convertorLanguage = ConverterUtil.getConverter(SimExplorerTab.class);
+ tab = (SimExplorerTab) convertorLanguage.convert(SimExplorerTab.class, matcher.group(1));
+
log.info(">>> " + this);
}
+ protected SimExplorerAbstractTabAction(String name) {
+ super(name);
+ param = name;
+ log.info(">>> " + this);
+ }
+
public String getParam() {
return param;
}
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/AdvancedSearchApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/AdvancedSearchApplicationAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/AdvancedSearchApplicationAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -18,10 +18,8 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.application;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
-import javax.swing.JComboBox;
-
/**
* Action pour réinitialiser une recherche d'application
*
@@ -36,19 +34,12 @@
mnemonic = 'v',
hideActionText = true
)
-public class AdvancedSearchApplicationAction extends SimExplorerAbstractAction {
+public class AdvancedSearchApplicationAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = -155773498930710467L;
public AdvancedSearchApplicationAction(String name) {
super(name);
- JComboBox c = null;
-
}
- @Override
- public void actionPerformed(java.awt.event.ActionEvent e) {
- super.actionPerformed(e);
- //TODO
- }
}
\ No newline at end of file
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/CollapseAllAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/CollapseAllAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/CollapseAllAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -47,7 +47,7 @@
LoggableElementTreeNode node;
public CollapseAllAction(String name) {
- super(name, null);
+ super(name);
}
@Override
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/DownloadAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/DownloadAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/DownloadAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -56,7 +56,7 @@
private static final long serialVersionUID = 7535647131305304738L;
- private static final MessageFormat FILENAME_PATTERN = new MessageFormat("{0}.xml");
+ protected static final MessageFormat FILENAME_PATTERN = new MessageFormat("{0}.xml");
JTree tree;
LoggableElementTreeNode node;
File file;
@@ -66,7 +66,7 @@
private static final int BUFFER_SIZE = 8 * 1024;
public DownloadAction(String name) {
- super(name, null);
+ super(name);
}
@Override
@@ -100,7 +100,7 @@
@Override
protected void doAction(ActionEvent e) throws Exception {
super.doAction(e);
- StorageService service = getStorageService(((DetailTabModel) getModel()).isRemote());
+ StorageService service = getContext().getStorageService(((DetailTabModel) getModel()).isRemote());
RemoteInputStream ris = service.retrieveData(getContext().getToken(), uuid, version.toString(), "_xml");
if (ris == null) {
// todo log error
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExpandAllAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExpandAllAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExpandAllAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -47,7 +47,7 @@
LoggableElementTreeNode node;
public ExpandAllAction(String name) {
- super(name, null);
+ super(name);
}
@Override
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExportApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExportApplicationAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ExportApplicationAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -30,7 +30,6 @@
import javax.swing.JTree;
import java.awt.event.ActionEvent;
import java.io.File;
-import java.text.MessageFormat;
/**
* Action pour exporter une application
@@ -50,7 +49,6 @@
private static final long serialVersionUID = 7535647131305304738L;
- private static final MessageFormat FILENAME_PATTERN = new MessageFormat("export-{0}.xml");
JTree tree;
LoggableElementTreeNode node;
File file;
@@ -59,7 +57,7 @@
Version version;
public ExportApplicationAction(String name) {
- super(name, null);
+ super(name);
}
@Override
@@ -85,7 +83,8 @@
super.doAction(e);
//TODO Where to save (if local to remote and vice-versa ?)
- StorageService service = getStorageService(((DetailTabModel) getModel()).isRemote());
+ StorageService service = getContext().getStorageService(((DetailTabModel) getModel()).isRemote());
+
service.exportElement(getContext().getToken(), null, uuid, version.toString());
}
@@ -96,7 +95,7 @@
node = null;
file = null;
element = null;
- version=null;
- uuid=null;
+ version = null;
+ uuid = null;
}
}
\ No newline at end of file
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ImportApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ImportApplicationAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ImportApplicationAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.application;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
/**
* Action de base pour importer une application
@@ -34,7 +34,7 @@
mnemonic = 'i',
hideActionText = false
)
-public class ImportApplicationAction extends SimExplorerAbstractAction {
+public class ImportApplicationAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = 3377670691203328711L;
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/LaunchSynchronizeAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/LaunchSynchronizeAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/LaunchSynchronizeAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.application;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
/**
* Action pouyr lancer la synchro
@@ -33,7 +33,7 @@
smallIcon = "action/reload.png",
hideActionText = false
)
-public class LaunchSynchronizeAction extends SimExplorerAbstractAction {
+public class LaunchSynchronizeAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = 8379937369551031306L;
@@ -41,9 +41,4 @@
super(name);
}
- @Override
- public void actionPerformed(java.awt.event.ActionEvent e) {
- super.actionPerformed(e);
- //TODO
- }
}
\ No newline at end of file
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/ResetSearchApplicationAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.application;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
/**
* Action pour réinitialiser une recherche d'application
@@ -35,7 +35,7 @@
hideActionText = true,
enabled = false
)
-public class ResetSearchApplicationAction extends SimExplorerAbstractAction {
+public class ResetSearchApplicationAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = -155773498930710467L;
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/application/SearchApplicationAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -19,6 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.action.application;
import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
/**
* Action pour lancer une recherche d'application
@@ -35,7 +36,7 @@
hideActionText = true,
enabled = false
)
-public class SearchApplicationAction extends SimExplorerAbstractAction {
+public class SearchApplicationAction extends SimExplorerAbstractTabAction {
private static final long serialVersionUID = -8537587629478588257L;
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -52,7 +52,7 @@
protected Integer newPage;
public ChangePageAction(String name) {
- super(name, null);
+ super(name);
}
@Override
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java 2008-01-24 13:51:38 UTC (rev 498)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java 2008-01-24 14:14:35 UTC (rev 499)
@@ -47,7 +47,7 @@
protected Integer newWidth;
public ChangeSizorAction(String name) {
- super(name, null);
+ super(name);
}
@Override
1
0
r498 - trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 13:51:38 +0000 (Thu, 24 Jan 2008)
New Revision: 498
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nFRAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nGBAction.java
Log:
i18n flags
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nFRAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nFRAction.java 2008-01-24 13:51:30 UTC (rev 497)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nFRAction.java 2008-01-24 13:51:38 UTC (rev 498)
@@ -27,7 +27,7 @@
shortDescription = "simexplorer.action.i18n.fr.tooltip",
longDescription = "simexplorer.action.i18n.fr.help",
mnemonic = 'F',
- //smallIcon = "action/i18n.fr.png",
+ smallIcon = "action/i18n-fr.png",
hideActionText = false
)
public class ChangeI18nFRAction extends ChangeI18nAbstractAction {
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nGBAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nGBAction.java 2008-01-24 13:51:30 UTC (rev 497)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nGBAction.java 2008-01-24 13:51:38 UTC (rev 498)
@@ -27,7 +27,7 @@
shortDescription = "simexplorer.action.i18n.en.tooltip",
longDescription = "simexplorer.action.i18n.en.help",
mnemonic = 'n',
- //smallIcon = "action/i18n-en.png",
+ smallIcon = "action/i18n-gb.png",
hideActionText = false
)
public class ChangeI18nGBAction extends ChangeI18nAbstractAction {
1
0
r497 - in trunk/simexplorer-is-swing/src/resources/icons: . action i18n
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 13:51:30 +0000 (Thu, 24 Jan 2008)
New Revision: 497
Added:
trunk/simexplorer-is-swing/src/resources/icons/action/i18n-fr.png
trunk/simexplorer-is-swing/src/resources/icons/action/i18n-gb.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/
trunk/simexplorer-is-swing/src/resources/icons/i18n/be.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/ca.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/ch.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/de.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/dk.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/es.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/fi.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/it.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/nl.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/no.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/se.png
trunk/simexplorer-is-swing/src/resources/icons/i18n/us.png
Log:
i18n flags
Added: trunk/simexplorer-is-swing/src/resources/icons/action/i18n-fr.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/action/i18n-fr.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/action/i18n-gb.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/action/i18n-gb.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/be.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/be.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/ca.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/ca.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/ch.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/ch.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/de.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/de.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/dk.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/dk.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/es.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/es.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/fi.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/fi.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/it.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/it.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/nl.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/nl.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/no.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/no.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/se.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/se.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/simexplorer-is-swing/src/resources/icons/i18n/us.png
===================================================================
(Binary files differ)
Property changes on: trunk/simexplorer-is-swing/src/resources/icons/i18n/us.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
1
0
r496 - trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
by tchemit@users.labs.libre-entreprise.org 24 Jan '08
24 Jan '08
Author: tchemit
Date: 2008-01-24 13:14:21 +0000 (Thu, 24 Jan 2008)
New Revision: 496
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java
Log:
utilisation m?\195?\169thode updateTabModel
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 13:13:23 UTC (rev 495)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangePageAction.java 2008-01-24 13:14:21 UTC (rev 496)
@@ -18,9 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.pagination;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
@@ -78,28 +76,20 @@
final ListTabModel model = (ListTabModel) getModel();
final PaginationModel pagination = model.getPagination();
- MetaDataEntity[] data;
int width = pagination.getWidth();
long newFirstIndex = newPage * width;
- //long newLastIndex = newFirstIndex + width;
- //long oldFirstindex = pagination.getFirstIndex();
- //long oldLastIndex = oldFirstindex + model.size();
+ // save new firstIndex in model
+ pagination.setFirstIndex(newFirstIndex);
- //TODO optimiser l'algo
- data = getData(getTab() == SimExplorerTab.remote, false, model.getQuery(), width, newFirstIndex, -1);
+ model.updateTabModel(isRemote(), getContext());
- // save in model
- model.setList(data);
-
+ // update table model
JApplicationListTab container = (JApplicationListTab) getUI();
JTable jApplicationTable = container.getTable();
JApplicationTableModel modelTab = (JApplicationTableModel) jApplicationTable.getModel();
- modelTab.setData(data);
+ modelTab.setData(model.getList());
- // save new firstIndex in model
- pagination.setFirstIndex(newFirstIndex);
-
// refresh ui
getMainUI().refreshListTabUI(model, container);
}
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java 2008-01-24 13:13:23 UTC (rev 495)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/pagination/ChangeSizorAction.java 2008-01-24 13:14:21 UTC (rev 496)
@@ -18,8 +18,6 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.action.pagination;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
@@ -77,28 +75,18 @@
// pour le moment, chaque retaille de fenetre repositionne
// la liste à zero pour simplifier
+ pagination.setWidth(newWidth);
+ pagination.setFirstIndex(0);
- long firstIndex = 0;
- long lastIndex = newWidth;
- if (lastIndex >= pagination.getSize()) {
- lastIndex = pagination.getSize() - 1;
- }
- int size = (int) (lastIndex - firstIndex);
+ model.updateTabModel(isRemote(), getContext());
- MetaDataEntity[] data = getData(getTab() == SimExplorerTab.remote, false, model.getQuery(), size, (int) firstIndex, -1);
- // save list
- model.setList(data);
// save in TableModel
JApplicationListTab container = (JApplicationListTab) getUI();
JTable jApplicationTable = container.getTable();
JApplicationTableModel modelTab = (JApplicationTableModel) jApplicationTable.getModel();
- modelTab.setData(data);
+ modelTab.setData(model.getList());
- // save pagination
- pagination.setWidth(newWidth);
- pagination.setFirstIndex(0);
-
// refresh ui
getMainUI().refreshListTabUI(model, container);
}
1
0