r1283 - trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service
Author: glandais Date: 2008-03-04 14:50:10 +0000 (Tue, 04 Mar 2008) New Revision: 1283 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/StorageServiceServer.java Log: Version incrementation 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-03-04 14:47:16 UTC (rev 1282) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-03-04 14:50:10 UTC (rev 1283) @@ -1,20 +1,20 @@ /* -* ##% 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. -* ##% */ + * ##% 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.service; import static org.codelutin.i18n.I18n._; @@ -30,12 +30,12 @@ /** The storage engine. */ private StorageEngine storageEngine; /** - * la localisation du fichier de configuration à lire, si null utilisera le fichier - * par défaut (properties/config.properties) + * la localisation du fichier de configuration à lire, si null utilisera le + * fichier par défaut (properties/config.properties) */ private String configFile; - /** le prefixe à supprimera chaque clef de la configuration. (voir Config) * */ + /** le prefixe à supprimera chaque clef de la configuration. (voir Config) * */ private String prefixKey; public StorageServiceClient() { @@ -47,21 +47,25 @@ this.prefixKey = prefixKey; } - /* (non-Javadoc) - * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String) - */ + /* + * (non-Javadoc) + * + * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, + * java.lang.String) + */ public String loginUser(String login, String password) throws SimExplorerException { throw new SimExplorerBusinessException( _("simexplorer.service.nologonlocal")); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see fr.cemagref.simexplorer.is.service.StorageServiceCommon#getStorageEngine() */ @Override - protected StorageEngine getStorageEngine() - throws SimExplorerException { + protected StorageEngine getStorageEngine() throws SimExplorerException { if (storageEngine == null) { storageEngine = new StorageEngineImpl(configFile, prefixKey); storageEngine.open(); @@ -72,9 +76,18 @@ @Override protected Version incrementVersion(Version version) { Version result = new Version(""); - result.setVersion(0, version.getVersion(0)); - // FIXME! can throw a NullPointerException - result.setVersion(1, version.getVersion(1) + 1); + Integer version0 = version.getVersion(0); + if (version0 == null) { + result.setVersion(0, 0); + } else { + result.setVersion(0, version0); + } + Integer version1 = version.getVersion(0); + if (version1 == null) { + result.setVersion(1, 1); + } else { + result.setVersion(1, version1 + 1); + } return result; } 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-03-04 14:47:16 UTC (rev 1282) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-03-04 14:50:10 UTC (rev 1283) @@ -1,20 +1,20 @@ /* -* ##% 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. -* ##% */ + * ##% 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.service; import javax.ejb.EJB; @@ -43,15 +43,21 @@ @EJB private StorageEngine storageEngine; - /* (non-Javadoc) - * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String) + /* + * (non-Javadoc) + * + * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, + * java.lang.String) */ - public String loginUser(String login, String password) throws SimExplorerException { + public String loginUser(String login, String password) + throws SimExplorerException { String token = authenticationService.loginUser(login, password); return token; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see fr.cemagref.simexplorer.is.service.StorageServiceCommon#getStorageEngine() */ @Override @@ -63,7 +69,12 @@ @Override protected Version incrementVersion(Version version) { Version result = new Version(""); - result.setVersion(0, version.getVersion(0) + 1); + Integer version0 = version.getVersion(0); + if (version0 == null) { + result.setVersion(0, 1); + } else { + result.setVersion(0, version0 + 1); + } return result; }
participants (1)
-
glandais@users.labs.libre-entreprise.org