fr.ifremer.isisfish.datastore
Class RegionStorage

java.lang.Object
  extended by fr.ifremer.isisfish.datastore.VersionStorage
      extended by fr.ifremer.isisfish.datastore.DataStorage
          extended by fr.ifremer.isisfish.datastore.RegionStorage

public class RegionStorage
extends DataStorage

Classe permettant de recuperer les TopiaContext des regions. Created: 17 août 2005 03:44:57 CEST

Version:
$Revision: 3615 $ Last update: $Date: 2012-02-24 17:46:43 +0100 (Fri, 24 Feb 2012) $ by : $Author: echatellier $
Author:
Benjamin POUSSIN

Field Summary
protected  File commentForNextCommitFile
          File to use to store next commit region comment.
static String MAP_DIRECTORY
           
static String REGION_PATH
           
protected static Map<String,RegionStorage> regions
           
 
Fields inherited from class fr.ifremer.isisfish.datastore.DataStorage
DATA_BACKUP_FILENAME, memstorage, name, storage
 
Fields inherited from class fr.ifremer.isisfish.datastore.VersionStorage
changeListeners, file, root
 
Constructor Summary
protected RegionStorage(File directory, String name)
          Constructor.
 
Method Summary
 void addCommentForNextCommit(String commentToAdd)
          Add new comment in comment used for the next cvs commit.
static RegionStorage checkout(String name)
          Checkout not existing Region locally from server
 void clearCommentForNextCommit()
          rename commentForNextCommitFile with current date at end must be used in user application after commit
static RegionStorage create(String name)
          Permet de creer une nouvelle region.
 void delete(boolean cvsDelete)
          Permet de supprimer un fichier ou répertoire versionné ou non.
static boolean exists(String name)
          Verifie si la region exists en local ou sur le serveur CVS.
 String getCommentForNextCommit()
           
static FisheryRegion getFisheryRegion(org.nuiton.topia.TopiaContext context)
           
 File getMapRepository()
           
static List<String> getNewRegionNames()
          Retourne la liste des noms de toutes les régions disponible en local qui ne sont pas encore sur le serveur VCS.
static List<String> getNewRemoteRegionNames()
          Retourne la liste des noms de toutes les régions disponible sur le serveur VCS qui ne sont pas encore en local.
static RegionStorage getRegion(String name)
          Recupere le TopiaContext d'une region.
static File getRegionDirectory()
           
static File getRegionDirectory(String name)
           
static List<String> getRegionNames()
          Retourne la liste des noms de toutes les régions disponible en local.
static List<RegionStorage> getRegions()
          Retourne la liste de toutes les régions disponible en local.
static List<String> getRemoteRegionNames()
          Retourne la liste des noms de toutes les régions disponible sur le serveur VCS.
static RegionStorage importAndRenameZip(File file, String newName)
          Import zipped region.
static RegionStorage importZip(File file)
          Import zipped region.
protected  boolean isVersionnableFile(File file)
          Permet de savoir si un fichier doit etre géré par le vcs ou non.
 void rename(String toName)
          Renome juste le repertoire, s'il y a besoin de modifier des données dans le TopiaContext il faut surcharger cette methode.
 void setCommentForNextCommit(String commentForNextCommit)
           
 
Methods inherited from class fr.ifremer.isisfish.datastore.DataStorage
closeMemStorage, closeStorage, copy, createZip, createZip, createZip, finalize, getDataBackupFile, getDirectory, getMemStorage, getName, getStorage, getStorageDirectory, prepare
 
Methods inherited from class fr.ifremer.isisfish.datastore.VersionStorage
add, addStorageChangeListener, checkout, commit, diff, fireDataChanged, getCommunityDatabaseDirectory, getCommunityVCS, getContextDatabaseDirectory, getCurrentVCS, getCurrentVCS, getFile, getFiles, getFiles, getRemoteStorageNames, getRoot, getStorageNames, getVCS, isOnRemote, isUpToDate, removeStorageChangeListener, update
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGION_PATH

public static final String REGION_PATH
See Also:
Constant Field Values

MAP_DIRECTORY

public static final String MAP_DIRECTORY
See Also:
Constant Field Values

regions

protected static Map<String,RegionStorage> regions

commentForNextCommitFile

protected File commentForNextCommitFile
File to use to store next commit region comment.

Constructor Detail

RegionStorage

protected RegionStorage(File directory,
                        String name)
Constructor.

Parameters:
directory - region directory
name - region name
Method Detail

getRegionDirectory

public static File getRegionDirectory()

getRegionDirectory

public static File getRegionDirectory(String name)

getCommentForNextCommit

public String getCommentForNextCommit()
                               throws IOException
Returns:
Returns the commentForNextCommit.
Throws:
IOException - if IO problem while reading file

setCommentForNextCommit

public void setCommentForNextCommit(String commentForNextCommit)
                             throws IOException
