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
February 2008
- 2 participants
- 701 discussions
r1015 - trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 14:54:21 +0000 (Sat, 16 Feb 2008)
New Revision: 1015
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java
Log:
ajout d'un helper avec deux enums : une pour definir les libelles des Entities (Type) et une autre pour definir le mapping des actions sur les loggableElement (Action)
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java 2008-02-16 14:54:21 UTC (rev 1015)
@@ -0,0 +1,161 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, 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.entities;
+
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import static org.codelutin.i18n.I18n._;
+import static org.codelutin.i18n.I18n.n_;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Une classe utilitaires pour les Entities du projet.
+ *
+ * @author chemit
+ */
+public class EntityHelper {
+ /**
+ * Une enum pour definir les differents typed'entities rencontres dans le projet.
+ * <p/>
+ * On ajoute ici une clef i18n pour pouvoir traduire plus tard ces types.
+ * <p/>
+ * Note: on n'utilise pas directement les traductions pour permettre le mécanisme
+ * de changement de langue (voir module swing et web).
+ *
+ * @author chemit
+ */
+ public static enum Type {
+ Attachment(n_("simexplorer.common.attachment"), n_("simexplorer.common.attachments")),
+ Code(n_("simexplorer.common.code"), n_("simexplorer.common.codes")),
+ Component(n_("simexplorer.common.component"), n_("simexplorer.common.components")),
+ Constant(n_("simexplorer.common.constant"), n_("simexplorer.common.constants")),
+ ConstantValue(n_("simexplorer.common.constantvalue"), n_("simexplorer.common.constantvalues")),
+ ExplorationApplication(n_("simexplorer.common.explorationapplication"), n_("simexplorer.common.explorationapplications")),
+ ExplorationData(n_("simexplorer.common.explorationdata"), n_("simexplorer.common.explorationdatas")),
+ Library(n_("simexplorer.common.library"), n_("simexplorer.common.libraries")),
+ Repository(n_("simexplorer.common.repository"), n_("simexplorer.common.repositories")),
+ Result(n_("simexplorer.common.result"), n_("simexplorer.common.results")),
+ Structure(n_("simexplorer.common.structure"), n_("simexplorer.common.structures"));
+
+ private String i18nKey;
+ private String i18nKeys;
+
+ public static String getLibelle(Object entity) {
+ if (entity == null) {
+ return "";
+ }
+ if (entity instanceof LoggableElement) {
+ return getLibelle((LoggableElement) entity);
+ }
+ return getLibelle(entity.getClass().getSimpleName());
+ }
+
+ public static String getLibelle(LoggableElement element) {
+ return element == null ? "" : getLibelle(element.getMetaData());
+ }
+
+ public static String getLibelle(MetaData data) {
+ return data == null ? "" : getLibelle(data.getType());
+ }
+
+ public String getLibelle() {
+ return _(i18nKey);
+ }
+
+ public String getLibelles() {
+ return _(i18nKeys);
+ }
+
+ protected static String getLibelle(String type) {
+ if (type != null) {
+ try {
+ Type type1 = Type.valueOf(type);
+ return type1.getLibelle();
+ } catch (IllegalArgumentException e) {
+ //TODO log it
+ System.err.println(e.getMessage());
+ }
+ }
+ return "";
+ }
+
+ private Type(String i18nKey, String i18nKeys) {
+ this.i18nKey = i18nKey;
+ this.i18nKeys = i18nKeys;
+ }
+ }
+
+ /**
+ * Une énumération pour définir les actions possibles sur les entités du
+ * projet.
+ *
+ * @author chemit
+ */
+ public static enum Action {
+
+ DOWNLOAD(ExplorationApplication.class, Result.class, Library.class),
+ EXPORT(ExplorationApplication.class, Result.class, Library.class),
+ IMPORT(ExplorationApplication.class, Library.class),
+ DELETE(ExplorationApplication.class, ExplorationData.class, Component.class);
+
+ private List<Class<?>> classes;
+ private List<String> types;
+
+ public boolean accept(DefaultMutableTreeNode node) {
+ return node != null && node.getUserObject() != null &&
+ accept(node.getUserObject().getClass());
+ }
+
+ public boolean accept(LoggableElement sNode) {
+ return sNode != null && accept(sNode.getClass());
+ }
+
+ public boolean accept(MetaData metaData) {
+ return metaData != null && accept(metaData.getType());
+ }
+
+ private Action(Class<?>... classes) {
+ this.classes = Arrays.asList(classes);
+ this.types = new ArrayList<String>(classes.length);
+ for (Class<?> aClass : classes) {
+ this.types.add(aClass.getSimpleName());
+ }
+ }
+
+ private boolean accept(Class<?> klass) {
+ return classes.contains(klass);
+ }
+
+ private boolean accept(String type) {
+ return types.contains(type);
+ }
+ }
+
+ protected EntityHelper() {
+ // no instance
+ }
+}
1
0
r1014 - trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 09:39:37 +0000 (Sat, 16 Feb 2008)
New Revision: 1014
Modified:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
Log:
ajout toString a Result
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 09:37:30 UTC (rev 1013)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 09:39:37 UTC (rev 1014)
@@ -19,12 +19,14 @@
import java.io.Serializable;
-/**
- * The Class Result.
- */
+/** The Class Result. */
public class Result extends DataEntity implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 2111484866027162494L;
+ @Override
+ public String toString() {
+ return "Result " + Math.abs(hashCode());
+ }
}
1
0
r1013 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 09:37:30 +0000 (Sat, 16 Feb 2008)
New Revision: 1013
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
Log:
un commit a ecrase des modifs...
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 18:02:15 UTC (rev 1012)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-16 09:37:30 UTC (rev 1013)
@@ -18,28 +18,17 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
-import static fr.cemagref.simexplorer.is.factories.XmlConstants.FILE_DATA_PREFIX;
-import static fr.cemagref.simexplorer.is.factories.XmlConstants.FILE_XML;
-import static fr.cemagref.simexplorer.is.factories.XmlConstants.FOLDER_SEPARATOR;
-
-import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-
-import org.codelutin.util.ZipStreamEncoder;
-
import com.healthmarketscience.rmiio.SerializableInputStream;
-
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.SortedMap;
+
/**
* The Class MockStorageServiceImpl.
*
@@ -49,8 +38,6 @@
protected MockDatabase base;
- private Attachment xmlAttachment;
-
private boolean remote;
public MockStorageServiceImpl(boolean remote) {
@@ -73,7 +60,7 @@
}
public MetaData saveElement(String token,
- SerializableInputStream xmlRemoteStream,
+ SerializableInputStream xmlRemoteStream,
Map<Attachment, SerializableInputStream> attachmentsRemoteStream)
throws SimExplorerException {
return (MetaData) checkImplemented();
@@ -129,61 +116,6 @@
return null;
}
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.StorageService#exportFull(java.lang.String, java.lang.String, java.lang.String)
- */
- public InputStream downloadElementFull(String token, String uuid,
- String version) throws SimExplorerException {
- LoggableElement element = getLoggableElement(token, uuid, version);
- try {
- PipedOutputStream pipedOut = new PipedOutputStream();
- Map<String, InputStream> files = new HashMap<String, InputStream>();
- files.put(FILE_XML, downloadElementData(token, uuid, version, getXMLAttachment()));
- List<LoggableElement> children = element.getChildren();
- for (LoggableElement loggableElement : children) {
- MetaData thisMde = loggableElement.getMetaData();
- List<Attachment> attachments;
- attachments = loggableElement.getMetaData().getAttachments();
- for (Attachment attachment : attachments) {
- files.put(FILE_DATA_PREFIX + FOLDER_SEPARATOR + attachment.getUniqueId(),
- retrieveElementData(token, thisMde.getUuid(), thisMde.getVersion().toString(), attachment));
- }
- }
- PipedInputStream pipedIn = new PipedInputStream(pipedOut);
- ZipStreamEncoder zse = new ZipStreamEncoder(files, pipedOut);
- zse.start();
- return pipedIn;
- } catch (Exception e) {
- throw new SimExplorerException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.StorageService#retrieveData(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- public InputStream downloadElementData(String token, String uuid, String version, Attachment attachment) throws SimExplorerException {
- LoggableElement element = getLoggableElement(token, uuid, version);
-
- try {
- ElementGenerator.RandomStream stream = base.generateTextStream();
- String md5 = stream.getMd5();
- attachment.setDataHash(md5);
- MockDatabase.log.info("setMd5 " + md5 + " for " + element);
- return stream.getStream();
- } catch (Exception e) {
- throw new SimExplorerException(e);
- }
- }
-
- private Attachment getXMLAttachment() {
- if (xmlAttachment == null) {
- xmlAttachment = new Attachment();
- xmlAttachment.setDataHash("");
- xmlAttachment.setFileName("entity.xml");
- }
- return xmlAttachment;
- }
-
public int findFullTextCount(String token, String query, boolean onlyLatest)
throws SimExplorerException {
// TODO Changer
1
0
r1012 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service 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-swing/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages simexplorer-is-web/src/main/webapp simexplorer-is-web/src/main/webapp/WEB-INF
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 18:02:15 +0000 (Fri, 15 Feb 2008)
New Revision: 1012
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml
trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties
Log:
Element hierarchy : bug fix on duplicating, changed "Used" by "UsedBy"
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -126,7 +126,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException;
+ MetaData[] getMetadatasUsedBy(String token, String uuid, String version) throws SimExplorerException;
/**
* Gets the metadatas using the element.
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -95,11 +95,11 @@
}
/* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsed(java.lang.String, java.lang.String, java.lang.String)
+ * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsedBy(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException {
- return getStorageEngine().getMetadatasUsed(token, uuid, new Version(version));
+ public MetaData[] getMetadatasUsedBy(String token, String uuid, String version) throws SimExplorerException {
+ return getStorageEngine().getMetadatasUsedBy(token, uuid, new Version(version));
}
/* (non-Javadoc)
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -960,7 +960,7 @@
throw new SimExplorerTechnicalException(e);
}
- Set<MetaData> elementsUsedByFrom = getElementsUsedBy(fromElement);
+ Set<MetaData> elementsUsedByFrom = getElementsUsing(fromElement);
for (MetaData elementUsed : elementsUsedByFrom) {
saveElementHierarchy(toElement, elementUsed);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -163,7 +163,7 @@
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract MetaData[] getMetadatasUsed(String token, String uuid, Version version)
+ public abstract MetaData[] getMetadatasUsedBy(String token, String uuid, Version version)
throws SimExplorerException;
/**
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -185,7 +185,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadatasUsed(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, Version version) throws SimExplorerException {
+ public MetaData[] getMetadatasUsedBy(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde = database.getElement(uuid, version);
Set<MetaData> elements = database.getElementsUsedBy(mde);
return elements.toArray(new MetaData[elements.size()]);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -297,7 +297,7 @@
}
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException {
+ public MetaData[] getMetadatasUsedBy(String token, String uuid, String version) throws SimExplorerException {
checkImplemented();
return null;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 18:02:15 UTC (rev 1012)
@@ -81,8 +81,8 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public MetaData[] getElementsUsed() throws SimExplorerException {
- return RemoteStorageService.getStorageService().getMetadatasUsed(getToken(), getMetadata().getUuid(),
+ public MetaData[] getElementsUsedBy() throws SimExplorerException {
+ return RemoteStorageService.getStorageService().getMetadatasUsedBy(getToken(), getMetadata().getUuid(),
getMetadata().getVersion().toString());
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml 2008-02-15 18:02:15 UTC (rev 1012)
@@ -10,11 +10,10 @@
</table>
<p>
- <h2>${message:simexplorer.ui.web.metadata.usedby}</h2>
+ <h2>${message:simexplorer.ui.web.metadata.using}</h2>
</p>
-
- <table t:type="Grid" source="elementsUsed" row="element" model="model">
+ <table t:type="Grid" source="elementsUsing" row="element" model="model">
<t:parameter name="uuidCell">
<t:actionlink t:id="detailElementUsed"
context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink>
@@ -22,11 +21,11 @@
</table>
<p>
- <h2>${message:simexplorer.ui.web.metadata.using}</h2>
+ <h2>${message:simexplorer.ui.web.metadata.usedby}</h2>
</p>
- <table t:type="Grid" source="elementsUsing" row="element" model="model">
+ <table t:type="Grid" source="elementsUsedBy" row="element" model="model">
<t:parameter name="uuidCell">
<t:actionlink t:id="detailElementUsing"
context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink>
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties 2008-02-15 17:58:44 UTC (rev 1011)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties 2008-02-15 18:02:15 UTC (rev 1012)
@@ -109,9 +109,9 @@
simexplorer.ui.web.elementlist.details=Details
-simexplorer.ui.web.metadata.properties=Properties
-simexplorer.ui.web.metadata.usedby=This element is used by
-simexplorer.ui.web.metadata.using=This element is using
+simexplorer.ui.web.metadata.properties=Propriétés
+simexplorer.ui.web.metadata.usedby=Cet élément est utilisé par
+simexplorer.ui.web.metadata.using=Cet élément utilise
simexplorer.ui.web.metadata.action=Metadonnées
simexplorer.ui.web.metadata.uuid=UUID
simexplorer.ui.web.metadata.version=Version
1
0
15 Feb '08
Author: tchemit
Date: 2008-02-15 17:58:44 +0000 (Fri, 15 Feb 2008)
New Revision: 1011
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerRuntimeException.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerRuntimeException.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabFactory.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/AboutAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HelpAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SiteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/DeleteAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java
Log:
runtime exception moved with other ones
Copied: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerRuntimeException.java (from rev 1009, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerRuntimeException.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerRuntimeException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerRuntimeException.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -0,0 +1,43 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, 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.exceptions;
+
+/**
+ * RuntimeException de base.
+ *
+ * @author chemit
+ */
+public class SimExplorerRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = -4412747043461741154L;
+
+ public SimExplorerRuntimeException() {
+ }
+
+ public SimExplorerRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+ public SimExplorerRuntimeException(String message) {
+ super(message);
+ }
+
+ public SimExplorerRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -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.VersionGenerator;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -27,6 +27,7 @@
import fr.cemagref.simexplorer.is.ui.swing.util.ErrorDialog;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import org.codelutin.i18n.I18n;
import org.codelutin.option.ui.ConfigTableModel;
import org.codelutin.option.ui.ConfigUI;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -21,6 +21,7 @@
import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfig;
import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfigFile;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import org.codelutin.i18n.CountryEnum;
import org.codelutin.i18n.I18n;
import static org.codelutin.i18n.I18n._;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -19,6 +19,7 @@
package fr.cemagref.simexplorer.is.ui;
import fr.cemagref.simexplorer.is.ui.actions.SimExplorerCommonActions;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.option.ParserException;
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerRuntimeException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerRuntimeException.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerRuntimeException.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -1,43 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, 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.ui;
-
-/**
- * RuntimeException de base.
- *
- * @author chemit
- */
-public class SimExplorerRuntimeException extends RuntimeException {
- private static final long serialVersionUID = -4412747043461741154L;
-
- public SimExplorerRuntimeException() {
- }
-
- public SimExplorerRuntimeException(Throwable cause) {
- super(cause);
- }
-
- public SimExplorerRuntimeException(String message) {
- super(message);
- }
-
- public SimExplorerRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -38,6 +38,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.service.MockStorageServiceImpl;
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.service.StorageServiceClient;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.builder.ActionFactory;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabFactory.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabFactory.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.ui.SimExplorer;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.swing.util.MyTabHeader;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.swing.JAXXTab;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/AboutAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/AboutAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/AboutAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import java.awt.event.ActionEvent;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -27,7 +27,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper;
import fr.cemagref.simexplorer.is.service.StorageService;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.LoginUI;
import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HelpAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HelpAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HelpAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import java.awt.event.ActionEvent;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SiteAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SiteAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SiteAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import java.awt.event.ActionEvent;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/DeleteAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/DeleteAbstractAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/DeleteAbstractAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -21,7 +21,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import static org.codelutin.i18n.I18n._;
import javax.swing.JOptionPane;
import java.awt.event.ActionEvent;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -21,7 +21,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java 2008-02-15 17:53:06 UTC (rev 1010)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java 2008-02-15 17:58:44 UTC (rev 1011)
@@ -28,7 +28,7 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.data.Result;
import fr.cemagref.simexplorer.is.entities.data.Structure;
-import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import static org.codelutin.i18n.I18n._;
import javax.swing.JTree;
1
0
r1010 - trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 17:53:06 +0000 (Fri, 15 Feb 2008)
New Revision: 1010
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
Log:
i18n pour les filtres
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-15 17:37:21 UTC (rev 1009)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-15 17:53:06 UTC (rev 1010)
@@ -115,7 +115,9 @@
simexplorer.action.unconnect.help=
simexplorer.action.unconnect.tooltip=Disconnect from remote server
simexplorer.change.config.property=
+simexplorer.choose.applicationexploration=Choose a application's exploration (*.zip)
simexplorer.choose.import.label=Import type
+simexplorer.choose.library=Choose a library file (*.?)
simexplorer.common.apply=Apply
simexplorer.common.cancel=Cancel
simexplorer.common.close=Close
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-15 17:37:21 UTC (rev 1009)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-15 17:53:06 UTC (rev 1010)
@@ -115,7 +115,9 @@
simexplorer.action.unconnect.help=
simexplorer.action.unconnect.tooltip=Se d\u00E9connecter du serveur distant
simexplorer.change.config.property=
+simexplorer.choose.applicationexploration=Choisir une exploration d'application (*.zip)
simexplorer.choose.import.label=Type d'\u00E9l\u00E9ment \u00E0 importer
+simexplorer.choose.library=Choisir une librairie (*.?)
simexplorer.common.apply=Appliquer
simexplorer.common.cancel=Annuler
simexplorer.common.close=Fermer
1
0
r1009 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing/actions uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 17:37:21 +0000 (Fri, 15 Feb 2008)
New Revision: 1009
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx
Log:
import action
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java 2008-02-15 17:03:52 UTC (rev 1008)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java 2008-02-15 17:37:21 UTC (rev 1009)
@@ -25,6 +25,8 @@
import java.awt.event.ActionEvent;
import java.io.File;
+import java.util.Map;
+import java.util.TreeMap;
import static org.codelutin.i18n.I18n.*;
@@ -48,10 +50,13 @@
protected File f;
protected Boolean remote;
private static final long serialVersionUID = 3377670691203328711L;
+ private Map<String, String[]> filters;
public ImportAction(String name) {
super(name);
- ui = new ImportDialog(getMainUI());
+ filters = new TreeMap<String,String[]>();
+ filters.put("ApplicationExploration",new String[]{".*.zip$",_("simexplorer.choose.applicationexploration")});
+ filters.put("Library",new String[]{".*.zip$",_("simexplorer.choose.library")});
}
public void disposeUI() {
@@ -94,7 +99,7 @@
protected ImportDialog getUi(Boolean remote) {
if (ui == null) {
- ui = new ImportDialog(getMainUI());
+ ui = new ImportDialog(getMainUI(),filters);
}
ui.setTitle(remote? _("simexplorer.action.import.remote.tooltip"):_("simexplorer.action.import.local.tooltip"));
ui.getTypeImport().setSelected(ui.getSelected().getModel(),true);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx 2008-02-15 17:03:52 UTC (rev 1008)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx 2008-02-15 17:37:21 UTC (rev 1009)
@@ -19,24 +19,30 @@
return f;
}
+private java.util.Map<String, String[]> filters;
+
protected void chooseDir() {
- File dir= org.codelutin.util.FileUtil.getFile(new String[0]);
+ String type = (String) getTypeImport().getSelectedValue();
+ String[] filter = this.filters.get(type);
+ File dir= org.codelutin.util.FileUtil.getFile(filter==null?null:filter);
if (dir!=null) {
filePath.setText(dir.toString());
}
}
-public ImportDialog(JFrame frame) {
+protected void check() {
+ String t = filePath.getText();
+ java.io.File f = new File(t);
+ ok.setEnabled(!t.equals("") && f.exists() && f.isFile());
+}
+
+public ImportDialog(JFrame frame,java.util.Map<String,String[]> filters) {
super(frame,true);
JRootPane rootPane = getRootPane();
rootPane.setDefaultButton(ok);
rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),"cancel");
- rootPane.getActionMap().put("cancel", cancelAction);
+ rootPane.getActionMap().put("cancel", cancelAction);
+ this.filters = filters;
}
-protected void check() {
- String t = filePath.getText();
- java.io.File f = new File(t);
- ok.setEnabled(!t.equals("") && f.exists() && f.isFile());
-}
</script>
<Table>
<row fill='vertical'>
1
0
r1008 - in trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web: . grid pages pages/security services
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 17:03:52 +0000 (Fri, 15 Feb 2008)
New Revision: 1008
Removed:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java
Modified:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java
Log:
Web exception handling
Deleted: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -1,67 +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.ui.web;
-
-/**
- * The Class SimExplorerWebException.
- */
-public class SimExplorerWebException extends RuntimeException {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 4644835311729988659L;
-
- /**
- * Instantiates a new sim explorer web exception.
- */
- public SimExplorerWebException() {
- super();
- }
-
- /**
- * Instantiates a new sim explorer web exception.
- *
- * @param cause
- * the cause
- */
- public SimExplorerWebException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sim explorer web exception.
- *
- * @param message
- * the message
- */
- public SimExplorerWebException(String message) {
- super(message);
- }
-
- /**
- * Instantiates a new sim explorer web exception.
- *
- * @param message
- * the message
- * @param cause
- * the cause
- */
- public SimExplorerWebException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -22,7 +22,6 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
/**
@@ -84,7 +83,7 @@
.findFullTextCount(token, query, false);
}
} catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ throw new RuntimeException(e);
}
return result;
}
@@ -131,7 +130,7 @@
1 + endIndex - startIndex, dateOrder);
}
} catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ throw new RuntimeException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -20,7 +20,6 @@
import org.apache.tapestry.annotations.InjectPage;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
/**
@@ -36,15 +35,11 @@
* On action from confirm.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromConfirm() {
- try {
- RemoteStorageService.getStorageService().deleteElement(getToken(),
- getMetadata().getUuid(),
- getMetadata().getVersion().toString());
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onActionFromConfirm() throws SimExplorerException {
+ RemoteStorageService.getStorageService().deleteElement(getToken(), getMetadata().getUuid(),
+ getMetadata().getVersion().toString());
return elementDetail;
}
@@ -52,14 +47,10 @@
* On action from confirm all.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromConfirmAll() {
- try {
- RemoteStorageService.getStorageService().deleteElement(getToken(),
- getMetadata().getUuid());
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onActionFromConfirmAll() throws SimExplorerException {
+ RemoteStorageService.getStorageService().deleteElement(getToken(), getMetadata().getUuid());
return elementDetail;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -33,7 +33,7 @@
import fr.cemagref.simexplorer.is.entities.data.Library;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
import fr.cemagref.simexplorer.is.ui.web.tools.AttachmentStreamResponse;
import fr.cemagref.simexplorer.is.ui.web.tools.XMLAttachment;
@@ -56,22 +56,17 @@
* On action from download xml.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDownloadXML() {
+ public Object onActionFromDownloadXML() throws SimExplorerException {
Object response;
MetaData mde = getMetadata();
- try {
- InputStream stream = RemoteStorageService.getStorageService()
- .retrieveElementXML(getToken(), mde.getUuid(),
- mde.getVersion().toString());
- response = new XMLAttachment(stream, mde.getType() + "."
- + mde.getUuid() + ".v" + mde.getVersion());
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
- }
+ InputStream stream = RemoteStorageService.getStorageService().retrieveElementXML(getToken(), mde.getUuid(),
+ mde.getVersion().toString());
+ response = new XMLAttachment(stream, mde.getType() + "." + mde.getUuid() + ".v" + mde.getVersion());
return response;
}
@@ -80,21 +75,16 @@
* On action from download full.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDownloadFull() {
+ public Object onActionFromDownloadFull() throws SimExplorerException {
Object response;
MetaData mde = getMetadata();
- try {
- InputStream stream = RemoteStorageService.getStorageService()
- .retrieveElementFull(getToken(), mde.getUuid(),
- mde.getVersion().toString());
- response = new ZipAttachment(stream, mde.getType() + "."
- + mde.getUuid() + ".v" + mde.getVersion());
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
- }
+ InputStream stream = RemoteStorageService.getStorageService().retrieveElementFull(getToken(), mde.getUuid(),
+ mde.getVersion().toString());
+ response = new ZipAttachment(stream, mde.getType() + "." + mde.getUuid() + ".v" + mde.getVersion());
return response;
}
@@ -102,37 +92,29 @@
/**
* On download file.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onDownloadFile(String context) {
+ public Object onDownloadFile(String context) throws SimExplorerException {
StreamResponse response = null;
- try {
- StringTokenizer st = new StringTokenizer(context, ",");
- String uuid = st.nextToken();
- String version = st.nextToken();
- String attachmentUniqueId = st.nextToken();
+ StringTokenizer st = new StringTokenizer(context, ",");
+ String uuid = st.nextToken();
+ String version = st.nextToken();
+ String attachmentUniqueId = st.nextToken();
- MetaData metadata = RemoteStorageService.getStorageService()
- .getMetadata(getToken(), uuid, version);
- List<Attachment> attachments = metadata.getAttachments();
- for (Attachment attachment : attachments) {
- if (attachment.getUniqueId().equals(attachmentUniqueId)) {
- InputStream stream = RemoteStorageService
- .getStorageService().retrieveElementData(
- getToken(), uuid, version, attachment);
+ MetaData metadata = RemoteStorageService.getStorageService().getMetadata(getToken(), uuid, version);
+ List<Attachment> attachments = metadata.getAttachments();
+ for (Attachment attachment : attachments) {
+ if (attachment.getUniqueId().equals(attachmentUniqueId)) {
+ InputStream stream = RemoteStorageService.getStorageService().retrieveElementData(getToken(), uuid,
+ version, attachment);
- response = new AttachmentStreamResponse(stream, attachment
- .getFileName());
- return response;
- }
+ response = new AttachmentStreamResponse(stream, attachment.getFileName());
+ return response;
}
-
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
}
return response;
@@ -196,22 +178,19 @@
node.setType(TreeNode.TYPE_FOLDER);
- node.setColumns(generateStringArray("Application exploration",
- getMetadata().getName()));
+ node.setColumns(generateStringArray("Application exploration", getMetadata().getName()));
List<TreeNode> children = new ArrayList<TreeNode>();
TreeNode node1 = new TreeNode();
node1.setType(TreeNode.TYPE_FOLDER);
node1.setColumns(generateStringArray("Components"));
- node1
- .setChildren(generateComponents((ExplorationApplication) getElement()));
+ node1.setChildren(generateComponents((ExplorationApplication) getElement()));
children.add(node1);
TreeNode node2 = new TreeNode();
node2.setType(TreeNode.TYPE_FOLDER);
node2.setColumns(generateStringArray("Explorations"));
- node2
- .setChildren(generateExplorations((ExplorationApplication) getElement()));
+ node2.setChildren(generateExplorations((ExplorationApplication) getElement()));
children.add(node2);
node.setChildren(children);
@@ -221,16 +200,13 @@
/**
* Generate explorations.
*
- * @param explorationApplication
- * the exploration application
+ * @param explorationApplication the exploration application
*
* @return the list< tree node>
*/
- private List<TreeNode> generateExplorations(
- ExplorationApplication explorationApplication) {
+ private List<TreeNode> generateExplorations(ExplorationApplication explorationApplication) {
List<TreeNode> res = new ArrayList<TreeNode>();
- for (ExplorationData explorationData : explorationApplication
- .getExplorations()) {
+ for (ExplorationData explorationData : explorationApplication.getExplorations()) {
res.add(generateExplorationData(explorationData));
}
return res;
@@ -239,8 +215,7 @@
/**
* Generate exploration data.
*
- * @param explorationData
- * the exploration data
+ * @param explorationData the exploration data
*
* @return the tree node
*/
@@ -248,13 +223,12 @@
TreeNode explorationDataNode = new TreeNode();
explorationDataNode.setType(TreeNode.TYPE_FOLDER);
- explorationDataNode.setColumns(generateStringArray("Exploration data",
- explorationData.getMetaData().getName()));
+ explorationDataNode
+ .setColumns(generateStringArray("Exploration data", explorationData.getMetaData().getName()));
List<TreeNode> children = new ArrayList<TreeNode>();
- List<Attachment> attachments = explorationData.getMetaData()
- .getAttachments();
+ List<Attachment> attachments = explorationData.getMetaData().getAttachments();
for (Attachment attachment : attachments) {
children.add(generateDownload(explorationData, attachment));
@@ -267,13 +241,11 @@
/**
* Generate components.
*
- * @param explorationApplication
- * the exploration application
+ * @param explorationApplication the exploration application
*
* @return the list< tree node>
*/
- private List<TreeNode> generateComponents(
- ExplorationApplication explorationApplication) {
+ private List<TreeNode> generateComponents(ExplorationApplication explorationApplication) {
Set<Component> components = explorationApplication.getComponents();
List<TreeNode> res = new ArrayList<TreeNode>();
@@ -287,8 +259,7 @@
/**
* Generate component.
*
- * @param component
- * the component
+ * @param component the component
*
* @return the tree node
*/
@@ -296,8 +267,7 @@
TreeNode componentNode = new TreeNode();
componentNode.setType(TreeNode.TYPE_FOLDER);
- componentNode.setColumns(generateStringArray("Component", component
- .getMetaData().getName()));
+ componentNode.setColumns(generateStringArray("Component", component.getMetaData().getName()));
List<TreeNode> children = new ArrayList<TreeNode>();
@@ -318,8 +288,7 @@
/**
* Generate libraries.
*
- * @param libraries
- * the libraries
+ * @param libraries the libraries
*
* @return the list< tree node>
*/
@@ -335,8 +304,7 @@
/**
* Generate library.
*
- * @param library
- * the library
+ * @param library the library
*
* @return the tree node
*/
@@ -351,33 +319,27 @@
}
node.setChildren(children);
- node.setColumns(generateStringArray("Library", library.getMetaData()
- .getName()));
+ node.setColumns(generateStringArray("Library", library.getMetaData().getName()));
return node;
}
/**
* Generate download.
*
- * @param explorationData
- * the exploration data
- * @param attachment
- * the attachment
+ * @param explorationData the exploration data
+ * @param attachment the attachment
*
* @return the tree node
*/
- private TreeNode generateDownload(LoggableElement explorationData,
- Attachment attachment) {
+ private TreeNode generateDownload(LoggableElement explorationData, Attachment attachment) {
TreeNode node = new TreeNode();
node.setType(TreeNode.TYPE_DOCUMENT);
- String context = explorationData.getMetaData().getUuid() + ","
- + explorationData.getMetaData().getVersion() + ","
- + attachment.getUniqueId();
+ String context = explorationData.getMetaData().getUuid() + "," + explorationData.getMetaData().getVersion()
+ + "," + attachment.getUniqueId();
- node.setColumns(generateStringArray(attachment.getContentType()
- .getDescription(), attachment.getDataHash(), generateString(
- attachment.getFileName(), "downloadFile", context)));
+ node.setColumns(generateStringArray(attachment.getContentType().getDescription(), attachment.getDataHash(),
+ generateString(attachment.getFileName(), "downloadFile", context)));
return node;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -27,7 +27,6 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
/**
@@ -43,13 +42,9 @@
* @see fr.cemagref.simexplorer.is.ui.web.pages.ElementPage#setup(java.lang.String, java.lang.String)
*/
@Override
- public void setup(String uuid, String version) {
+ public void setup(String uuid, String version) throws SimExplorerException {
super.setup(uuid, version);
- try {
versions = RemoteStorageService.getStorageService().getVersions(getToken(), uuid);
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
- }
}
/* (non-Javadoc)
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -26,7 +26,6 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -29,6 +29,7 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.tools.MetaDataModelFactory;
@@ -119,8 +120,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDetailElement(String context) {
+ public Object onActionFromDetailElement(String context) throws SimExplorerException {
StringTokenizer st = new StringTokenizer(context, ",");
String uuid = st.nextToken();
String version = st.nextToken();
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -113,8 +113,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDetailElementUsed(String context) {
+ public Object onActionFromDetailElementUsed(String context) throws SimExplorerException {
return onDetails(context);
}
@@ -124,8 +125,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDetailElementUsing(String context) {
+ public Object onActionFromDetailElementUsing(String context) throws SimExplorerException {
return onDetails(context);
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -21,7 +21,7 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -37,18 +37,12 @@
/**
* Prepare page.
*
- * @param uuid
- * Id of element to display
- * @param version
- * Version of element to display
+ * @param uuid Id of element to display
+ * @param version Version of element to display
+ * @throws SimExplorerException
*/
- public void setup(String uuid, String version) {
- try {
- element = RemoteStorageService.getStorageService().getLoggableElement(
- getToken(), uuid, version);
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
- }
+ public void setup(String uuid, String version) throws SimExplorerException {
+ element = RemoteStorageService.getStorageService().getLoggableElement(getToken(), uuid, version);
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -31,6 +31,7 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* The Class ElementPageDetail.
@@ -75,8 +76,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- private Object preparePage(ElementPage page, String context) {
+ private Object preparePage(ElementPage page, String context) throws SimExplorerException {
StringTokenizer st = new StringTokenizer(context, ",");
String uuid = st.nextToken();
String version = st.nextToken();
@@ -90,8 +92,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onExport(String context) {
+ public Object onExport(String context) throws SimExplorerException {
return preparePage(elementDownload, context);
}
@@ -101,8 +104,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onHistory(String context) {
+ public Object onHistory(String context) throws SimExplorerException {
return preparePage(elementHistory, context);
}
@@ -112,8 +116,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onDelete(String context) {
+ public Object onDelete(String context) throws SimExplorerException {
return preparePage(elementDelete, context);
}
@@ -123,8 +128,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onRights(String context) {
+ public Object onRights(String context) throws SimExplorerException {
return preparePage(elementRights, context);
}
@@ -134,8 +140,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onDetails(String context) {
+ public Object onDetails(String context) throws SimExplorerException {
return preparePage(elementDetail, context);
}
@@ -145,8 +152,9 @@
* @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onMetadata(String context) {
+ public Object onMetadata(String context) throws SimExplorerException {
return preparePage(elementMetadata, context);
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -31,7 +31,6 @@
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
import fr.cemagref.simexplorer.is.ui.web.services.UserValueEncoder;
@@ -97,7 +96,7 @@
* @see fr.cemagref.simexplorer.is.ui.web.pages.ElementPage#setup(java.lang.String, java.lang.String)
*/
@Override
- public void setup(String uuid, String version) {
+ public void setup(String uuid, String version) throws SimExplorerException {
super.setup(uuid, version);
userEncoder = new UserValueEncoder(getToken());
groupEncoder = new GroupValueEncoder(getToken());
@@ -114,9 +113,8 @@
adminUsers = new ArrayList<User>();
adminGroups = new ArrayList<Group>();
- Permission[] permissions = RemoteSecurityService
- .getAuthentificationService().getPermissions(
- getMetadata().getUuid());
+ Permission[] permissions = RemoteSecurityService.getAuthentificationService().getPermissions(
+ getMetadata().getUuid());
for (Permission permission : permissions) {
if (permission.isOwner() && permission.getActor() instanceof User) {
ownerUsers.add((User) permission.getActor());
@@ -124,28 +122,23 @@
if (permission.isCanRead() && permission.getActor() instanceof User) {
readUsers.add((User) permission.getActor());
}
- if (permission.isCanWrite()
- && permission.getActor() instanceof User) {
+ if (permission.isCanWrite() && permission.getActor() instanceof User) {
writeUsers.add((User) permission.getActor());
}
- if (permission.isCanAdmin()
- && permission.getActor() instanceof User) {
+ if (permission.isCanAdmin() && permission.getActor() instanceof User) {
adminUsers.add((User) permission.getActor());
}
if (permission.isOwner() && permission.getActor() instanceof Group) {
ownerGroups.add((Group) permission.getActor());
}
- if (permission.isCanRead()
- && permission.getActor() instanceof Group) {
+ if (permission.isCanRead() && permission.getActor() instanceof Group) {
readGroups.add((Group) permission.getActor());
}
- if (permission.isCanWrite()
- && permission.getActor() instanceof Group) {
+ if (permission.isCanWrite() && permission.getActor() instanceof Group) {
writeGroups.add((Group) permission.getActor());
}
- if (permission.isCanAdmin()
- && permission.getActor() instanceof Group) {
+ if (permission.isCanAdmin() && permission.getActor() instanceof Group) {
adminGroups.add((Group) permission.getActor());
}
}
@@ -155,15 +148,12 @@
/**
* Gets the permission.
*
- * @param actor
- * the actor
- * @param permissions
- * the permissions
+ * @param actor the actor
+ * @param permissions the permissions
*
* @return the permission
*/
- private Permission getPermission(Actor actor,
- Map<Actor, Permission> permissions) {
+ private Permission getPermission(Actor actor, Map<Actor, Permission> permissions) {
Permission permission = permissions.get(actor);
if (permission == null) {
permission = new Permission();
@@ -182,8 +172,9 @@
* On success.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onSuccess() {
+ public Object onSuccess() throws SimExplorerException {
Map<Actor, Permission> permissions = new HashMap<Actor, Permission>();
for (User user : ownerUsers) {
@@ -212,11 +203,9 @@
getPermission(group, permissions).setCanAdmin(true);
}
- Permission[] permissionsArray = permissions.values().toArray(
- new Permission[permissions.values().size()]);
+ Permission[] permissionsArray = permissions.values().toArray(new Permission[permissions.values().size()]);
- RemoteSecurityService.getAuthentificationService().setPermissions(
- getMetadata().getUuid(), permissionsArray);
+ RemoteSecurityService.getAuthentificationService().setPermissions(getMetadata().getUuid(), permissionsArray);
return elementDetail;
}
@@ -225,16 +214,12 @@
* Gets the users.
*
* @return the users
+ * @throws SimExplorerException
*/
- public List<User> getUsers() {
+ public List<User> getUsers() throws SimExplorerException {
List<User> result = new ArrayList<User>();
- try {
- User[] users = RemoteSecurityService.getAuthentificationService()
- .getUsers(getToken());
- result.addAll(Arrays.asList(users));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ User[] users = RemoteSecurityService.getAuthentificationService().getUsers(getToken());
+ result.addAll(Arrays.asList(users));
return result;
}
@@ -242,16 +227,12 @@
* Gets the groups.
*
* @return the groups
+ * @throws SimExplorerException
*/
- public List<Group> getGroups() {
+ public List<Group> getGroups() throws SimExplorerException {
List<Group> result = new ArrayList<Group>();
- try {
- Group[] groups = RemoteSecurityService.getAuthentificationService()
- .getGroups(getToken());
- result.addAll(Arrays.asList(groups));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ Group[] groups = RemoteSecurityService.getAuthentificationService().getGroups(getToken());
+ result.addAll(Arrays.asList(groups));
return result;
}
@@ -268,8 +249,7 @@
/**
* Sets the owner users.
*
- * @param ownerUsers
- * the new owner users
+ * @param ownerUsers the new owner users
*/
public void setOwnerUsers(List<User> ownerUsers) {
this.ownerUsers = ownerUsers;
@@ -287,8 +267,7 @@
/**
* Sets the read users.
*
- * @param readUsers
- * the new read users
+ * @param readUsers the new read users
*/
public void setReadUsers(List<User> readUsers) {
this.readUsers = readUsers;
@@ -306,8 +285,7 @@
/**
* Sets the read groups.
*
- * @param readGroups
- * the new read groups
+ * @param readGroups the new read groups
*/
public void setReadGroups(List<Group> readGroups) {
this.readGroups = readGroups;
@@ -325,8 +303,7 @@
/**
* Sets the write users.
*
- * @param writeUsers
- * the new write users
+ * @param writeUsers the new write users
*/
public void setWriteUsers(List<User> writeUsers) {
this.writeUsers = writeUsers;
@@ -344,8 +321,7 @@
/**
* Sets the write groups.
*
- * @param writeGroups
- * the new write groups
+ * @param writeGroups the new write groups
*/
public void setWriteGroups(List<Group> writeGroups) {
this.writeGroups = writeGroups;
@@ -363,8 +339,7 @@
/**
* Sets the admin users.
*
- * @param adminUsers
- * the new admin users
+ * @param adminUsers the new admin users
*/
public void setAdminUsers(List<User> adminUsers) {
this.adminUsers = adminUsers;
@@ -382,8 +357,7 @@
/**
* Sets the admin groups.
*
- * @param adminGroups
- * the new admin groups
+ * @param adminGroups the new admin groups
*/
public void setAdminGroups(List<Group> adminGroups) {
this.adminGroups = adminGroups;
@@ -419,8 +393,7 @@
/**
* Sets the owner groups.
*
- * @param ownerGroups
- * the new owner groups
+ * @param ownerGroups the new owner groups
*/
public void setOwnerGroups(List<Group> ownerGroups) {
this.ownerGroups = ownerGroups;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -27,7 +27,7 @@
import org.apache.tapestry.services.ExceptionReporter;
import de.hsofttec.t5components.annotations.SetterGetter;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* The Class ExceptionReport.
@@ -39,7 +39,7 @@
private boolean _unknown;
/** The exception. */
- private SimExplorerWebException exception;
+ private SimExplorerException exception;
/** The _stack. */
@SuppressWarnings("unused")
@@ -80,7 +80,7 @@
* @see org.apache.tapestry.services.ExceptionReporter#reportException(java.lang.Throwable)
*/
public void reportException(Throwable exceptionReported) {
- SimExplorerWebException simException = getException(exceptionReported);
+ SimExplorerException simException = getException(exceptionReported);
if (simException != null) {
_unknown = false;
this.exception = simException;
@@ -104,10 +104,10 @@
*
* @return the exception
*/
- private SimExplorerWebException getException(Throwable exceptionReported) {
+ private SimExplorerException getException(Throwable exceptionReported) {
if (exceptionReported != null) {
- if (exceptionReported instanceof SimExplorerWebException) {
- SimExplorerWebException result = (SimExplorerWebException) exceptionReported;
+ if (exceptionReported instanceof SimExplorerException) {
+ SimExplorerException result = (SimExplorerException) exceptionReported;
return result;
}
return getException(exceptionReported.getCause());
@@ -122,7 +122,9 @@
*/
public String getErrorMessage() {
if (!_unknown) {
+
return exception.getMessage();
+
}
return "";
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -28,7 +28,6 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -74,33 +73,23 @@
/**
* Sets the up.
*
- * @param groupId
- * the new up
+ * @param groupId the new up
+ * @throws SimExplorerException
*/
- void setup(int groupId) {
+ void setup(int groupId) throws SimExplorerException {
this.usersInGroup = new ArrayList<User>();
this.groupsInGroup = new ArrayList<Group>();
if (groupId == -1) {
this.group = new Group();
this.group.setOwner(getUserLogged());
} else {
- try {
- this.group = RemoteSecurityService.getAuthentificationService()
- .getGroup(getToken(), groupId);
+ this.group = RemoteSecurityService.getAuthentificationService().getGroup(getToken(), groupId);
- User[] users = RemoteSecurityService
- .getAuthentificationService().getUsersOfGroup(
- getToken(), group);
- this.usersInGroup.addAll(Arrays.asList(users));
+ User[] users = RemoteSecurityService.getAuthentificationService().getUsersOfGroup(getToken(), group);
+ this.usersInGroup.addAll(Arrays.asList(users));
- Group[] groups = RemoteSecurityService
- .getAuthentificationService().getGroupsOfGroup(
- getToken(), group);
- this.groupsInGroup.addAll(Arrays.asList(groups));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
-
+ Group[] groups = RemoteSecurityService.getAuthentificationService().getGroupsOfGroup(getToken(), group);
+ this.groupsInGroup.addAll(Arrays.asList(groups));
}
userEncoder = new UserValueEncoder(getToken());
groupEncoder = new GroupValueEncoder(getToken());
@@ -110,37 +99,30 @@
* On success.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onSuccess() {
- try {
- if (group.getId() == null) {
- group = RemoteSecurityService.getAuthentificationService()
- .saveGroup(getToken(), group.getName());
- } else {
- group = RemoteSecurityService.getAuthentificationService()
- .updateGroup(getToken(), group);
- }
+ public Object onSuccess() throws SimExplorerException {
+ if (group.getId() == null) {
+ group = RemoteSecurityService.getAuthentificationService().saveGroup(getToken(), group.getName());
+ } else {
+ group = RemoteSecurityService.getAuthentificationService().updateGroup(getToken(), group);
+ }
- Integer[] usersIds = new Integer[usersInGroup.size()];
- int i = 0;
- for (User user : usersInGroup) {
- usersIds[i] = user.getId();
- i++;
- }
- RemoteSecurityService.getAuthentificationService().setUsersOfGroup(
- getToken(), group, usersIds);
+ Integer[] usersIds = new Integer[usersInGroup.size()];
+ int i = 0;
+ for (User user : usersInGroup) {
+ usersIds[i] = user.getId();
+ i++;
+ }
+ RemoteSecurityService.getAuthentificationService().setUsersOfGroup(getToken(), group, usersIds);
- Integer[] groupsIds = new Integer[groupsInGroup.size()];
- i = 0;
- for (Group aGroup : groupsInGroup) {
- groupsIds[i] = aGroup.getId();
- i++;
- }
- RemoteSecurityService.getAuthentificationService()
- .setGroupsOfGroup(getToken(), group, groupsIds);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ Integer[] groupsIds = new Integer[groupsInGroup.size()];
+ i = 0;
+ for (Group aGroup : groupsInGroup) {
+ groupsIds[i] = aGroup.getId();
+ i++;
}
+ RemoteSecurityService.getAuthentificationService().setGroupsOfGroup(getToken(), group, groupsIds);
return groupList;
}
@@ -158,16 +140,12 @@
* Gets the users.
*
* @return the users
+ * @throws SimExplorerException
*/
- public List<User> getUsers() {
+ public List<User> getUsers() throws SimExplorerException {
List<User> result = new ArrayList<User>();
- try {
- User[] users = RemoteSecurityService.getAuthentificationService()
- .getUsers(getToken());
- result.addAll(Arrays.asList(users));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ User[] users = RemoteSecurityService.getAuthentificationService().getUsers(getToken());
+ result.addAll(Arrays.asList(users));
return result;
}
@@ -175,16 +153,12 @@
* Gets the groups.
*
* @return the groups
+ * @throws SimExplorerException
*/
- public List<Group> getGroups() {
+ public List<Group> getGroups() throws SimExplorerException {
List<Group> result = new ArrayList<Group>();
- try {
- Group[] groups = RemoteSecurityService.getAuthentificationService()
- .getGroups(getToken());
- result.addAll(Arrays.asList(groups));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ Group[] groups = RemoteSecurityService.getAuthentificationService().getGroups(getToken());
+ result.addAll(Arrays.asList(groups));
return result;
}
@@ -228,8 +202,7 @@
/**
* Sets the users in group.
*
- * @param usersInGroup
- * the new users in group
+ * @param usersInGroup the new users in group
*/
public void setUsersInGroup(List<User> usersInGroup) {
this.usersInGroup = usersInGroup;
@@ -256,8 +229,7 @@
/**
* Sets the group list.
*
- * @param groupList
- * the new group list
+ * @param groupList the new group list
*/
public void setGroupList(GroupList groupList) {
this.groupList = groupList;
@@ -275,8 +247,7 @@
/**
* Sets the groups in group.
*
- * @param groupsInGroup
- * the new groups in group
+ * @param groupsInGroup the new groups in group
*/
public void setGroupsInGroup(List<Group> groupsInGroup) {
this.groupsInGroup = groupsInGroup;
@@ -294,8 +265,7 @@
/**
* Sets the owner.
*
- * @param owner
- * the new owner
+ * @param owner the new owner
*/
public void setOwner(User owner) {
this.group.setOwner(owner);
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -30,7 +30,6 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -89,22 +88,15 @@
* Gets the groups.
*
* @return the groups
+ * @throws SimExplorerException
*/
- public Group[] getGroups() {
+ public Group[] getGroups() throws SimExplorerException {
Group[] groups;
- try {
-
- if (isUserSuperAdmin()) {
- groups = RemoteSecurityService.getAuthentificationService()
- .getGroups(getToken());
- } else {
- groups = RemoteSecurityService.getAuthentificationService()
- .getGroupsOwnedBy(getToken(), getUserLogged());
- }
-
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ if (isUserSuperAdmin()) {
+ groups = RemoteSecurityService.getAuthentificationService().getGroups(getToken());
+ } else {
+ groups = RemoteSecurityService.getAuthentificationService().getGroupsOwnedBy(getToken(), getUserLogged());
}
return groups;
@@ -113,30 +105,25 @@
/**
* On action from delete.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDelete(Integer context) {
- try {
- RemoteSecurityService.getAuthentificationService().deleteGroup(
- getToken(), context);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onActionFromDelete(Integer context) throws SimExplorerException {
+ RemoteSecurityService.getAuthentificationService().deleteGroup(getToken(), context);
return null;
}
/**
* On action from edit.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromEdit(Integer context) {
+ public Object onActionFromEdit(Integer context) throws SimExplorerException {
groupEdit.setup(context);
return groupEdit;
}
@@ -145,8 +132,9 @@
* On action from add.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromAdd() {
+ public Object onActionFromAdd() throws SimExplorerException {
groupEdit.setup(-1);
return groupEdit;
}
@@ -172,8 +160,7 @@
/**
* Sets the group edit.
*
- * @param groupEdit
- * the new group edit
+ * @param groupEdit the new group edit
*/
public void setGroupEdit(GroupEdit groupEdit) {
this.groupEdit = groupEdit;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -39,7 +39,6 @@
import fr.cemagref.simexplorer.is.factories.XmlConstants;
import fr.cemagref.simexplorer.is.service.ElementGenerator;
import fr.cemagref.simexplorer.is.service.ElementGenerator.RandomStream;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.SuperAdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -64,65 +63,61 @@
* On action from generate data.
*
* @return the object
+ * @throws Exception
*/
- public Object onActionFromGenerateData() {
+ public Object onActionFromGenerateData() throws Exception {
ElementGenerator elementGenerator = new ElementGenerator();
Random r = new Random();
int c = 20;
- try {
+ for (int i = 0; i < c; i++) {
+ ExplorationApplication parentEa;
+ parentEa = elementGenerator.generateRandomEA();
- for (int i = 0; i < c; i++) {
- ExplorationApplication parentEa;
- parentEa = elementGenerator.generateRandomEA();
+ int v = 2 + r.nextInt(5);
+ Version version = new Version(parentEa.getMetaData().getVersion().toString());
- int v = 2 + r.nextInt(5);
- Version version = new Version(parentEa.getMetaData().getVersion().toString());
+ for (int j = 0; j < v; j++) {
+ ExplorationApplication ea = elementGenerator.generateRandomEA();
+ ea.getMetaData().setUuid(parentEa.getMetaData().getUuid());
- for (int j = 0; j < v; j++) {
- ExplorationApplication ea = elementGenerator.generateRandomEA();
- ea.getMetaData().setUuid(parentEa.getMetaData().getUuid());
+ version = version.incVersion(r.nextInt(3));
+ ea.getMetaData().setVersion(version.toString());
- version = version.incVersion(r.nextInt(3));
- ea.getMetaData().setVersion(version.toString());
+ Map<Attachment, SerializableInputStream> attachments = new HashMap<Attachment, SerializableInputStream>();
- Map<Attachment, SerializableInputStream> attachments = new HashMap<Attachment, SerializableInputStream>();
+ List<Attachment> attachmentsKeys = new ArrayList<Attachment>();
- List<Attachment> attachmentsKeys = new ArrayList<Attachment>();
-
- attachmentsKeys.addAll(ea.getMetaData().getAttachments());
- Set<Component> components = ea.getComponents();
- for (Component component : components) {
- attachmentsKeys.addAll(component.getMetaData().getAttachments());
- Set<Library> libraries = component.getLibraries();
- for (Library library : libraries) {
- attachmentsKeys.addAll(library.getMetaData().getAttachments());
- }
+ attachmentsKeys.addAll(ea.getMetaData().getAttachments());
+ Set<Component> components = ea.getComponents();
+ for (Component component : components) {
+ attachmentsKeys.addAll(component.getMetaData().getAttachments());
+ Set<Library> libraries = component.getLibraries();
+ for (Library library : libraries) {
+ attachmentsKeys.addAll(library.getMetaData().getAttachments());
}
- Set<ExplorationData> explorations = ea.getExplorations();
- for (ExplorationData explorationData : explorations) {
- attachmentsKeys.addAll(explorationData.getMetaData().getAttachments());
- }
+ }
+ Set<ExplorationData> explorations = ea.getExplorations();
+ for (ExplorationData explorationData : explorations) {
+ attachmentsKeys.addAll(explorationData.getMetaData().getAttachments());
+ }
- for (Attachment attachment : attachmentsKeys) {
- RandomStream randomStream = elementGenerator.generateTextStream();
- attachment.setDataHash(randomStream.getMd5());
- SerializableInputStream remoteStream = new SerializableInputStream(randomStream.getStream());
- attachments.put(attachment, remoteStream);
- }
-
- InputStream xmlStream = BaseEntityFactory.getFactory(ExplorationApplication.class).saveElement(
- XmlConstants.VALUE_METADATA_TYPE_EA, ea);
-
- SerializableInputStream xmlRemoteStream = new SerializableInputStream(xmlStream);
- RemoteStorageService.getStorageService().saveElement(getToken(), xmlRemoteStream, attachments);
+ for (Attachment attachment : attachmentsKeys) {
+ RandomStream randomStream = elementGenerator.generateTextStream();
+ attachment.setDataHash(randomStream.getMd5());
+ SerializableInputStream remoteStream = new SerializableInputStream(randomStream.getStream());
+ attachments.put(attachment, remoteStream);
}
+ InputStream xmlStream = BaseEntityFactory.getFactory(ExplorationApplication.class).saveElement(
+ XmlConstants.VALUE_METADATA_TYPE_EA, ea);
+
+ SerializableInputStream xmlRemoteStream = new SerializableInputStream(xmlStream);
+ RemoteStorageService.getStorageService().saveElement(getToken(), xmlRemoteStream, attachments);
}
- } catch (Exception e) {
- throw new SimExplorerWebException(e);
+
}
return elementList;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -17,10 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
-import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
+import java.util.Arrays;
+
import org.apache.tapestry.annotations.ApplicationState;
import org.apache.tapestry.annotations.Component;
import org.apache.tapestry.annotations.InjectPage;
@@ -29,7 +27,9 @@
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.annotations.Inject;
-import java.util.Arrays;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper;
+import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
/** The Class Login. */
public class Login {
@@ -38,7 +38,7 @@
@Persist
private String user;
- /** The password.TODO voir si on peut utiliser directement un char[] */
+ /** The password.TODO voir si on peut utiliser directement un char[] */
private String password;
/** The login. */
@@ -65,47 +65,39 @@
/**
* On success.
- *
+ *
* @return the object
+ * @throws SimExplorerException
*/
- public Object onSuccessFromFormLogin() {
- try {
- // on hache directement le password pour ne pas le transmettre en clair
- char[] chars = password.toCharArray();
- String pass = AuthenticationServiceHelper.computeHash(chars);
- // reset du tableau
- Arrays.fill(chars, (char) 0);
- password = null;
- token = RemoteSecurityService.getAuthentificationService().loginUser(user, pass);
- if (token != null && !token.equals("")) {
- return elementList;
- }
- formLogin.recordError(messages
- .get("simexplorer.ui.web.login.invalid"));
- return this;
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ public Object onSuccessFromFormLogin() throws SimExplorerException {
+ // on hache directement le password pour ne pas le transmettre en clair
+ char[] chars = password.toCharArray();
+ String pass = AuthenticationServiceHelper.computeHash(chars);
+ // reset du tableau
+ Arrays.fill(chars, (char) 0);
+ password = null;
+ token = RemoteSecurityService.getAuthentificationService().loginUser(user, pass);
+ if (token != null && !token.equals("")) {
+ return elementList;
}
+ formLogin.recordError(messages.get("simexplorer.ui.web.login.invalid"));
+ return this;
}
/**
* On success from form request account.
- *
+ *
* @return the object
+ * @throws SimExplorerException
*/
- public Object onSuccessFromFormRequestAccount() {
- try {
- RemoteSecurityService.getAuthentificationService().requestAccount(
- login, mail);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onSuccessFromFormRequestAccount() throws SimExplorerException {
+ RemoteSecurityService.getAuthentificationService().requestAccount(login, mail);
return this;
}
/**
* Gets the user.
- *
+ *
* @return the user
*/
public String getUser() {
@@ -114,7 +106,7 @@
/**
* Sets the user.
- *
+ *
* @param user the new user
*/
public void setUser(String user) {
@@ -123,7 +115,7 @@
/**
* Gets the password.
- *
+ *
* @return the password
*/
public String getPassword() {
@@ -132,7 +124,7 @@
/**
* Sets the password.
- *
+ *
* @param password the new password
*/
public void setPassword(String password) {
@@ -141,7 +133,7 @@
/**
* Gets the element list.
- *
+ *
* @return the element list
*/
public ElementList getElementList() {
@@ -150,7 +142,7 @@
/**
* Gets the window title.
- *
+ *
* @return the window title
*/
public String getWindowTitle() {
@@ -159,7 +151,7 @@
/**
* Gets the login.
- *
+ *
* @return the login
*/
public String getLogin() {
@@ -168,7 +160,7 @@
/**
* Sets the login.
- *
+ *
* @param login the new login
*/
public void setLogin(String login) {
@@ -177,7 +169,7 @@
/**
* Gets the mail.
- *
+ *
* @return the mail
*/
public String getMail() {
@@ -186,7 +178,7 @@
/**
* Sets the mail.
- *
+ *
* @param mail the new mail
*/
public void setMail(String mail) {
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -34,7 +34,6 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -103,24 +102,17 @@
/**
* Sets the up.
*
- * @param userId
- * the new up
+ * @param userId the new up
+ * @throws SimExplorerException
*/
- void setup(int userId) {
+ void setup(int userId) throws SimExplorerException {
this.groupsOfUser = new ArrayList<Group>();
if (userId == -1) {
this.user = new User();
} else {
- try {
- this.user = RemoteSecurityService.getAuthentificationService()
- .getUser(getToken(), userId);
- Group[] groups = RemoteSecurityService
- .getAuthentificationService().getGroupsOfUser(
- getToken(), this.user);
- groupsOfUser.addAll(Arrays.asList(groups));
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ this.user = RemoteSecurityService.getAuthentificationService().getUser(getToken(), userId);
+ Group[] groups = RemoteSecurityService.getAuthentificationService().getGroupsOfUser(getToken(), this.user);
+ groupsOfUser.addAll(Arrays.asList(groups));
}
groupEncoder = new GroupValueEncoder(getToken());
@@ -130,44 +122,34 @@
* On success.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onSuccess() {
- try {
- if (user.getId() == null) {
- user = RemoteSecurityService.getAuthentificationService()
- .saveUser(getToken(), user.getLogin(), user.getMail());
- return this;
- }
- user = RemoteSecurityService.getAuthentificationService()
- .updateUser(getToken(), user);
- Integer[] groupsIds = new Integer[groupsOfUser.size()];
- int i = 0;
- for (Group group : groupsOfUser) {
- groupsIds[i] = group.getId();
- i++;
- }
- RemoteSecurityService.getAuthentificationService().setGroupsOfUser(
- getToken(), user, groupsIds);
- return userList;
-
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ public Object onSuccess() throws SimExplorerException {
+ if (user.getId() == null) {
+ user = RemoteSecurityService.getAuthentificationService().saveUser(getToken(), user.getLogin(),
+ user.getMail());
+ return this;
}
+ user = RemoteSecurityService.getAuthentificationService().updateUser(getToken(), user);
+ Integer[] groupsIds = new Integer[groupsOfUser.size()];
+ int i = 0;
+ for (Group group : groupsOfUser) {
+ groupsIds[i] = group.getId();
+ i++;
+ }
+ RemoteSecurityService.getAuthentificationService().setGroupsOfUser(getToken(), user, groupsIds);
+ return userList;
}
/**
* Gets the groups.
*
* @return the groups
+ * @throws SimExplorerException
*/
- public List<Group> getGroups() {
+ public List<Group> getGroups() throws SimExplorerException {
Group[] groups;
- try {
- groups = RemoteSecurityService.getAuthentificationService()
- .getGroups(getToken());
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ groups = RemoteSecurityService.getAuthentificationService().getGroups(getToken());
List<Group> result = new ArrayList<Group>();
result.addAll(Arrays.asList(groups));
return result;
@@ -177,17 +159,13 @@
* Gets the owned groups.
*
* @return the owned groups
+ * @throws SimExplorerException
*/
- public Group[] getOwnedGroups() {
- try {
- if (user.getId() == null) {
- return new Group[0];
- }
- return RemoteSecurityService.getAuthentificationService()
- .getGroupsOwnedBy(getToken(), user);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ public Group[] getOwnedGroups() throws SimExplorerException {
+ if (user.getId() == null) {
+ return new Group[0];
}
+ return RemoteSecurityService.getAuthentificationService().getGroupsOwnedBy(getToken(), user);
}
/**
@@ -221,15 +199,11 @@
* On action from reset password.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromResetPassword() {
- try {
- RemoteSecurityService.getAuthentificationService().resetPassword(
- getToken(), user.getLogin());
- return this;
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onActionFromResetPassword() throws SimExplorerException {
+ RemoteSecurityService.getAuthentificationService().resetPassword(getToken(), user.getLogin());
+ return this;
}
/**
@@ -244,8 +218,7 @@
/**
* Sets the user list.
*
- * @param userList
- * the new user list
+ * @param userList the new user list
*/
public void setUserList(UserList userList) {
this.userList = userList;
@@ -272,8 +245,7 @@
/**
* Sets the groups of user.
*
- * @param groupsOfUser
- * the new groups of user
+ * @param groupsOfUser the new groups of user
*/
public void setGroupsOfUser(List<Group> groupsOfUser) {
this.groupsOfUser = groupsOfUser;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -30,7 +30,6 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -93,46 +92,35 @@
* Gets the users.
*
* @return the users
+ * @throws SimExplorerException
*/
- public User[] getUsers() {
- User[] users;
- try {
- users = RemoteSecurityService.getAuthentificationService()
- .getUsers(getToken());
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
-
+ public User[] getUsers() throws SimExplorerException {
+ User[] users = RemoteSecurityService.getAuthentificationService().getUsers(getToken());
return users;
}
/**
* On action from delete.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromDelete(Integer context) {
- try {
- RemoteSecurityService.getAuthentificationService().deleteUser(
- getToken(), context);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ public Object onActionFromDelete(Integer context) throws SimExplorerException {
+ RemoteSecurityService.getAuthentificationService().deleteUser(getToken(), context);
return null;
}
/**
* On action from edit.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromEdit(Integer context) {
+ public Object onActionFromEdit(Integer context) throws SimExplorerException {
userEdit.setup(context);
return userEdit;
}
@@ -141,8 +129,9 @@
* On action from add.
*
* @return the object
+ * @throws SimExplorerException
*/
- public Object onActionFromAdd() {
+ public Object onActionFromAdd() throws SimExplorerException {
userEdit.setup(-1);
return userEdit;
}
@@ -159,8 +148,7 @@
/**
* Sets the user edit.
*
- * @param userEdit
- * the new user edit
+ * @param userEdit the new user edit
*/
public void setUserEdit(UserEdit userEdit) {
this.userEdit = userEdit;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -23,8 +23,8 @@
import org.apache.tapestry.ioc.annotations.Inject;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerSecurityException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
/**
@@ -60,22 +60,24 @@
* On activate.
*
* @return the object
+ *
+ * @throws SimExplorerException the sim explorer exception
*/
- Object onActivate() {
+ Object onActivate() throws SimExplorerException {
getUserRights();
if (!userLogged)
return "Login";
if (!hasAccessToPage())
- throw new SimExplorerWebException(messages
- .get("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
return null;
}
/**
* Gets the user rights.
*
+ * @throws SimExplorerException the sim explorer exception
*/
- private void getUserRights() {
+ private void getUserRights() throws SimExplorerException {
user = computeUserLogged();
if (user != null) {
userLogged = true;
@@ -101,16 +103,12 @@
* Compute user logged.
*
* @return the user
+ * @throws SimExplorerException
*/
- private User computeUserLogged() {
+ private User computeUserLogged() throws SimExplorerException {
User loggedUser = null;
if (token != null) {
- try {
- loggedUser = RemoteSecurityService.getAuthentificationService()
- .getLoggedUser(token);
- } catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
- }
+ loggedUser = RemoteSecurityService.getAuthentificationService().getLoggedUser(token);
}
return loggedUser;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -21,7 +21,6 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
/**
* The Class GroupValueEncoder.
@@ -58,7 +57,7 @@
group = RemoteSecurityService.getAuthentificationService().getGroup(
token, Integer.decode(arg0));
} catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ throw new RuntimeException(e);
}
return group;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -17,6 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.services;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.AuthenticationService;
/**
@@ -28,8 +29,9 @@
* Gets the authentification service.
*
* @return the authentification service
+ * @throws SimExplorerException
*/
- public static AuthenticationService getAuthentificationService() {
+ public static AuthenticationService getAuthentificationService() throws SimExplorerException {
return (AuthenticationService) getService("AuthenticationService");
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -25,15 +25,21 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
/**
* The Class RemoteService.
*/
public abstract class RemoteService {
+ /** The Constant PROVIDER_URL. */
private final static String PROVIDER_URL = "java.naming.provider.url";
+
+ /** The Constant FACTORY_INITIAL. */
private final static String FACTORY_INITIAL = "java.naming.factory.initial";
+
+ /** The Constant FACTORY_URL_PKGS. */
private final static String FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
/** The services. */
@@ -42,12 +48,12 @@
/**
* Gets the service.
*
- * @param serviceName
- * the service name
+ * @param serviceName the service name
*
* @return the service
+ * @throws SimExplorerException
*/
- protected static Object getService(String serviceName) {
+ protected static Object getService(String serviceName) throws SimExplorerException {
Object service;
if (!services.containsKey(serviceName)) {
@@ -61,7 +67,7 @@
}
services.put(serviceName, context.lookup(serviceName));
} catch (NamingException e) {
- throw new SimExplorerWebException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
service = services.get(serviceName);
@@ -69,10 +75,15 @@
return service;
}
+ /**
+ * Inits the properties.
+ *
+ * @return the properties
+ */
protected static Properties initProperties() {
Properties props = (Properties) System.getProperties().clone();
props.put(PROVIDER_URL, "jnp://localhost:1099");
- props.put(FACTORY_INITIAL,"org.jnp.interfaces.NamingContextFactory");
+ props.put(FACTORY_INITIAL, "org.jnp.interfaces.NamingContextFactory");
props.put(FACTORY_URL_PKGS, "org.jnp.interfaces");
return props;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -17,6 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.services;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.service.StorageServiceHelper;
@@ -29,8 +30,9 @@
* Gets the storage service.
*
* @return the storage service
+ * @throws SimExplorerException
*/
- public static StorageService getStorageService() {
+ public static StorageService getStorageService() throws SimExplorerException {
return (StorageService) getService(StorageServiceHelper.STORAGE_SERVICE_LOOKUP_NAME);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-15 16:25:38 UTC (rev 1007)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-15 17:03:52 UTC (rev 1008)
@@ -20,8 +20,8 @@
import org.apache.tapestry.ValueEncoder;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
/**
* The Class UserValueEncoder.
@@ -58,7 +58,7 @@
user = RemoteSecurityService.getAuthentificationService().getUser(
token, Integer.decode(arg0));
} catch (SimExplorerException e) {
- throw new SimExplorerWebException(e);
+ throw new RuntimeException(e);
}
return user;
}
1
0
r1007 - trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 16:25:38 +0000 (Fri, 15 Feb 2008)
New Revision: 1007
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerBusinessException.java
Log:
Modified exception mechanism
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerBusinessException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerBusinessException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerBusinessException.java 2008-02-15 16:25:38 UTC (rev 1007)
@@ -0,0 +1,65 @@
+/*
+* ##% 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.exceptions;
+
+/**
+ * The Class SimExplorerBusinessException.
+ */
+public class SimExplorerBusinessException extends SimExplorerException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3302304257020920119L;
+
+ /**
+ * Instantiates a new sim explorer business exception.
+ */
+ public SimExplorerBusinessException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer business exception.
+ *
+ * @param cause the cause
+ */
+ public SimExplorerBusinessException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer business exception.
+ *
+ * @param message the message
+ */
+ public SimExplorerBusinessException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer business exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
+ public SimExplorerBusinessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
1
0
r1006 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-service/src/resources/i18n simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment simexplo
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 16:25:18 +0000 (Fri, 15 Feb 2008)
New Revision: 1006
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerSecurityException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerTechnicalException.java
Removed:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerException.java
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceHelper.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-en_GB.properties
trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-fr_FR.properties
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java
Log:
Modified exception mechanism
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -17,6 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
@@ -33,20 +34,20 @@
* @param login the login
* @param password the password
* @return the string
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public String loginUser(String login, String password)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Request account.
*
* @param login the login
* @param mail the mail
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void requestAccount(String login, String mail)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Save user.
@@ -55,20 +56,20 @@
* @param login the login
* @param mail the mail
* @return the user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public User saveUser(String token, String login, String mail)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Reset password.
*
* @param token the token
* @param login the login
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void resetPassword(String token, String login)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Change password.
@@ -78,11 +79,11 @@
* @param password
* the password
*
- * @throws SimExplorerServiceException
+ * @throws SimExplorerException
* the sim explorer service exception
*/
// public void changePassword(String token, String password)
-// throws SimExplorerServiceException;
+// throws SimExplorerException;
/**
* Gets the user.
@@ -90,10 +91,10 @@
* @param token the token
* @param id the id
* @return the user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public User getUser(String token, Integer id)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the user.
@@ -101,10 +102,10 @@
* @param token the token
* @param login the login
* @return the user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public User getUser(String token, String login)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Update user.
@@ -112,29 +113,29 @@
* @param token the token
* @param user the user
* @return the user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public User updateUser(String token, User user)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Delete user.
*
* @param token the token
* @param id the id
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void deleteUser(String token, Integer id)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the users.
*
* @param token the token
* @return the users
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public User[] getUsers(String token) throws SimExplorerServiceException;
+ public User[] getUsers(String token) throws SimExplorerException;
/**
* Gets the users of group.
@@ -142,10 +143,10 @@
* @param token the token
* @param group the group
* @return the users of group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public User[] getUsersOfGroup(String token, Group group)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Sets the users of group.
@@ -153,10 +154,10 @@
* @param token the token
* @param group the group
* @param usersInGroup the users in group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void setUsersOfGroup(String token, Group group,
- Integer[] usersInGroup) throws SimExplorerServiceException;
+ Integer[] usersInGroup) throws SimExplorerException;
/**
* Sets the groups of group.
@@ -164,10 +165,10 @@
* @param token the token
* @param group the group
* @param groupsIds the groups ids
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the groups of user.
@@ -175,10 +176,10 @@
* @param token the token
* @param user the user
* @return the groups of user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group[] getGroupsOfUser(String token, User user)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the groups of group.
@@ -186,10 +187,10 @@
* @param token the token
* @param group the group
* @return the groups of group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group[] getGroupsOfGroup(String token, Group group)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Sets the groups of user.
@@ -197,10 +198,10 @@
* @param token the token
* @param user the user
* @param groupsIds the groups ids
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void setGroupsOfUser(String token, User user, Integer[] groupsIds)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Save group.
@@ -208,10 +209,10 @@
* @param token the token
* @param name the name
* @return the group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group saveGroup(String token, String name)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the group.
@@ -219,10 +220,10 @@
* @param token the token
* @param id the id
* @return the group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group getGroup(String token, Integer id)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the group.
@@ -230,10 +231,10 @@
* @param token the token
* @param name the name
* @return the group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group getGroup(String token, String name)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Update group.
@@ -241,29 +242,29 @@
* @param token the token
* @param group the group
* @return the group
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group updateGroup(String token, Group group)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Delete group.
*
* @param token the token
* @param id the id
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public void deleteGroup(String token, Integer id)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the groups.
*
* @param token the token
* @return the groups
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public Group[] getGroups(String token) throws SimExplorerServiceException;
+ public Group[] getGroups(String token) throws SimExplorerException;
/**
* Gets the groups owned by.
@@ -271,19 +272,19 @@
* @param token the token
* @param user the user
* @return the groups owned by
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public Group[] getGroupsOwnedBy(String token, User user)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Gets the logged user.
*
* @param token the token
* @return the logged user
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public User getLoggedUser(String token) throws SimExplorerServiceException;
+ public User getLoggedUser(String token) throws SimExplorerException;
/**
* Gets the permissions.
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceHelper.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceHelper.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -20,6 +20,9 @@
import org.codelutin.util.ConverterUtil;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
+
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -38,14 +41,14 @@
*
* @return the string
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public static String computeHash(char[] clearString) throws SimExplorerServiceException {
+ public static String computeHash(char[] clearString) throws SimExplorerException {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
}
messageDigest.reset();
byte[] bytes = ConverterUtil.convert(clearString);
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -42,6 +42,10 @@
import org.codelutin.i18n.I18n;
import org.jboss.annotation.ejb.RemoteBinding;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerBusinessException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerSecurityException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.storage.util.Config;
import fr.cemagref.simexplorer.is.security.dao.DaoSecurity;
import fr.cemagref.simexplorer.is.security.entities.Group;
@@ -111,10 +115,10 @@
* @param mailFrom the mail from
* @param mailRecipient the mail recipient
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
private void sendMail(String mailFrom, String mailRecipient, String subject, String content)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
try {
javax.mail.Session mailSession = (javax.mail.Session) new InitialContext().lookup("java:/Mail");
javax.mail.Message msg = new MimeMessage(mailSession);
@@ -127,9 +131,9 @@
msg.setSentDate(new java.util.Date());
Transport.send(msg);
} catch (MessagingException e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
} catch (NamingException e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
@@ -139,7 +143,7 @@
* @return the string
*/
private char[] generatePassword() {
- //TODO ne plus utiliser un String
+ // TODO ne plus utiliser un String
return RandomStringUtils.randomAlphanumeric(10).toCharArray();
}
@@ -151,9 +155,9 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canAdminGroup(String token, Integer id) throws SimExplorerServiceException {
+ private boolean canAdminGroup(String token, Integer id) throws SimExplorerException {
User loggedUser = getLoggedUser(token);
if (loggedUser != null) {
if (loggedUser.isSuperAdmin()) {
@@ -195,9 +199,9 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canAdminUser(String token, Integer id) throws SimExplorerServiceException {
+ private boolean canAdminUser(String token, Integer id) throws SimExplorerException {
User loggedUser = getLoggedUser(token);
if (loggedUser != null) {
if (loggedUser.isSuperAdmin()) {
@@ -241,9 +245,9 @@
* @param id the id
*
* @return true, if successful
- * @throws SimExplorerServiceException
+ * @throws SimExplorerException
*/
- private boolean canDeleteGroup(String token, Integer id) throws SimExplorerServiceException {
+ private boolean canDeleteGroup(String token, Integer id) throws SimExplorerException {
return canAdminGroup(token, id);
}
@@ -260,11 +264,11 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteGroup(java.lang.String, java.lang.Integer)
*/
- public void deleteGroup(String token, Integer id) throws SimExplorerServiceException {
+ public void deleteGroup(String token, Integer id) throws SimExplorerException {
if (canDeleteGroup(token, id)) {
deleteGroupImpl(token, id);
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
@@ -276,9 +280,9 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canDeleteUser(String token, Integer id) throws SimExplorerServiceException {
+ private boolean canDeleteUser(String token, Integer id) throws SimExplorerException {
return canAdminUser(token, id);
}
@@ -295,11 +299,11 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteUser(java.lang.String, java.lang.Integer)
*/
- public void deleteUser(String token, Integer id) throws SimExplorerServiceException {
+ public void deleteUser(String token, Integer id) throws SimExplorerException {
if (canDeleteUser(token, id)) {
deleteUserImpl(token, id);
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
@@ -309,9 +313,9 @@
* @param token the token
*
* @return true, if successful
- * @throws SimExplorerServiceException
+ * @throws SimExplorerException
*/
- private boolean canViewElements(String token) throws SimExplorerServiceException {
+ private boolean canViewElements(String token) throws SimExplorerException {
User loggedUser = getLoggedUser(token);
// boolean canView = loggedUser.isAdmin() || loggedUser.isSuperAdmin();
// return canView;
@@ -321,45 +325,45 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.Integer)
*/
- public Group getGroup(String token, Integer id) throws SimExplorerServiceException {
+ public Group getGroup(String token, Integer id) throws SimExplorerException {
if (canViewElements(token)) {
Group group = dao.getGroup(id);
return group;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.String)
*/
- public Group getGroup(String token, String name) throws SimExplorerServiceException {
+ public Group getGroup(String token, String name) throws SimExplorerException {
if (canViewElements(token)) {
Group group = dao.getGroup(name);
return group;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.Integer)
*/
- public User getUser(String token, Integer id) throws SimExplorerServiceException {
+ public User getUser(String token, Integer id) throws SimExplorerException {
if (canViewElements(token)) {
User user = dao.getUser(id);
return user;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.String)
*/
- public User getUser(String token, String login) throws SimExplorerServiceException {
+ public User getUser(String token, String login) throws SimExplorerException {
if (canViewElements(token)) {
User user = dao.getUser(login);
return user;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/**
@@ -369,9 +373,9 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canSaveElement(String token) throws SimExplorerServiceException {
+ private boolean canSaveElement(String token) throws SimExplorerException {
User loggedUser = getLoggedUser(token);
boolean canView = loggedUser.isAdmin() || loggedUser.isSuperAdmin();
return canView;
@@ -380,11 +384,11 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveGroup(java.lang.String, java.lang.String)
*/
- public Group saveGroup(String token, String name) throws SimExplorerServiceException {
+ public Group saveGroup(String token, String name) throws SimExplorerException {
if (canSaveElement(token)) {
Group oldGroup = dao.getGroup(name);
if (oldGroup != null) {
- throw new SimExplorerServiceException(_("simexplorer.service.business.groupexist"));
+ throw new SimExplorerBusinessException(_("simexplorer.service.business.groupexist"));
}
Group group = new Group();
@@ -394,17 +398,17 @@
group = getGroup(token, group.getId());
return group;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveUser(java.lang.String, java.lang.String, java.lang.String)
*/
- public User saveUser(String token, String login, String mail) throws SimExplorerServiceException {
+ public User saveUser(String token, String login, String mail) throws SimExplorerException {
if (canSaveElement(token)) {
User oldUser = dao.getUser(login);
if (oldUser != null) {
- throw new SimExplorerServiceException(_("simexplorer.service.business.userexist"));
+ throw new SimExplorerBusinessException(_("simexplorer.service.business.userexist"));
}
User user = new User();
@@ -416,14 +420,14 @@
String passwordHash = AuthenticationServiceHelper.computeHash(password);
user.setPasswordHash(passwordHash);
// reset array
- Arrays.fill(password,(char)0);
+ Arrays.fill(password, (char) 0);
user.setAdmin(false);
user.setSuperAdmin(false);
dao.saveUser(user);
user = getUser(token, user.getId());
return user;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/**
@@ -434,20 +438,20 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canUpdateGroup(String token, Integer id) throws SimExplorerServiceException {
+ private boolean canUpdateGroup(String token, Integer id) throws SimExplorerException {
return canAdminGroup(token, id);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
*/
- public Group updateGroup(String token, Group group) throws SimExplorerServiceException {
+ public Group updateGroup(String token, Group group) throws SimExplorerException {
if (canUpdateGroup(token, group.getId())) {
return dao.updateGroup(group);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/**
@@ -458,9 +462,9 @@
*
* @return true, if successful
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private boolean canUpdateUser(String token, User user) throws SimExplorerServiceException {
+ private boolean canUpdateUser(String token, User user) throws SimExplorerException {
if (canAdminUser(token, user.getId())) {
if (getLoggedUser(token).isSuperAdmin()) {
return true;
@@ -476,17 +480,17 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
*/
- public User updateUser(String token, User user) throws SimExplorerServiceException {
+ public User updateUser(String token, User user) throws SimExplorerException {
if (canUpdateUser(token, user)) {
return dao.updateUser(user);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getLoggedUser(java.lang.String)
*/
- public User getLoggedUser(String token) throws SimExplorerServiceException {
+ public User getLoggedUser(String token) throws SimExplorerException {
if (token == null || token.equals("")) {
return null;
}
@@ -495,15 +499,15 @@
if (loggedUser != null) {
return loggedUser;
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/**
* Check super admin.
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private void checkSuperAdmin() throws SimExplorerServiceException {
+ private void checkSuperAdmin() throws SimExplorerException {
if (dao.getUser("superadmin") == null) {
User user = new User();
user.setLogin("superadmin");
@@ -520,7 +524,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#loginUser(java.lang.String, java.lang.String)
*/
- public String loginUser(String login, String password) throws SimExplorerServiceException {
+ public String loginUser(String login, String password) throws SimExplorerException {
if (!superAdminCheck) {
I18n.initISO88591("fr", "FR");
checkSuperAdmin();
@@ -528,7 +532,7 @@
}
String token = null;
// le password est deja haché
- //User loggedUser = dao.loginUser(login, AuthenticationServiceHelper.computeHash(password));
+ // User loggedUser = dao.loginUser(login, AuthenticationServiceHelper.computeHash(password));
User loggedUser = dao.loginUser(login, password);
if (loggedUser != null) {
// FIXME delete previous tokens
@@ -547,7 +551,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#requestAccount(java.lang.String, java.lang.String)
*/
- public void requestAccount(String login, String mail) throws SimExplorerServiceException {
+ public void requestAccount(String login, String mail) throws SimExplorerException {
User superadmin = dao.getUser("superadmin");
sendMail(Config.getProperties().getProperty("simexplorer.adminmail"), superadmin.getMail(),
_("simexplorer.service.mail.subject"), getMailContentRequestAccount(login, mail));
@@ -557,7 +561,7 @@
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#changePassword(java.lang.String, java.lang.String)
*/
// public void changePassword(String token, String password)
- // throws SimExplorerServiceException {
+ // throws SimExplorerException {
// User user = getLoggedUser(token);
// String passwordHash = computeHash(password);
// user.setPasswordHash(passwordHash);
@@ -566,70 +570,70 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#resetPassword(java.lang.String, java.lang.String)
*/
- public void resetPassword(String token, String login) throws SimExplorerServiceException {
+ public void resetPassword(String token, String login) throws SimExplorerException {
User user = getUser(token, login);
if (canAdminUser(token, user.getId())) {
char[] password = generatePassword();
sendMail(Config.getProperties().getProperty("simexplorer.adminmail"), user.getMail(),
_("simexplorer.service.mail.subject"), getMailContentWithPassword(login, password));
String passwordHash = AuthenticationServiceHelper.computeHash(password);
- // reset char[]
- Arrays.fill(password,(char)0);
+ // reset char[]
+ Arrays.fill(password, (char) 0);
user.setPasswordHash(passwordHash);
dao.updateUser(user);
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroups(java.lang.String)
*/
- public Group[] getGroups(String token) throws SimExplorerServiceException {
+ public Group[] getGroups(String token) throws SimExplorerException {
if (canViewElements(token)) {
List<Group> groups = dao.getGroups();
return groups.toArray(new Group[groups.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
*/
- public Group[] getGroupsOwnedBy(String token, User user) throws SimExplorerServiceException {
+ public Group[] getGroupsOwnedBy(String token, User user) throws SimExplorerException {
if (canViewElements(token)) {
List<Group> list = dao.getGroupsOwnedBy(user);
return list.toArray(new Group[list.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsers(java.lang.String)
*/
- public User[] getUsers(String token) throws SimExplorerServiceException {
+ public User[] getUsers(String token) throws SimExplorerException {
if (canViewElements(token)) {
List<User> users = dao.getUsers();
return users.toArray(new User[users.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
*/
- public User[] getUsersOfGroup(String token, Group group) throws SimExplorerServiceException {
+ public User[] getUsersOfGroup(String token, Group group) throws SimExplorerException {
if (canViewElements(token)) {
List<User> usersOfGroup = dao.getUsersOfGroup(group);
return usersOfGroup.toArray(new User[usersOfGroup.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#setUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[])
*/
- public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) throws SimExplorerServiceException {
+ public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) throws SimExplorerException {
if (canUpdateGroup(token, group.getId())) {
List<Integer> newUsers = new ArrayList<Integer>();
newUsers.addAll(Arrays.asList(usersInGroup));
@@ -666,14 +670,14 @@
dao.updateUser(user);
}
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User, java.lang.Integer[])
*/
- public void setGroupsOfUser(String token, User user, Integer[] groupsIds) throws SimExplorerServiceException {
+ public void setGroupsOfUser(String token, User user, Integer[] groupsIds) throws SimExplorerException {
if (canUpdateUser(token, user)) {
User realUser = dao.getUser(user.getId());
realUser.getGroups().clear();
@@ -683,36 +687,36 @@
}
dao.updateUser(realUser);
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
*/
- public Group[] getGroupsOfUser(String token, User user) throws SimExplorerServiceException {
+ public Group[] getGroupsOfUser(String token, User user) throws SimExplorerException {
if (canViewElements(token)) {
List<Group> list = dao.getGroupsOfUser(user);
return list.toArray(new Group[list.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
*/
- public Group[] getGroupsOfGroup(String token, Group group) throws SimExplorerServiceException {
+ public Group[] getGroupsOfGroup(String token, Group group) throws SimExplorerException {
if (canViewElements(token)) {
List<Group> groupsOfGroup = dao.getGroupsOfGroup(group);
return groupsOfGroup.toArray(new Group[groupsOfGroup.size()]);
}
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[])
*/
- public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) throws SimExplorerServiceException {
+ public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) throws SimExplorerException {
if (canUpdateGroup(token, group.getId())) {
Group realGroup = dao.getGroup(group.getId());
realGroup.getGroups().clear();
@@ -722,7 +726,7 @@
}
dao.updateGroup(realGroup);
} else {
- throw new SimExplorerServiceException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerSecurityException();
}
}
Deleted: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -1,69 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, 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.service;
-
-/**
- * Exception de base pour toute erreur rencontrée dans un service.
- *
- * @author chemit
- */
-public class SimExplorerServiceException extends Exception {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 1054522404126322604L;
-
- /**
- * Instantiates a new sim explorer service exception.
- */
- public SimExplorerServiceException() {
- super();
- }
-
- /**
- * Instantiates a new sim explorer service exception.
- *
- * @param cause
- * the cause
- */
- public SimExplorerServiceException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sim explorer service exception.
- *
- * @param message
- * the message
- */
- public SimExplorerServiceException(String message) {
- super(message);
- }
-
- /**
- * Instantiates a new sim explorer service exception.
- *
- * @param message
- * the message
- * @param cause
- * the cause
- */
- public SimExplorerServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -28,6 +28,7 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* Service interface.
@@ -45,9 +46,9 @@
*
* @return Token as logon evidence
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- String loginUser(String login, String password) throws SimExplorerServiceException;
+ String loginUser(String login, String password) throws SimExplorerException;
/**
* Save an element.
@@ -57,9 +58,9 @@
*
* @return Metadata of element imported
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- MetaData saveElement(String token, SerializableInputStream zipStream) throws SimExplorerServiceException;
+ MetaData saveElement(String token, SerializableInputStream zipStream) throws SimExplorerException;
/**
* Save an element.
@@ -70,10 +71,10 @@
*
* @return Metadata of element saved
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
MetaData saveElement(String token, SerializableInputStream xmlStream,
- Map<Attachment, SerializableInputStream> attachmentsStream) throws SimExplorerServiceException;
+ Map<Attachment, SerializableInputStream> attachmentsStream) throws SimExplorerException;
/**
* Update.
@@ -84,10 +85,10 @@
* @param updatedElement the updated element
* @param justRemoveLatest just remove latest, if true, updatedElement has to be null
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
void update(String token, String uuid, Version version, MetaData updatedElement, boolean justRemoveLatest)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Retrieve metadata (latest version).
@@ -97,9 +98,9 @@
*
* @return the metadata
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException;
+ MetaData getMetadata(String token, String uuid) throws SimExplorerException;
/**
* Retrieve metadata.
@@ -110,9 +111,9 @@
*
* @return the metadata
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException;
+ MetaData getMetadata(String token, String uuid, String version) throws SimExplorerException;
/**
* Gets the metadatas used by the element.
@@ -123,9 +124,9 @@
*
* @return the metadatas used
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException;
+ MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException;
/**
* Gets the metadatas using the element.
@@ -136,9 +137,9 @@
*
* @return the metadatas using
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException;
+ MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerException;
/**
* Export XML of element to a stream.
@@ -149,9 +150,9 @@
*
* @return RMIIO stream with data
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- InputStream retrieveElementXML(String token, String uuid, String version) throws SimExplorerServiceException;
+ InputStream retrieveElementXML(String token, String uuid, String version) throws SimExplorerException;
/**
* Export full element to a stream as a zip.
@@ -162,9 +163,9 @@
*
* @return the input stream
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- InputStream retrieveElementFull(String token, String uuid, String version) throws SimExplorerServiceException;
+ InputStream retrieveElementFull(String token, String uuid, String version) throws SimExplorerException;
/**
* Retrieve data related to an entity.
@@ -176,10 +177,10 @@
*
* @return the input stream
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
InputStream retrieveElementData(String token, String uuid, String version, Attachment attachment)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Retrieve number of elements matching query.
@@ -190,9 +191,9 @@
*
* @return the int
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException;
+ int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException;
/**
* Find elements matching query.
@@ -206,10 +207,10 @@
*
* @return the meta data[]
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Retrieve number of applications.
@@ -219,9 +220,9 @@
*
* @return the int
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException;
+ int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerException;
/**
* Get a list of applications.
@@ -234,10 +235,10 @@
*
* @return the meta data[]
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, int dateOrder)
- throws SimExplorerServiceException;
+ throws SimExplorerException;
/**
* Fully load an element.
@@ -248,9 +249,9 @@
*
* @return the element
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- LoggableElement getLoggableElement(String token, String uuid, String version) throws SimExplorerServiceException;
+ LoggableElement getLoggableElement(String token, String uuid, String version) throws SimExplorerException;
/**
* Get all version of an element.
@@ -260,9 +261,9 @@
*
* @return the versions
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- Version[] getVersions(String token, String uuid) throws SimExplorerServiceException;
+ Version[] getVersions(String token, String uuid) throws SimExplorerException;
/**
* Delete element.
@@ -271,9 +272,9 @@
* @param uuid the uuid
* @param version the version
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- void deleteElement(String token, String uuid, String version) throws SimExplorerServiceException;
+ void deleteElement(String token, String uuid, String version) throws SimExplorerException;
/**
* Delete element.
@@ -281,8 +282,8 @@
* @param token the token
* @param uuid the uuid
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- void deleteElement(String token, String uuid) throws SimExplorerServiceException;
+ void deleteElement(String token, String uuid) throws SimExplorerException;
}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -18,9 +18,9 @@
package fr.cemagref.simexplorer.is.service;
import static org.codelutin.i18n.I18n._;
-
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerBusinessException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl;
@@ -36,8 +36,8 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String)
*/
public String loginUser(String login, String password)
- throws SimExplorerServiceException {
- throw new SimExplorerServiceException(
+ throws SimExplorerException {
+ throw new SimExplorerBusinessException(
_("simexplorer.service.nologonlocal"));
}
@@ -46,7 +46,7 @@
*/
@Override
protected StorageEngine getStorageEngine()
- throws SimExplorerStorageException {
+ throws SimExplorerException {
if (storageEngine == null) {
storageEngine = new StorageEngineImpl();
storageEngine.open();
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -19,6 +19,7 @@
import static org.codelutin.i18n.I18n._;
+import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -45,10 +46,12 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerBusinessException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
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.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
/**
@@ -64,9 +67,9 @@
*
* @return the storage engine
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- protected abstract StorageEngine getStorageEngine() throws SimExplorerStorageException;
+ protected abstract StorageEngine getStorageEngine() throws SimExplorerException;
/**
* Increment version.
@@ -80,114 +83,76 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String)
*/
- public MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException {
- try {
- return getStorageEngine().getMetadata(token, uuid);
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public MetaData getMetadata(String token, String uuid) throws SimExplorerException {
+ return getStorageEngine().getMetadata(token, uuid);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String, java.lang.String)
*/
- public MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException {
- try {
- return getStorageEngine().getMetadata(token, uuid, new Version(version));
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public MetaData getMetadata(String token, String uuid, String version) throws SimExplorerException {
+ return getStorageEngine().getMetadata(token, uuid, new Version(version));
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsed(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException {
- try {
- return getStorageEngine().getMetadatasUsed(token, uuid, new Version(version));
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException {
+ return getStorageEngine().getMetadatasUsed(token, uuid, new Version(version));
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsing(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
- public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException {
- try {
- return getStorageEngine().getMetadatasUsing(token, uuid, new Version(version));
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerException {
+ return getStorageEngine().getMetadatasUsing(token, uuid, new Version(version));
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findFullText(java.lang.String, java.lang.String, boolean, int, int, int)
*/
public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- int dateOrder) throws SimExplorerServiceException {
- try {
- return getStorageEngine().findFullText(token, query, onlyLatest, indexStart, count, dateOrder);
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ int dateOrder) throws SimExplorerException {
+ return getStorageEngine().findFullText(token, query, onlyLatest, indexStart, count, dateOrder);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findFullTextCount(java.lang.String, java.lang.String, boolean)
*/
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException {
- try {
- return getStorageEngine().findFullTextCount(token, query, onlyLatest);
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
+ return getStorageEngine().findFullTextCount(token, query, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findApplicationsCount(java.lang.String, boolean)
*/
- public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException {
- try {
- return getStorageEngine().findElementsByTypeCount(token, VALUE_METADATA_TYPE_EA, onlyLatest);
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerException {
+ return getStorageEngine().findElementsByTypeCount(token, VALUE_METADATA_TYPE_EA, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findApplications(java.lang.String, boolean, int, int, int)
*/
public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, int dateOrder)
- throws SimExplorerServiceException {
- try {
- return getStorageEngine().findElementsByType(token, VALUE_METADATA_TYPE_EA, onlyLatest, start, count,
- dateOrder);
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ throws SimExplorerException {
+ return getStorageEngine()
+ .findElementsByType(token, VALUE_METADATA_TYPE_EA, onlyLatest, start, count, dateOrder);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getLoggableElement(java.lang.String, java.lang.String, java.lang.String)
*/
- public LoggableElement getLoggableElement(String token, String uuid, String version)
- throws SimExplorerServiceException {
+ public LoggableElement getLoggableElement(String token, String uuid, String version) throws SimExplorerException {
MetaData mde = getMetadata(token, uuid, version);
- try {
- LoggableElement le;
- BaseEntityFactory<? extends DataEntity> factory = BaseEntityFactory.getFactory(LoggableElement.class
- .getPackage().getName()
- + DOT + mde.getType());
- le = (LoggableElement) factory.loadElement(getStorageEngine().retrieveData(token, mde, getXMLAttachment()));
+ LoggableElement le;
+ BaseEntityFactory<? extends DataEntity> factory;
+ factory = BaseEntityFactory.getFactory(LoggableElement.class.getPackage().getName() + DOT + mde.getType());
+ le = (LoggableElement) factory.loadElement(getStorageEngine().retrieveData(token, mde, getXMLAttachment()));
- return le;
- } catch (Exception e) {
- throw new SimExplorerServiceException(e);
- }
+ return le;
}
/**
@@ -198,58 +163,69 @@
*
* @return the meta data
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public MetaData saveElement(String token, SerializableInputStream zipStream) throws SimExplorerServiceException {
+ public MetaData saveElement(String token, SerializableInputStream zipStream) throws SimExplorerException {
String xmlFile = null;
Map<Attachment, String> attachments = new HashMap<Attachment, String>();
ZipInputStream zis = new ZipInputStream(zipStream);
+ ZipEntry entry;
try {
- ZipEntry entry;
- while ((entry = zis.getNextEntry()) != null) {
- if (!entry.isDirectory()) {
- String entryName = entry.getName();
- if (entryName.equals(FILE_XML)) {
- xmlFile = getStorageEngine().storeTempData(zis);
- } else {
- if (entryName.startsWith(FILE_DATA_PREFIX)) {
- String fileName = entryName.replace(FILE_DATA_PREFIX + FOLDER_SEPARATOR, "");
+ entry = zis.getNextEntry();
+ } catch (IOException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
- String zipMD5 = Attachment.getHashFromUniqueId(fileName);
- fileName = Attachment.getFileNameFromUniqueId(fileName);
+ while (entry != null) {
+ if (!entry.isDirectory()) {
+ String entryName = entry.getName();
+ if (entryName.equals(FILE_XML)) {
+ xmlFile = getStorageEngine().storeTempData(zis);
+ } else {
+ if (entryName.startsWith(FILE_DATA_PREFIX)) {
+ String fileName = entryName.replace(FILE_DATA_PREFIX + FOLDER_SEPARATOR, "");
- MD5InputStream md5Stream = new MD5InputStream(zis);
- String idFile = getStorageEngine().storeTempData(md5Stream);
+ String zipMD5 = Attachment.getHashFromUniqueId(fileName);
+ fileName = Attachment.getFileNameFromUniqueId(fileName);
- String localMD5 = MD5.asHex(md5Stream.hash());
+ MD5InputStream md5Stream = new MD5InputStream(zis);
+ String idFile = getStorageEngine().storeTempData(md5Stream);
- if (!localMD5.equals(zipMD5)) {
+ String localMD5 = MD5.asHex(md5Stream.hash());
- throw new SimExplorerServiceException(_("simexplorer.service.invalidhash"));
+ if (!localMD5.equals(zipMD5)) {
+ throw new SimExplorerBusinessException(_("simexplorer.service.invalidhash"));
- }
-
- Attachment attachment = new Attachment();
- attachment.setFileName(fileName);
- attachment.setDataHash(localMD5);
- attachments.put(attachment, idFile);
}
+ Attachment attachment = new Attachment();
+ attachment.setFileName(fileName);
+ attachment.setDataHash(localMD5);
+ attachments.put(attachment, idFile);
}
}
}
-
- Document document = BaseEntityFactory.getXMLBuilder().parse(getStorageEngine().retrieveTempData(xmlFile));
- MetaData elementSaved = saveElement(token, document, getFirstElement(document), attachments);
- getStorageEngine().deleteTempData(xmlFile);
- for (Map.Entry<Attachment, String> tmpId : attachments.entrySet()) {
- getStorageEngine().deleteTempData(tmpId.getValue());
+ try {
+ entry = zis.getNextEntry();
+ } catch (IOException e) {
+ throw new SimExplorerTechnicalException(e);
}
- return elementSaved;
+
+ }
+ Document document;
+ InputStream xmlData = getStorageEngine().retrieveTempData(xmlFile);
+ try {
+ document = BaseEntityFactory.getXMLBuilder().parse(xmlData);
} catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
}
+ MetaData elementSaved = saveElement(token, document, getFirstElement(document), attachments);
+ getStorageEngine().deleteTempData(xmlFile);
+ for (Map.Entry<Attachment, String> tmpId : attachments.entrySet()) {
+ getStorageEngine().deleteTempData(tmpId.getValue());
+ }
+ return elementSaved;
}
/**
@@ -261,28 +237,30 @@
*
* @return the meta data
*
- * @throws SimExplorerServiceException the exception
+ * @throws SimExplorerException the exception
*/
public MetaData saveElement(String token, SerializableInputStream xmlFile,
- Map<Attachment, SerializableInputStream> attachments) throws SimExplorerServiceException {
- try {
- // Store temporary data
- String idxml = getStorageEngine().storeTempData(xmlFile);
- Map<Attachment, String> idsattachment = new HashMap<Attachment, String>();
- for (Map.Entry<Attachment, SerializableInputStream> entry : attachments.entrySet()) {
- String idattachment = getStorageEngine().storeTempData(entry.getValue());
- idsattachment.put(entry.getKey(), idattachment);
- }
- Document document = BaseEntityFactory.getXMLBuilder().parse(getStorageEngine().retrieveTempData(idxml));
- MetaData elementSaved = saveElement(token, document, getFirstElement(document), idsattachment);
- getStorageEngine().deleteTempData(idxml);
- for (Map.Entry<Attachment, String> tmpId : idsattachment.entrySet()) {
- getStorageEngine().deleteTempData(tmpId.getValue());
- }
- return elementSaved;
+ Map<Attachment, SerializableInputStream> attachments) throws SimExplorerException {
+ // Store temporary data
+ String idxml = getStorageEngine().storeTempData(xmlFile);
+ Map<Attachment, String> idsattachment = new HashMap<Attachment, String>();
+ for (Map.Entry<Attachment, SerializableInputStream> entry : attachments.entrySet()) {
+ String idattachment = getStorageEngine().storeTempData(entry.getValue());
+ idsattachment.put(entry.getKey(), idattachment);
+ }
+ Document document;
+ InputStream xmlData = getStorageEngine().retrieveTempData(idxml);
+ try {
+ document = BaseEntityFactory.getXMLBuilder().parse(xmlData);
} catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
}
+ MetaData elementSaved = saveElement(token, document, getFirstElement(document), idsattachment);
+ getStorageEngine().deleteTempData(idxml);
+ for (Map.Entry<Attachment, String> tmpId : idsattachment.entrySet()) {
+ getStorageEngine().deleteTempData(tmpId.getValue());
+ }
+ return elementSaved;
}
/**
@@ -295,18 +273,20 @@
*
* @return the input stream
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public InputStream retrieveElementData(String token, String uuid, String version, Attachment attachment)
- throws SimExplorerServiceException {
- try {
- MetaData mde = getMetadata(token, uuid, version);
- InputStream stream = getStorageEngine().retrieveData(token, mde, attachment);
+ throws SimExplorerException {
+ MetaData mde = getMetadata(token, uuid, version);
+ InputStream stream = getStorageEngine().retrieveData(token, mde, attachment);
- return new SerializableInputStream(stream);
- } catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ SerializableInputStream serializableInputStream;
+ try {
+ serializableInputStream = new SerializableInputStream(stream);
+ } catch (IOException e) {
+ throw new SimExplorerTechnicalException(e);
}
+ return serializableInputStream;
}
/**
@@ -318,17 +298,18 @@
*
* @return the input stream
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public InputStream retrieveElementXML(String token, String uuid, String version) throws SimExplorerServiceException {
+ public InputStream retrieveElementXML(String token, String uuid, String version) throws SimExplorerException {
MetaData mde = getMetadata(token, uuid, version);
+ InputStream xmlStream = getStorageEngine().retrieveData(token, mde, getXMLAttachment());
+ SerializableInputStream serializableInputStream;
try {
- InputStream xmlStream = getStorageEngine().retrieveData(token, mde, getXMLAttachment());
- return new SerializableInputStream(xmlStream);
- } catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ serializableInputStream = new SerializableInputStream(xmlStream);
+ } catch (IOException e) {
+ throw new SimExplorerTechnicalException(e);
}
-
+ return serializableInputStream;
}
/**
@@ -340,123 +321,108 @@
*
* @return the input stream
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public InputStream retrieveElementFull(String token, String uuid, String version)
- throws SimExplorerServiceException {
+ public InputStream retrieveElementFull(String token, String uuid, String version) throws SimExplorerException {
LoggableElement element = getLoggableElement(token, uuid, version);
MetaData mde = element.getMetaData();
- try {
- PipedOutputStream pipedOut = new PipedOutputStream();
- Map<String, InputStream> files = new HashMap<String, InputStream>();
+ PipedOutputStream pipedOut = new PipedOutputStream();
+ Map<String, InputStream> files = new HashMap<String, InputStream>();
- files.put(FILE_XML, getStorageEngine().retrieveData(token, mde, getXMLAttachment()));
- List<LoggableElement> children = element.getChildren();
- for (LoggableElement loggableElement : children) {
- MetaData thisMde = loggableElement.getMetaData();
- List<Attachment> attachments = loggableElement.getMetaData().getAttachments();
- for (Attachment attachment : attachments) {
- files.put(FILE_DATA_PREFIX + FOLDER_SEPARATOR + attachment.getUniqueId(), getStorageEngine()
- .retrieveData(token, thisMde, attachment));
- }
+ files.put(FILE_XML, getStorageEngine().retrieveData(token, mde, getXMLAttachment()));
+ List<LoggableElement> children = element.getChildren();
+ for (LoggableElement loggableElement : children) {
+ MetaData thisMde = loggableElement.getMetaData();
+ List<Attachment> attachments = loggableElement.getMetaData().getAttachments();
+ for (Attachment attachment : attachments) {
+ files.put(FILE_DATA_PREFIX + FOLDER_SEPARATOR + attachment.getUniqueId(), getStorageEngine()
+ .retrieveData(token, thisMde, attachment));
}
+ }
+ SerializableInputStream serializableInputStream;
+ try {
PipedInputStream pipedIn = new PipedInputStream(pipedOut);
ZipStreamEncoder zse = new ZipStreamEncoder(files, pipedOut);
zse.start();
- return new SerializableInputStream(pipedIn);
- } catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ serializableInputStream = new SerializableInputStream(pipedIn);
+ } catch (IOException e) {
+ throw new SimExplorerTechnicalException(e);
}
-
+ return serializableInputStream;
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#update(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version, fr.cemagref.simexplorer.is.entities.metadata.MetaData, boolean)
*/
public void update(String token, String uuid, Version version, MetaData updatedElement, boolean justRemoveLatest)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
Map<Attachment, InputStream> attachments = new HashMap<Attachment, InputStream>();
- try {
- MetaData elementToUpdate;
+ MetaData elementToUpdate;
- MetaData currentMetaData = getStorageEngine().getMetadata(token, uuid, version);
-
- if (justRemoveLatest) {
- currentMetaData.setLatest(false);
- elementToUpdate = currentMetaData;
- } else {
- elementToUpdate = updatedElement;
- }
+ MetaData currentMetaData = getStorageEngine().getMetadata(token, uuid, version);
- InputStream currentXml = getStorageEngine().retrieveData(token, currentMetaData, getXMLAttachment());
+ if (justRemoveLatest) {
+ currentMetaData.setLatest(false);
+ elementToUpdate = currentMetaData;
+ } else {
+ elementToUpdate = updatedElement;
+ }
+ InputStream currentXml = getStorageEngine().retrieveData(token, currentMetaData, getXMLAttachment());
+
+ InputStream newXml = null;
MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
- InputStream newXml = mdeFactory.modifyMedataElementStream(currentXml, elementToUpdate);
+ newXml = mdeFactory.modifyMedataElementStream(currentXml, elementToUpdate);
- attachments.put(getXMLAttachment(), newXml);
+ attachments.put(getXMLAttachment(), newXml);
- List<Attachment> realAttachments = currentMetaData.getAttachments();
- for (Attachment attachment : realAttachments) {
- attachments.put(attachment, getStorageEngine().retrieveData(token, currentMetaData, attachment));
- }
+ List<Attachment> realAttachments = currentMetaData.getAttachments();
+ for (Attachment attachment : realAttachments) {
+ attachments.put(attachment, getStorageEngine().retrieveData(token, currentMetaData, attachment));
+ }
- if (justRemoveLatest) {
- getStorageEngine().deleteElement(token, uuid, version);
- } else {
- getStorageEngine().duplicateElementHierarchy(token, currentMetaData, elementToUpdate);
- }
- getStorageEngine().saveElement(token, elementToUpdate, attachments);
- getStorageEngine().commit();
- } catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ if (justRemoveLatest) {
+ getStorageEngine().deleteElement(token, uuid, version);
+ } else {
+ getStorageEngine().duplicateElementHierarchy(token, currentMetaData, elementToUpdate);
}
+ getStorageEngine().saveElement(token, elementToUpdate, attachments);
+ getStorageEngine().commit();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#getVersions(java.lang.String, java.lang.String)
*/
- public Version[] getVersions(String token, String uuid) throws SimExplorerServiceException {
- try {
- Set<MetaData> versions = getStorageEngine().getElementVersions(token, uuid);
- Version[] result = new Version[versions.size()];
- int i = 0;
- for (MetaData metaData : versions) {
- result[i] = metaData.getVersion();
- i++;
- }
- return result;
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
+ public Version[] getVersions(String token, String uuid) throws SimExplorerException {
+ Set<MetaData> versions = getStorageEngine().getElementVersions(token, uuid);
+ Version[] result = new Version[versions.size()];
+ int i = 0;
+ for (MetaData metaData : versions) {
+ result[i] = metaData.getVersion();
+ i++;
}
+ return result;
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String, java.lang.String)
*/
- public void deleteElement(String token, String uuid, String version) throws SimExplorerServiceException {
- try {
- // FIXME
- getStorageEngine().deleteElement(token, uuid, new Version(version));
- getStorageEngine().commit();
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public void deleteElement(String token, String uuid, String version) throws SimExplorerException {
+ // FIXME
+ getStorageEngine().deleteElement(token, uuid, new Version(version));
+ getStorageEngine().commit();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String)
*/
- public void deleteElement(String token, String uuid) throws SimExplorerServiceException {
- try {
- // FIXME
- getStorageEngine().deleteElements(token, uuid);
- getStorageEngine().commit();
- } catch (SimExplorerStorageException e) {
- throw new SimExplorerServiceException(e);
- }
+ public void deleteElement(String token, String uuid) throws SimExplorerException {
+ // FIXME
+ getStorageEngine().deleteElements(token, uuid);
+ getStorageEngine().commit();
}
/**
@@ -467,10 +433,10 @@
* @param document the document
* @param xmlNode the xml node
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
protected void processVersionRules(String token, MetaData metaData, Document document, Element xmlNode)
- throws Exception {
+ throws SimExplorerException {
// This one will always be the latest
metaData.setLatest(true);
@@ -500,11 +466,11 @@
metaData.setParentVersionUuid(previousVersion.getUuid());
metaData.setParentVersionVersion(previousVersion.getVersion().toString());
- // get metadata factory
- MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
+ // get metadata factory
+ MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
- // Update XML with version updated
- mdeFactory.replaceMetadataInXML(document, xmlNode, metaData);
+ // Update XML with version updated
+ mdeFactory.replaceMetadataInXML(document, xmlNode, metaData);
}
}
@@ -550,9 +516,9 @@
*
* @return true, if successful
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- private boolean notExists(String token, MetaData metaData) throws Exception {
+ private boolean notExists(String token, MetaData metaData) throws SimExplorerException {
MetaData previousVersion = getStorageEngine().getMetadata(token, metaData.getUuid());
// Check if previous is not null and both hash are equals
@@ -569,7 +535,12 @@
if (getStorageEngine().canCreateSubVersion(token, metaData.getUuid())) {
// trying to save a version with same hash but in superior version
// so we will copy versionToUpgrade to metaData.getVersion()
- Version versionToUpgrade = previousVersion.getVersion().clone();
+ Version versionToUpgrade;
+ try {
+ versionToUpgrade = previousVersion.getVersion().clone();
+ } catch (CloneNotSupportedException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
// set previous as not being the latest one
update(token, previousVersion.getUuid(), previousVersion.getVersion(), null, true);
@@ -604,16 +575,17 @@
*
* @return the meta data
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
private MetaData saveElement(String token, Document document, Element xmlNode, Map<Attachment, String> idsattachment)
- throws Exception {
- // Load metadata xml
- MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
- MetaData metaData = mdeFactory.loadElementFromParentXML(xmlNode);
+ throws SimExplorerException {
+ MetaData metaData;
+ // Load metadata xml
+ MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
+ metaData = mdeFactory.loadElementFromParentXML(xmlNode);
- // Compute element hash
- metaData.setHash(mdeFactory.computeHash(xmlNode));
+ // Compute element hash
+ metaData.setHash(mdeFactory.computeHash(xmlNode));
if (notExists(token, metaData)) {
@@ -637,14 +609,14 @@
// Prepare saving
Map<Attachment, InputStream> attachments = new HashMap<Attachment, InputStream>();
- attachments.put(getXMLAttachment(), BaseEntityFactory.serializeElement(xmlNode));
+ attachments.put(getXMLAttachment(), BaseEntityFactory.serializeElement(xmlNode));
List<Attachment> realAttachments = metaData.getAttachments();
for (Attachment attachment : realAttachments) {
String idAttachment = idsattachment.get(attachment);
// Check hash of attachments
if (idAttachment == null) {
- throw new SimExplorerServiceException(_("simexplorer.service.attachmentnotfund"));
+ throw new SimExplorerBusinessException(_("simexplorer.service.attachmentnotfund"));
}
attachments.put(attachment, getStorageEngine().retrieveTempData(idAttachment));
}
@@ -668,12 +640,13 @@
* @param node the node
* @param parent the parent
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
private void saveSubElements(String token, MetaData parent, Document document, Element node, String entitiesNode,
- String entityNode, Map<Attachment, String> idsattachment) throws Exception {
+ String entityNode, Map<Attachment, String> idsattachment) throws SimExplorerException {
- BaseEntityFactory<MetaData> elementFactory = MetaDataFactory.getFactory(MetaData.class);
+ BaseEntityFactory<MetaData> elementFactory;
+ elementFactory = MetaDataFactory.getFactory(MetaData.class);
// Elements
Element entitiesElement = elementFactory.getXMLElementByTagName(node, entitiesNode);
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -24,6 +24,8 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
public class StorageServiceHelper {
@@ -40,10 +42,10 @@
*
* @return the version
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
public static MetaData exportElementTo(String token, StorageService fromService, StorageService toService,
- String uuid, String version) throws SimExplorerServiceException {
+ String uuid, String version) throws SimExplorerException {
// Extract element from source service
InputStream fromElement = fromService.retrieveElementFull(token, uuid, version);
// Store element in remote service
@@ -51,7 +53,7 @@
try {
toElement = toService.saveElement(token, new SerializableInputStream(fromElement));
} catch (IOException e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerTechnicalException(e);
}
// fromElement has to be updated
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -17,21 +17,14 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import org.jboss.annotation.ejb.RemoteBinding;
-import com.healthmarketscience.rmiio.RemoteInputStreamServer;
-import com.healthmarketscience.rmiio.SimpleRemoteInputStream;
-
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
/**
@@ -53,7 +46,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String)
*/
- public String loginUser(String login, String password) throws SimExplorerServiceException {
+ public String loginUser(String login, String password) throws SimExplorerException {
String token = authenticationService.loginUser(login, password);
return token;
}
@@ -62,7 +55,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageServiceCommon#getStorageEngine()
*/
@Override
- protected StorageEngine getStorageEngine() throws SimExplorerStorageException {
+ protected StorageEngine getStorageEngine() throws SimExplorerException {
storageEngine.open();
return storageEngine;
}
Deleted: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -1,65 +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;
-
-/**
- * The Class SimExplorerStorageSecurityException.
- */
-public class SimExplorerStorageSecurityException extends SimExplorerStorageException {
-
- /**
- *
- */
- private static final long serialVersionUID = 862842493087651110L;
-
- /**
- * Instantiates a new sim explorer storage security exception.
- */
- public SimExplorerStorageSecurityException() {
- super();
- }
-
- /**
- * Instantiates a new sim explorer storage security exception.
- *
- * @param message the message
- */
- public SimExplorerStorageSecurityException(String message) {
- super(message);
- }
-
- /**
- * Instantiates a new sim explorer storage security exception.
- *
- * @param cause the cause
- */
- public SimExplorerStorageSecurityException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sim explorer storage security exception.
- *
- * @param message the message
- * @param cause the cause
- */
- public SimExplorerStorageSecurityException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -17,8 +17,6 @@
* ##% */
package fr.cemagref.simexplorer.is.storage.engine;
-import static org.codelutin.i18n.I18n._;
-
import java.io.InputStream;
import java.util.List;
import java.util.Map;
@@ -30,10 +28,10 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerSecurityException;
import fr.cemagref.simexplorer.is.security.credentials.CredentialManager;
import fr.cemagref.simexplorer.is.security.entities.Permission;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageSecurityException;
/**
* The Class StorageEngineSecuImpl.
@@ -50,13 +48,13 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#deleteElement(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public void deleteElement(String token, String uuid, Version version) throws SimExplorerStorageException {
+ public void deleteElement(String token, String uuid, Version version) throws SimExplorerException {
Permission permission = credentialManager.getPermission(token, uuid);
// TODO check candelete = canadmin
if (permission.isCanAdmin()) {
super.deleteElement(token, uuid, version);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
}
@@ -64,13 +62,13 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#deleteElements(java.lang.String, java.lang.String)
*/
@Override
- public void deleteElements(String token, String uuid) throws SimExplorerStorageException {
+ public void deleteElements(String token, String uuid) throws SimExplorerException {
Permission permission = credentialManager.getPermission(token, uuid);
// TODO check candelete = canadmin
if (permission.isCanAdmin()) {
super.deleteElements(token, uuid);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
}
@@ -79,7 +77,7 @@
*/
@Override
public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count,
- int dateOrder) throws SimExplorerStorageException {
+ int dateOrder) throws SimExplorerException {
MetaData[] list;
list = super.findElementsByType(token, type, onlyLatest, start, count, dateOrder);
// TODO how to filter without losing pagination?
@@ -91,7 +89,7 @@
*/
@Override
public int findElementsByTypeCount(String token, String type, boolean onlyLatest)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
// TODO how to filter without losing pagination?
return super.findElementsByTypeCount(token, type, onlyLatest);
}
@@ -101,7 +99,7 @@
*/
@Override
public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- int dateOrder) throws SimExplorerStorageException {
+ int dateOrder) throws SimExplorerException {
// TODO how to filter without losing pagination?
return super.findFullText(token, query, onlyLatest, indexStart, count, dateOrder);
}
@@ -110,7 +108,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findFullTextCount(java.lang.String, java.lang.String, boolean)
*/
@Override
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerStorageException {
+ public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
// TODO how to filter without losing pagination?
return super.findFullTextCount(token, query, onlyLatest);
}
@@ -119,13 +117,13 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getMetadata(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerStorageException {
+ public MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid, version);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
return mde;
}
@@ -134,13 +132,13 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getMetadata(java.lang.String, java.lang.String)
*/
@Override
- public MetaData getMetadata(String token, String uuid) throws SimExplorerStorageException {
+ public MetaData getMetadata(String token, String uuid) throws SimExplorerException {
MetaData mde;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
return mde;
}
@@ -149,13 +147,13 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getVersions(java.lang.String, java.lang.String)
*/
@Override
- public List<Version> getVersions(String token, String uuid) throws SimExplorerStorageException {
+ public List<Version> getVersions(String token, String uuid) throws SimExplorerException {
List<Version> versions;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanRead()) {
versions = super.getVersions(token, uuid);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
return versions;
}
@@ -165,13 +163,13 @@
*/
@Override
public InputStream retrieveData(String token, MetaData entity, Attachment attachment)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
InputStream stream;
Permission permission = credentialManager.getPermission(token, entity.getUuid());
if (permission.isCanRead()) {
stream = super.retrieveData(token, entity, attachment);
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
return stream;
}
@@ -180,7 +178,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#canCreateSubVersion(java.lang.String, java.lang.String)
*/
@Override
- public boolean canCreateSubVersion(String token, String uuid) throws SimExplorerStorageException {
+ public boolean canCreateSubVersion(String token, String uuid) throws SimExplorerException {
Permission permission = credentialManager.getPermission(token, uuid);
if (permission.isCanWrite()) {
return true;
@@ -193,13 +191,13 @@
*/
@Override
public void saveElement(String token, MetaData element, Map<Attachment, InputStream> attachments)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
Permission permission = credentialManager.getPermission(token, element.getUuid());
if (permission.isCanWrite()) {
super.saveElement(token, element, attachments);
credentialManager.saveElement(token, element.getUuid());
} else {
- throw new SimExplorerStorageSecurityException();
+ throw new SimExplorerSecurityException();
}
}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-en_GB.properties 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-en_GB.properties 2008-02-15 16:25:18 UTC (rev 1006)
@@ -11,4 +11,3 @@
simexplorer.service.mail.requestheader=Account request
simexplorer.service.mail.subject=Simexplorer IS web message
simexplorer.service.nologonlocal=Local logon is non sense
-simexplorer.service.security.norights=Not enough rights to perform that action
Modified: trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-fr_FR.properties 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/resources/i18n/simexplorer-is-service-fr_FR.properties 2008-02-15 16:25:18 UTC (rev 1006)
@@ -11,4 +11,3 @@
simexplorer.service.mail.requestheader=Demande de compte
simexplorer.service.mail.subject=Simexplorer IS message web
simexplorer.service.nologonlocal=Login local incoh\u00E9rent
-simexplorer.service.security.norights=Pas assez de droit pour r\u00E9aliser cette action
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -23,6 +23,7 @@
import javax.naming.InitialContext;
import junit.framework.TestCase;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
/**
@@ -54,10 +55,10 @@
/**
* Test hash code.
*
- * @throws SimExplorerServiceException
+ * @throws SimExplorerException
* the sim explorer service exception
*/
- public void testHashCode() throws SimExplorerServiceException {
+ public void testHashCode() throws SimExplorerException {
String token = authenticationService
.loginUser("superadmin", "password");
User[] users1 = authenticationService.getUsers(token);
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -23,6 +23,7 @@
import javax.naming.InitialContext;
import junit.framework.TestCase;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
@@ -55,10 +56,10 @@
/**
* Test security entities.
*
- * @throws SimExplorerServiceException
+ * @throws SimExplorerException
* the sim explorer service exception
*/
- public void testSecurityEntities() throws SimExplorerServiceException {
+ public void testSecurityEntities() throws SimExplorerException {
/*
User user = authenticationService.getUser("user3");
Group[] groups = authenticationService.getGroupsOfUser(user);
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -40,6 +40,7 @@
import fr.cemagref.simexplorer.is.entities.data.Library;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
import fr.cemagref.simexplorer.is.factories.MetaDataFactory;
import fr.cemagref.simexplorer.is.factories.XmlConstants;
@@ -120,7 +121,7 @@
return storageService.saveElement(token, xmlStream, realAttachments);
}
- private void listExisting(String uuid) throws SimExplorerServiceException {
+ private void listExisting(String uuid) throws SimExplorerException {
if (uuid != null) {
Version[] versions = storageService.getVersions(token, uuid);
System.out.println("Versions of uuid " + uuid + ":");
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -23,6 +23,7 @@
import javax.naming.InitialContext;
import junit.framework.TestCase;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.StorageService;
/**
@@ -58,7 +59,7 @@
try {
String token = storageService.loginUser("superadmin", "password");
System.out.println(token);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
fail();
}
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -20,6 +20,8 @@
import java.io.InputStream;
import java.io.Reader;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+
/**
* Content handler.
*
@@ -35,10 +37,10 @@
*
* @return Indexable text
*
- * @throws Exception
+ * @throws SimExplorerException
* the exception
*/
- public abstract Reader renderToText(InputStream is) throws Exception;
+ public abstract Reader renderToText(InputStream is) throws SimExplorerException;
/**
* Gets the mime type.
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -0,0 +1,69 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, 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.exceptions;
+
+/**
+ * Exception de base pour toute erreur rencontrée dans un service.
+ *
+ * @author chemit
+ */
+public class SimExplorerException extends Exception {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 1054522404126322604L;
+
+ /**
+ * Instantiates a new sim explorer service exception.
+ */
+ public SimExplorerException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer service exception.
+ *
+ * @param cause
+ * the cause
+ */
+ public SimExplorerException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer service exception.
+ *
+ * @param message
+ * the message
+ */
+ public SimExplorerException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer service exception.
+ *
+ * @param message
+ * the message
+ * @param cause
+ * the cause
+ */
+ public SimExplorerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerSecurityException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerSecurityException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerSecurityException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -0,0 +1,66 @@
+/*
+* ##% 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.exceptions;
+
+
+/**
+ * The Class SimExplorerSecurityException.
+ */
+public class SimExplorerSecurityException extends SimExplorerBusinessException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 862842493087651110L;
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ */
+ public SimExplorerSecurityException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param message the message
+ */
+ public SimExplorerSecurityException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param cause the cause
+ */
+ public SimExplorerSecurityException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
+ public SimExplorerSecurityException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerTechnicalException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerTechnicalException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/exceptions/SimExplorerTechnicalException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -0,0 +1,62 @@
+/*
+* ##% 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.exceptions;
+
+/**
+ * The Class SimExplorerTechnicalException.
+ */
+public class SimExplorerTechnicalException extends SimExplorerException {
+
+ private static final long serialVersionUID = 7182289381405452276L;
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ */
+ public SimExplorerTechnicalException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param message the message
+ */
+ public SimExplorerTechnicalException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param cause the cause
+ */
+ public SimExplorerTechnicalException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
+ public SimExplorerTechnicalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -20,29 +20,14 @@
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import javax.xml.crypto.dom.DOMStructure;
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.crypto.dsig.Reference;
-import javax.xml.crypto.dsig.SignatureMethod;
-import javax.xml.crypto.dsig.SignedInfo;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
@@ -53,6 +38,8 @@
import fr.cemagref.simexplorer.is.entities.BaseEntity;
import fr.cemagref.simexplorer.is.entities.data.DataEntity;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
/**
* A factory for creating BaseEntity objects.
@@ -80,19 +67,24 @@
*
* @return Factory
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
@SuppressWarnings("unchecked")
- public static <E extends DataEntity> BaseEntityFactory<E> getFactory(Class entityClass) throws Exception {
+ public static <E extends DataEntity> BaseEntityFactory<E> getFactory(Class entityClass) throws SimExplorerException {
BaseEntityFactory<E> result = (BaseEntityFactory<E>) factories.get(entityClass.getSimpleName());
if (result == null) {
String elementFactoryClassName = BaseEntityFactory.class.getPackage().getName() + "."
+ entityClass.getSimpleName() + FACTORY_SUFFIX;
- Class<? extends BaseEntityFactory<E>> factoryClass = (Class<? extends BaseEntityFactory<E>>) Class.forName(
- elementFactoryClassName).asSubclass(BaseEntityFactory.class);
+ Class<? extends BaseEntityFactory<E>> factoryClass;
+ try {
+ factoryClass = (Class<? extends BaseEntityFactory<E>>) Class.forName(elementFactoryClassName)
+ .asSubclass(BaseEntityFactory.class);
+ result = factoryClass.newInstance();
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
- result = factoryClass.newInstance();
factories.put(entityClass.getSimpleName(), result);
}
return result;
@@ -105,10 +97,16 @@
*
* @return the factory
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public static BaseEntityFactory<? extends DataEntity> getFactory(String entityClassName) throws Exception {
- Class<? extends DataEntity> entityClass = Class.forName(entityClassName).asSubclass(DataEntity.class);
+ public static BaseEntityFactory<? extends DataEntity> getFactory(String entityClassName)
+ throws SimExplorerException {
+ Class<? extends DataEntity> entityClass;
+ try {
+ entityClass = Class.forName(entityClassName).asSubclass(DataEntity.class);
+ } catch (ClassNotFoundException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
return getFactory(entityClass);
}
@@ -116,10 +114,10 @@
* Retrieve an instance of document builder.
*
* @return XML document builder
+ * @throws ParserConfigurationException
*
- * @throws Exception the exception
*/
- public static synchronized DocumentBuilder getXMLBuilder() throws Exception {
+ public static synchronized DocumentBuilder getXMLBuilder() throws ParserConfigurationException {
if (documentBuilder == null) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
documentBuilder = factory.newDocumentBuilder();
@@ -146,9 +144,9 @@
*
* @return the E
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public E loadElement(Element xmlElement) throws Exception {
+ public E loadElement(Element xmlElement) throws SimExplorerException {
E element = createInstance();
return element;
}
@@ -160,11 +158,16 @@
*
* @return the E
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public E loadElement(InputStream stream) throws Exception {
- Document document = getXMLBuilder().parse(stream);
- Element rootElement = (Element) document.getFirstChild();
+ public E loadElement(InputStream stream) throws SimExplorerException {
+ Element rootElement;
+ try {
+ Document document = getXMLBuilder().parse(stream);
+ rootElement = (Element) document.getFirstChild();
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
E element = loadElement(rootElement);
return element;
}
@@ -176,9 +179,9 @@
* @param xmlElement XML node storing the element (not null)
* @param element Element to save
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public abstract void saveElement(Document document, Element xmlElement, E element) throws Exception;
+ public abstract void saveElement(Document document, Element xmlElement, E element) throws SimExplorerException;
/**
* Save an element to a XML stream.
@@ -188,28 +191,36 @@
*
* @return the input stream
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public InputStream saveElement(String rootNodeName, E element) throws Exception {
- org.w3c.dom.Document xmlDocument = getXMLBuilder().newDocument();
- // DOM properties
- xmlDocument.setXmlVersion("1.0");
- xmlDocument.setXmlStandalone(true);
- // DOM tree
- Element rootNode = xmlDocument.createElement(rootNodeName);
-
+ public InputStream saveElement(String rootNodeName, E element) throws SimExplorerException {
+ Document xmlDocument;
+ Element rootNode;
+ try {
+ xmlDocument = getXMLBuilder().newDocument();
+ // DOM properties
+ xmlDocument.setXmlVersion("1.0");
+ xmlDocument.setXmlStandalone(true);
+ // DOM tree
+ rootNode = xmlDocument.createElement(rootNodeName);
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
saveElement(xmlDocument, rootNode, element);
+ try {
+ xmlDocument.appendChild(rootNode);
+ DOMSource domSource = new DOMSource(xmlDocument);
- xmlDocument.appendChild(rootNode);
- DOMSource domSource = new DOMSource(xmlDocument);
+ PipedOutputStream os = new PipedOutputStream();
+ PipedInputStream is = new PipedInputStream(os);
- PipedOutputStream os = new PipedOutputStream();
- PipedInputStream is = new PipedInputStream(os);
+ XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
+ xse.start();
- XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
- xse.start();
-
- return is;
+ return is;
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
}
/*
@@ -229,10 +240,10 @@
*
* @return the set< t>
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
public <T extends DataEntity> Set<T> loadCollection(String tagSetName, String tagName, Class<T> clazz,
- Element xmlElement, DataEntity parentData) throws Exception {
+ Element xmlElement, DataEntity parentData) throws SimExplorerException {
Set<T> entities = new HashSet<T>();
// Retrieve XML node containing the collection
@@ -266,10 +277,10 @@
* @param document the document
* @param xmlElement the xml element
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
public <T extends DataEntity> void saveCollection(Set<T> entities, String tagSetName, String tagName,
- Class<T> clazz, Document document, Element xmlElement) throws Exception {
+ Class<T> clazz, Document document, Element xmlElement) throws SimExplorerException {
if (entities != null && entities.size() > 0) {
Element xmlCollection = document.createElement(tagSetName);
BaseEntityFactory<T> elementFactory = getFactory(clazz);
@@ -289,24 +300,28 @@
*
* @return the input stream
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public static InputStream serializeElement(Node node) throws Exception {
- Document xmlDocument = getXMLBuilder().newDocument();
- // DOM properties
- xmlDocument.setXmlVersion("1.0");
- xmlDocument.setXmlStandalone(true);
- // DOM tree
- xmlDocument.appendChild(xmlDocument.importNode(node, true));
- DOMSource domSource = new DOMSource(xmlDocument);
+ public static InputStream serializeElement(Node node) throws SimExplorerException {
+ try {
+ Document xmlDocument = getXMLBuilder().newDocument();
+ // DOM properties
+ xmlDocument.setXmlVersion("1.0");
+ xmlDocument.setXmlStandalone(true);
+ // DOM tree
+ xmlDocument.appendChild(xmlDocument.importNode(node, true));
+ DOMSource domSource = new DOMSource(xmlDocument);
- PipedOutputStream os = new PipedOutputStream();
- PipedInputStream is = new PipedInputStream(os);
+ PipedOutputStream os = new PipedOutputStream();
+ PipedInputStream is = new PipedInputStream(os);
- XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
- xse.start();
+ XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
+ xse.start();
- return is;
+ return is;
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
}
/*
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,6 +21,7 @@
import org.w3c.dom.Element;
import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating Code objects.
@@ -40,7 +41,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public Code loadElement(Element xmlElement) throws Exception {
+ public Code loadElement(Element xmlElement) throws SimExplorerException {
Code code = super.loadElement(xmlElement);
code.setLanguage(getXMLProperty(xmlElement, KEY_CODE_LANGUAGE));
code.setCode(getXMLProperty(xmlElement, KEY_CODE_CODE));
@@ -52,7 +53,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement, Code element)
- throws Exception {
+ throws SimExplorerException {
setXMLProperty(document, xmlElement, KEY_CODE_LANGUAGE, element
.getLanguage());
setXMLProperty(document, xmlElement, KEY_CODE_CODE, element.getCode());
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -25,6 +25,7 @@
import fr.cemagref.simexplorer.is.entities.data.Constant;
import fr.cemagref.simexplorer.is.entities.data.Library;
import fr.cemagref.simexplorer.is.entities.data.Structure;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating Component objects.
@@ -45,7 +46,7 @@
* @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public Component loadElement(Element xmlElement) throws Exception {
+ public Component loadElement(Element xmlElement) throws SimExplorerException {
Component component = super.loadElement(xmlElement);
component.setConstants(loadCollection(KEY_COMPONENT_CONSTANTS,
@@ -68,7 +69,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- Component element) throws Exception {
+ Component element) throws SimExplorerException {
super.saveElement(document, xmlElement, element);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,6 +21,8 @@
import org.w3c.dom.Element;
import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
/**
* A factory for creating Constant objects.
@@ -41,11 +43,15 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public Constant loadElement(Element xmlElement) throws Exception {
+ public Constant loadElement(Element xmlElement) throws SimExplorerException {
Constant constant = super.loadElement(xmlElement);
constant.setName(getXMLProperty(xmlElement, KEY_CONSTANT_NAME));
String className = getXMLProperty(xmlElement, KEY_CONSTANT_TYPE);
- constant.setType(Class.forName(className));
+ try {
+ constant.setType(Class.forName(className));
+ } catch (ClassNotFoundException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
return constant;
}
@@ -54,7 +60,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- Constant element) throws Exception {
+ Constant element) throws SimExplorerException {
setXMLProperty(document, xmlElement, KEY_CONSTANT_NAME, element
.getName());
String className = element.getType().getName();
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -22,6 +22,7 @@
import fr.cemagref.simexplorer.is.entities.data.Constant;
import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating ConstantValue objects.
@@ -42,7 +43,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public ConstantValue loadElement(Element xmlElement) throws Exception {
+ public ConstantValue loadElement(Element xmlElement) throws SimExplorerException {
ConstantValue constantValue = super.loadElement(xmlElement);
constantValue.setConstant((Constant) getFactory(Constant.class)
.loadElement(
@@ -58,7 +59,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- ConstantValue element) throws Exception {
+ ConstantValue element) throws SimExplorerException {
Element xmlConstant = document
.createElement(KEY_CONSTANTVALUE_CONSTANT);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -23,6 +23,7 @@
import fr.cemagref.simexplorer.is.entities.data.Component;
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating ExplorationApplication objects.
@@ -43,7 +44,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- ExplorationApplication element) throws Exception {
+ ExplorationApplication element) throws SimExplorerException {
super.saveElement(document, xmlElement, element);
saveCollection(element.getExplorations(),
KEY_EXPLORATIONAPPLICATION_DATA,
@@ -60,7 +61,7 @@
*/
@Override
public ExplorationApplication loadElement(Element xmlElement)
- throws Exception {
+ throws SimExplorerException {
ExplorationApplication explorationApplication = super
.loadElement(xmlElement);
explorationApplication.setExplorations(loadCollection(
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -23,6 +23,7 @@
import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating ExplorationData objects.
@@ -42,7 +43,7 @@
* @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public ExplorationData loadElement(Element xmlElement) throws Exception {
+ public ExplorationData loadElement(Element xmlElement) throws SimExplorerException {
ExplorationData explorationData = super.loadElement(xmlElement);
explorationData.setResult((Result) getFactory(Result.class)
.loadElement(
@@ -59,7 +60,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- ExplorationData element) throws Exception {
+ ExplorationData element) throws SimExplorerException {
super.saveElement(document, xmlElement, element);
Element xmlResult = document.createElement(KEY_EXPLORATIONDATA_RESULT);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,6 +21,7 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating LoggableElement objects.
@@ -35,7 +36,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public E loadElement(Element xmlElement) throws Exception {
+ public E loadElement(Element xmlElement) throws SimExplorerException {
E element = super.loadElement(xmlElement);
MetaDataFactory<MetaData> elementFactory = MetaDataFactory
@@ -54,7 +55,7 @@
*/
@Override
public void saveElement(org.w3c.dom.Document document, Element xmlElement,
- E element) throws Exception {
+ E element) throws SimExplorerException {
MetaDataFactory<MetaData> elementFactory = MetaDataFactory
.getFactory(MetaData.class);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -20,6 +20,7 @@
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -41,6 +42,8 @@
import fr.cemagref.simexplorer.is.attachment.ContentType;
import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
/**
* A factory for creating MetaData objects.
@@ -69,10 +72,10 @@
*
* @return the factory
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
@SuppressWarnings( { "unchecked" })
- public static <E extends MetaData> MetaDataFactory<E> getFactory(Class<E> entityClass) throws Exception {
+ public static <E extends MetaData> MetaDataFactory<E> getFactory(Class<E> entityClass) throws SimExplorerException {
return (MetaDataFactory) BaseEntityFactory.getFactory(entityClass);
}
@@ -83,7 +86,7 @@
*/
@Override
- public MetaData loadElement(Element xmlElement) throws Exception {
+ public MetaData loadElement(Element xmlElement) throws SimExplorerException {
MetaData entity = super.loadElement(xmlElement);
entity.setUuid(getXMLProperty(xmlElement, KEY_METADATA_UUID));
entity.setName(getXMLProperty(xmlElement, KEY_METADATA_NAME));
@@ -100,7 +103,12 @@
String creationDate = getXMLProperty(xmlElement, KEY_METADATA_CREATIONDATE);
if (creationDate != null) {
- Date date = sdf.parse(creationDate);
+ Date date;
+ try {
+ date = sdf.parse(creationDate);
+ } catch (ParseException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
entity.setCreationDate(date);
}
@@ -152,7 +160,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
*/
@Override
- public void saveElement(Document document, Element xmlElement, MetaData element) throws Exception {
+ public void saveElement(Document document, Element xmlElement, MetaData element) throws SimExplorerException {
setXMLProperty(document, xmlElement, KEY_METADATA_UUID, element.getUuid());
setXMLProperty(document, xmlElement, KEY_METADATA_NAME, element.getName());
@@ -217,12 +225,16 @@
*
* @return the meta data
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public MetaData loadElementFromParentXML(Element node) throws Exception {
+ public MetaData loadElementFromParentXML(Element node) throws SimExplorerException {
Element mdeElement = getXMLElementByTagName(node, KEY_METADATA);
MetaData mde;
- mde = loadElement(mdeElement);
+ try {
+ mde = loadElement(mdeElement);
+ } catch (SimExplorerException e) {
+ throw new SimExplorerTechnicalException(e);
+ }
return mde;
}
@@ -234,27 +246,37 @@
*
* @return the input stream
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public InputStream modifyMedataElementStream(InputStream xmlStream, MetaData newMetadata) throws Exception {
- Document document = getXMLBuilder().parse(xmlStream);
- Element rootElement = (Element) document.getFirstChild();
-
- Element newElement = document.createElement(KEY_METADATA);
+ public InputStream modifyMedataElementStream(InputStream xmlStream, MetaData newMetadata)
+ throws SimExplorerException {
+ Document document;
+ Element rootElement;
+ Element newElement;
+ try {
+ document = getXMLBuilder().parse(xmlStream);
+ rootElement = (Element) document.getFirstChild();
+ newElement = document.createElement(KEY_METADATA);
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
this.saveElement(document, newElement, newMetadata);
-
Element oldElement = getXMLElementByTagName(rootElement, KEY_METADATA);
rootElement.replaceChild(newElement, oldElement);
DOMSource domSource = new DOMSource(document);
- PipedOutputStream os = new PipedOutputStream();
- PipedInputStream is = new PipedInputStream(os);
+ try {
+ PipedOutputStream os = new PipedOutputStream();
+ PipedInputStream is = new PipedInputStream(os);
- XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
- xse.start();
+ XMLStreamEncoder xse = new XMLStreamEncoder(domSource, os);
+ xse.start();
- return is;
+ return is;
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
}
/**
@@ -264,9 +286,10 @@
* @param document the document
* @param xmlNode the xml node
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public void replaceMetadataInXML(Document document, Element xmlNode, MetaData newMetadata) throws Exception {
+ public void replaceMetadataInXML(Document document, Element xmlNode, MetaData newMetadata)
+ throws SimExplorerException {
Element newElement = document.createElement(KEY_METADATA);
this.saveElement(document, newElement, newMetadata);
@@ -281,18 +304,22 @@
*
* @return the string
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- public String computeHash(Element node) throws Exception {
- Document document = getXMLBuilder().newDocument();
- document.appendChild(document.importNode(node, true));
+ public String computeHash(Element node) throws SimExplorerException {
+ try {
+ Document document = getXMLBuilder().newDocument();
+ document.appendChild(document.importNode(node, true));
- int removeNodes = removeMetadatas(document);
+ int removeNodes = removeMetadatas(document);
- DigestGenerator digestGenerator = new DigestGenerator();
- byte[] digest = digestGenerator.getDigest(document, DigestGenerator.sha1DigestAlgorithm);
+ DigestGenerator digestGenerator = new DigestGenerator();
+ byte[] digest = digestGenerator.getDigest(document, DigestGenerator.sha1DigestAlgorithm);
- return MD5.asHex(digest);
+ return MD5.asHex(digest);
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
+ }
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,6 +21,7 @@
import org.w3c.dom.Element;
import fr.cemagref.simexplorer.is.entities.data.Repository;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating Repository objects.
@@ -41,7 +42,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public Repository loadElement(Element xmlElement) throws Exception {
+ public Repository loadElement(Element xmlElement) throws SimExplorerException {
return super.loadElement(xmlElement);
}
@@ -50,7 +51,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- Repository element) throws Exception {
+ Repository element) throws SimExplorerException {
// nothing to do yet
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,6 +21,7 @@
import org.w3c.dom.Element;
import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* A factory for creating Result objects.
@@ -40,7 +41,7 @@
* @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
*/
@Override
- public Result loadElement(Element xmlElement) throws Exception {
+ public Result loadElement(Element xmlElement) throws SimExplorerException {
return super.loadElement(xmlElement);
}
@@ -49,7 +50,7 @@
*/
@Override
public void saveElement(Document document, Element xmlElement,
- Result element) throws Exception {
+ Result element) throws SimExplorerException {
// not used yet
Deleted: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -1,63 +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;
-
-/**
- * The Class SimExplorerStorageException.
- */
-public abstract class SimExplorerStorageException extends Exception {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 4405447107690074844L;
-
- /**
- * Instantiates a new sim explorer storage exception.
- */
- public SimExplorerStorageException() {
- super();
- }
-
- /**
- * Instantiates a new sim explorer storage exception.
- *
- * @param message the message
- */
- public SimExplorerStorageException(String message) {
- super(message);
- }
-
- /**
- * Instantiates a new sim explorer storage exception.
- *
- * @param cause the cause
- */
- public SimExplorerStorageException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sim explorer storage exception.
- *
- * @param message the message
- * @param cause the cause
- */
- public SimExplorerStorageException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
Deleted: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -1,62 +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;
-
-/**
- * The Class SimExplorerStorageTechnicalException.
- */
-public class SimExplorerStorageTechnicalException extends SimExplorerStorageException {
-
- private static final long serialVersionUID = 7182289381405452276L;
-
- /**
- * Instantiates a new sim explorer storage technical exception.
- */
- public SimExplorerStorageTechnicalException() {
- super();
- }
-
- /**
- * Instantiates a new sim explorer storage technical exception.
- *
- * @param message the message
- */
- public SimExplorerStorageTechnicalException(String message) {
- super(message);
- }
-
- /**
- * Instantiates a new sim explorer storage technical exception.
- *
- * @param cause the cause
- */
- public SimExplorerStorageTechnicalException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sim explorer storage technical exception.
- *
- * @param message the message
- * @param cause the cause
- */
- public SimExplorerStorageTechnicalException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,7 +21,7 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* Store, retrieve and delete content.
@@ -40,11 +40,11 @@
* @param attachment
* the attachment
*
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
* the sim explorer storage exception
*/
public abstract void storeData(MetaData entity, Attachment attachment, InputStream is)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Retrieve content.
@@ -56,11 +56,11 @@
*
* @return Content
*
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
* the sim explorer storage exception
*/
public abstract InputStream retrieveData(MetaData entity, Attachment attachment)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Retrieve MD5.
@@ -72,11 +72,11 @@
*
* @return the string
*
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
* the sim explorer storage exception
*/
public abstract String retrieveMD5Data(MetaData entity, Attachment attachment)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Delete content.
@@ -86,10 +86,10 @@
* @param attachment
* the attachment
*
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
* the sim explorer storage exception
*/
public abstract void deleteData(MetaData entity, Attachment attachment)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -31,8 +31,8 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.storage.util.Config;
/**
@@ -102,13 +102,13 @@
* @see fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler#retrieveData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String)
*/
@Override
- public InputStream retrieveData(MetaData entity, Attachment attachment) throws SimExplorerStorageException {
+ public InputStream retrieveData(MetaData entity, Attachment attachment) throws SimExplorerException {
// Simple stream on file
FileInputStream fis;
try {
fis = new FileInputStream(getFile(entity, attachment, false));
} catch (FileNotFoundException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return fis;
}
@@ -117,12 +117,12 @@
* @see fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler#retrieveMD5Data(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String)
*/
@Override
- public String retrieveMD5Data(MetaData entity, Attachment attachment) throws SimExplorerStorageException {
+ public String retrieveMD5Data(MetaData entity, Attachment attachment) throws SimExplorerException {
String md5;
try {
md5 = MD5.asHex(MD5.getHash(getFile(entity, attachment, false)));
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return md5;
}
@@ -131,7 +131,7 @@
* @see fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler#storeData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String, java.io.InputStream)
*/
@Override
- public void storeData(MetaData entity, Attachment attachment, InputStream is) throws SimExplorerStorageException {
+ public void storeData(MetaData entity, Attachment attachment, InputStream is) throws SimExplorerException {
BufferedOutputStream bout = null;
// Simple stream on file
@@ -154,21 +154,21 @@
bout.flush();
} catch (FileNotFoundException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
} finally {
closeStream(bout);
}
}
- protected void closeStream(OutputStream fos) throws SimExplorerStorageException {
+ protected void closeStream(OutputStream fos) throws SimExplorerException {
if (fos != null) {
// Close file
try {
fos.close();
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
}
@@ -177,12 +177,12 @@
* @see fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler#deleteData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String)
*/
@Override
- public void deleteData(MetaData entity, Attachment attachment) throws SimExplorerStorageException {
+ public void deleteData(MetaData entity, Attachment attachment) throws SimExplorerException {
try {
// Simple delete on file
getFile(entity, attachment, false).delete();
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -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.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* Interface of a database able to manage metadata elements.
@@ -37,9 +37,9 @@
/**
* Open database connection.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public void open() throws SimExplorerStorageException {
+ public void open() throws SimExplorerException {
open(false);
}
@@ -48,23 +48,23 @@
*
* @param create Create database
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void open(boolean create) throws SimExplorerStorageException;
+ public abstract void open(boolean create) throws SimExplorerException;
/**
* Close database connection.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void close() throws SimExplorerStorageException;
+ public abstract void close() throws SimExplorerException;
/**
* Commit pending modifications.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void commit() throws SimExplorerStorageException;
+ public abstract void commit() throws SimExplorerException;
// Create / Update
@@ -74,9 +74,9 @@
* @param element Element to insert
* @param readers the readers
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void insertElement(MetaData element, List<Reader> readers) throws SimExplorerStorageException;
+ public abstract void insertElement(MetaData element, List<Reader> readers) throws SimExplorerException;
/**
* Save element hierarchy, saving the fact that parent uses child.
@@ -84,18 +84,18 @@
* @param parent the parent
* @param child the child
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerStorageException;
+ public abstract void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerException;
/**
* Duplicate element hierarchy.
*
* @param fromElement the from element
* @param toElement the to element
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
*/
- public abstract void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerStorageException;
+ public abstract void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerException;
// Read
@@ -107,9 +107,9 @@
*
* @return Fund element, null if not fund
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract MetaData getElement(String uuid, Version version) throws SimExplorerStorageException;
+ public abstract MetaData getElement(String uuid, Version version) throws SimExplorerException;
/**
* Get all version of an element thanks to its id <br>
@@ -119,9 +119,9 @@
*
* @return Versions
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract List<Version> getVersions(String uuid) throws SimExplorerStorageException;
+ public abstract List<Version> getVersions(String uuid) throws SimExplorerException;
/**
* Gets the elements used by mde.
@@ -129,9 +129,9 @@
* @param mde the mde
*
* @return the elements used by
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
*/
- public abstract Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerStorageException;
+ public abstract Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerException;
/**
* Gets the elements using mde.
@@ -139,9 +139,9 @@
* @param mde the mde
*
* @return the elements using
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
*/
- public abstract Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerStorageException;
+ public abstract Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerException;
/**
* Retrieve all elements by id Empty list if no element with this id.
@@ -151,9 +151,9 @@
*
* @return Element list
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract Set<MetaData> findElementsById(String uuid, boolean onlyLatest) throws SimExplorerStorageException;
+ public abstract Set<MetaData> findElementsById(String uuid, boolean onlyLatest) throws SimExplorerException;
/**
* Retrieve elements with specific properties<br>
@@ -163,9 +163,9 @@
*
* @return Element list
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public Set<MetaData> findElementsByProperties(Map<String, String> properties) throws SimExplorerStorageException {
+ public Set<MetaData> findElementsByProperties(Map<String, String> properties) throws SimExplorerException {
return findElementsByProperties(properties, 0, -1, 0);
}
@@ -180,10 +180,10 @@
*
* @return Element list
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract Set<MetaData> findElementsByProperties(Map<String, String> properties, int start, int count,
- int dateOrder) throws SimExplorerStorageException;
+ int dateOrder) throws SimExplorerException;
/**
* Retrieve element count specific properties.
@@ -192,10 +192,10 @@
*
* @return Number of elements fund
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract int findElementsByPropertiesCount(Map<String, String> properties)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Prepare properties for query.
@@ -225,10 +225,10 @@
*
* @return Element list
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public Set<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, int dateOrder)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
return findElementsByProperties(getPropertiesByType(type, onlyLatest), start, count, dateOrder);
}
@@ -240,9 +240,9 @@
*
* @return Number of elements
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public int findElementsByTypeCount(String type, boolean onlyLatest) throws SimExplorerStorageException {
+ public int findElementsByTypeCount(String type, boolean onlyLatest) throws SimExplorerException {
return findElementsByPropertiesCount(getPropertiesByType(type, onlyLatest));
}
@@ -258,10 +258,10 @@
*
* @return Element list
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract Set<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start,
- int count, int dateOrder) throws SimExplorerStorageException;
+ int count, int dateOrder) throws SimExplorerException;
/**
* Retrieve element count with specific content.
@@ -271,10 +271,10 @@
*
* @return Number of elements fund
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract int findElementsByContentSearchCount(String queryText, boolean onlyLatest)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
// Delete
@@ -283,9 +283,9 @@
*
* @param element Element to delete
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer exception
*/
- public void deleteElement(MetaData element) throws SimExplorerStorageException {
+ public void deleteElement(MetaData element) throws SimExplorerException {
deleteElement(element.getUuid(), element.getVersion());
}
@@ -295,9 +295,9 @@
* @param uuid Id
* @param version Version
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void deleteElement(String uuid, Version version) throws SimExplorerStorageException;
+ public abstract void deleteElement(String uuid, Version version) throws SimExplorerException;
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -59,8 +59,8 @@
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.SimExplorerStorageException;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.storage.database.Database;
import fr.cemagref.simexplorer.is.storage.util.Config;
import fr.cemagref.simexplorer.is.storage.util.KeyValue;
@@ -171,7 +171,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#open(boolean)
*/
@Override
- public void open(boolean create) throws SimExplorerStorageException {
+ public void open(boolean create) throws SimExplorerException {
if (writer == null) {
// Create an analyzer
Analyzer analyzer = new SimpleAnalyzer();
@@ -200,7 +200,7 @@
commit();
}
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
}
@@ -209,7 +209,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#close()
*/
@Override
- public void close() throws SimExplorerStorageException {
+ public void close() throws SimExplorerException {
try {
synchronized (writerSynchronizer) {
// Close writer and invalidate reader
@@ -218,7 +218,7 @@
}
resetReader();
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
searcherPool = null;
}
@@ -249,12 +249,12 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#commit()
*/
@Override
- public void commit() throws SimExplorerStorageException {
+ public void commit() throws SimExplorerException {
try {
// Allows concurent access
synchedCommit();
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
@@ -262,7 +262,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#insertElement(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.List)
*/
@Override
- public void insertElement(MetaData element, List<Reader> readers) throws SimExplorerStorageException {
+ public void insertElement(MetaData element, List<Reader> readers) throws SimExplorerException {
// Save element to a Lucene document
Document document = saveLuceneElement(element, readers);
@@ -272,7 +272,7 @@
writer.addDocument(document);
}
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
@@ -280,7 +280,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#saveElementHierarchy(fr.cemagref.simexplorer.is.entities.metadata.MetaData, fr.cemagref.simexplorer.is.entities.metadata.MetaData)
*/
@Override
- public void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerStorageException {
+ public void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerException {
// Save element to a Lucene document
Document document = saveLuceneElementHierarchy(parent, child);
@@ -290,7 +290,7 @@
writer.addDocument(document);
}
} catch (IOException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
@@ -298,7 +298,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#getElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public MetaData getElement(String uuid, Version version) throws SimExplorerStorageException {
+ public MetaData getElement(String uuid, Version version) throws SimExplorerException {
MetaData result = null;
try {
@@ -314,8 +314,10 @@
// Release searcher instance
releaseSearcher(searcher);
}
+ } catch (SimExplorerException e) {
+ throw e;
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return result;
@@ -347,7 +349,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#getVersions(java.lang.String)
*/
@Override
- public List<Version> getVersions(String uuid) throws SimExplorerStorageException {
+ public List<Version> getVersions(String uuid) throws SimExplorerException {
// Retrieve all document corresponding to id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
@@ -373,7 +375,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return versions;
@@ -383,7 +385,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsById(java.lang.String, boolean)
*/
@Override
- public Set<MetaData> findElementsById(String uuid, boolean onlyLatest) throws SimExplorerStorageException {
+ public Set<MetaData> findElementsById(String uuid, boolean onlyLatest) throws SimExplorerException {
// Create hash map with id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
@@ -403,8 +405,10 @@
// Release searcher instance
releaseSearcher(searcher);
}
+ } catch (SimExplorerException e) {
+ throw e;
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -415,7 +419,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByPropertiesCount(java.util.Map)
*/
@Override
- public int findElementsByPropertiesCount(Map<String, String> properties) throws SimExplorerStorageException {
+ public int findElementsByPropertiesCount(Map<String, String> properties) throws SimExplorerException {
int result = 0;
try {
@@ -429,7 +433,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -441,7 +445,7 @@
*/
@Override
public Set<MetaData> findElementsByProperties(Map<String, String> properties, int start, int count, int dateOrder)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
Set<MetaData> result = null;
try {
@@ -454,8 +458,10 @@
// Release searcher instance
releaseSearcher(searcher);
}
+ } catch (SimExplorerException e) {
+ throw e;
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -466,13 +472,12 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByContentSearchCount(java.lang.String, boolean)
*/
@Override
- public int findElementsByContentSearchCount(String queryText, boolean onlyLatest)
- throws SimExplorerStorageException {
+ public int findElementsByContentSearchCount(String queryText, boolean onlyLatest) throws SimExplorerException {
Query query;
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
int result = 0;
@@ -490,7 +495,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return result;
@@ -519,12 +524,12 @@
*/
@Override
public Set<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start, int count,
- int dateOrder) throws SimExplorerStorageException {
+ int dateOrder) throws SimExplorerException {
Query query;
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
Set<MetaData> result = null;
@@ -541,8 +546,10 @@
// Release searcher instance
releaseSearcher(searcher);
}
+ } catch (SimExplorerException e) {
+ throw e;
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return result;
@@ -585,7 +592,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#deleteElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public void deleteElement(String uuid, Version version) throws SimExplorerStorageException {
+ public void deleteElement(String uuid, Version version) throws SimExplorerException {
// Delete element in db with term search
Term term = new Term(KEY_UUID_VERSION, getUuidVersion(uuid, version));
@@ -595,7 +602,7 @@
writer.deleteDocuments(term);
}
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
}
@@ -630,17 +637,23 @@
*
* @return Entities list
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
- private Set<MetaData> convertHitsToElements(Hits hits, int start, int count) throws Exception {
+ private Set<MetaData> convertHitsToElements(Hits hits, int start, int count) throws SimExplorerException {
Set<MetaData> elements = new HashSet<MetaData>();
- if (hits != null) {
- // For documents in range
- for (int i = start; i < hits.length() && (i < start + count || count == -1); i++) {
- Document document = hits.doc(i);
- // Convert to element
- elements.add(loadLuceneElement(document));
+ try {
+ if (hits != null) {
+ // For documents in range
+ for (int i = start; i < hits.length() && (i < start + count || count == -1); i++) {
+ Document document = hits.doc(i);
+ // Convert to element
+ elements.add(loadLuceneElement(document));
+ }
}
+ } catch (SimExplorerException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SimExplorerTechnicalException(e);
}
return elements;
}
@@ -652,10 +665,10 @@
*
* @return Instance of element
*
- * @throws Exception the exception
+ * @throws SimExplorerException the exception
*/
@SuppressWarnings( { "unchecked" })
- private MetaData loadLuceneElement(Document document) throws Exception {
+ private MetaData loadLuceneElement(Document document) throws SimExplorerException {
MetaData element = new MetaData();
// Fill element with Lucene document
@@ -866,10 +879,10 @@
* @param toField the to field
*
* @return the associated elements
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
*/
protected Set<MetaData> getAssociatedElements(MetaData mde, String fromField, String toField)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
Set<MetaData> result = new HashSet<MetaData>();
try {
Query query;
@@ -908,8 +921,10 @@
// Release searcher instance
releaseSearcher(searcher);
}
+ } catch (SimExplorerException e) {
+ throw e;
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
return result;
}
@@ -918,7 +933,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#getElementsUsedBy(fr.cemagref.simexplorer.is.entities.metadata.MetaData)
*/
@Override
- public Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerStorageException {
+ public Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerException {
return getAssociatedElements(mde, KEY_UUID_VERSION_CHILD, KEY_UUID_VERSION_PARENT);
}
@@ -926,7 +941,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#getElementsUsing(fr.cemagref.simexplorer.is.entities.metadata.MetaData)
*/
@Override
- public Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerStorageException {
+ public Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerException {
return getAssociatedElements(mde, KEY_UUID_VERSION_PARENT, KEY_UUID_VERSION_CHILD);
}
@@ -934,7 +949,7 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#duplicateElementHierarchy(fr.cemagref.simexplorer.is.entities.metadata.MetaData, fr.cemagref.simexplorer.is.entities.metadata.MetaData)
*/
@Override
- public void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerStorageException {
+ public void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerException {
// Delete element in db with term search
Term term = new Term(KEY_UUID_VERSION_PARENT, getUuidVersion(toElement.getUuid(), toElement.getVersion()));
try {
@@ -942,7 +957,7 @@
writer.deleteDocuments(term);
}
} catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
+ throw new SimExplorerTechnicalException(e);
}
Set<MetaData> elementsUsedByFrom = getElementsUsedBy(fromElement);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -27,7 +27,7 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
/**
* The Interface StorageEngine.
@@ -38,23 +38,23 @@
/**
* Open storage.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void open() throws SimExplorerStorageException;
+ public abstract void open() throws SimExplorerException;
/**
* Close storage.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void close() throws SimExplorerStorageException;
+ public abstract void close() throws SimExplorerException;
/**
* Commit changes to storage.
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void commit() throws SimExplorerStorageException;
+ public abstract void commit() throws SimExplorerException;
/**
* Save an element to storage.
@@ -63,10 +63,10 @@
* @param attachments Attachments related
* @param token the token
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract void saveElement(String token, MetaData element, Map<Attachment, InputStream> attachments)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Save element hierarchy.
@@ -75,10 +75,10 @@
* @param parent the parent
* @param child the child
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract void saveElementHierarchy(String token, MetaData parent, MetaData child)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Duplicate element hierarchy.
@@ -86,9 +86,9 @@
* @param token the token
* @param fromElement the from element
* @param toElement the to element
- * @throws SimExplorerStorageException
+ * @throws SimExplorerException
*/
- public abstract void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerStorageException;
+ public abstract void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerException;
/**
* Can create sub version for element.
@@ -98,9 +98,9 @@
*
* @return true, if can create sub version
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract boolean canCreateSubVersion(String token, String uuid) throws SimExplorerStorageException;
+ public abstract boolean canCreateSubVersion(String token, String uuid) throws SimExplorerException;
/**
* Retrieve an element.
@@ -110,9 +110,9 @@
*
* @return The element
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract MetaData getMetadata(String token, String uuid) throws SimExplorerStorageException;
+ public abstract MetaData getMetadata(String token, String uuid) throws SimExplorerException;
/**
* Retrieve versions of an element<br>
@@ -123,9 +123,9 @@
*
* @return List of versions of the element<br>
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract List<Version> getVersions(String token, String uuid) throws SimExplorerStorageException;
+ public abstract List<Version> getVersions(String token, String uuid) throws SimExplorerException;
/**
* Retrieve all version of a metadata.
@@ -135,9 +135,9 @@
*
* @return the element versions
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract Set<MetaData> getElementVersions(String token, String uuid) throws SimExplorerStorageException;
+ public abstract Set<MetaData> getElementVersions(String token, String uuid) throws SimExplorerException;
/**
* Retrieve an element in a specific version.
@@ -148,9 +148,9 @@
*
* @return the metadata
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerStorageException;
+ public abstract MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerException;
/**
* Gets the metadatas used.
@@ -161,10 +161,10 @@
*
* @return the metadatas used
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract MetaData[] getMetadatasUsed(String token, String uuid, Version version)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Gets the metadatas using.
@@ -175,10 +175,10 @@
*
* @return the metadatas using
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract MetaData[] getMetadatasUsing(String token, String uuid, Version version)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Get data associated to an element.
@@ -189,10 +189,10 @@
*
* @return Data stream
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract InputStream retrieveData(String token, MetaData entity, Attachment attachment)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Get number of items corresponding to query.
@@ -203,10 +203,10 @@
*
* @return the int
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract int findFullTextCount(String token, String query, boolean onlyLatest)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Retrieve list of items corresponding to query.
@@ -220,10 +220,10 @@
*
* @return the meta data[]
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- int dateOrder) throws SimExplorerStorageException;
+ int dateOrder) throws SimExplorerException;
/**
* Retrieve list of items of type wanted.
@@ -237,10 +237,10 @@
*
* @return the meta data[]
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count,
- int dateOrder) throws SimExplorerStorageException;
+ int dateOrder) throws SimExplorerException;
/**
* Retrieve number of items of type wanted.
@@ -251,10 +251,10 @@
*
* @return the int
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
public abstract int findElementsByTypeCount(String token, String type, boolean onlyLatest)
- throws SimExplorerStorageException;
+ throws SimExplorerException;
/**
* Delete elements.
@@ -262,9 +262,9 @@
* @param uuid the uuid
* @param token the token
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void deleteElements(String token, String uuid) throws SimExplorerStorageException;
+ public abstract void deleteElements(String token, String uuid) throws SimExplorerException;
/**
* Delete one element.
@@ -273,9 +273,9 @@
* @param version the version
* @param token the token
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void deleteElement(String token, String uuid, Version version) throws SimExplorerStorageException;
+ public abstract void deleteElement(String token, String uuid, Version version) throws SimExplorerException;
/**
* Store temporary data, for stream duplication.
@@ -284,9 +284,9 @@
*
* @return id for retrieval
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract String storeTempData(InputStream stream) throws SimExplorerStorageException;
+ public abstract String storeTempData(InputStream stream) throws SimExplorerException;
/**
* Store temporary data, for stream duplication.
@@ -294,9 +294,9 @@
* @param stream Stream to store
* @param id the id
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void storeTempData(String id, InputStream stream) throws SimExplorerStorageException;
+ public abstract void storeTempData(String id, InputStream stream) throws SimExplorerException;
/**
* Retrieve temporary data.
@@ -305,9 +305,9 @@
*
* @return Data stream
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract InputStream retrieveTempData(String id) throws SimExplorerStorageException;
+ public abstract InputStream retrieveTempData(String id) throws SimExplorerException;
/**
* Retrieve MD5 temp data.
@@ -316,18 +316,18 @@
*
* @return the string
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract String retrieveMD5TempData(String id) throws SimExplorerStorageException;
+ public abstract String retrieveMD5TempData(String id) throws SimExplorerException;
/**
* Delete temporary data.
*
* @param id the id
*
- * @throws SimExplorerStorageException the sim explorer storage exception
+ * @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void deleteTempData(String id) throws SimExplorerStorageException;
+ public abstract void deleteTempData(String id) throws SimExplorerException;
}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -31,8 +31,8 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
-import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
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,7 +75,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#open()
*/
- public void open() throws SimExplorerStorageException {
+ public void open() throws SimExplorerException {
if (!opened) {
database.open();
opened = true;
@@ -85,14 +85,14 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#close()
*/
- public void close() throws SimExplorerStorageException {
+ public void close() throws SimExplorerException {
database.close();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#commit()
*/
- public void commit() throws SimExplorerStorageException {
+ public void commit() throws SimExplorerException {
database.commit();
}
@@ -102,7 +102,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<Attachment, InputStream> attachments)
- throws SimExplorerStorageException {
+ throws SimExplorerException {
// Save all attachments in system
for (Map.Entry<Attachment, InputStream> entry : attachments.entrySet()) {
@@ -116,13 +116,9 @@
if (attachment.getContentType() != null) {
InputStream content = attachmentHandler.retrieveData(element, attachment);
- try {
- // Transform stream into indexable text
- Reader reader = attachment.getContentType().renderToText(content);
- readers.add(reader);
- } catch (Exception e) {
- throw new SimExplorerStorageTechnicalException(e);
- }
+ // Transform stream into indexable text
+ Reader reader = attachment.getContentType().renderToText(content);
+ readers.add(reader);
}
}
@@ -146,21 +142,22 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#saveElementHierarchy(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.MetaData, fr.cemagref.simexplorer.is.entities.metadata.MetaData)
*/
- public void saveElementHierarchy(String token, MetaData parent, MetaData child) throws SimExplorerStorageException {
+ public void saveElementHierarchy(String token, MetaData parent, MetaData child) throws SimExplorerException {
database.saveElementHierarchy(parent, child);
}
@Override
- public void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerStorageException {
- database.duplicateElementHierarchy(fromElement, toElement);
+ public void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement)
+ throws SimExplorerException {
+ database.duplicateElementHierarchy(fromElement, toElement);
}
-
+
// Read
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String)
*/
- public MetaData getMetadata(String token, String uuid) throws SimExplorerStorageException {
+ public MetaData getMetadata(String token, String uuid) throws SimExplorerException {
MetaData mde = null;
Set<MetaData> set = database.findElementsById(uuid, true);
if (!set.isEmpty()) {
@@ -172,14 +169,14 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getVersions(java.lang.String)
*/
- public List<Version> getVersions(String token, String uuid) throws SimExplorerStorageException {
+ public List<Version> getVersions(String token, String uuid) throws SimExplorerException {
return database.getVersions(uuid);
}
/* (non-Javadoc)
* @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 SimExplorerStorageException {
+ public MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde = database.getElement(uuid, version);
return mde;
}
@@ -188,7 +185,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadatasUsed(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, Version version) throws SimExplorerStorageException {
+ public MetaData[] getMetadatasUsed(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde = database.getElement(uuid, version);
Set<MetaData> elements = database.getElementsUsedBy(mde);
return elements.toArray(new MetaData[elements.size()]);
@@ -198,7 +195,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadatasUsing(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@Override
- public MetaData[] getMetadatasUsing(String token, String uuid, Version version) throws SimExplorerStorageException {
+ public MetaData[] getMetadatasUsing(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde = database.getElement(uuid, version);
Set<MetaData> elements = database.getElementsUsing(mde);
return elements.toArray(new MetaData[elements.size()]);
@@ -207,8 +204,7 @@
/* (non-Javadoc)
* @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, Attachment attachment)
- throws SimExplorerStorageException {
+ public InputStream retrieveData(String token, MetaData entity, Attachment attachment) throws SimExplorerException {
InputStream result = attachmentHandler.retrieveData(entity, attachment);
return result;
}
@@ -216,7 +212,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean)
*/
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerStorageException {
+ public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
return database.findElementsByContentSearchCount(query, onlyLatest);
}
@@ -224,7 +220,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullText(java.lang.String, boolean, int, int, int)
*/
public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- int dateOrder) throws SimExplorerStorageException {
+ int dateOrder) throws SimExplorerException {
Set<MetaData> elements = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, dateOrder);
MetaData[] result = elements.toArray(new MetaData[elements.size()]);
return result;
@@ -234,7 +230,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findElementsByType(java.lang.String, boolean, int, int, int)
*/
public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count,
- int dateOrder) throws SimExplorerStorageException {
+ int dateOrder) throws SimExplorerException {
Set<MetaData> elements = database.findElementsByType(type, onlyLatest, start, count, dateOrder);
MetaData[] result = elements.toArray(new MetaData[elements.size()]);
return result;
@@ -243,8 +239,7 @@
/* (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 SimExplorerStorageException {
+ public int findElementsByTypeCount(String token, String type, boolean onlyLatest) throws SimExplorerException {
return database.findElementsByTypeCount(type, onlyLatest);
}
@@ -253,7 +248,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElements(java.lang.String)
*/
- public void deleteElements(String token, String uuid) throws SimExplorerStorageException {
+ public void deleteElements(String token, String uuid) throws SimExplorerException {
List<Version> versions = getVersions(token, uuid);
for (Version version : versions) {
deleteElement(token, uuid, version);
@@ -263,7 +258,7 @@
/* (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 SimExplorerStorageException {
+ public void deleteElement(String token, String uuid, Version version) throws SimExplorerException {
MetaData element = getMetadata(token, uuid, version);
List<Attachment> attachments = element.getAttachments();
for (Attachment attachment : attachments) {
@@ -291,7 +286,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.io.InputStream)
*/
- public String storeTempData(InputStream stream) throws SimExplorerStorageException {
+ public String storeTempData(InputStream stream) throws SimExplorerException {
String id = UUID.randomUUID().toString();
storeTempData(id, stream);
return id;
@@ -301,14 +296,14 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.lang.String, java.io.InputStream)
*/
@Override
- public void storeTempData(String id, InputStream stream) throws SimExplorerStorageException {
+ public void storeTempData(String id, InputStream stream) throws SimExplorerException {
attachmentHandler.storeData(mdTmp, getTmpAttachment(id), stream);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveTempData(java.lang.String)
*/
- public InputStream retrieveTempData(String id) throws SimExplorerStorageException {
+ public InputStream retrieveTempData(String id) throws SimExplorerException {
InputStream is = attachmentHandler.retrieveData(mdTmp, getTmpAttachment(id));
return is;
}
@@ -317,7 +312,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveMD5TempData(java.lang.String)
*/
@Override
- public String retrieveMD5TempData(String id) throws SimExplorerStorageException {
+ public String retrieveMD5TempData(String id) throws SimExplorerException {
String md5 = attachmentHandler.retrieveMD5Data(mdTmp, getTmpAttachment(id));
return md5;
}
@@ -325,14 +320,14 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteTempData(java.lang.String)
*/
- public void deleteTempData(String id) throws SimExplorerStorageException {
+ public void deleteTempData(String id) throws SimExplorerException {
attachmentHandler.deleteData(mdTmp, getTmpAttachment(id));
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getElementVersions(java.lang.String, java.lang.String)
*/
- public Set<MetaData> getElementVersions(String token, String uuid) throws SimExplorerStorageException {
+ public Set<MetaData> getElementVersions(String token, String uuid) throws SimExplorerException {
return database.findElementsById(uuid, false);
}
@@ -340,10 +335,9 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#canCreateSubVersion(java.lang.String, java.lang.String)
*/
@Override
- public boolean canCreateSubVersion(String token, String uuid) throws SimExplorerStorageException {
+ public boolean canCreateSubVersion(String token, String uuid) throws SimExplorerException {
// by default
return true;
}
-
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -18,15 +18,9 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
-import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.entities.metadata.Version;
import static fr.cemagref.simexplorer.is.factories.XmlConstants.FILE_DATA_PREFIX;
import static fr.cemagref.simexplorer.is.factories.XmlConstants.FILE_XML;
import static fr.cemagref.simexplorer.is.factories.XmlConstants.FOLDER_SEPARATOR;
-import org.codelutin.util.ZipStreamEncoder;
import java.io.InputStream;
import java.io.PipedInputStream;
@@ -36,6 +30,16 @@
import java.util.Map;
import java.util.SortedMap;
+import org.codelutin.util.ZipStreamEncoder;
+
+import com.healthmarketscience.rmiio.SerializableInputStream;
+
+import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+
/**
* The Class MockStorageServiceImpl.
*
@@ -64,19 +68,19 @@
}
public MetaData saveElement(String token, SerializableInputStream zipRemoteStream)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
return (MetaData) checkImplemented();
}
public MetaData saveElement(String token,
SerializableInputStream xmlRemoteStream,
Map<Attachment, SerializableInputStream> attachmentsRemoteStream)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
return (MetaData) checkImplemented();
}
public MetaData getMetadata(String token, String uuid)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
MetaData[] datas = base.metadatas.get(uuid);
return datas == null ? null : datas[0];
}
@@ -85,7 +89,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String, java.lang.String)
*/
public MetaData getMetadata(String token, String uuid, String version)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
MetaData[] datas = base.metadatas.get(uuid);
if (datas == null) {
return null;
@@ -103,7 +107,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#exportElement(java.lang.String, java.lang.String, java.lang.String)
*/
public InputStream retrieveElementXML(String token, String uuid,
- String version) throws SimExplorerServiceException {
+ String version) throws SimExplorerException {
return (InputStream) checkImplemented();
}
@@ -111,7 +115,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#exportFull(java.lang.String, java.lang.String, java.lang.String)
*/
public InputStream retrieveElementFull(String token, String uuid,
- String version) throws SimExplorerServiceException {
+ String version) throws SimExplorerException {
return (InputStream) checkImplemented();
}
@@ -120,7 +124,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#retrieveData(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
public InputStream retrieveElementData(String token, String uuid,
- String version, Attachment attachment) throws SimExplorerServiceException {
+ String version, Attachment attachment) throws SimExplorerException {
return null;
}
@@ -129,7 +133,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#exportFull(java.lang.String, java.lang.String, java.lang.String)
*/
public InputStream downloadElementFull(String token, String uuid,
- String version) throws SimExplorerServiceException {
+ String version) throws SimExplorerException {
LoggableElement element = getLoggableElement(token, uuid, version);
try {
PipedOutputStream pipedOut = new PipedOutputStream();
@@ -150,14 +154,14 @@
zse.start();
return pipedIn;
} catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerException(e);
}
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#retrieveData(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
- public InputStream downloadElementData(String token, String uuid, String version, Attachment attachment) throws SimExplorerServiceException {
+ public InputStream downloadElementData(String token, String uuid, String version, Attachment attachment) throws SimExplorerException {
LoggableElement element = getLoggableElement(token, uuid, version);
try {
@@ -167,7 +171,7 @@
MockDatabase.log.info("setMd5 " + md5 + " for " + element);
return stream.getStream();
} catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerException(e);
}
}
@@ -181,20 +185,20 @@
}
public int findFullTextCount(String token, String query, boolean onlyLatest)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
// TODO Changer
return findApplicationsCount(token, onlyLatest);
}
public MetaData[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
// TODO Changer
return findApplications(token, onlyLatest, indexStart, count, dateOrder);
}
public int findApplicationsCount(String token, boolean onlyLatest)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
return base.metadatas.size();
}
@@ -203,7 +207,7 @@
*/
public MetaData[] findApplications(String token, boolean onlyLatest,
int start, int count, int dateOrder)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
int last = start + count;
MockDatabase.log.info("ask data from " + start + " width:" + count);
SortedMap<String, MetaData[]> map = base.metadatas;
@@ -222,7 +226,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#getElement(java.lang.String, java.lang.String, java.lang.String)
*/
public LoggableElement getLoggableElement(String token, String uuid, String version)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
try {
LoggableElement[] eas = base.loggableElements.get(uuid);
if (eas == null) {
@@ -236,7 +240,7 @@
}
return null;
} catch (Exception e) {
- throw new SimExplorerServiceException(e);
+ throw new SimExplorerException(e);
}
}
@@ -244,7 +248,7 @@
* @see fr.cemagref.simexplorer.is.service.StorageService#getVersions(java.lang.String, java.lang.String)
*/
public Version[] getVersions(String token, String uuid)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
MetaData[] datas = base.metadatas.get(uuid);
if (datas == null) {
return new Version[0];
@@ -260,9 +264,9 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String)
*/
- public String loginUser(String login, String password) throws SimExplorerServiceException {
+ public String loginUser(String login, String password) throws SimExplorerException {
if (login == null) {
- throw new SimExplorerServiceException(new NullPointerException("login can not be null"));
+ throw new SimExplorerException(new NullPointerException("login can not be null"));
}
return password == null || password.length() == 0 ? null : "abc";
}
@@ -283,7 +287,7 @@
@Override
public void update(String token, String oldUuid, Version oldVersion, MetaData newVersion, boolean deleteOldElement)
- throws SimExplorerServiceException {
+ throws SimExplorerException {
checkImplemented();
}
@@ -293,13 +297,13 @@
}
@Override
- public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException {
+ public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerException {
checkImplemented();
return null;
}
@Override
- public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException {
+ public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerException {
checkImplemented();
return null;
}
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerException.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerException.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -1,44 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, 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.ui;
-
-/**
- * Exception de base.
- *
- * @author chemit
- */
-public class SimExplorerException extends Exception {
-
- private static final long serialVersionUID = -8288416952045350383L;
-
- public SimExplorerException() {
- }
-
- public SimExplorerException(Throwable cause) {
- super(cause);
- }
-
- public SimExplorerException(String message) {
- super(message);
- }
-
- public SimExplorerException(String message, Throwable cause) {
- super(message, cause);
- }
-}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -18,27 +18,30 @@
* ##% */
package fr.cemagref.simexplorer.is.ui;
+import static fr.cemagref.simexplorer.is.service.StorageServiceHelper.STORAGE_SERVICE_LOOKUP_NAME;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
import com.healthmarketscience.rmiio.SerializableInputStream;
+
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.MockStorageServiceImpl;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.service.StorageServiceClient;
-import static fr.cemagref.simexplorer.is.service.StorageServiceHelper.STORAGE_SERVICE_LOOKUP_NAME;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Properties;
-
/**
* Une classe pour encapsuler les appels aux services Storage et leur initialisation.
*
@@ -80,7 +83,7 @@
size = service.findFullTextCount(token, query, onlyLatest);
}
return size;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerRuntimeException(e);
}
}
@@ -96,7 +99,7 @@
data = service.findFullText(token, query, onlyLatest, (int) newFirstIndex, width, rowOrder);
}
return data;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerRuntimeException(e);
}
}
@@ -107,7 +110,7 @@
LoggableElement data;
data = getService(context, remote).getLoggableElement(context.getToken(), uuid, version);
return data;
- } catch (SimExplorerServiceException e1) {
+ } catch (SimExplorerException e1) {
throw new SimExplorerRuntimeException(e1);
}
}
@@ -117,7 +120,7 @@
MetaData metas;
metas = getService(context, remote).getMetadata(context.getToken(), uuid, version);
return metas;
- } catch (SimExplorerServiceException e1) {
+ } catch (SimExplorerException e1) {
throw new SimExplorerRuntimeException(e1);
}
}
@@ -129,7 +132,7 @@
BufferedInputStream bis;
bis = new BufferedInputStream(stream);
return bis;
- } catch (SimExplorerServiceException e1) {
+ } catch (SimExplorerException e1) {
throw new SimExplorerRuntimeException(e1);
}
}
@@ -140,7 +143,7 @@
BufferedInputStream bis;
bis = new BufferedInputStream(stream);
return bis;
- } catch (SimExplorerServiceException e1) {
+ } catch (SimExplorerException e1) {
throw new SimExplorerRuntimeException(e1);
}
}
@@ -160,7 +163,7 @@
Version[] result;
result = getService(context, remote).getVersions(context.getToken(), uuid);
return result;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerRuntimeException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ConnectAction.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -18,19 +18,21 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
+import static org.codelutin.i18n.I18n._;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.JOptionPane;
+
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.LoginUI;
import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
-import static org.codelutin.i18n.I18n._;
-import javax.swing.JOptionPane;
-import java.awt.event.ActionEvent;
-
/**
* Action de connexion au serveur distant
*
@@ -115,7 +117,7 @@
String token;
try {
token = service.loginUser(login, password);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
token = null;
}
getContext().setToken(token);
@@ -137,7 +139,7 @@
protected boolean connect(String login, char[] password) {
try {
return connect(login, AuthenticationServiceHelper.computeHash(password));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerRuntimeException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-15 16:25:18 UTC (rev 1006)
@@ -69,9 +69,6 @@
simexplorer.action.hide.remote=List (remote)
simexplorer.action.hide.remote.help=
simexplorer.action.hide.remote.tooltip=Hide the list of remote elements
-simexplorer.action.hide.synchronize=Synchronize
-simexplorer.action.hide.synchronize.help=
-simexplorer.action.hide.synchronize.tooltip=Hide Synchronize screen
simexplorer.action.historyNext=Next in history
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Display next element ''{0}''
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-15 16:25:18 UTC (rev 1006)
@@ -65,13 +65,10 @@
simexplorer.action.help.tooltip=Acc\u00E9der \u00E0 l'aide
simexplorer.action.hide.local=Liste locale
simexplorer.action.hide.local.help=
-simexplorer.action.hide.local.tooltip=Cacher la liste des élements du serveur local
+simexplorer.action.hide.local.tooltip=Cacher la liste des \u00E9lements du serveur local
simexplorer.action.hide.remote=Liste distante
simexplorer.action.hide.remote.help=
-simexplorer.action.hide.remote.tooltip=Cacher la liste des éléments du serveur distant
-simexplorer.action.hide.synchronize=Synchronisation
-simexplorer.action.hide.synchronize.help=
-simexplorer.action.hide.synchronize.tooltip=Cacher l'\u00E9cran de synchronisation
+simexplorer.action.hide.remote.tooltip=Cacher la liste des \u00E9l\u00E9ments du serveur distant
simexplorer.action.historyNext=El\u00E9ment suivant
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Afficher l''\u00E9l\u00E9ment suivant ''{0}''
@@ -100,13 +97,13 @@
simexplorer.action.searchText.tooltip=Le texte de recherche
simexplorer.action.show.detail=D\u00E9tail
simexplorer.action.show.detail.help=
-simexplorer.action.show.detail.tooltip=Affciher les d\u00E9tail de l'élément
+simexplorer.action.show.detail.tooltip=Affciher les d\u00E9tail de l'\u00E9l\u00E9ment
simexplorer.action.show.local=Liste locale
simexplorer.action.show.local.help=
-simexplorer.action.show.local.tooltip=Afficher la liste des éléments du serveur local
+simexplorer.action.show.local.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur local
simexplorer.action.show.remote=Liste distante
simexplorer.action.show.remote.help=
-simexplorer.action.show.remote.tooltip=Afficher la liste des éléments du serveur distant
+simexplorer.action.show.remote.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur distant
simexplorer.action.show.synchronize=Synchroniser
simexplorer.action.show.synchronize.help=
simexplorer.action.show.synchronize.tooltip=Afficher l'\u00E9cran de synchronisation des applications
@@ -189,9 +186,9 @@
simexplorer.tab.detail=D\u00E9tail
simexplorer.tab.detail.tooltip=L'\u00E9cran affichant les d\u00E9tails d'un \u00E9l\u00E9ment
simexplorer.tab.local=Liste locale
-simexplorer.tab.local.tooltip=La liste des éléments pr\u00E9sents sur le serveur local
+simexplorer.tab.local.tooltip=La liste des \u00E9l\u00E9ments pr\u00E9sents sur le serveur local
simexplorer.tab.remote=Liste distante
-simexplorer.tab.remote.tooltip=La liste des éléments pr\u00E9sents sur le serveur distant
+simexplorer.tab.remote.tooltip=La liste des \u00E9l\u00E9ments pr\u00E9sents sur le serveur distant
simexplorer.tab.synchronize=Synchronisation
-simexplorer.tab.synchronize.tooltip=L'\u00E9cran de synchronisation des éléments
+simexplorer.tab.synchronize.tooltip=L'\u00E9cran de synchronisation des \u00E9l\u00E9ments
{0}\ should\ have\ a\ name\ like\ this\ {1},\ but\ was\ {2}=
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -21,7 +21,7 @@
import org.apache.tapestry.grid.GridDataSource;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -83,7 +83,7 @@
result = RemoteStorageService.getStorageService()
.findFullTextCount(token, query, false);
}
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return result;
@@ -130,7 +130,7 @@
.findFullText(token, query, false, startIndex,
1 + endIndex - startIndex, dateOrder);
}
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -19,7 +19,7 @@
import org.apache.tapestry.annotations.InjectPage;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -42,7 +42,7 @@
RemoteStorageService.getStorageService().deleteElement(getToken(),
getMetadata().getUuid(),
getMetadata().getVersion().toString());
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return elementDetail;
@@ -57,7 +57,7 @@
try {
RemoteStorageService.getStorageService().deleteElement(getToken(),
getMetadata().getUuid());
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return elementDetail;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -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.service.SimExplorerServiceException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -78,9 +78,9 @@
*
* @return the versions
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public List<TreeNode> getVersions() throws SimExplorerServiceException {
+ public List<TreeNode> getVersions() throws SimExplorerException {
List<TreeNode> nodes = new ArrayList<TreeNode>();
nodes.add(generateNodes());
return nodes;
@@ -91,9 +91,9 @@
*
* @return the tree node
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private TreeNode generateNodes() throws SimExplorerServiceException {
+ private TreeNode generateNodes() throws SimExplorerException {
Arrays.sort(versions);
TreeNode rootNode = new TreeNode();
rootNode.setType(TreeNode.TYPE_FOLDER);
@@ -113,9 +113,9 @@
* @param parent the parent
* @param version the version
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private void insertNode(Version version, int pos, TreeNode parent) throws SimExplorerServiceException {
+ private void insertNode(Version version, int pos, TreeNode parent) throws SimExplorerException {
List<TreeNode> nodes = parent.getChildren();
if (pos == version.getLength()) {
nodes.add(generateLeaf(version));
@@ -177,9 +177,9 @@
*
* @return the tree node
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- private TreeNode generateLeaf(Version version) throws SimExplorerServiceException {
+ private TreeNode generateLeaf(Version version) throws SimExplorerException {
TreeNode node = new TreeNode();
MetaData mde = RemoteStorageService.getStorageService().getMetadata(getToken(), getMetadata().getUuid(),
version.toString());
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -24,6 +24,8 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
@@ -52,31 +54,25 @@
*
* @throws Exception the exception
*/
- public Object onSuccess() throws Exception {
+ public Object onSuccess() throws SimExplorerException {
MetaData mde = null;
if (_fileEA != null) {
- SerializableInputStream zipStream = new SerializableInputStream(_fileEA.getStream());
- // RemoteInputStreamServer zipRemoteStream = new SimpleRemoteInputStream(
- // _fileEA.getStream());
+ SerializableInputStream zipStream;
try {
- // mde = RemoteStorageService.getStorageService().saveElement(
- // getToken(), zipRemoteStream.export());
- mde = RemoteStorageService.getStorageService().saveElement(getToken(), zipStream);
+ zipStream = new SerializableInputStream(_fileEA.getStream());
} catch (Exception e) {
- throw new SimExplorerWebException(e);
+ throw new SimExplorerTechnicalException(e);
}
+ mde = RemoteStorageService.getStorageService().saveElement(getToken(), zipStream);
} else {
if (_fileLib != null) {
- SerializableInputStream zipStream = new SerializableInputStream(_fileLib.getStream());
- // RemoteInputStreamServer zipRemoteStream = new SimpleRemoteInputStream(
- // _fileLib.getStream());
+ SerializableInputStream zipStream;
try {
- // mde = RemoteStorageService.getStorageService().saveElement(
- // getToken(), zipRemoteStream.export());
- mde = RemoteStorageService.getStorageService().saveElement(getToken(), zipStream);
+ zipStream = new SerializableInputStream(_fileLib.getStream());
} catch (Exception e) {
- throw new SimExplorerWebException();
+ throw new SimExplorerTechnicalException(e);
}
+ mde = RemoteStorageService.getStorageService().saveElement(getToken(), zipStream);
}
}
if (mde != null) {
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -25,7 +25,7 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
import fr.cemagref.simexplorer.is.ui.web.tools.MetaDataModelFactory;
@@ -79,9 +79,9 @@
*
* @return the elements used
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public MetaData[] getElementsUsed() throws SimExplorerServiceException {
+ public MetaData[] getElementsUsed() throws SimExplorerException {
return RemoteStorageService.getStorageService().getMetadatasUsed(getToken(), getMetadata().getUuid(),
getMetadata().getVersion().toString());
}
@@ -91,9 +91,9 @@
*
* @return the elements using
*
- * @throws SimExplorerServiceException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer service exception
*/
- public MetaData[] getElementsUsing() throws SimExplorerServiceException {
+ public MetaData[] getElementsUsing() throws SimExplorerException {
return RemoteStorageService.getStorageService().getMetadatasUsing(getToken(), getMetadata().getUuid(),
getMetadata().getVersion().toString());
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -26,11 +26,11 @@
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.Persist;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Actor;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -232,7 +232,7 @@
User[] users = RemoteSecurityService.getAuthentificationService()
.getUsers(getToken());
result.addAll(Arrays.asList(users));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return result;
@@ -249,7 +249,7 @@
Group[] groups = RemoteSecurityService.getAuthentificationService()
.getGroups(getToken());
result.addAll(Arrays.asList(groups));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -25,9 +25,9 @@
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.Persist;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
@@ -97,7 +97,7 @@
.getAuthentificationService().getGroupsOfGroup(
getToken(), group);
this.groupsInGroup.addAll(Arrays.asList(groups));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
@@ -138,7 +138,7 @@
}
RemoteSecurityService.getAuthentificationService()
.setGroupsOfGroup(getToken(), group, groupsIds);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
@@ -165,7 +165,7 @@
User[] users = RemoteSecurityService.getAuthentificationService()
.getUsers(getToken());
result.addAll(Arrays.asList(users));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return result;
@@ -182,7 +182,7 @@
Group[] groups = RemoteSecurityService.getAuthentificationService()
.getGroups(getToken());
result.addAll(Arrays.asList(groups));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -28,8 +28,8 @@
import org.apache.tapestry.services.BeanModelSource;
import de.hsofttec.t5components.annotations.SetterGetter;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -103,7 +103,7 @@
.getGroupsOwnedBy(getToken(), getUserLogged());
}
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
@@ -122,7 +122,7 @@
try {
RemoteSecurityService.getAuthentificationService().deleteGroup(
getToken(), context);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return null;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -17,8 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
import org.apache.tapestry.annotations.ApplicationState;
@@ -83,7 +83,7 @@
formLogin.recordError(messages
.get("simexplorer.ui.web.login.invalid"));
return this;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
@@ -97,7 +97,7 @@
try {
RemoteSecurityService.getAuthentificationService().requestAccount(
login, mail);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return this;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -31,9 +31,9 @@
import org.apache.tapestry.services.BeanModelSource;
import de.hsofttec.t5components.annotations.SetterGetter;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
@@ -118,7 +118,7 @@
.getAuthentificationService().getGroupsOfUser(
getToken(), this.user);
groupsOfUser.addAll(Arrays.asList(groups));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
@@ -150,7 +150,7 @@
getToken(), user, groupsIds);
return userList;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
@@ -165,7 +165,7 @@
try {
groups = RemoteSecurityService.getAuthentificationService()
.getGroups(getToken());
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
List<Group> result = new ArrayList<Group>();
@@ -185,7 +185,7 @@
}
return RemoteSecurityService.getAuthentificationService()
.getGroupsOwnedBy(getToken(), user);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
@@ -227,7 +227,7 @@
RemoteSecurityService.getAuthentificationService().resetPassword(
getToken(), user.getLogin());
return this;
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -28,8 +28,8 @@
import org.apache.tapestry.services.BeanModelSource;
import de.hsofttec.t5components.annotations.SetterGetter;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -99,7 +99,7 @@
try {
users = RemoteSecurityService.getAuthentificationService()
.getUsers(getToken());
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
@@ -118,7 +118,7 @@
try {
RemoteSecurityService.getAuthentificationService().deleteUser(
getToken(), context);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return null;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -22,8 +22,8 @@
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.annotations.Inject;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -108,7 +108,7 @@
try {
loggedUser = RemoteSecurityService.getAuthentificationService()
.getLoggedUser(token);
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -19,8 +19,8 @@
import org.apache.tapestry.ValueEncoder;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
/**
@@ -57,7 +57,7 @@
try {
group = RemoteSecurityService.getAuthentificationService().getGroup(
token, Integer.decode(arg0));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return group;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-15 15:45:52 UTC (rev 1005)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-15 16:25:18 UTC (rev 1006)
@@ -19,8 +19,8 @@
import org.apache.tapestry.ValueEncoder;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
-import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
/**
@@ -57,7 +57,7 @@
try {
user = RemoteSecurityService.getAuthentificationService().getUser(
token, Integer.decode(arg0));
- } catch (SimExplorerServiceException e) {
+ } catch (SimExplorerException e) {
throw new SimExplorerWebException(e);
}
return user;
1
0