Parameters:
commentForNextCommit - The commentForNextCommit to set.
Throws:
IOException - if io problem while writing file

clearCommentForNextCommit

public void clearCommentForNextCommit()
rename commentForNextCommitFile with current date at end must be used in user application after commit


isVersionnableFile

protected boolean isVersionnableFile(File file)
Description copied from class: VersionStorage
Permet de savoir si un fichier doit etre géré par le vcs ou non. L'implantation par defaut exclus les répertoires VCS, il faut toujours appeler le super si on surcharge la methode.

Overrides:
isVersionnableFile in class DataStorage
Parameters:
file - le fichier a tester
Returns:
true si le fichier est versionné

addCommentForNextCommit

public void addCommentForNextCommit(String commentToAdd)
                             throws IOException
Add new comment in comment used for the next cvs commit. This comment is prefixed by the current date.

Parameters:
commentToAdd - the comment to add
Throws:
IOException - if IO problem while writing file

rename

public void rename(String toName)
            throws StorageException
Description copied from class: DataStorage
Renome juste le repertoire, s'il y a besoin de modifier des données dans le TopiaContext il faut surcharger cette methode. Il est surement necessaire de surcharger cette methode pour aussi modifier l'entre qu'il y a dans le cache.

Overrides:
rename in class DataStorage
Parameters:
toName - le nouveau nom
Throws:
StorageException - si problème lors du renommage

getMapRepository

public File getMapRepository()

checkout

public static RegionStorage checkout(String name)
                              throws VCSException,
                                     org.nuiton.topia.TopiaException
Checkout not existing Region locally from server

Parameters:
name - name of region to retrieve
Returns:
le storage après checkout
Throws:
VCSException - if problem with vcs while checkout
org.nuiton.topia.TopiaException - if problem while restoring db

getRegion

public static RegionStorage getRegion(String name)
Recupere le TopiaContext d'une region.

Parameters:
name - le nom de la region a recuperer
Returns:
Le TopiaContext contenant la region, si la region n'existait null est retourné

exists

public static boolean exists(String name)
Verifie si la region exists en local ou sur le serveur CVS.

Parameters:
name - le nom de la region
Returns:
vrai si la region existe deja

create

public static RegionStorage create(String name)
                            throws StorageException
Permet de creer une nouvelle region. Si le nom est deja utilisé en local ou sur le serveur alors une exception est leve. Sinon le repertoire pour accueillir la region est cree.

Parameters:
name - Le nom de la nouvelle region
Returns:
La nouvelle region
Throws:
StorageException - Si le nom est deja uitlisé

delete

public void delete(boolean cvsDelete)
            throws StorageException
Description copied from class: VersionStorage
Permet de supprimer un fichier ou répertoire versionné ou non.

Overrides:
delete in class DataStorage
Parameters:
cvsDelete - si vrai alors le fichier sera aussi supprimé sur le vcs si elle existait. Cela prend effet immediatement (un commit est fait)
Throws:
StorageException - if delete operation fail

getRegionNames

public static List<String> getRegionNames()
Retourne la liste des noms de toutes les régions disponible en local.

Returns:
la liste des noms de toutes les régions disponible en local

getRegions

public static List<RegionStorage> getRegions()
Retourne la liste de toutes les régions disponible en local.

Returns:
la liste de toutes les régions disponible en local

getNewRegionNames

public static List<String> getNewRegionNames()
Retourne la liste des noms de toutes les régions disponible en local qui ne sont pas encore sur le serveur VCS.

Returns:
liste de noms de regions

getRemoteRegionNames

public static List<String> getRemoteRegionNames()
Retourne la liste des noms de toutes les régions disponible sur le serveur VCS.

Returns:
la liste des noms de toutes les régions disponible sur le serveur VCS. Si le serveur n'est pas disponible la liste retournée est vide.

getNewRemoteRegionNames

public static List<String> getNewRemoteRegionNames()
Retourne la liste des noms de toutes les régions disponible sur le serveur VCS qui ne sont pas encore en local.

Returns:
liste de noms de regions

getFisheryRegion

public static FisheryRegion getFisheryRegion(org.nuiton.topia.TopiaContext context)
                                      throws StorageException
Throws:
StorageException

importZip

public static RegionStorage importZip(File file)
                               throws IOException,
                                      StorageException
Import zipped region.

Parameters:
file - zipped region file
Returns:
region storage or null
Throws:
IOException - if IO problem while import zip
StorageException - if problem while restoring db

importAndRenameZip

public static RegionStorage importAndRenameZip(File file,
                                               String newName)
                                        throws IOException,
                                               StorageException
Import zipped region.

Parameters:
file - zipped region file
newName - new name for the imported simulation
Returns:
region storage or null
Throws:
IOException - if IO problem while import zip
StorageException - if problem while restoring db


Copyright © 1999-2012 CodeLutin. All Rights Reserved.