remove old ebi packages
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Dec 2006 16:40:55 +0000 (16:40 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Dec 2006 16:40:55 +0000 (16:40 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@260 be28352e-c001-0410-b1a7-c7978e42abec

12 files changed:
src/uk/ac/ebi/msd/vamsas/vamav/VAMAVClient.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/PDBUtil.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/VamsasDocumentProcessor.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/IncorrectDocumentException.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/UnableToProcessException.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_domain.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_structure.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/exceptions/UnableToGroupSequencesException.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/session/SessionManager.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/session/VAMAVSession.java [deleted file]
src/uk/ac/ebi/msd/vamsas/vamav/session/exceptions/UnableToOpenSession.java [deleted file]

diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/VAMAVClient.java b/src/uk/ac/ebi/msd/vamsas/vamav/VAMAVClient.java
deleted file mode 100755 (executable)
index 3734057..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *=============================================================================
-* EMBL - European Bioinformatics institute
-* MSD Group
-* VAMSAS Project
-* 
-*  Copyright (c) 2005 The European Bioinformatics Institute. All rights reserved.
-*  
-*   Redistribution and use in source and binary forms, with or without
-*   modification.
-*
-*The European Bioinformatics Institute may publish revised and/or new 
-*versions of this license with new releases of VAMSAS software. 
-*==============================================================================
- *
- * 
- * Created on Feb 22, 2006
- *
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @version  2  
- * @since 22 Feb. 2006
- */
-package uk.ac.ebi.msd.vamsas.vamav;
-
-import java.io.File;
-
-import org.vamsas.client.ClientHandle;
-import org.vamsas.client.Events;
-import org.vamsas.client.IClientDocument;
-import org.vamsas.client.InvalidSessionUrnException;
-import org.vamsas.client.UserHandle;
-import org.vamsas.client.simpleclient.SimpleClient;
-import org.vamsas.client.simpleclient.VamsasSession;
-
-import uk.ac.ebi.msd.vamsas.vamav.communication.astexviewer.AVClientIntf;
-import uk.ac.ebi.msd.vamsas.vamav.session.VAMAVSession;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;
-
-
-/**
- * This class represents a VAMSAS client in the VAMSAS workflow (VAMSAS Client API),
- *  
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @since 22 Feb. 2006
- * @version 2 
- * 
- */
-public class VAMAVClient extends SimpleClient {
-
-
-       private String lastStatus = Events.DOCUMENT_CREATE; 
-       private final VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());
-       private VAMAVSession vamavSession = null;
-       private AVClientIntf avclient = null;
-       private VamsasSession sess = null;
-       private IClientDocument document = null;
-       
-       
-       /**
-        * Should not be used
-        * @param applicationHandle application handle for the current application
-        * @throws InvalidSessionUrnException if a error occurs during the creation of the client and the session.
-        */
-       @Deprecated
-       public VAMAVClient (ClientHandle applicationHandle)throws InvalidSessionUrnException
-       {
-               super(null, applicationHandle, null);
-               this.client = applicationHandle;
-               
-       }
-       /**
-        * Inits a client with a given user and a given Client handle in a given session
-        * @param user  information, of the user opening the session
-        * @param client the clientHandle
-        * @param sess Session in which is opened the client.
-        * @throws InvalidSessionUrnException if a error occurs during the creation of the client and the session.
-        
-        */
-       public VAMAVClient (
-               UserHandle user,
-               ClientHandle client,
-               VamsasSession _sess) throws InvalidSessionUrnException{
-               super(user, client, _sess);
-               this.sess = _sess;
-       }
-
-       /**
-        * Inits a client with a given user and a given Client handle in a given session
-        * and an archive file from a previous session/treatment
-        * @param user  information, of the user opening the session
-        * @param client the clientHandle
-        * @param _sess Session in which is opened the client.
-        * @param importingArchive
-        * 
-        * @throws Exception raises if an error occurs during the creation of the client (archive reading, incorrect session, ...)
-        */
-       public VAMAVClient(
-               UserHandle user,
-               ClientHandle client,
-               VamsasSession _sess,
-               File importingArchive)
-               throws Exception {
-               super(user, client, _sess, importingArchive);
-               this.sess = _sess;
-       }
-
-       /**
-                 * @see org.vamsas.client.IClient#getAbout()
-                 */
-                public String getAbout() {
-                  return new String("VAMAV Client version $version$ build $build$");
-                }
-       
-       /**
-                  * a clone the current VAMSASClient object
-                  * @return a clone object of the current object
-                  */
-                 public Object clone()
-                         {
-                                 VAMAVClient client = null;
-                                 try
-                                         {
-                                                 client = new VAMAVClient(this.user, this.client, this.sess);//this.SessionUrn);
-                                 //client.setVAMAVDocument(this.getClientDocument());
-                                         }
-                                 catch (InvalidSessionUrnException isuE)
-                                         {
-                                                 this.logger.appliError("Unable to clone client.");
-                                                 this.logger.sessionError("Unable to clone client.");
-                                                 client = null;
-                                         }
-                                 return client;
-                         }
-
-               /**
-                * Retrieves the  vAMAVSession attribut
-                *
-                * @return Returns the vAMAVSession.
-                */
-               public VAMAVSession getVAMAVSession()
-                       {
-                               return this.vamavSession;
-                       }
-
-               /**
-                *Sets session attribut
-                *
-                * @param session The vAMAVSession to set.
-                */
-               public void setVAMAVSession(VAMAVSession session)
-                       {
-                               this.vamavSession = session;
-                               this.logger.setSession(session);
-                       }
-
-               /**
-                * Retrieves the  avclient attribut
-                *
-                * @return Returns the avclient.
-                */
-               public AVClientIntf getAvclient()
-                       {
-                               return this.avclient;
-                       }
-
-               /**
-                *Sets avclient attribut
-                *
-                * @param avclient The avclient to set.
-                */
-               public void setAvclient(AVClientIntf avclient)
-                       {
-                               this.avclient = avclient;
-                       }
-/**
- * Set current document associated to the current client
- * @param document the document object to associate to the client
- */
-       public void setVAMAVDocument(IClientDocument document)
-                        {
-                                if (document != null)
-                                        {
-                                                this.document = document;
-                                        }
-                        }
-                        
-                        public void setUser(UserHandle _user)
-                        {
-                               if (_user !=null)
-                               {
-                                       this.user = _user;
-                               }
-                        }
-}
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/PDBUtil.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/PDBUtil.java
deleted file mode 100755 (executable)
index bb876e5..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-/* \r
- * EMBL - European Bioinformatics institute\r
- * MSD Group\r
- * VAMSAS Project\r
- * \r
- *Created on 28 oct. 2005\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 28 oct. 2005\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement;\r
-\r
-\r
-import uk.ac.ebi.msd.vamsas.vamav.session.VAMAVSession;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.data.DataBuffer;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.data.PDBEntry;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.file.PlainTextFileReader;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.DataBufferPool;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.StringBufferPool;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-\r
-/**\r
- * Convenient methods for PDB entry manipulation\r
- * \r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 28 oct. 2005 \r
- * \r
- */\r
-public class PDBUtil\r
-       {\r
-               private  VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());\r
-               \r
-               private static Hashtable<String, String> AminoAcids = null; \r
-               \r
-               /**\r
-                * Constructor \r
-                *\r
-                */\r
-               public PDBUtil(String session)\r
-                       {\r
-                               super();\r
-                               logger.setSession(session);\r
-                               \r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                */\r
-               public PDBUtil(VAMAVSession session)\r
-                       {\r
-                               super();\r
-                               logger.setSession(session);\r
-                               \r
-                       }\r
-               /**\r
-                * PDB Format \r
-                * http://www.rcsb.org/pdb/docs/format/pdbguide2.2/part_35.html\r
-                * \r
-                * @param entry\r
-                * @return\r
-                */\r
-               public  ArrayList<Chain> GetChain(PDBEntry entry)\r
-               {\r
-                       if( entry == null) return null;\r
-                       File pdbFile = entry.getPdbFile();\r
-                       if (pdbFile == null || !pdbFile.exists() )\r
-                               {\r
-                                       return null;\r
-                               }\r
-                       logger.sessionInfo("Retrieving PDB sequence from PDB file.");\r
-                       ArrayList<Chain>  chains = null;\r
-                       PlainTextFileReader reader = new PlainTextFileReader(pdbFile);\r
-                       try\r
-                               {\r
-                                       reader.openFile();\r
-                                       DataBuffer line = null;\r
-                                       Hashtable<String, StringBuffer> retrievingChains = new  Hashtable<String, StringBuffer>();\r
-                                       while (( line = reader.getLine()) !=null)\r
-                                               {\r
-                                                       /*System.out.println("line "+line);*/\r
-                                       if( line.toString().startsWith("SEQRES"))//.matches("^SEQRES*"))\r
-                                               {//chain line found\r
-                                                       /*System.out.println("SEQRES found ");\r
-                                                       System.out.println("line "+line);*/\r
-                                                       //12             Character       chainID\r
-                                                       char chainID = line.charAt(12 -1);\r
-                                                       String chainName = String.valueOf(chainID);\r
-                                                       /*System.out.println("chainName "+chainName);*/\r
-                                                       StringBuffer seq = retrievingChains.get(chainName.intern());\r
-                                                       if (seq == null)\r
-                                                               {\r
-                                                                       seq = StringBufferPool.getString();\r
-                                                               }\r
-                                                       \r
-                                                       /*      System.out.println("chain retrieves.");*/\r
-//                                                     20 23        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=23 )\r
-                                                               {\r
-                                                                       String aa = line.substring(20-1, 23-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if(aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                                       \r
-                                                                               }               \r
-                                                               }\r
-                                                       //24 - 27        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=27 )\r
-                                                               {\r
-                                                                       String aa = line.substring(24-1, 27-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //28 - 30        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=31 )\r
-                                                               {\r
-                                                                       String aa = line.substring(28-1, 31-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //32 - 34        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=35 )\r
-                                                               {\r
-                                                                       String aa = line.substring(32-1, 35-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //36 - 38        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=39 )\r
-                                                               {\r
-                                                                       String aa = line.substring(36-1, 39-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //40 - 42        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=42 )\r
-                                                               {\r
-                                                                       String aa = line.substring(40-1, 43-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //44 - 46        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=47 )\r
-                                                               {\r
-                                                                       String aa = line.substring(44-1, 47-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //48 - 50        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=51 )\r
-                                                               {\r
-                                                                       String aa = line.substring(48-1, 51-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //52 - 54        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=55 )\r
-                                                               {\r
-                                                                       String aa = line.substring(52-1, 55-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //56 - 58        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=59 )\r
-                                                               {\r
-                                                                       String aa = line.substring(56-1, 59-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //60 - 62        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=63 )\r
-                                                               {\r
-                                                                       String aa = line.substring(60-1, 63-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //64 - 66        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=67 )\r
-                                                               {\r
-                                                                       String aa = line.substring(64-1, 67-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       //68 - 70        Residue name    resName       Residue name.\r
-                                                       if(line.length()>=71 )\r
-                                                               {\r
-                                                                       String aa = line.substring(68-1, 71-1);\r
-                                                                       if( aa != null)\r
-                                                                               {\r
-                                                                                       aa = aa.trim();\r
-                                                                                       if( aa.length()>0)\r
-                                                                                               seq.append(get1LetterCodeFrom3LettersCode(aa));\r
-                                                                               }\r
-                                                               }\r
-                                                       retrievingChains.put(chainName.intern(), seq);\r
-                                               \r
-                                                       //System.out.println("seq "+seq.toString());\r
-                                                       \r
-                                                       //StringBufferPool.returnString(seq);\r
-                                               }\r
-                                       \r
-                                       //cleaning\r
-                                       DataBufferPool.returnString(line);\r
-                                       \r
-                                       \r
-                                               }\r
-                                       reader.closeFile();\r
-                                       //cleaning\r
-                                       if( retrievingChains !=null)\r
-                                               {\r
-                                                       if( chains == null)\r
-                                                               \r
-                                                               chains = new ArrayList<Chain>();\r
-                                                       for (Enumeration elements = retrievingChains.keys() ; elements.hasMoreElements();  )\r
-                                                               {\r
-                                                                       String chainID = (String)elements.nextElement();\r
-                                                                       if( chainID == null|| chainID.length()<1) continue;\r
-                                                                       StringBuffer seq =  retrievingChains.get(chainID);\r
-                                                                       if(seq == null || seq.length()<1) continue;\r
-                                                                       chains.add(new PDBUtil.Chain(entry.getPdbID()+"_"+chainID, seq.toString()));\r
-                                                                       \r
-                                                                       StringBufferPool.returnString(seq);\r
-                                                               }\r
-                                                       retrievingChains.clear();\r
-                                                       retrievingChains = null;\r
-                                               }\r
-                                       \r
-                               }\r
-                       catch (IOException ioe)\r
-                               {\r
-                                       logger.sessionError("error access to PDB file "+pdbFile.getName()+".",ioe);\r
-                               }\r
-                       if (!this.logger.isProduction()) logger.sessionDebug("retrieved chain for PDBID: "+entry.getPdbID()+" "+chains.get(0).getSequence());\r
-                       return chains;\r
-               }\r
-               \r
-/**\r
- * Converts a three letter code of AminoAcid to the one letter code of AminoAcid.\r
- * @param threeLettersCode the three letter code to convert\r
- * @return the one letter code associated to the three letter code, if found. null otherwise\r
- */\r
-               private static String get1LetterCodeFrom3LettersCode(String threeLettersCode)\r
-                       {\r
-                               /*System.out.println("threeLettersCode to convert |"+threeLettersCode+"|");*/\r
-                               if (threeLettersCode == null || threeLettersCode.length()!=3)\r
-                                       {\r
-                                               /*System.out.println("incorrect threeLettersCode "+threeLettersCode);*/\r
-                                               if( threeLettersCode.length() ==1 ) return threeLettersCode;\r
-                                               return null;\r
-                                       }\r
-                               String oneLetterCode = getAminoAcids().get(threeLettersCode.toLowerCase());\r
-                               if(oneLetterCode == null || oneLetterCode.length()!=1 ) oneLetterCode ="X";\r
-                               return oneLetterCode;\r
-                       }\r
-               \r
-               /**\r
-                * Represents a chain contains in a PDB entry/file\r
-                * \r
-                * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
-                * @version 1\r
-                * @since 28 oct. 2005 \r
-                *\r
-                */\r
-               public static class Chain\r
-               {\r
-                       /**\r
-                        * name of the chain\r
-                        */\r
-                       private String name = null;\r
-                       private String sequence = null;\r
-                       \r
-                       /**\r
-                        * \r
-                        * Constructor for chain \r
-                        *\r
-                        * @param _name name of the chain\r
-                        * @param _sequence     sequence of the chain\r
-                        */\r
-                       public Chain (String _name, String _sequence)\r
-                               {\r
-                                       this.name = _name;\r
-                                       this.sequence = _sequence;\r
-                               }\r
-\r
-                       /**\r
-                        * Retrieves the  name attribut\r
-                        *\r
-                        * @return Returns the name.\r
-                        */\r
-                       public String getName()\r
-                               {\r
-                                       return this.name;\r
-                               }\r
-\r
-                       /**\r
-                        * Retrieves the  sequence attribut\r
-                        *\r
-                        * @return Returns the sequence.\r
-                        */\r
-                       public String getSequence()\r
-                               {\r
-                                       return this.sequence;\r
-                               }\r
-                       \r
-                       \r
-               }\r
-\r
-               /**\r
-                * Retrieves the  aminoAcids attribut\r
-                *\r
-                *AAs = Hashtable<String, String>();\r
-                               AAsAla  A       hydrophobic\r
-                               Arginine        Arg     R       free amino group makes it basic and hydrophilic\r
-                               Asparagine      Asn     N       carbohydrate can be covalently linked ("N-linked) to its -NH\r
-                               Aspartic acid   Asp     D       free carboxyl group makes it acidic and hydrophilic\r
-                               Cysteine        Cys     C       oxidation of their sulfhydryl (-SH) groups link 2 Cys (S-S)\r
-                               Glutamic acid   Glu     E       free carboxyl group makes it acidic and hydrophilic\r
-                               Glutamine       Gln     Q       moderately hydrophilic\r
-                               Glycine Gly     G       so small it is amphiphilic (can exist in any surroundings)\r
-                               Histidine       His     H       basic and hydrophilic\r
-                               Isoleucine      Ile     I       hydrophobic\r
-                               Leucine Leu     L       hydrophobic\r
-                               Lysine  Lys     K       strongly basic and hydrophilic\r
-                               Methionine      Met     M       hydrophobic\r
-                               Phenylalanine   Phe     F       very hydrophobic\r
-                               Proline Pro     P       causes kinks in the chain\r
-                               Serine  Ser     S       carbohydrate can be covalently linked ("O-linked") to its -OH\r
-                               Threonine       Thr     T       carbohydrate can be covalently linked ("O-linked") to its -OH\r
-                               Tryptophan      Trp     W       scarce in most plant proteins\r
-                               Tyrosine        Tyr     Y       a phosphate or sulfate group can be covalently attached to its -OH\r
-                               Valine  Val     V\r
-                               \r
-                               A R D N B C E Z Q G H I L K M F P S T W Y V X\r
-                *\r
-                * @return Returns the aminoAcids.\r
-                */\r
-               private static Hashtable<String, String> getAminoAcids()\r
-                       {\r
-                               if( AminoAcids == null)\r
-                                       {//lazy initialisation\r
-                                               AminoAcids = new Hashtable<String, String>();\r
-                                               AminoAcids.put("Ala".toLowerCase(),     "A");\r
-                                               AminoAcids.put("Arg".toLowerCase(), "R");\r
-                                               AminoAcids.put("Asp".toLowerCase(), "D");       \r
-                                               AminoAcids.put("Asn".toLowerCase(), "N");\r
-                                               AminoAcids.put("Asx".toLowerCase(), "B");//       Aspartic acid or Asparagine\r
-                                               AminoAcids.put("Cys".toLowerCase(), "C");\r
-                                               AminoAcids.put("Glu".toLowerCase(), "E");\r
-                                               AminoAcids.put("Glx".toLowerCase(), "Z");//       Glutamine or Glutamic acid.\r
-                                               AminoAcids.put("Gln".toLowerCase(), "Q");\r
-                                               AminoAcids.put("Gly".toLowerCase(), "G");\r
-                                               AminoAcids.put("His".toLowerCase(), "H");\r
-                                               AminoAcids.put("Ile".toLowerCase(), "I");\r
-                                               AminoAcids.put("Leu".toLowerCase(), "L");\r
-                                               AminoAcids.put("Lys".toLowerCase(), "K");\r
-                                               AminoAcids.put("Met".toLowerCase(), "M");\r
-                                               AminoAcids.put("Phe".toLowerCase(), "F");\r
-                                               AminoAcids.put("Pro".toLowerCase(), "P");\r
-                                               AminoAcids.put("Ser".toLowerCase(), "S");\r
-                                               AminoAcids.put("Thr".toLowerCase(), "T");\r
-                                               AminoAcids.put("Trp".toLowerCase(), "W");\r
-                                               AminoAcids.put("Tyr".toLowerCase(), "Y");\r
-                                               AminoAcids.put("Val".toLowerCase(), "V");\r
-                                               AminoAcids.put("Xaa".toLowerCase(), "X");//       Any amino acid.\r
-                                      \r
-                                      \r
-                                       }\r
-                               return AminoAcids;\r
-                       }\r
-               \r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/VamsasDocumentProcessor.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/VamsasDocumentProcessor.java
deleted file mode 100755 (executable)
index 0487002..0000000
+++ /dev/null
@@ -1,1380 +0,0 @@
-
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement;
-
-import uk.ac.ebi.msd.vamsas.vamav.VAMAVClient;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.exceptions.IncorrectDocumentException;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.exceptions.UnableToProcessException;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping_domain;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping_structure;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.exceptions.UnableToGroupSequencesException;
-import uk.ac.ebi.msd.vamsas.vamav.exceptions.IncorrectVamavModuleInitialisation;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.MappingManager;
-import uk.ac.ebi.msd.vamsas.vamav.util.properties.PropertyManager;
-import org.vamsas.objects.core.Alignment;
-import org.vamsas.objects.core.AlignmentAnnotations;
-import org.vamsas.objects.core.AlignmentSequence;
-import org.vamsas.objects.core.AnnotationElement;
-import org.vamsas.objects.core.ApplicationData;
-import org.vamsas.objects.core.DataSet;
-import org.vamsas.objects.core.DbRef;
-import org.vamsas.objects.core.Entry;
-import org.vamsas.objects.core.Provenance;
-import org.vamsas.objects.core.Sequence;
-import org.vamsas.objects.core.SequenceType;
-import org.vamsas.objects.core.Tree;
-import org.vamsas.objects.core.User;
-import org.vamsas.objects.core.VAMSAS;
-import org.vamsas.objects.core.VamsasDocument;
-
-import org.vamsas.client.IClient;
-import org.vamsas.client.IClientDocument;
-import org.vamsas.client.simpleclient.IdFactory;
-import org.vamsas.client.simpleclient.SimpleDocument;
-import org.vamsas.client.simpleclient.VamsasArchive;
-import org.vamsas.client.simpleclient.ClientDocument;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.TimeZone;
-
-import MSD.vamav.common.AVActiveSite;
-import MSD.vamav.common.AVSequence;
-import MSD.vamav.common.Highlight;
-import MSD.vamav.common.ResidueAnnotation;
-
-/**
- * <p>Processor for Vamsas Document, to extract data for calling an AstexViewer@MSD-EBI, for displaying the provided data</p>
- * 
- * <p>Grouping mode :</p>
- * <ul>
- *  <li>1. per structure</li>
- *  <li>2. per PFAM domain</li>
- *  </ul>
- * 
- */
-public class VamsasDocumentProcessor implements uk.ac.ebi.msd.vamsas.vamav.VamaVModule {
-
-       
-       //private IClientDocument doc = null;
-       private IClient client = null;
-       private  VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());
-       
-       private final String modulePrefix = "documentprocessor";
-       private SequenceGrouping  groupingManager = null;
-       private int moleculeNumber = 1;
-       private int highlightNumber = 0;
-       private boolean hasAlignmentSequences = false; 
-       private MappingManager mappingManager = null;
-       private String activeSiteDescription = "Active Site";
-       
-       /**
-        * Retrieves the  modulePrefix attribut
-        *
-        * @return Returns the modulePrefix.
-        */
-       public String getModulePrefix()
-               {
-                       return this.modulePrefix;
-               }
-       
-       public void init(Properties moduleProperties) throws IncorrectVamavModuleInitialisation
-               {
-                       PropertyManager propManager = new PropertyManager();
-                       Properties props = propManager.getModuleProperties(moduleProperties, this.groupingManager.getModulePrefix());
-                       this.groupingManager.init(props);
-                       propManager = null;
-               }
-       
-       /**
-        * 
-        * Constructor for a given document 
-        * @param document Vamsas Document to process.
-        * @param _mappingManager mapping manager
-        * @throws IncorrectDocumentException if the given document is incorrect
-        */
-       public VamsasDocumentProcessor (IClient _client, MappingManager _mappingManager ) throws IncorrectDocumentException
-               {
-                       if(_client == null   ) throw new IncorrectDocumentException();
-                       
-                       this.client = _client;
-                       this.logger.setSession(this.client.getSessionUrn());
-                       this.mappingManager = _mappingManager;
-                       this.mappingManager.setSession(((VAMAVClient)this.client).getVAMAVSession());
-                       this.groupingManager = new SequenceGrouping_structure(this.mappingManager, ((VAMAVClient)this.client).getVAMAVSession());
-                       //this.logger = new  VAMAVLoggerImpl(this.getClass(),this.client.getSessionUrn() );
-                       
-                       //this.groupingManager.load();
-               }
-       
-       /**
-        * 
-        * Constructor for a given document 
-        * @param document Vamsas Document to process.
-        * @param _mappingManager mapping manager
-        * @param groupingMode grouping Mode number, for sequence grouping (structure, domain)
-        * @throws IncorrectDocumentException if the given document is incorrect
-        */
-       public VamsasDocumentProcessor (IClient _client, MappingManager _mappingManager, int groupingMode) throws IncorrectDocumentException
-               {
-                       if(_client == null ) throw new IncorrectDocumentException();
-                       
-                       this.client = _client;
-                       this.logger.setSession(this.client.getSessionUrn());
-                       
-                       
-                       ((VAMAVClient)this.client).getVAMAVSession().setGroupingMode(groupingMode);
-                       this.mappingManager = _mappingManager;
-                       this.mappingManager.setSession(((VAMAVClient)this.client).getVAMAVSession());
-                       this.mappingManager.setSession(((VAMAVClient)this.client).getVAMAVSession());
-                       if( groupingMode == 0)
-                               {
-                                       this.groupingManager = new SequenceGrouping_structure(this.mappingManager, ((VAMAVClient)this.client).getVAMAVSession());
-                               }
-                       else
-                               if( groupingMode == 1)
-                               {
-                                       this.groupingManager = new SequenceGrouping_domain(this.mappingManager, ((VAMAVClient)this.client).getVAMAVSession());
-                               }
-                               else
-                                       // default
-                                       this.groupingManager = new SequenceGrouping_structure(this.mappingManager, ((VAMAVClient)this.client).getVAMAVSession());
-                       
-               
-                       //this.logger = new  VAMAVLoggerImpl(this.getClass(),this.client.getSessionUrn() );
-                       
-                       //this.groupingManager.load();
-               }
-/**
- * <p>Process a document to extract element for AstexViewer@MSD-EBI</p>
- * 
- */
-    public Hashtable<String, Object> process( )  throws IncorrectDocumentException, UnableToProcessException
-       {        
-               Hashtable<String, Object>  parameters = new Hashtable<String, Object>();
-               //int moleculeNumber = 1;
-                       IClientDocument  doc =  null;
-               try
-                       {
-                               doc = this.client.getClientDocument();
-                       }
-               catch (IOException ioe)
-                       {
-                               this.logger.sessionError("Unable to access to the VAMSAS document. Can not process.",ioe);
-                                       throw new IncorrectDocumentException(ioe);
-                       }
-               if( doc == null)
-                       {
-                               this.logger.sessionError("The document is null. Can not process it.");
-                               throw new IncorrectDocumentException();
-                       }
-               this.logger.sessionInfo("The processing vamsas document.");
-               try     
-                       {
-                               VAMSAS[] roots = doc.getVamsasRoots();
-                               if( roots != null && roots.length>0)
-                                       for (int rootNumber = roots.length-1; rootNumber>=0; rootNumber--)
-                                               {
-                                                       VAMSAS root = roots[rootNumber];
-                                                       if (root == null) continue;
-                                                       Tree [] trees = root.getTree();
-                                                       //treating Trees
-                                                       if (trees !=null)
-                                                               {
-                                                                       for (int treeNumber=0; treeNumber< trees.length; treeNumber++)
-                                                                               {
-                                                                                       Tree aTree = trees[treeNumber];
-                                                                                       if( aTree == null) continue;
-                                                                                       parameters = this.addParameters(this.processTree(aTree), parameters);
-                                                                               }
-                                                               }
-                                                       else
-                                                               {
-                                                                       this.logger.sessionDebug("No Tree found.");
-                                                               }
-                                                       int setCount = root.getDataSetCount();
-                                                       this.logger.sessionDebug("DataSet "+setCount);
-                                                       if (setCount>0)
-                                                               { 
-                                                                       this.hasAlignmentSequences = false;
-                                                                       for (int setNumber=0; setNumber< setCount; setNumber++)
-                                                                               {
-                                                                                       //                              treating DataSet
-                                                                                       this.logger.sessionDebug("DataSet " +setNumber );
-                                                                                       DataSet set = root.getDataSet(setNumber);
-                                                                                       if (set == null)
-                                                                                               {
-                                                                                                       this.logger.sessionDebug("data set is null?? "+setNumber);
-                                                                                                       continue;
-                                                                                               }
-                                                                                       parameters = this.addParameters(this.processDataSet(set), parameters);
-                                                                               }
-                                                               }  
-                                               }
-                       }
-               catch (Exception e)
-                       {
-                               this.logger.sessionError("VamsasDocumentProcessor process- Error during Document processing.",e);
-                               parameters = null;
-                       }
-               if (parameters!=null) this.logger.sessionDebug("parameter count "+parameters.size());
-               //store PDB 
-               //this.logger.sessionInfo("Save computed data");
-               try
-                       {
-                               File atrFile = this.groupingManager.storeGroups();
-     //  this.groupingManager.getSequenceFiles()
- //     add atribute file parameter
-                               if(atrFile != null)
-                                       {
-                                                       this.logger.sessionDebug("Atribute file "+atrFile.getName());
-                                               parameters.put("attribute", atrFile);
-                                       }
-                               else 
-                                       this.logger.sessionError("No atribute file created.");
-       
-                  //addsequenceFile
-                  ArrayList<File>seqFiles = this.groupingManager.getSequenceFiles();
-                  if(seqFiles != null && seqFiles.size()>0)
-                          {
-                                  for (int fileNumber = seqFiles.size() - 1;fileNumber >=0; fileNumber -- )
-                                          {
-                                                  File file = seqFiles.get(fileNumber);
-                                                  if( file == null) continue;
-                                                  this.logger.sessionDebug("VAMSASSequence"+(fileNumber+1)+": add sequence file to parameter "+file.getName());
-                                                  parameters.put("VAMSASSequence"+(fileNumber+1), file);
-                                          }
-                               }
-          }
-       catch (UnableToGroupSequencesException ue)
-          {
-                  this.logger.sessionError("VamsasDocumentProcessor StoreGroups - Unable to group sequences.", ue);
-                  throw new UnableToProcessException(ue);
-          }
-          
-      this.groupingManager = null;
-      this.logger.sessionDebug("process "+(parameters==null?0:parameters.size()));
-       return parameters;
-    } 
-
-    /**
-     * Process Vamsas Tree object
-     * Currently do nothing
-     * @param atree the tree to process
-     * @return a list of parameters to call an AstexViewer@MSD-EBI client
-     */
-    private Hashtable <String, Object> processTree(Tree atree)
-       {
-               return null;
-       }
-    
-    
-    private Hashtable <String, Object> processDataSet(DataSet aDataSet) throws UnableToGroupSequencesException
-       {
-               if (aDataSet == null)
-                       {
-                                       this.logger.sessionDebug("data set is null??");
-                                       return null;
-                       }
-               Hashtable <String, Object> parameters = new Hashtable <String, Object>();
-               int alignCount = aDataSet.getAlignmentCount();
-               if (alignCount>0)
-                       {
-                               for (int algNumber=0; algNumber< alignCount; algNumber++)
-                                       {
-                                               this.logger.sessionDebug("Alignment " +algNumber );
-                                                       Alignment align = aDataSet.getAlignment(algNumber);
-                                                       if (align == null) continue; //should not happen
-                                                       Hashtable <String, Object> newparameters =this.ProcessAlignment(align);
-                                                       this.logger.sessionDebug("end ab aligment  "+(newparameters==null?0:newparameters.size()));
-                                                       parameters = this.addParameters(newparameters, parameters);
-                                                       this.logger.sessionDebug("end ab aligment  "+(parameters==null?0:parameters.size()));
-                                       }
-                               this.logger.sessionDebug("end aligments  "+(parameters==null?0:parameters.size()));
-                       }       
-               int sequenceCount = aDataSet.getSequenceCount();
-               if (!this.hasAlignmentSequences && sequenceCount > 0 )
-                       {  
-                               this.logger.sessionInfo("No alignment has been found. Process DataSet sequences."+sequenceCount);
-                               for (int seqNumber=0; seqNumber< sequenceCount; seqNumber++)
-                                       {
-                                               Sequence seq = aDataSet.getSequence(seqNumber);
-                                               if (seq == null)
-                                                       {
-                                                               this.logger.sessionDebug("sequence  is null??");
-                                                               continue;
-                                                       }
-                                               
-                                               this.logger.sessionDebug(seq.getId());
-                                               DbRef[] dbRefs = seq.getDbRef();
-                                               boolean idFound = false;
-                                               if( dbRefs != null && dbRefs.length >0)
-                                                       {
-                                                               for (int dbRefNumber = dbRefs.length - 1; dbRefNumber >=0; dbRefNumber-- )
-                                                                       {
-                                                                               DbRef ref = dbRefs[dbRefNumber];
-                                                                               if( ref == null) continue;
-                                                                               
-                                                                               String acID = ref.getAccessionId();
-                                                                                       if( acID == null)
-                                                                                               {
-                                                                                                       continue;
-                                                                                               }
-                                                                                       String source = ref.getSource() ;
-                                                                                       if( source== null || source.length()<1 )
-                                                                                               {
-                                                                                                       continue;
-                                                                                               }
-                                                                                       
-                                                                                       Hashtable <String, Object> tempParameters = this.groupingManager.addSequence(seq.getSequence(), seq.getName(), acID, source);
-                                                                                       if (tempParameters != null && tempParameters.size()>0)
-                                                                                               {
-                                                                                                       this.logger.sessionDebug("parameter count "+parameters.size());
-                                                                                                       String pdbids = (String) tempParameters.remove(this.groupingManager.getPdbidsproperty());
-                                                                                                                       
-                                                                                                       if(pdbids!=null && pdbids.length()>0)
-                                                                                                               {
-                                                                                                                       //TODO check if the ref does not have already the new DB reference
-                                                                                                                       this.logger.sessionDebug("Adding pdb IDs to doc "+pdbids );
-                                                                                                                       DbRef dbref = new DbRef();
-                                                                                                                       dbref.setSource("PDB");
-                                                                                                                       dbref.setAccessionId(pdbids);
-                                                                                                                       seq.addDbRef(dbref);
-                                                                                                                       //seq.setRefid(ref)
-                                                                                                               }
-                                                                                                       parameters = addParameters(tempParameters, parameters);
-                                                                                                       this.logger.sessionDebug("end add sequence "+(parameters==null?0:parameters.size()));
-                                                                                                       idFound = true;
-                                                                                                       this.hasAlignmentSequences = true;
-                                                                                               }
-                                                                                               
-                                                                                       /*String pdbids = (String) tempParameters.remove(this.groupingManager.getPdbidsproperty());
-                                                                                               String id = ref.getAccessionId();
-                                                                               if(id == null || id.length()<1 ) continue;
-                                                                               //suppose it is  a PDB ID (should be like PDBID:CHAIN)
-                                                                               //We don t handle chain name , remove id
-                                                                               int pos = id.indexOf(":");
-                                                                               if (pos>=0)
-                                                                                       {//there is a match
-                                                                                               id = id.substring(0,pos);
-                                                                                       }
-                                                                                       PDBEntry entry = SequenceToPDB_MSDLite.getPDBFileFromPDBID(id);
-                                                                                       if( entry != null)
-                                                                                       {
-                                                                                       idFound = true;
-                                                                                       if( !parameters.containsValue(entry))
-                                                                                       /*parameters.add(entry);*/
-                                                                                       /*      {
-                                                                                                       parameters.put("molecule"+moleculeNumber,entry);
-                                                                                                       parameters.put("name"+moleculeNumber, entry.getPdbID());
-                                                                                                       moleculeNumber++;
-                                                                                               }
-                                                               Grouping.addSequenceToGroup(entry.getPdbID(), seq);*/
-                                                                       
-                                                                       }       
-                                                       }
-                                               if (!idFound)
-                                                               {
-                                                                       Hashtable<String, Object>tempParameters = this.processSequence(seq);
-                                                                       if (tempParameters != null)
-                                                                       {
-                                                                       //parameters = this.addParameters(this.processSequence(seq), parameters);
-                                                                       String pdbids = (String) tempParameters.remove(this.groupingManager.getPdbidsproperty());
-                                                                       if(pdbids!=null && pdbids.length()>0)
-                                                                               {
-                                                                                       //TODO check if the ref does not have already the new DB reference
-                                                                                       this.logger.sessionDebug("Adding pdb IDs to doc "+pdbids );
-                                                                                       DbRef ref = new DbRef();
-                                                                                       ref.setSource("PDB");
-                                                                                       ref.setAccessionId(pdbids);
-                                                                                       seq.addDbRef(ref);
-                                                                                       //seq.setRefid(ref)
-                                                                               }
-                                                                               parameters = this.addParameters(tempParameters, parameters);
-                                                                       }
-                                                               }
-                                       }
-                       }
-               this.logger.sessionDebug("ProcessDataSet "+(parameters==null?0:parameters.size()));
-               return parameters;
-       }
-       
-   
-    /**
-     * Process an alignment to extract sequences for grouping
-     * 
-     * @param align alignment Object to process
-     */
-    private Hashtable <String, Object> ProcessAlignment(Alignment align) throws UnableToGroupSequencesException
-       {
-               if (align == null) return null; //should not happen
-                       int seqCount = align.getAlignmentSequenceCount();
-                       Hashtable <String, Object> parameters = null;
-                       if( seqCount>0 )
-                               {
-                                       parameters = new Hashtable <String, Object>();
-                                       String sequenceName =  null;
-                                       for (int seqNumber=0; seqNumber< seqCount; seqNumber++)
-                                               {
-                                                       this.logger.sessionDebug("alig seq " +seqNumber );
-                                                       AlignmentSequence seq = align.getAlignmentSequence(seqNumber);
-                                                       if (seq == null) continue; //should not happen
-                                                       Sequence refSeq = (Sequence) seq.getRefid();
-                                                       boolean notFound = true;
-                                                       if (refSeq != null)
-                                                               {
-                                                                       if (refSeq.getDbRefCount()>0)
-                                                                               {
-                                                                                       int dbRefNumber = 0;
-                                                                                       int refCount = refSeq.getDbRefCount();
-                                                                                       while (notFound && dbRefNumber<refCount)
-                                                                                               {
-                                                                                                       DbRef dbRef= refSeq.getDbRef(dbRefNumber++);
-                                                                                                       this.logger.sessionDebug("dbref  " +(dbRefNumber -1) );
-                                                                                                       if(dbRef == null) continue;
-                                                                                                       String acID = dbRef.getAccessionId();
-                                                                                                       if( acID == null)
-                                                                                                               {
-                                                                                                                       continue;
-                                                                                                               }
-                                                                                                       String source = dbRef.getSource() ;
-                                                                                                       if( source== null || source.length()<1 )
-                                                                                                               {
-                                                                                                                       continue;
-                                                                                                               }
-                                                                                                       
-                                                                                                       Hashtable <String, Object> tempParameters = this.groupingManager.addSequence(seq.getSequence(), seq.getName(), acID, source);
-                                                                                                       
-                                                                                                       if (tempParameters != null && tempParameters.size()>0)
-                                                                                                               {
-                                                                                                                       this.logger.sessionDebug("parameter count "+parameters.size());
-                                                                                                                       String pdbids = (String) tempParameters.remove(this.groupingManager.getPdbidsproperty());
-                                                                                                                       if(pdbids!=null && pdbids.length()>0)
-                                                                                                                               {
-                                                                                                                                       //TODO check if the ref does not have already the new DB reference
-                                                                                                                                       this.logger.sessionDebug("Adding pdb IDs to doc "+pdbids );
-                                                                                                                                       DbRef ref = new DbRef();
-                                                                                                                                       ref.setSource("PDB");
-                                                                                                                                       ref.setAccessionId(pdbids);
-                                                                                                                                       refSeq.addDbRef(ref);
-                                                                                                                                       //seq.setRefid(ref)
-                                                                                                                               }
-                                                                                                                       parameters = addParameters(tempParameters, parameters);
-                                                                                                                       notFound = false;
-                                                                                                                       hasAlignmentSequences = true;
-                                                                                                                       this.logger.sessionDebug("parameter count "+parameters.size());
-                                                                                                               }
-                                                                                                       //if (sequenceName ==null) sequenceName = entry.getPdbID()+"_";
-                                                                                               }
-                                                                               }
-                                                                       else
-                                                                               { /*System.out.println("No DbRef");*/
-                                                                               }
-                                                               }
-                                                       if (notFound)
-                                                               {
-                                                                       Hashtable<String, Object> tempParameters = processSequence(seq);
-                                                                       if (tempParameters != null)
-                                                                                       {
-                                                                               /*      String pdbids = (String) tempParameters.remove(this.groupingManager.getPdbidsproperty());
-                                                                                       if(pdbids!=null && pdbids.length()>0)
-                                                                                                       {
-                                                                                                       //TODO check if the ref does not have already the new DB reference
-                                                                                                       this.logger.sessionDebug("Adding pdb IDs to doc "+pdbids );
-                                                                                                       DbRef ref = new DbRef();
-                                                                                                       ref.setSource("PDB");
-                                                                                                       ref.setAccessionId(pdbids);
-                                                                                                       seq.addDbRef(ref);
-                                                                                               //seq.setRefid(ref)
-                                                                                               }*/
-                                                                                       parameters = this.addParameters(tempParameters, parameters);
-                                                                                       }
-                                                               }
-                                               }               
-                                               //treat AnnotationElement for highlight
-                                       int annotationCount = align.getAlignmentAnnotationsCount();
-                                       this.logger.sessionDebug("annotationCount "+ annotationCount);
-                                       for (int annotationNumber = annotationCount-1; annotationNumber>=0; annotationNumber--)
-                                               {
-                                                       this.logger.sessionDebug("annotationNumber "+annotationNumber);
-                                                       AlignmentAnnotations annotation = align.getAlignmentAnnotations(annotationNumber);
-                                                       if (annotation == null) continue;
-                                                       int elementCount =  annotation.getAnnotationElementCount();
-                                                       for (int elementNumber = elementCount-1; elementNumber>=0; elementNumber--)
-                                                               {
-                                                                       this.logger.sessionDebug("annotationElement  "+elementNumber);
-                                                                       AnnotationElement elt = annotation.getAnnotationElement(elementNumber);
-                                                                       if (elt == null) continue;
-                                                                       parameters = this.addParameters(this.processAnnotationElement(elt), parameters);
-                                                               }
-                                               }
-                               }
-                       this.logger.sessionDebug("ProcessAlignment "+(parameters==null?0:parameters.size()));
-                       return parameters;
-       }
-    
-   private Hashtable <String, Object> processAnnotationElement( AnnotationElement annotation)
-       {
-               if (annotation == null) return null;
-                       int secStructure = -1;//unknown
-                       Hashtable <String, Object> parameters = null;
-                       try
-                               {
-                                       secStructure = new Integer(annotation.getSecondaryStructure()).intValue();
-                               }
-                       catch (NumberFormatException nfExcep)
-                               {
-                                       this.logger.sessionWarn("Unknown secondary sequence: "+ annotation.getSecondaryStructure());
-                                       secStructure = -1;
-                               }
-                       if (annotation.getDescription().contains("breakpoint") || annotation.getDescription().contains("Breakpoint"))
-                                       {
-                                               Highlight hgl = new Highlight (annotation.getDisplayCharacter().charAt(0), annotation.getDescription(), secStructure, null, annotation.getPosition());
-                                               //Hashtable<String, Object> temp
-                                               parameters = new Hashtable<String, Object>();
-                                               //temp
-                                               parameters.put("highlightT0",hgl);
-                                               this.groupingManager.addBreakpoint(annotation);
-                                       }
-                       //this.groupingManager.addBreakpoint(annotation);
-                       return parameters;
-       }
-    
-    private Hashtable <String, Object> processSequence(SequenceType sequence) throws UnableToGroupSequencesException
-    {
-       if (sequence == null) return null;
-               Hashtable <String, Object> tempParameters =  this.groupingManager.addSequence(sequence.getSequence(), sequence.getName());
-               
-       //return null;
-               
-               return tempParameters;
-    }
-/**
- * <p>Does ...</p>
- * 
- */
-    public void updateDocument(Hashtable<String, Object> parameters) 
-       {        
-               this.logger.sessionDebug("Updating Document");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("UpdateDocument: no object provided: No update.");
-                               return ;
-                       }
-                       VAMSAS[] roots = null;
-               try
-                       {
-                               roots = this.client.getClientDocument().getVamsasRoots();
-                       }
-               catch (IOException ioe)
-                       {
-                                       this.logger.sessionWarn("Add active site: The document does not exist. Can not add Active site.");
-                                       return;
-                                       
-                       }
-               if (roots == null || roots.length<1)
-                       {
-                               this.logger.sessionWarn("Add active site: The document is empty. Can not add Active site.");
-                               return;
-                       }
-               for (int rootNumber = roots.length-1; rootNumber >=0 &&  parameters != null&& parameters.size()>0; rootNumber-- )
-                       {
-                               VAMSAS root = roots[rootNumber];
-                               if (root == null)
-                                       {
-                                               continue;
-                                       }
-                               updateVAMSAS(root,parameters);
-                       }
-       } 
-    
-    /**
-     * Updates a VAMSAS entity with the given parameters
-     * @param parameters  list of objects to update into the VAMSAS  tree
-     */
-    private void updateVAMSAS(VAMSAS root, Hashtable<String, Object> parameters) 
-       {        
-               this.logger.sessionDebug("Updating Vamsas");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("UpdateVAMSAS: no object provided: No update.");
-                               return ;
-                       }
-               if(root == null )
-                       {
-                               this.logger.sessionWarn("UpdateVAMSAS: no VAMSAS XML Entity.");
-                               return ;
-                       }
-               for (int dataSetNumber = root.getDataSetCount() -1; dataSetNumber>=0&&  parameters != null&& parameters.size()>0; dataSetNumber--)
-                       {
-                               DataSet set  = root.getDataSet(dataSetNumber);
-                               if( set == null) continue;
-                               updateDataSet(set, parameters);
-                                       
-                       }
-       }
-    
-    /**
-     * Updates a DataSet entity with the given parameters
-     * @param parameters  list of objects to update into the DataSet  tree
-     */
-    private void updateDataSet(DataSet root, Hashtable<String, Object> parameters) 
-       {        
-               this.logger.sessionDebug("Updating DataSet");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("updateDataSet: no object provided: No update.");
-                               return ;
-                       }
-               if(root == null )
-                       {
-                               this.logger.sessionWarn("updateDataSet: no DataSet XML Entity.");
-                               return ;
-                       }
-               for (int alignmentNumber= root.getAlignmentCount()-1; alignmentNumber>=0&&  parameters != null&& parameters.size()>0; alignmentNumber-- )
-                       {
-                               Alignment align  = root.getAlignment(alignmentNumber);
-                               if( align != null)
-                                       {
-                                               updateAlignment(align, parameters);
-                                       }
-                       }
-       }
-
-    /**
-     * Updates a Alignment entity with the given parameters
-     * @param parameters  list of objects to update into the Alignment  tree
-     */
-    private void updateAlignment(Alignment root, Hashtable<String, Object> parameters) 
-       {        
-               this.logger.sessionDebug("Updating ALignment");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("updateAlignment: no object provided: No update.");
-                               return ;
-                       }
-               if(root == null )
-                       {
-                               this.logger.sessionWarn("updateAlignment: no DataSet XML Entity.");
-                               return ;
-                       }
-               this.logger.sessionDebug("list of parameters: "+parameters);
-               Hashtable<String, ArrayList<AVActiveSite>> sites = (Hashtable<String, ArrayList<AVActiveSite>>) parameters.get("MSD.vamav.common.AVActiveSite");
-               Hashtable<String, ArrayList<ResidueAnnotation>> residueAnnotations = (Hashtable<String, ArrayList<ResidueAnnotation>>) parameters.get("MSD.vamav.common.ResidueAnnotation");
-               try
-                       {
-               if ((sites != null && sites.size()>0) || (residueAnnotations!= null && residueAnnotations.size()>0))
-                       {
-                               boolean hasSitesToUpdate = false;
-                               if (sites!= null && sites.size()>0)
-                                       {
-                                               hasSitesToUpdate = true;
-                                       }
-                               boolean hasAnnotationToUpdate = false;
-                               if (residueAnnotations!= null && residueAnnotations.size()>0)
-                                       {
-                                               hasAnnotationToUpdate = true;
-                                       }
-                               for (int seqNumber = root.getAlignmentSequenceCount() -1; seqNumber>=0; seqNumber --)
-                                       {
-                                               AlignmentSequence seq = root.getAlignmentSequence(seqNumber);
-                                               if( seq == null) continue;
-                                               String name = seq.getName();
-                                               if( name == null ) continue;
-                                               this.logger.sessionDebug("sequence name "+name);
-                                               name = name.trim().toLowerCase().intern();
-                                               if (hasSitesToUpdate)
-                                                       {
-                                                               if( sites.containsKey(name) )
-                                                                       {//found the alignment associated to an Active Site
-                                                               //add the active site as annotation element
-                                                       ///     AlignmentAnnotations[] annotations = root.getAlignmentAnnotations();
-                                                               //if (annotations == null)
-                                                               //      {
-                                                                               this.addActiveSite(root, sites.get(name));
-                                                                               sites.remove(name);
-                                                               //      }
-                                                                       }
-                                                               else
-                                                                       {
-                                                               //look for PDB ID
-                                                               //usely active sites are associated with PDB chain.
-                                                               //check any seq has a PDB ID with an active site.
-                                                                               Sequence seqRef = (Sequence)seq.getRefid();
-                                                                               if( !this.logger.isProduction())this.logger.sessionDebug(" sites "+sites);
-                                                                       //      this.logger.sessionDebug(" sites "+sites.keys());
-                                                                               if (seqRef != null)
-                                                                                       {
-                                                                                       boolean found = false;
-                                                                                       int refNumber = seqRef.getDbRefCount() ;
-                                                                                       while (!found && refNumber>0)
-                                                                                               {
-                                                                                                       refNumber --;
-                                                                                                       DbRef ref = seqRef.getDbRef(refNumber);
-                                                                                                       if( ref == null ) continue;
-                                                                                                       String source = ref.getSource();
-                                                                                                       this.logger.sessionDebug("DBRef "+ refNumber+ " "+source);
-                                                                                                       if (source  != null && "PDB".equalsIgnoreCase(source))
-                                                                                                               {
-                                                                                                                       String accID = ref.getAccessionId();
-                                                                                                                       if( accID == null || accID.length()<1) continue;
-                                                                                                                       accID = accID.trim().toLowerCase().intern();
-                                                                                                                       this.logger.sessionDebug("ACCID  "+accID);
-                                                                                                                       if( accID != null)
-                                                                                                                               {
-                                                                                                                                       for ( Enumeration<String> keys = sites.keys(); keys.hasMoreElements();)
-                                                                                                                                               {
-                                                                                                                                                       String sitePDBID = keys.nextElement();
-                                                                                                                                                       if( sitePDBID == null) continue;
-                                                                                                                                       
-                                                                                                                                                       int underPos = sitePDBID.indexOf("_");
-                                                                                                                               
-                                                                                                                                                       this.logger.sessionDebug("position underscore "+underPos +" "+sitePDBID.substring(underPos+1, name.length()));
-                                                                                                                                                       if( underPos>0  && (sitePDBID.substring(underPos+1, sitePDBID.length()).length()==1 || sitePDBID.substring(underPos+1, sitePDBID.length()).length()==0))
-                                                                                                                                                               {//remove chain name and leave the PDB ID
-                                                                                                                                                                       sitePDBID = sitePDBID.substring(0, underPos);
-                                                                                                                                                               }
-                                                                                                                                                       sitePDBID = sitePDBID.trim().toLowerCase().intern();
-                                                                                                                                                       if( sitePDBID.equalsIgnoreCase(accID))
-                                                                                                                                                               {
-                                                                                                                                                                       root = this.addActiveSite(root, sites.get(accID));
-                                                                                                                                                               }
-                                                                                                                                               }
-                                                                                                                                       //sites.remove(accID);
-                                                                                                                               }
-                                                                                                               }
-                                                                                               }
-                                                                                       }
-                                                               }
-                                                       }
-                                                       if( hasAnnotationToUpdate)
-                                                               {
-                                                                       this.logger.sessionDebug("Testing "+name+ " for residue annotation.");
-                                                                       if(residueAnnotations.containsKey(name))
-                                                                               {//found the alignment associated to an Active Site
-                                                                                       //add the active site as annotation element
-                                                                                       this.logger.sessionDebug("The sequence "+name+" has a residue annotation.");
-                                                                                       //AlignmentAnnotations[] annotations = root.getAlignmentAnnotations();
-                                                                                       //if (annotations == null)
-                                                                                       //      {
-                                                                                       this.addResidueAnnotation(root, residueAnnotations.remove(name));
-                                                                                       //      }
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       //look for PDB ID
-                                                                                       //usely active sites are associated with PDB chain.
-                                                                                       //check any seq has a PDB ID with an active site.
-                                                                                       Sequence seqRef = (Sequence)seq.getRefid();
-                                                                                       if (!this.logger.isProduction()) this.logger.sessionDebug(" residueAnnotations "+residueAnnotations);
-                                                                               
-                                                                                       if (seqRef != null)
-                                                                                               {
-                                                                                                       boolean found = false;
-                                                                                                       int refNumber = seqRef.getDbRefCount() ;
-                                                                                                       while (!found && refNumber>0)
-                                                                                                               {
-                                                                                                                       refNumber --;
-                                                                                                                       DbRef ref = seqRef.getDbRef(refNumber);
-                                                                                                                       if( ref == null ) continue;
-                                                                                                                       String source = ref.getSource();
-                                                                                                                       this.logger.sessionDebug("DBRef "+ refNumber+ " "+source);
-                                                                                                                       if (source  != null && "PDB".equalsIgnoreCase(source))
-                                                                                                                               {
-                                                                                                                                       String accID = ref.getAccessionId();
-                                                                                                                                       if( accID == null || accID.length()<1) continue;
-                                                                                                                                       accID = accID.trim().toLowerCase().intern();
-                                                                                                                                       this.logger.sessionDebug("ACCID  "+accID);
-                                                                                                                                       if( accID != null && residueAnnotations.containsKey(accID))
-                                                                                                                                               {
-                                                                                                                                                       root = this.addResidueAnnotation(root, residueAnnotations.get(accID));
-                                                                                                                                               }
-                                                                                                                               }
-                                                                                                               }
-                                                                                                       
-                                                                                               }
-                                                                               }
-                                                                       
-                                                               }
-                                       }
-                                       
-                       }
-               else
-                       {
-                               this.logger.sessionInfo("Update Alignment: no Residue alignment provided.");
-                       }
-                       }catch (Exception e)
-                               {
-                                       this.logger.sessionError("Error during Alignment update ",e);
-                               }
-       
-       }
-    
-    /**
-     * add an active site to the document
-     * @param sites
-     */
-    private Alignment addActiveSite(Alignment align, ArrayList<AVActiveSite> sites )
-       {
-               this.logger.sessionDebug("adding active site");
-               if(align == null )
-                       {
-                               this.logger.sessionWarn("AddActiveSite: no Aligmnemt XML Entity.");
-                               return align;
-                       }
-               if( sites == null || sites.size()<1)
-                       {
-                               this.logger.sessionDebug("addActiveSite: No site to add.");
-                               return align;
-                       }
-               Hashtable <String, ArrayList<AVActiveSite>> orderedSites = new Hashtable <String,  ArrayList<AVActiveSite>>();
-               //order site per position
-               this.logger.sessionDebug(" Ordering sites: "+sites.size());
-               for (int siteNumber = sites.size() -1; siteNumber>=0; siteNumber--)
-                       {
-                               AVActiveSite site = sites.get(siteNumber);
-                               if (site == null) continue;
-                               
-                               //we suppose we can have several sites at the same position
-                               //orderedSites.put(Integer.valueOf(siteNumber), site);
-                               Integer position = Integer.valueOf(site.getPosition());
-                               this.logger.sessionDebug("position: "+position.toString());
-                                ArrayList<AVActiveSite> s = orderedSites.get(position.toString().intern());
-                                if(s == null )
-                                        {
-                                                s = new ArrayList<AVActiveSite>();
-                                        }
-                               if (!s.contains(site)) s.add(site);
-                               orderedSites.put(position.toString().intern(), s);
-                               //orderedSites.
-                               //site.getPosition();
-                       }//check if active site are already contained in the Annotation
-               for (int alignNumber = align.getAlignmentAnnotationsCount() - 1 ; alignNumber>=0; alignNumber--)
-                       {
-                               AlignmentAnnotations annotation= align.getAlignmentAnnotations(alignNumber);
-                               if( annotation == null) continue;
-                               this.logger.sessionDebug("annotation number : "+alignNumber);
-                               this.logger.sessionDebug("Element count "+annotation.getAnnotationElementCount());
-                               for ( int elementNumber = annotation.getAnnotationElementCount() - 1;elementNumber>=0; elementNumber-- )
-                                       {
-                                               AnnotationElement element = annotation.getAnnotationElement(elementNumber);
-                                               this.logger.sessionDebug("element "+elementNumber);
-                                       if( element == null) continue;
-                               //      if(this.activeSiteDescription.equalsIgnoreCase(element.getDescription())&&
-                                                       //
-                                       Integer pos = Integer.valueOf(element.getPosition());
-                                       String desc = element.getDescription();
-                                       this.logger.sessionDebug("element position "+ pos+",");
-                                       this.logger.sessionDebug("positions "+orderedSites.keys());
-                                       if(desc != null && desc.startsWith(this.activeSiteDescription) && orderedSites.containsKey(pos.toString().intern()))
-                                               {
-                                                       this.logger.sessionInfo("AddActiveSite: The active site already exists at position: "+element.getPosition());
-                                                       ArrayList<AVActiveSite> s = orderedSites.remove(pos.toString().intern());
-                                                       
-                                                       //continue;
-                                               }
-                                       pos = null;
-                                       }
-                       }
-               //the remaining sites must be added.
-               if(orderedSites !=null && orderedSites.size()>0 )
-                       {
-                               AlignmentAnnotations annotation = new AlignmentAnnotations();
-                               
-                               Collection<ArrayList<AVActiveSite>> s =  orderedSites.values();
-                               if( s != null && s.size()>0)
-                                       {
-                                               for ( Iterator <ArrayList<AVActiveSite>> iter = s.iterator(); iter.hasNext();)
-                                                       {
-                                                               ArrayList<AVActiveSite> list = iter.next();
-                                                               if (list == null || list.size()<1) continue;
-                                                               for (int arrayNumber = list.size()-1; arrayNumber>=0; arrayNumber--)
-                                                                       {
-                                                                               AVActiveSite site = list.get(arrayNumber);
-                                                                               AnnotationElement element = new AnnotationElement();
-                                                                               if (site == null ) continue;
-                                                                               this.logger.sessionDebug("site : "+site.getSequenceName() + " "+site.getPosition() );
-                                                                       element.setDescription(this.activeSiteDescription +" "+site.getLigandName());
-                                                                       element.setPosition(site.getPosition());
-                                                                       //element.setValue();
-                                                                       annotation.addAnnotationElement(element);
-                                                                       }
-                                                       }
-                                       }
-                               /*for (Enumeration siteEnum = ; siteEnum.hasMoreElements();)
-                                       {
-                                               AVActiveSite site = (AVActiveSite)siteEnum.nextElement();
-                                               if (site == null) continue;
-                                               logger.Applidebug("site : "+site.getSequenceName());
-                                               element.setDescription(this.activeSiteDescription +" "+site.getLigandName());
-                                               element.setPosition(site.getPosition());
-                                               //element.setValue();
-                                               annotation.addAnnotationElement(element);
-                                       }*/
-                               //adding provenance entry to the annotation
-                               Provenance provenance = annotation.getProvenance();
-                               Entry provenanceEntry = this.createProvenanceEntry(this.client, "Update - added ActiveSite");
-                               if(provenanceEntry != null )//otherwise  something is wrong
-                                       {
-                                               if( provenance == null) provenance = new Provenance();
-                                               provenance.addEntry(provenanceEntry);
-                                       }
-                               align.addAlignmentAnnotations(annotation);
-                       }
-               return align;
-       }
-
-    /**
-     * add an active site to the document
-     * @param sites
-     */
-    private Alignment addResidueAnnotation(Alignment align, ArrayList<ResidueAnnotation> annotations )
-       {
-               this.logger.sessionDebug("adding active site");
-               if(align == null )
-                       {
-                               this.logger.sessionWarn("AddResidueAnnotation: no Aligmnemt XML Entity.");
-                               return align;
-                       }
-               if( annotations == null || annotations.size()<1)
-                       {
-                               this.logger.sessionDebug("addResidueAnnotation: No annotation to add.");
-                               return align;
-                       }
-               Hashtable <String, ArrayList<ResidueAnnotation>> orderedAnnotation = new Hashtable <String,  ArrayList<ResidueAnnotation>>();
-               //order site per position
-               this.logger.sessionDebug(" Ordering sites: "+annotations.size());
-               for (int siteNumber = annotations.size() -1; siteNumber>=0; siteNumber--)
-                       {
-                               ResidueAnnotation annotation = annotations.get(siteNumber);
-                               if (annotation == null) continue;
-                               
-                               //we suppose we can have several sites at the same position
-                               //orderedSites.put(Integer.valueOf(siteNumber), site);
-                               Integer position = Integer.valueOf(annotation.getResidueNumber());
-                               this.logger.sessionDebug("position: "+position.toString());
-                                ArrayList<ResidueAnnotation> s = orderedAnnotation.get(position.toString().intern());
-                                if(s == null )
-                                        {
-                                                s = new ArrayList<ResidueAnnotation>();
-                                        }
-                               if (!s.contains(annotation)) s.add(annotation);
-                               orderedAnnotation.put(position.toString().intern(), s);
-                               //orderedSites.
-                               //site.getPosition();
-                       }//check if active site are already contained in the Annotation
-               for (int alignNumber = align.getAlignmentAnnotationsCount() - 1 ; alignNumber>=0; alignNumber--)
-                       {
-                               AlignmentAnnotations annotation= align.getAlignmentAnnotations(alignNumber);
-                               if( annotation == null) continue;
-                               this.logger.sessionDebug("annotation number : "+alignNumber);
-                               this.logger.sessionDebug("Element count "+annotation.getAnnotationElementCount());
-                               for ( int elementNumber = annotation.getAnnotationElementCount() - 1;elementNumber>=0; elementNumber-- )
-                                       {
-                                               AnnotationElement element = annotation.getAnnotationElement(elementNumber);
-                                               this.logger.sessionDebug("element "+elementNumber);
-                                       if( element == null) continue;
-                               //      if(this.activeSiteDescription.equalsIgnoreCase(element.getDescription())&&
-                                                       //
-                                       Integer pos = Integer.valueOf(element.getPosition());
-                                       String desc = element.getDescription();
-                                       this.logger.sessionDebug("element position "+ pos+",");
-                                       if( !this.logger.isProduction()) this.logger.sessionDebug("positions "+orderedAnnotation.keys());
-                                       if(desc != null && desc.startsWith(this.activeSiteDescription) && orderedAnnotation.containsKey(pos.toString().intern()))
-                                               {
-                                                       this.logger.sessionInfo("AddActiveSite: The active site already exists at position: "+element.getPosition());
-                                                       ArrayList<ResidueAnnotation> s = orderedAnnotation.remove(pos.toString().intern());
-                                                       
-                                                       //continue;
-                                               }
-                                       pos = null;
-                                       }
-                       }
-               //the remaining sites must be added.
-               if(orderedAnnotation !=null && orderedAnnotation.size()>0 )
-                       {
-                               AlignmentAnnotations annots = new AlignmentAnnotations();
-                               
-                               Collection<ArrayList<ResidueAnnotation>> s =  orderedAnnotation.values();
-                               if( s != null && s.size()>0)
-                                       {
-                                               for ( Iterator <ArrayList<ResidueAnnotation>> iter = s.iterator(); iter.hasNext();)
-                                                       {
-                                                               ArrayList<ResidueAnnotation> list = iter.next();
-                                                               if (list == null || list.size()<1) continue;
-                                                               for (int arrayNumber = list.size()-1; arrayNumber>=0; arrayNumber--)
-                                                                       {
-                                                                               ResidueAnnotation annotation = list.get(arrayNumber);
-                                                                               AnnotationElement element = new AnnotationElement();
-                                                                               if (annotation == null ) continue;
-                                                                               this.logger.sessionDebug("annotation : "+annotation.getSequenceName() + " "+annotation.getResidueNumber() );
-                                                                       element.setDescription(annotation.getDescription());
-                                                                       element.setPosition(annotation.getResidueNumber());
-                                                                       if (annotation.getDisplayCharacter()!= null && annotation.getDisplayCharacter().length()>0)
-                                                                               element.setDisplayCharacter(annotation.getDisplayCharacter());
-                                                                       else
-                                                                               element.setDisplayCharacter("?");
-                                                                       if( annotation.getSecondaryStructure() != null && annotation.getSecondaryStructure().length()>0 )
-                                                                               {
-                                                                                       element.setSecondaryStructure(annotation.getSecondaryStructure());
-                                                                               }
-                                                                       else
-                                                                               element.setSecondaryStructure("?");
-                                                                       element.setValue(Float.parseFloat(annotation.getValue()));
-                                                                       //element.setValue();
-                                                                       annots.addAnnotationElement(element);
-                                                                       }
-                                                       }
-                                       }
-                               /*for (Enumeration siteEnum = ; siteEnum.hasMoreElements();)
-                                       {
-                                               AVActiveSite site = (AVActiveSite)siteEnum.nextElement();
-                                               if (site == null) continue;
-                                               logger.Applidebug("site : "+site.getSequenceName());
-                                               element.setDescription(this.activeSiteDescription +" "+site.getLigandName());
-                                               element.setPosition(site.getPosition());
-                                               //element.setValue();
-                                               annotation.addAnnotationElement(element);
-                                       }*/
-                               //adding provenance entry to the annotation
-                               Provenance provenance = annots.getProvenance();
-                               Entry provenanceEntry = this.createProvenanceEntry(this.client, "Update - added Residue Annotation");
-                               if(provenanceEntry != null )//otherwise  something is wrong
-                                       {
-                                               if( provenance == null) provenance = new Provenance();
-                                               provenance.addEntry(provenanceEntry);
-                                       }
-                               align.addAlignmentAnnotations(annots);
-                       }
-               return align;
-       }
-    
-    private Hashtable<String, Object>  addParameters(Hashtable<String, Object> newParameters, Hashtable<String, Object> parameters)
-       {
-               if (parameters == null) parameters = new Hashtable<String, Object>();
-               if (newParameters != null && newParameters.size()>0)
-                       {
-                               boolean found = false;
-                               /*for (Enumeration keys = newParameters.keys(); keys.hasMoreElements();)
-                                       {
-                                               String key = (String) keys.nextElement();
-                                               if( key == null) continue;
-                                               Object value = newParameters.get(key);
-                                               if (value == null) continue;
-                                               
-                                               String newKey = null;
-                                               if("molecule".equals(key) )
-                                                       {
-                                                               if( parameters.containsValue(value)) continue;
-                                                               newKey = "molecule"+this.moleculeNumber;
-                                                       }
-                                               else
-                                                       if("name".equals(key) )
-                                                               {
-                                                                       if( parameters.containsValue(value)) continue;
-                                                                       newKey = "name"+this.moleculeNumber;
-                                                               }
-                                                       else newKey = key;
-                                               parameters.put(newKey, value);
-                                               logger.Applidebug("Adding new parameter "+newKey);
-                                               newParameters.remove(key);
-                                               key = null;
-                                               found = true;
-                                       }
-                               found = false;
-                               this.moleculeNumber++;*/
-                               boolean moreMolecules = true;
-                               int molNumber = -1;
-                               int highlightN= -1;
-                               boolean moreHighlight = true;
-                               if (!this.logger.isProduction() )
-                                       {
-                                               for (Enumeration<String> keys = newParameters.keys(); keys.hasMoreElements();)
-                                                       {
-                                                               this.logger.sessionDebug("new parameter "+keys.nextElement());
-                                                       }
-                                               for (Enumeration<String> keys = parameters.keys(); keys.hasMoreElements();)
-                                                       {
-                                                               this.logger.sessionDebug("current stored parameter "+keys.nextElement());
-                                                       }
-                                       }
-                               while (newParameters != null && !newParameters.isEmpty() && (moreMolecules || moreHighlight))
-                                       {
-                                               highlightN++;
-                                               String currentParameterName = "highlightT"+highlightN;
-                                               Object hig  = newParameters.remove(currentParameterName);
-                                               currentParameterName = null;
-                                               if(hig != null)
-                                                       {
-                                                               if (!parameters.containsValue(hig))
-                                                                       {
-                                                                               this.logger.sessionDebug("Highlight found in the document");
-                                                               //newParameters.remove("highlight"+highlightNumber);
-                                                                               int currentNumber = this.highlightNumber++;
-                                                                               String newKey = "highlight"+currentNumber;
-                                                                               this.logger.sessionDebug("Adding new parameter "+newKey);
-                                                                               parameters.put(newKey, hig);
-                                                                       }
-                                                               else
-                                                                       {
-                                                                               this.logger.sessionDebug("the highlight is already contained in the parameter list.");
-                                                                       }
-                                                       }
-                                               else
-                                                       {
-                                                               moreHighlight = false; 
-                                                               //continue;
-                                                               this.logger.sessionDebug("no more highlight");
-                                                       }
-                                               
-                                               molNumber++;
-                                               Object mol  = newParameters.get("moleculeG"+molNumber);
-                                               if (mol == null) 
-                                                       {
-                                                               moreMolecules = false; 
-                                                               continue;
-                                                       }
-                                               newParameters.remove("moleculeG"+molNumber);
-                                               Object name  = newParameters.get("nameG"+molNumber);
-                                               if (name == null) 
-                                                       {
-                                                               //moreMolecules = false; 
-                                                               continue;
-                                                       }
-                                               newParameters.remove("nameG"+molNumber);
-                                               if( parameters.containsValue(mol)) continue;
-                                               int currentNumber = this.moleculeNumber++;
-                                               String newKey = "molecule"+currentNumber;
-                                               this.logger.sessionDebug("Adding new parameter "+newKey);
-                                               parameters.put(newKey, mol);
-                                               if( parameters.containsValue(name)) continue;
-                                               newKey = "name"+currentNumber;
-                                               this.logger.sessionDebug("Adding new parameter "+newKey);
-                                               parameters.put(newKey, name);
-                                       }
-                               if (newParameters!= null && !newParameters.isEmpty())parameters.putAll(newParameters);
-                       }
-               if (newParameters != null)
-                       {
-                               newParameters.clear();
-                               newParameters = null;
-                       }
-               return parameters;
-       }
-    /** @poseidon-generated */
-    public SequenceGrouping getSequenceGrouping() {
-        return this.groupingManager;
-    }
-    /** @poseidon-generated */
-    public void setSequenceGrouping(SequenceGrouping sequenceGrouping) {
-        this.groupingManager = sequenceGrouping;
-    }
-    
-    
-    private Entry createProvenanceEntry(IClient client, String action)
-       {
-               if (client == null)
-                       {
-                               this.logger.sessionError("No vamsas client provided to create provenance entry. The entry object will not be added.");
-                               return null;
-                       }
-               return this.createProvenanceEntry(client.getUserHandle().getFullName(), action);
-       }
-    
-    private Entry createProvenanceEntry(String user, String action)
-       {
-               if( user == null || user.length()<1)
-                       {
-                               this.logger.sessionError("No User name provided to create provenance entry. The entry object will not be added.");
-                               return null;
-                       }
-               if( action == null || action.length()<1)
-                       {
-                               this.logger.sessionError("No action provided to create provenance entry. The entry object will not be added.");
-                               return null;
-                       }
-               Entry provenanceEntry = new Entry();
-               provenanceEntry.setUser(user);
-               provenanceEntry.setAction(action);
-       
-               /* 
-                ** on some JDK, the default TimeZone is wrong
-                ** we must set the TimeZone manually!!!
-                **   Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("EST"));
-                */
-               Calendar cal = Calendar.getInstance(TimeZone.getDefault());
-               org.exolab.castor.types.Date date = new org.exolab.castor.types.Date (cal.getTime());
-               provenanceEntry.setDate(date);
-               cal = null;
-               return provenanceEntry;
-       }
-    
-    public ArrayList<String> getGroupingModes()
-       {
-               ArrayList<String> modes = new ArrayList<String>();
-               modes.add("structure");
-               modes.add("Protein domain");
-               return modes;
-       }
-    
-    /**
-     * Create a document following provided parameters
-     * 
-     * @param parameters list of parameters, containing objects to map to the document objects/tree
-     * @return the IClient with the associated newly created document
-     * @throws IOException if an  error occurs during VAMsas document file access
-     */
-    public IClient createDocument(Hashtable<String, Object> parameters) throws IOException
-       {
-               if(parameters == null  || parameters.size()<1)
-                       {
-                               this.logger.sessionError("No parameter provided to create the VAMSAS document. Abort.");
-                       }
-                IClientDocument _doc = null;
-               
-                        VamsasDocument doc = new VamsasDocument();
-                VAMSAS root  = new VAMSAS();
-                doc.addVAMSAS(root);
-                
-                
-                Tree aTree = this.createTree(parameters);
-                if( aTree != null) root.addTree(aTree);
-                
-               DataSet set = this.createDataSet(parameters);
-               if (set != null)
-                       root.addDataSet(set);
-                
-                       IdFactory vorba = null;
-                          // TODO: reduce size of vorba ids generated from these parameters to IdFactory (mainly sessionHandle rationalization ?)
-                          try {
-                                       vorba= new IdFactory(this.client.getSessionHandle(),
-                                        this.client.getClientHandle(), ((VAMAVClient)this.client).getUserHandle());//makeVorbaIdFactory();
-                                // if session currently holds data - read it in - or get a dummy
-                                       this.logger.sessionDebug("Accessing document");
-                                 }
-                          catch (Exception e) {
-                               File sessionDir = ((VAMAVClient)this.client).getVAMAVSession().getSessionDirectory();
-                                       this.logger.sessionError("Failed to get session document for session directory '"+sessionDir.getAbsolutePath()+"'", e);
-                                throw new IOException("Failed to get session document for session directory '"+sessionDir.getAbsolutePath()+"'");
-                          }
-                          // Construct the IClientDocument instance
-                       ApplicationData appliData = new ApplicationData();
-                       User user = new User();
-                       user.setFullname(this.client.getUserHandle().getFullName());
-                       user.setOrganization(this.client.getUserHandle().getOrganization());
-               
-                       appliData.addUser(user);
-               doc.addApplicationData(appliData);
-                       _doc = new ClientDocument(doc, (VamsasArchive)null, vorba, this.client);
-                
-               //_doc = new ClientDocument(doc, new VAMSAS[]{root}, null,this.client);
-               this.client.updateDocument(_doc);
-               return this.client;
-       }
-    
-    /** Create Vamsas Tree object
-    * Currently do nothing
-    * @return the created tree 
-    * @param parameters a list of parameters from an AstexViewer@MSD-EBI client
-    */
-   private Tree createTree(Hashtable<String, Object> parameters)
-          {
-                  return null;
-               }
-   
-   
-   private DataSet createDataSet(Hashtable<String, Object> parameters) 
-       {
-               if (parameters == null || parameters.size()<1)
-                       {
-                                       this.logger.sessionDebug("No parameter provided to create DataSet");
-                                       return null;
-                       }
-               this.logger.sessionDebug("Create DataSet ");
-               DataSet set = new DataSet();
-               Alignment align = this.createAlignment(parameters);
-               if (align != null) set.addAlignment(align);
-               set  = this.createSequences(parameters,set);
-   
-               this.logger.sessionDebug("end CreateDataSet ");
-               return set;
-       }
-       
-   /**
-    * creates a Alignment entity following the given parameters
-    * @param parameters  list of objects used to create  the Alignment  tree
-    */
-   private Alignment createAlignment(Hashtable<String, Object> parameters) 
-       {        
-               this.logger.sessionDebug("Create Alignment");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("createAlignment: no object provided: Can not create.");
-                               return  null;
-                       }
-               Alignment align = null;
-               //new Alignment();
-               if (!this.logger.isProduction())  this.logger.sessionDebug("list of parameters: "+parameters);  
-               return align;
-       }
-   
-   /**
-    * creates a Alignment entity following the given parameters
-    * @param parameters  list of objects used to create  the Alignment  tree
-    */
-   private DataSet createSequences(Hashtable<String, Object> parameters, DataSet set) 
-       {        
-               this.logger.sessionDebug("Create Sequences");
-               if( parameters == null || parameters.size()<1)
-                       {
-                               this.logger.sessionWarn("createSequence: no object provided: Can not create.");
-                               return  null;
-                       }
-               ArrayList<AVSequence> sequences = (ArrayList<AVSequence>) parameters.get("MSD.vamav.common.AVSequence");
-               if( sequences != null && sequences.size()>0)
-                       {
-                               Alignment align = new Alignment();
-                               
-                               for (int sequenceNumber = sequences.size() -1; sequenceNumber >=0; sequenceNumber-- )
-                                       {
-                                               AVSequence sequence = sequences.get(sequenceNumber);
-                                               
-                                               //create sequence object
-                                               Sequence seq = new Sequence();
-                                               seq.setName(sequence.getName());
-                                               String sequenceWithoutGap = sequence.getSequence();
-                                               if( sequenceWithoutGap != null && sequenceWithoutGap.length()>0)
-                                                       {
-                                                               sequenceWithoutGap = sequenceWithoutGap.replaceAll("-", "");
-                                                       }
-                                               seq.setSequence(sequenceWithoutGap);
-                                               set.addSequence(seq);
-                                               
-                                               //create Alignment object relative to thie Sequence object
-                                       
-                                               AlignmentSequence alignmSeq = new AlignmentSequence();
-                                               alignmSeq.setName(sequence.getName());
-                                               alignmSeq.setSequence(sequence.getSequence());
-                                               alignmSeq.setRefid(seq);
-                                               align.addAlignmentSequence(alignmSeq);
-                                       }
-                               set.addAlignment(align);
-                       }
-               
-               if (!this.logger.isProduction())  this.logger.sessionDebug("list of parameters: "+parameters);  
-               return set;
-       }
-  
-  
- }
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/IncorrectDocumentException.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/IncorrectDocumentException.java
deleted file mode 100755 (executable)
index 3b81398..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Created on 14 nov. 2005\r
- *  * EMBL-EBI\r
- * MSD Group\r
- * VAMSAS Project\r
- * VAMAV\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 14 nov. 2005\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.exceptions;\r
-\r
-/**\r
- * Exception raises if the a Vamsas document is considered as incorrect\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 14 nov. 2005 \r
- * \r
- */\r
-public class IncorrectDocumentException extends Exception\r
-       {\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                */\r
-               public IncorrectDocumentException()\r
-                       {\r
-                               super();\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public IncorrectDocumentException(String arg0)\r
-                       {\r
-                               super(arg0);\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                * @param arg1\r
-                */\r
-               public IncorrectDocumentException(String arg0, Throwable arg1)\r
-                       {\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public IncorrectDocumentException(Throwable arg0)\r
-                       {\r
-                               super(arg0);\r
-                       }\r
-\r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/UnableToProcessException.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/exceptions/UnableToProcessException.java
deleted file mode 100755 (executable)
index 0454e0f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Created on 12 janv. 2006\r
- *  * EMBL-EBI\r
- * MSD Group\r
- * VAMSAS Project\r
- * VAMAV\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 12 janv. 2006\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.exceptions;\r
-\r
-/**\r
- * Exception raised when the application is unable to process a document\r
- * or a session\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 12 janv. 2006 \r
- * \r
- */\r
-public class UnableToProcessException extends Exception\r
-       {\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                */\r
-               public UnableToProcessException()\r
-                       {\r
-                               super();\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public UnableToProcessException(String arg0)\r
-                       {\r
-                               super(arg0);\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                * @param arg1\r
-                */\r
-               public UnableToProcessException(String arg0, Throwable arg1)\r
-                       {\r
-                               super(arg0, arg1);\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public UnableToProcessException(Throwable arg0)\r
-                       {\r
-                               super(arg0);\r
-                       }\r
-\r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping.java
deleted file mode 100755 (executable)
index 43f5184..0000000
+++ /dev/null
@@ -1,1169 +0,0 @@
-/* * EMBL-EBI
-* MSD Group
-* VAMSAS Project
-* VAMAV
-*  * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @version  1  
-*/
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping;
-
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.exceptions.UnableToGroupSequencesException;
-import uk.ac.ebi.msd.vamsas.vamav.exceptions.IncorrectVamavModuleInitialisation;
-import uk.ac.ebi.msd.vamsas.vamav.util.data.DataBuffer;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.MappingManager;
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.exceptions.MappingException;
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.matrixrotation.RotationTranslationMatrix;
-import uk.ac.ebi.msd.vamsas.vamav.util.multiplealignment.AlignmentManager;
-import uk.ac.ebi.msd.vamsas.vamav.util.multiplealignment.ClustalW_EBIWSClient;
-import uk.ac.ebi.msd.vamsas.vamav.util.multiplealignment.MultipleAlignmentIntf;
-import uk.ac.ebi.msd.vamsas.vamav.util.multiplealignment.exceptions.AlignmentException;
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.DataBufferPool;
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.StringBufferPool;
-import uk.ac.ebi.msd.vamsas.vamav.util.properties.PropertyManager;
-import org.vamsas.objects.core.AnnotationElement;
-import org.vamsas.objects.core.SequenceType;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-
-/**
-* Abstract class for defining Structure grouping methods. 
-* 
-* Grouping mode should implement these methods
-* 
-* Providing method definitions and code for atribute file generation
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @version  1  
-*/
-
-public abstract class SequenceGrouping  implements uk.ac.ebi.msd.vamsas.vamav.VamaVModule{
-
-       protected final String  pdbidsproperty = "pdbids";
-       
-       protected  String modulePrefix = "sequence";
-       protected final VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());
-
-       protected  Hashtable <String, ArrayList<SequenceType>> groups = null;
-       
-       /**
-        * List of PDB structures per group
-        * to allow rotation translation matrix mapping
-        */
-       protected  Hashtable <String, ArrayList<String>> structuresPerGroup = null;
-       
-       protected char gapChar = 'X';
-       protected Hashtable <String,Integer> maxSeqLengthsPerGroup = null;
-       protected Hashtable <Integer,String> fakeSequencePerLength = null;
-       
-       protected ArrayList<File> sequenceFile = null;
-       protected final String atrFilePrefix = "atr";
-       protected final String alignmentFilePrefix = ".aln";
-       protected String workingDirectory = "atributeFile";
-       //protected String atributeFile = this.workingDirectory+File.separator+"vamsas"+"."+this.atrFilePrefix;
-       protected static String enc = null;
-       protected static final boolean erase = true;
-       protected static final boolean append = false;
-       protected Hashtable<String, Hashtable<Integer, StringBuffer>> sequenceBreakPoints = null;
-       protected final boolean deleteOnExit = false;
-       /**
-        * Mapping manager to retrieve a mapping between ID for example
-        * 
-        */
-       protected MappingManager mapping = null;
-       
-        protected AlignmentManager alignManager = null;
-       
-           
-       /**
-        * <p></p>
-        * 
-        */
-        //   private MultipleAlignmentIntf multipleAlignment;
-
-       
-         /**
-          * List of breakpoints for the current alignmentSet
-          */
-       protected  ArrayList<AnnotationElement> breakpoints = null;
-         /**
-          * Saves adding order of sequences 
-         */
-       protected  ArrayList <String> groupOrder = null;
-       
-       /**
-        *  
-        * Constructor of the  SequenceGrouping class, given a mapping manager 
-        *
-        * @param _mappingManager the mapping manager to use for mapping 
-        */
-         public SequenceGrouping( MappingManager _mappingManager)
-               {
-                       this.mapping = _mappingManager;
-                       
-               }
-       
-       /**
-        * Inits the Sequence Grouping sub module, with a list of configuration properties.
-        */
-       public void init (Properties moduleProperties) throws IncorrectVamavModuleInitialisation
-               {
-                       PropertyManager propManager = new PropertyManager();
-                       this.alignManager = new  AlignmentManager();
-                       try
-                               {
-                                       Properties props = propManager.getModuleProperties(moduleProperties, this.alignManager.getModulePrefix());
-                                       this.alignManager.init(props);
-                                       props = null;
-                               }
-                       catch (IncorrectVamavModuleInitialisation ivmie)
-                               {
-                                       logger.appliError("Unable to init Alignment Manager.");
-                                       throw new IncorrectVamavModuleInitialisation(ivmie);
-                               }
-                       propManager = null;
-                       if (moduleProperties == null || moduleProperties.size()<1)
-                               {
-                                       this.logger.appliInfo("SequenceGrouping - No properties provided. Uses default.");
-                                       return;
-                               }
-                       String gap = moduleProperties.getProperty("gapcharacter", String.valueOf(this.gapChar));
-                       if( gap !=null && gap.length()<1) 
-                               this.gapChar = gap.charAt(0);
-               
-               }
-        
-
-    
-    
-  
-    
-    /**
-        * Retrieves the  mapping attribut
-        *
-        * @return Returns the mapping.
-        */
-       protected MappingManager getMapping()
-               {
-                       return this.mapping;
-               }
-
-       /**
-        *  retrieves the MultipleAlignmentIntf associated to the current object,
-        *  to execute multiple alignment
-        * @return the MultipleAlignmentIntf object associated to the current object.
-        */
- /*   private  MultipleAlignmentIntf getMultipleAlignment() {
-        return this.multipleAlignment;
-    }*/
-    
-    /**
-     * Set the MultipleAlignmentIntf for the current object
-     * @param multipleAlignmentIntf the MultipleAlignmentIntf object ot associated to the object.
-     */
-   /* private void setMultipleAlignment(MultipleAlignmentIntf _multipleAlignment) 
-       {
-           this.multipleAlignment = _multipleAlignment;
-       }*/
-    
-    /**
-     * Add a sequence for grouping.
-     * 
-     * @param sequence chain sequence to add
-     * @param name name of the sequence to add
-     * @return a list of parameters to call the AstexViewer
-     * @throws UnableToGroupSequencesException if an error occurs during the adding.
-     */
-    public abstract Hashtable<String, Object>  addSequence(String sequence, String name) throws UnableToGroupSequencesException;
-    
-    /**
-     * Add a sequence for grouping, with an associated accessionID and its source.
-     * 
-     * @param sequence chain sequence to add for grouping
-     * @param name name of the sequence to add
-     * @param accessionID accessionId associated to the sequence
-     * @param source source of the accessionID
-     * @return list of parameters to call the AstexViewer, if needed.  Null, otherwise.
-     * @throws UnableToGroupSequencesException if an error occurs during the adding.
-     */
-    public abstract Hashtable<String, Object> addSequence(String sequence, String name, String accessionID, String source) throws UnableToGroupSequencesException;
-    
-    /**
-     * Registers a PDB ID as belonging to a group
-     * @param groupName name of the group to add the structure in it.
-     * @param pdbID Id of the PDB structure to add
-     */
-    protected void addStructureToGroup(String groupName, String pdbID)
-       {
-               if (this.structuresPerGroup == null)
-                       {
-                               this.structuresPerGroup = new Hashtable<String,ArrayList<String>>();    
-                       }
-               ArrayList<String> structs= this.structuresPerGroup.get(groupName);
-               if (structs == null)
-                       {//create new list of the group
-                               structs = new ArrayList<String> ();
-                       }
-               //add structure
-               if (!structs.contains(pdbID))
-                       {
-                               structs.add(pdbID);
-                                       logger.sessionDebug("Adding structure"+pdbID+" to group "+groupName);
-                               //      readd list to be sure to have the right list in the global list
-                               this.structuresPerGroup.put(groupName, structs);
-                       }
-       }
-    /**
-          * Add a sequence to a group
-          * @param groupName name of the group to add the sequence into
-          * @param sequence sequence to add
-          * @param sequenceName name of the sequence to add
-          */
-    protected void addSequenceToGroup(String groupName, String sequence, String sequenceName)
-       {
-               if (groupName == null || groupName.length()<1) 
-                       {
-                               this.logger.sessionError("There is no group name. Can not add the sequence to the group.");
-                               return;
-                       }
-               if (sequence == null || sequence.length()<1) 
-                       {
-                               this.logger.sessionError("There is no sequence. Can not add the sequence to the group.");
-                               return;
-                   }
-                   
-               this.logger.sessionInfo("Adding "+sequenceName+" sequence to "+groupName+" group.");
-               ArrayList<SequenceType> elements = getGroups().get(groupName);
-               if (elements == null) 
-                       {
-                               elements = new ArrayList<SequenceType>();
-                               this.logger.sessionInfo("No previous list, create one");
-                       }
-               if (sequence ==null)
-                       this.logger.sessionError("No sequence provided for "+sequenceName+".");
-               else
-                       {
-                               if (sequence.length()>0)
-                                       {
-                                               Integer maxLength = getMaxSeqLengthsPerGroup().get(groupName);                  
-                                               if(maxLength!=null&& maxLength.intValue()>0 )
-                                                       {
-                                                               int maxSeqLength = maxLength.intValue();
-                                                               int seqLen = sequence.length();
-                                                               if (maxSeqLength < seqLen)
-                                                                       {
-                                                                               maxSeqLength = seqLen;
-                                                                               maxLength = Integer.valueOf(maxSeqLength);
-                                                                               getMaxSeqLengthsPerGroup().put(groupName, maxLength);
-                                                                       }
-                                                       }
-                                               else
-                                                       {
-                                                               int seqLen = sequence.length();
-                                                               maxLength = Integer.valueOf(seqLen);
-                                                               getMaxSeqLengthsPerGroup().put(groupName, maxLength);
-                                                       }
-                                       }
-                               SequenceType seq = new SequenceType() ;
-                               seq.setName(sequenceName);
-                               seq.setSequence(sequence);
-                               if( !elements.contains(seq))
-                                       {
-                                               if (!this.logger.isProduction())
-                                                       {
-                                                               this.logger.sessionDebug("sequences size before ");
-                                                               this.logger.sessionDebug(""+elements.size());
-                                                       }
-                                               elements.add(seq);
-                                       }
-                               //else
-                                       //seq = null;
-                               if( !this.logger.isProduction())
-                                       {
-                                               this.logger.sessionDebug("sequences size after ");
-                                               this.logger.sessionDebug("" +elements.size());
-                                               this.logger.sessionDebug("groups size before ");
-                                               this.logger.sessionDebug(""+getGroups().size());
-                                       }
-                               getGroups().put(groupName, elements);
-                               if( !this.logger.isProduction())
-                                       {
-                                               this.logger.sessionDebug("groups size after ");
-                                               this.logger.sessionDebug(""+getGroups().size());
-                                       }
-                               addGroupToOrder(groupName);
-                       }
-       }
-
-       /**
-        * Retrieves the  groups attribut
-        *
-        * @return Returns the groups.
-        */
-    protected  Hashtable<String, ArrayList<SequenceType>> getGroups()
-               {
-                       if (this.groups == null)
-                               this.groups = new  Hashtable<String, ArrayList<SequenceType>> ();
-                       return this.groups;
-               }
-
-       /**
-        * Retrieves the  fakeSequencePerLength attribut
-        *
-        * @return Returns the fakeSequencePerLength.
-        */
-       public Hashtable<Integer, String> getFakeSequencePerLength()
-               {
-                       if (this.fakeSequencePerLength == null)
-                               {
-                                       this.fakeSequencePerLength = new Hashtable<Integer, String>();
-                               }
-                       return this.fakeSequencePerLength;
-               }
-
-       /**
-        * Retrieves the  maxSeqLengthsPerGroup attribut
-        *
-        * @return Returns the maxSeqLengthsPerGroup.
-        */
-       public  Hashtable<String, Integer> getMaxSeqLengthsPerGroup()
-               {
-                       if( this.maxSeqLengthsPerGroup == null)
-                               this.maxSeqLengthsPerGroup = new Hashtable<String, Integer>();
-                       return this.maxSeqLengthsPerGroup;
-               }
-    
-         /**
-          * Retrieves the  sequenceOrder attribut
-          *
-          * @return Returns the sequenceOrder.
-          */
-         protected  ArrayList<String> getGroupOrder() {
-           if( this.groupOrder == null)
-               this.groupOrder = new ArrayList <String>();
-           return this.groupOrder;
-         }
-         
-         protected  void addGroupToOrder(String groupName)
-         {
-           if (!(getGroupOrder().contains(groupName)))
-             getGroupOrder().add(groupName);
-         }
-         
-         /**
-          * Clear the sequence order List
-          */
-         public  void groupOrderClear() {
-           if( this.groupOrder != null)
-               this.groupOrder = null;
-         }
-
-       /**
-        * Retrieves the  modulePrefix attribut
-        *
-        * @return Returns the modulePrefix.
-        */
-       public String getModulePrefix()
-               {
-                       return this.modulePrefix;
-               }
-
-        /**
-          * Add a breakpoint to the grouping
-          * @param element annotation element associated to a breakpoint.
-          */
-         public void  addBreakpoint(AnnotationElement element)
-                 {
-                         if (element == null) 
-                           {
-                               this.logger.sessionError("Sequence Grouping  addBreakPoint - There is no annotation element. Can not add the breakpoint to groups");
-                               return;
-                           }
-                         this.logger.sessionDebug("Adding breakpoint");
-                         getBreakpoints().add(element);
-                 }
-         
-         /**
-         * Retrieves the  breakpoints attribut
-         *
-         * @return Returns the breakpoints.
-         */
-         protected ArrayList<AnnotationElement> getBreakpoints()
-               {
-                       if (this.breakpoints == null)
-                               this.breakpoints= new ArrayList<AnnotationElement>();
-                       return this.breakpoints;
-               }
-        
-        /**
-         * Create a fake sequence containing provided breakpoints.
-         * @param breaks list of breakpoints
-         * @param groupName name of the group the fake sequence will be associated.
-         * @return the created fake sequence corresponding to the list of breakpoint
-         */
-         protected String  createFakeSequence(String groupName, ArrayList<AnnotationElement> breaks)
-               {
-                       
-                       if(breaks == null || breaks.size()<1) return null;
-                       this.logger.sessionInfo("Creating BreakPoint sequence for "+groupName );
-                       this.logger.sessionDebug("break points: "+breaks.size());
-                       String fakeSequence = null;
-                       Integer len = getMaxSeqLengthsPerGroup().get(groupName);
-                       if (len != null)
-                               {
-                                       //retrieves store fake sequence:
-                                       fakeSequence = getFakeSequencePerLength().get(len);
-                                       if( fakeSequence == null || fakeSequence.length()<1)
-                                               {
-                                                       Hashtable<Integer, AnnotationElement> positions  = new Hashtable<Integer, AnnotationElement> (breaks.size());
-                                                       StringBuffer sequence = StringBufferPool.getString(); 
-                                                       for (int breakNumber = breaks.size()-1; breakNumber >=0; breakNumber --)
-                                                               {
-                                                                       AnnotationElement bp = breaks.get(breakNumber);
-                                                                       if (bp == null) continue;
-                                                                       int pos = bp.getPosition()-1;//position in the sequence start at 1
-                                                                       if (pos >=0)
-                                                                               {
-                                                                                       positions.put(new Integer(pos), bp);
-                                                                                       //System.out.println("adding position "+pos);
-                                                                               }
-                                                               }
-                                                       
-                                                       int maxSeqLength = len.intValue();
-                                                       int size = maxSeqLength -1;
-                                                       for (int i =  0; i< maxSeqLength; i++ )
-                                                               {
-                                                                       int reversePos =  i;
-                                                                       //System.out.println("reverse pos "+reversePos);
-                                                                       Integer p = new Integer(reversePos);
-                                                                       if (positions.containsKey(p))
-                                                                               {
-                                                                                       AnnotationElement bp = positions.get(p);
-                                                                                       sequence.append(bp.getDisplayCharacter());
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       sequence.append(this.gapChar);
-                                                                               //System.out.println("no breakpoint found at pos "+reversePos);
-                                                                               }
-                                                               }
-                                       positions = null;
-                                       fakeSequence = sequence.toString();
-                                       StringBufferPool.returnString(sequence);
-                                       getFakeSequencePerLength().put(len, fakeSequence);
-                               }
-                               }
-                       else
-                               {
-                                       this.logger.sessionDebug("no len");
-                               }
-                       this.logger.sessionDebug("fake sequence "+fakeSequence);
-                       return fakeSequence;
-               }
-
-
-        /**
-         * Writes created groups into an atribute file for tha AstexViewer
-         * 
-         * @throws UnableToGroupSequencesException, if unable to group added sequences
-         *  @return the atribute file corresponding to the grouping of added sequences
-         *
-         */ 
-        public File storeGroups() throws  UnableToGroupSequencesException
-                {
-                        int size = this.getGroups().size();
-                        if (size<1)
-                                {
-                                        this.logger.sessionWarn("Sequence Grouping - There is no computed group. Can not store groups.");
-                                       // return null;
-                                        throw new UnableToGroupSequencesException();
-                                }
-                       
-                        //test if there is at least a sequence in each group. 
-                        boolean correct = true;
-                        for (Enumeration<String> _groups = this.getGroups().keys(); _groups.hasMoreElements() && correct; )
-                                {
-                                        String groupName = _groups.nextElement();
-                                        ArrayList<SequenceType> sequences = this.getGroups().get(groupName);
-                                        this.logger.sessionDebug("Group "+groupName);
-                                        if (sequences == null || sequences.size()<1)
-                                                {
-                                                        correct = false;
-                                                }
-                                        else
-                                                {
-                                                        this.logger.sessionDebug("group size "+sequences.size());
-                                                }
-                                }
-                        if (!correct)
-                                {
-                                        this.logger.sessionWarn("Sequence Grouping - There is no computed group. Can not store groups.");
-                                        //return null;
-                                        throw new UnableToGroupSequencesException();
-                                }
-                        if (this.sequenceFile == null)
-                                this.sequenceFile = new ArrayList<File>();
-                        else 
-                                this.sequenceFile.clear();
-                        File atrFile = null;
-                        try
-                                {
-                                        this.workingDirectory  = this.getOutputDirectory();
-                                        String atributeFile = this.workingDirectory+File.separator+"vamav-"+this.getSessionID()+"."+this.atrFilePrefix;
-                                        logger.sessionInfo("Creating atribute file: "+atributeFile);
-                                        //writing Atribute file
-                                        if( atributeFile == null)
-                                                {
-                                                        throw new UnableToGroupSequencesException("No atribute file path provided.");
-                                                }
-                                        if (!atributeFile.endsWith(this.atrFilePrefix))
-                                                {
-                                                        atributeFile = atributeFile.concat("."+this.atrFilePrefix);
-                                                }
-                                        atrFile = new File (atributeFile);
-                                        //atrFile.mkdirs();
-                                        this.logger.sessionInfo("SequenceGrouping - Writing Atribute File.");
-                                        PrintWriter out = openFile(atrFile);
-                                        if( out == null)
-                                                throw new UnableToGroupSequencesException("Unable to open file to write. "+atrFile.getAbsolutePath());;
-                                                //return null;
-                                        DataBuffer line = DataBufferPool.getString();
-             
-                                        //write header
-                                        line.setString("Atribute file Version 1.0");
-                                        writeLine(line, out);
-                                        line.setString("");
-                                        writeLine(line, out);
-                                        /*int groupNumber = 0;
-                                         for (Enumeration keys = getGroups().keys(); keys.hasMoreElements();)
-                                         {*/
-                                       
-                                        this.alignManager.setSession(this.getSessionID());
-                                        for (int groupNumber = 0; groupNumber < getGroupOrder().size() ;groupNumber++ )
-                                                {
-                                                        
-                                                        
-                                                        String groupName = getGroupOrder().get(groupNumber);
-                                                        getGroups();
-                                                        //exporting fasta file
-                                                        ArrayList<SequenceType> sequences = getGroups().get(groupName);
-                                                        
-                                                        //generate alignment file name
-                                                       // MultipleAlignmentIntf 
-                                                       // AlignmentManager clustal =  new  AlignmentManager();//ClustalW_EBIWSClient(this.getSessionID());
-                                                        //clustal.setSession(this.getSessionID());
-                                                        String extension = "";
-                                                        String alignmentfileExtension = alignManager.getMultipleAligmnentFileExtension();
-                                                        if (alignmentfileExtension != null && alignmentfileExtension.length()>0)
-                                                               if (alignmentfileExtension.startsWith("."))
-                                                                       extension = alignmentfileExtension;
-                                                               else
-                                                                       extension = ".".concat(alignmentfileExtension);
-                                                        
-                                                        String alignmentFileName = groupName + extension;
-                                                        if( sequences != null && sequences.size()>0)
-                                                                {
-                                                                        //(groupName, "atributeFile");
-                                                                        this.logger.sessionDebug("Preparing multiple alignment "+groupName);
-                                                                        if(getBreakpoints()!=null && getBreakpoints().size()>0)
-                                                                                {
-                                                                                        alignManager.HasBreakPoint();
-                                                                                        String sequence = createFakeSequence(groupName,getBreakpoints() );
-                                                                                        if (sequence !=null)
-                                                                                                {
-                                                                                                        String sequenceName = groupName+"Breakpoints_";
-                                                                                                        alignManager.addSequence(sequenceName, this.prepareAddSequence(sequence,sequenceName));
-                                                                                                }
-                                                                                }
-                                                                        else
-                                                                                {
-                                                                                        alignManager.HasNoBreakPoint();
-                                                                                }
-                                                                        for (int seqNumber = sequences.size() -1; seqNumber>=0; seqNumber--)
-                                                                                {
-                                                                                        SequenceType seq = sequences.get(seqNumber);
-                                                                                        if (seq == null) 
-                                                                                                {
-                                                                                                        this.logger.sessionWarn("No sequence to add");
-                                                                                                        continue;
-                                                                                                }
-                                                                                        this.logger.sessionDebug("Add sequence for multiple alignment "+seq.getName() + " "+seq.getSequence());
-                                                                                        alignManager.addSequence(seq.getName(), this.prepareAddSequence(seq.getSequence(), seq.getName()));
-                                                                                }
-                                                                       String alignment = alignManager.execMultipleAlignment();
-                                                                       if (alignment!= null)
-                                                                               {
-                                                                                       File alignmentFile = this.unModifieSequences(alignment, groupName,this.workingDirectory + File.separator+alignmentFileName);
-                                                                                       if (alignmentFile != null)
-                                                                                               this.getSequenceFiles().add(alignmentFile);
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       logger.sessionDebug("No alignment retrieved.");
-                                                                               }
-                                                                       
-                               //      add group
-                                                                        ArrayList<String> structs = null;
-                                                                        DataBuffer ids = DataBufferPool.getString();
-                                                                       
-                                                                        if( this.structuresPerGroup != null && this.structuresPerGroup.size()>0)
-                                                                                {
-                                                                                        structs = this.structuresPerGroup.get(groupName);
-                                                                                        
-                                                                                        if (structs == null || structs.size()<1)
-                                                                                                {
-                                                                                                        ids.append("groupName");
-                                                                                                        
-                                                                                                        logger.sessionInfo("no pdb structure for the group "+groupName+". No matrix added");
-                                                                                                        line.setString("  Molecule "+groupName+" "+groupName+"  {\n");
-                                                                                                       // writeLine(line, out);
-                                                                                                        line.append("  }\n");
-                                                                                                        //writeLine(line, out);
-                                                                                                }
-                                                                                        else
-                                                                                                {
-                                                                                                        String primaryID = structs.remove(structs.size()-1);
-                                                                                                        line.setString("  Molecule "+primaryID+" {\n");
-                                                                                                       // writeLine(line, out);
-                                                                                                        line.append("  }\n"); 
-                                                                                                        //writeLine(line, out);
-                                                                                                        ids.append(primaryID);
-                                                                                                        for (int structNumber = structs.size()-1; structNumber>=0; structNumber--)
-                                                                                                                {
-                                                                                                                        String id = structs.get(structNumber);
-                                                                                                                        line.append("  Molecule "+id+" {\n");
-                                                                                                                        //writeLine(line, out);
-                                                                                                                        ids.append(" ".concat(id));
-                                                                                                                        try
-                                                                                                                                {
-                                                                                                                                        Collection<RotationTranslationMatrix> matrixes = this.mapping.getRotationTranslationMatrix(primaryID, id);
-                                                                                                                                        if (matrixes != null)
-                                                                                                                                                {
-                                                                                                                                                       for (RotationTranslationMatrix matrix : matrixes)
-                                                                                                                                                        {
-                                                                                                                                                               if( matrix != null)
-                                                                                                                                                                       {
-                                                                                                                                                                               boolean isChain = false;
-                                                                                                                                                                               String chainID = matrix.getPrimaryPDBIDChain();
-                                                                                                                                                                               if(chainID!= null  &&chainID.length()>0 )
-                                                                                                                                                                                       {
-                                                                                                                                                                                         isChain = true;
-                                                                                                                                                                                         line.append("    Chain "+chainID+ " {\n");
-                                                                                                                                                                                       }
-                                                                                                                                                                               if( matrix != null)
-                                                                                                                                                                                       {
-                                                                                                                                                                                               line.append("    Matrix ");
-                                                                                                                                                                                                line.append(BigDecimal.valueOf(matrix.get(0, 0).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(0,1).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(0,2).doubleValue())+ " "+
-                                                                                                                                                                                               BigDecimal.valueOf(matrix.get(1,0).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(1, 1).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(1, 2).doubleValue())+ " "+
-                                                                                                                                                                                               BigDecimal.valueOf(matrix.get(2,0).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(2, 1).doubleValue())+ " "+BigDecimal.valueOf(matrix.get(2,2).doubleValue())+ " "
-                                                                                                                                                                                               + BigDecimal.valueOf(matrix.get(0,3).doubleValue()) + " " + BigDecimal.valueOf(matrix.get(1, 3).doubleValue()) + " " + BigDecimal.valueOf(matrix.get(2, 3).doubleValue()) );
-                                                                                                                                                        //writeLine(line, out);
-                                                                                                                                                                                               line.append("\n");
-                                                                                                                                                                                       }
-                                                                                                                                                                               if( isChain)
-                                                                                                                                                                                       {
-                                                                                                                                                                                               line.append("}\n"); 
-                                                                                                                                                                                       }
-                                                                                                                                                                       }
-                                                                                                                                                               }
-                                                                                                                                                }
-                                                                                                                                }
-                                                                                                                        catch (MappingException mexcep)
-                                                                                                                                {
-                                                                                                                                        logger.sessionError("Error during RTM mapping.",mexcep);
-                                                                                                                                }
-                                                                                                                        line.append("  }\n"); 
-                                                                                                                        //writeLine(line, out);
-                                                                                                                }
-                                                                                                        
-                                                                                                }
-                                                                                        
-                                                                                }
-                                                                        DataBuffer groupLine = DataBufferPool.getString();
-                                                                       groupLine.setString("Group \""+groupName+"\" "+ids+" {");
-                                                                       // groupLine.setString("Group \""+groupName+"\" {");
-                                                                        writeLine(groupLine, out);
-                                                                        DataBufferPool.returnString(groupLine);
-                                                                        DataBufferPool.returnString(ids);
-                                                                        line.append("  Sequence \""+alignmentFileName+"\" \n");//\""+groupName+".aln"+"\" ");
-                                                                        //writeLine(line, out);
-                                                                        line.append("  Text \"This is a group "+groupName+"\"\n");
-                                                                        //writeLine(line, out);
-                                                                        writeLine(line, out);
-                                   //Group "dfr" 7dfr 8dfr {
-                                                                        
-                                                                        line.setString("}\n");
-                                                                        writeLine(line, out);
-                                                                       
-                                                                       
-                                                                       
-                                                                }
-                                                        else 
-                                                                this.logger.sessionWarn("No sequence to add to group "+ groupName);
-                                                }
-                                        line.setString("}\n");
-                                        writeLine(line, out);
-                                        closeFile(out);
-                                        alignManager = null;   
-                                } 
-                        catch (AlignmentException ae )
-                                {
-                                        atrFile = null;
-                                        throw new UnableToGroupSequencesException(); 
-                                }
-                        catch (IOException ioe)
-                                {
-                                        this.logger.sessionError("Error during Atribute file writing "+atrFile+". ",ioe);
-                                        //ioe.printStackTrace(System.out);
-                                        atrFile = null;
-                                }
-                        return atrFile;
-         }
-         
-        /**
-         * Readds breakpoints after the multiple alignment ( as  display character for breakpoint, are not supported by multiple alignment tools
-         * 
-         * @param alignment alignment String 
-         * @param alignmentName name of the alignment
-         * @return the file containing the alignment with breakpoints
-         */
-        protected File unModifieSequences (String alignment, String alignmentName, String masterFileName)
-                {
-                        if (alignment == null) 
-                                {
-                                        this.logger.sessionError("UnModifiedSequences - No aligment found. Can not unmodified sequences.");
-                                        return null;
-                                }
-                       // logger.Applidebug("Readded breakpoint to sequences "+alignment);
-                       
-                        
-                       // String masterFileName = this.workingDirectory + File.separator+alignmentName+ alignmentfileExtension;
-                     // WORK_ROOT + "/" +sessionId+ "/master_" + i + ".seq";
-                    //check workingDirectory exists, can be read and is a directory
-                        File workingDir = new File (this.workingDirectory);
-                        if(!(workingDir !=null && workingDir.exists()))
-                             {
-                                 if (!workingDir.mkdir())
-                                  {
-                                          this.logger.sessionError( "%%% WARNING: couldn't open master "
-                                                          + "sequence file for writing. Working directory does not exist. Can not be created. "+this.workingDirectory );
-                                          return null;
-                                  }    
-                             }
-                        if(! (workingDir.isDirectory()&&  workingDir.canRead()))
-                                {
-                            logger.sessionError( "%%% WARNING: couldn't open master "
-                                        + "sequence file for writing. Working directory does not exist. " );
-                            return null;
-                      }
-                       File masterFile = new File(masterFileName );
-                        try
-                                {
-                                        Writer masterWriter = new FileWriter( masterFile );
-                                        PrintWriter master = new PrintWriter( masterWriter );
-                                        if(this.deleteOnExit) masterFile.deleteOnExit();
-                        
-                              //write alignment
-                                        boolean endAlignment = false;
-                                        int len = 0;
-                                        DataBuffer brkSequence = DataBufferPool.getString();
-                                        logger.sessionDebug("Retrieving alignment");
-                                        String[] lines = alignment.split("\n");
-                                        if (lines == null || lines.length<1)
-                                                {
-                                                        logger.sessionError("No line retrieving - something wrong.");
-                                                        return null;
-                                                }
-                                        logger.sessionDebug(lines.length+" lines found.");
-                                        for ( int lineNumber = 0; lineNumber<lines.length; lineNumber++ )
-                                                {
-                                                        String line = lines[lineNumber];
-                                                               if (line == null)continue;
-                                                               //modified breakpoint sequence as incorrect characters are erased (they have been replaced by X)
-                                                               if(line.trim().length()<=0 ||line.trim().equals(" ") ) {master.println(line); continue;}
-                                                               if (line.startsWith("Clustal") || line.startsWith("CLUSTAL")) 
-                                                                       {
-                                                                               master.println(line);
-                                                                               continue;
-                                                                       }
-                                                               //System.out.println(line);
-                                                               int pos = line.indexOf(" ");
-                                                               String name = line.substring(0,pos);
-                                                               name = name.trim().toLowerCase();
-                                                               Hashtable<Integer, StringBuffer> bkpts = this.getSequenceBreakPoints().get(name);
-                                                               if (bkpts == null)//no breakpoint associated - write line
-                                                                       {
-                                                                               logger.sessionDebug("No breakpoint export line "+line);
-                                                                               master.println(line);
-                                               /*System.out.println("no break point");*/
-                                                                       }
-                                                               else
-                                                                       {//modified at positions
-                                                                               //get sequence
-                                                                               /*System.out.println(line);*/
-                                                                               logger.sessionDebug("No breakpoint found ");
-                                                                               String sequence = line.substring(pos+1,line.length()).trim();
-                                                                               /*System.out.println("sequence: "+sequence);*/
-                                                                               int seqPos = line.indexOf(sequence);
-                                                                               /*System.out.println("break point "+bkpts.size());*/
-                                       
-                                                                               char[] chars = sequence.toCharArray();
-                                                                               int currentResidentNumber = 0;
-                                                                               for (int charNumber = 0; charNumber< chars.length;charNumber++ )
-                                                                                       {
-                                                                                               char currentChar = chars[charNumber];
-                                                                                               if (currentChar == '-') 
-                                                                                                       {
-                                                                                                       //System.out.print(" gap ");
-                                                                                                       continue;
-                                                                                                       }
-                                                                                               //check if breakpoint
-                                                                                               /*System.out.print(" "+currentResidentNumber+" ");*/
-                                                                                               Integer resN = Integer.valueOf(currentResidentNumber++);
-                                                                                               StringBuffer displayCharacter = bkpts.get(resN);
-                                                                                               len++;
-                                                               //System.out.print("|"+(currentResidentNumber-1)+"-"+len+"|");
-                                                                                               if (displayCharacter == null ||displayCharacter.length()<1 )
-                                                                                                       {
-                                                                                                               continue;
-                                                                                                       }
-                                                                       //breakpoint found
-                                                                                               chars[charNumber] = displayCharacter.charAt(0);
-                                                                       /*System.out.print(displayCharacter.charAt(0));*/
-                                                                                               bkpts.remove(resN);resN=null;
-                                                                                       }
-                                                                               int resCount = currentResidentNumber;
-                                                                               sequence = String.valueOf(chars);
-                                                       /*System.out.println("new seq: "+sequence);*/
-                                                                               if (brkSequence.length()<=0) brkSequence.setString(sequence);
-                                                                               else brkSequence.append(sequence);
-                                                                               line = line.substring(0,seqPos).concat(sequence);
-                                                                               master.println(line);
-                                                                               Hashtable<Integer, StringBuffer> newBkpts = new Hashtable<Integer, StringBuffer> (bkpts.size());
-                                           
-                                                                               for (Enumeration positions = bkpts.keys(); positions.hasMoreElements();)
-                                                                                       {
-                                                                                               Integer position = (Integer) positions.nextElement();
-                                                                                               if (position == null|| position.intValue()<0) continue;
-                                                                                               StringBuffer character = bkpts.get(position);
-                                                                                               if( character == null || character.length()!=1)
-                                                                                                       continue;
-                                                                               /*System.out.println("previous breakpoint position "+position.intValue());*/
-                                                                                       bkpts.remove(position); 
-                                                                       //position = null;
-                                                                                       position = Integer.valueOf(position.intValue() - (resCount));
-                                                                               /*System.out.println("new breakpoint position "+position.intValue());*/
-                                                                               //use temporary table to avoid deadlock
-                                                                                       newBkpts.put(position, character);
-                                                                                       }
-                                       /*for (Enumeration positions = bkpts.keys(); positions.hasMoreElements();)
-                                               {
-                                                       Integer position = (Integer) positions.nextElement();
-                                                       if (position == null|| position.intValue()<0) continue;
-                                                       StringBuffer character = bkpts.get(position);
-                                                       if( character == null || character.length()!=1)
-                                                               continue;
-                                                       if( position.intValue()<sequence.length()-1 && position.intValue()<=0)
-                                                               {
-                                                                       StringBuffer newLine = new StringBuffer(line);
-                                                                       newLine.setCharAt(position.intValue(), character.charAt(0));
-                                                                       line = newLine.toString();
-                                                                       newLine = null;
-                                                                       bkpts.remove(position);
-                                                               }
-                                                       else
-                                                               {
-                                                                       position = Integer.valueOf(position.intValue() - (sequence.length()));
-                                                                       //use temporary table to avoid deadlock
-                                                                       tempTable.put(position, character);
-                                                               }
-                                               }
-                                       for (Enumeration positions = tempTable.keys(); positions.hasMoreElements();)
-                                               {
-                                                       Integer position = (Integer) positions.nextElement();
-                                                       if (position == null|| position.intValue()<0) continue;
-                                                       StringBuffer character = bkpts.get(position);
-                                                       if( character == null || character.length()!=1)
-                                                               continue;
-                                                       bkpts.put(position, character);
-                                               }*/
-                                       /*System.out.println("New breakpoints "+bkpts.size());
-                                       System.out.println("New breakpoints "+newBkpts.size());*/
-                                       //remove previous breakpoint list
-                                                                               this.getSequenceBreakPoints().remove(name);
-                                                                               bkpts = null;
-                                                                               if (newBkpts != null && newBkpts.size()>0)
-                                                                                       this.getSequenceBreakPoints().put(name, newBkpts);              
-                                                                       }
-                                                }
-                                      
-                                //release unused object
-                                               this.clearSequenceBreakPoints();
-                                               //StringBufferPool.returnString(this.sequences);
-                                               alignment = null;
-                                               master.close();
-                                               master = null;
-                                               alignmentName = null;
-                                               // System.out.println("new bk seq "+brkSequence);
-                                               DataBufferPool.returnString(brkSequence);
-                                }
-                        catch( IOException ioe ) 
-                              {
-                                       logger.sessionError( "%%% WARNING: couldn't open master "+ "sequence file for writing: " + ioe );
-                          //         ioe.printStackTrace(System.out);
-                                       masterFile = null;
-                              }
-                        return masterFile;
-                       }
-        
-        /**
-         * As multiple alignment tools do not support breakpoint display characters, they are removed from the sequence, replaced by 'X' character 
-         * and stored for readding after the multiple alignment (see unModifieSequences method) 
-         * @param sequence sequence to prepare for alignment
-         * @param name name of the sequence to prepare
-         * @return the sequence without breakpoint display character
-         */
-                
-        protected String prepareAddSequence(String sequence, String name)
-                {
-//                     save position for breakpoint sequences
-                               //modified non expected character (     A R D N B C E Z Q G H I L K M F P S T W Y V X)
-                               //t     o the same/unique one ->"|"
-                               //
-                               /*sequences.setLength(0);
-                               sequences.trimToSize();
-                               sequences.append(sequence);*/
-                               //System.out.println("current seq "+sequences);
-                               String temp = sequence.replaceAll("[^ARDNBCEZQGHILKMFPSTWYVX-]", "|");
-                               StringBuffer s = StringBufferPool.getString();
-                               s.setLength(0);
-                               s.trimToSize();
-                               s.append(temp);
-                               int pos = s.indexOf("|");
-                               //System.out.println("tem p seq "+temp);
-                               Hashtable<Integer, StringBuffer> breakpointPositions = null;
-                               while (pos>0)
-                                       {
-                                               logger.sessionInfo("new breakpoint "+pos);
-                                               if (breakpointPositions == null) breakpointPositions = new Hashtable<Integer, StringBuffer>();
-                                               breakpointPositions.put(Integer.valueOf(pos), new StringBuffer(sequence.subSequence(pos, pos+1)));
-                                               s.setCharAt(pos, 'X');
-                                               pos = s.indexOf("|");   
-                                       }
-                               if(breakpointPositions!=null )
-                                       {//a breakpoint has been found at least
-                                               this.getSequenceBreakPoints().put(name.trim().toLowerCase(), breakpointPositions);
-                                       }
-                               String seq = s.toString();
-                               StringBufferPool.returnString(s);
-                               return seq;
-                }
-        
-         /**
-          * Retrieves the  sequenceFile attribut
-          *
-          * @return Returns the sequenceFile.
-          */
-         public ArrayList<File> getSequenceFiles() {
-                 if( this.sequenceFile == null)
-                         this.sequenceFile = new  ArrayList<File> ();
-           return this.sequenceFile;
-         }
-
-
-         /**
-          * Opens a file for writing
-          *
-          *@param file file to open.
-          *@return a printwriter to writer into it
-          * @exception IOException if an error occurs
-          */
-         protected PrintWriter openFile(File file) throws IOException 
-               {
-                       PrintWriter out = null;
-                       if (file == null)
-                               { 
-                    //Application log(no such file)
-                                       throw new IOException("Unknown file");
-                               }
-             
-             //      check if the current file exists
-           file = new File(file.getAbsolutePath());
-           logger.sessionDebug("atribute file "+file.getAbsolutePath());
-           if (!file.exists() )
-               {
-                         File directory = new File(file.getParent());
-                         logger.sessionDebug("parent directory "+ directory.getParent());
-                     // but first, see if it exists already. If so, we don't need
-                     // to run the groups calculation again, so just return and
-                     // we're done
-                                  if( directory.exists() ) {
-                                         //
-                                  } else {
-                                          if( ! directory.mkdirs() ) {
-                                                 logger.sessionError( "%%% ERROR: Grouping; couldn't create "
-                                                                  + "directory for grouping /atribute file "  );
-                                          }
-                                  }
-               if (!file.createNewFile()) 
-                 {
-                   throw new IOException("Can't create file: "
-                       + file.getAbsolutePath());
-                 }
-              }
-             // the file will be overwritten, if the file already exists (but it should be indicated in the log)
-             
-             if (file.exists() && !erase)
-               {
-                 throw new IOException("The file already exists: "+ file.getAbsolutePath()+ "  Shall we overwrite?");
-               }
-               
-
-             if (!file.canWrite() )
-               {
-                 throw new IOException("Can not write in file: "
-                     + file.getAbsolutePath());
-               }
-
-             // check possible problem with the reader
-             //  The file is already opened. So, we close the file, before reopening it.
-             if (out != null)
-               {
-                 closeFile(out);
-                 logger.sessionWarn("The file "+ file.getName()+" has already been opened.");
-               }
-
-             if (enc != null)
-               {
-                 logger.sessionDebug("Opening File: "+file.getName());
-                 logger.sessionDebug("set output with encoding : "+enc+"  "+file.getAbsolutePath());
-                 FileOutputStream fos = new FileOutputStream(file.getAbsolutePath(), append);
-                 try
-                         { 
-                                 OutputStreamWriter ow = new OutputStreamWriter(fos, enc);
-                                 out = new PrintWriter(ow,true);
-                                 logger.sessionDebug("Encoding "+ow.getEncoding()+" support "+java.nio.charset.Charset.isSupported(enc));
-                        }
-                 catch (java.io.UnsupportedEncodingException ue)
-                         {
-                                 logger.sessionError("unsupported encoding ",ue);
-                         }
-                  }
-             else 
-                 {
-                        
-                         logger.sessionDebug("Opening File: "+file.getName());
-                         FileWriter fw = new FileWriter(file.getAbsolutePath(), append);
-                         out = new PrintWriter(new BufferedWriter(fw),true);
-                 }
-             return out;
-         }
-         
-         
-         /**
-          * Closes a data text file.
-          * @param out writer of the file to close.
-          * 
-          */
-         protected  void closeFile(PrintWriter out)
-                 {
-                         if (out != null) 
-                                 {
-                                         out.flush();
-                                         out.close();
-                                         out = null;
-                                 }
-                 }
-         
-         
-         /**
-          * <p>
-          * Retrieves a line from a data file  
-          * Only when termination requirements have been met, the method should return a
-          * <code>String</code> object.
-          * </p>
-          * @param line containing data items in one String
-          * @param out PrintWriter of the file to write line into. 
-          */
-         protected void writeLine(DataBuffer line, PrintWriter out )
-         {
-           /*System.out.println("Writeline ");*/
-           if (line != null)
-             {
-               if (line.length()  == 0) 
-                 {
-                   /*System.out.println("line empty");*/
-                   out.println("");
-                 }
-               else
-                 {
-                   out.println(line);
-                  /* System.out.println("Writeline :" + line);*/
-                 }
-             }
-         }
-         
-
-               /**
-                * Retrieves the  sequenceBreakPoints attribut
-                *
-                * @return Returns the sequenceBreakPoints.
-                */
-         protected Hashtable<String, Hashtable<Integer, StringBuffer>> getSequenceBreakPoints()
-                       {
-                               if(this.sequenceBreakPoints == null)
-                                       {
-                                               this.sequenceBreakPoints = new Hashtable<String, Hashtable<Integer, StringBuffer>>();
-                                       }
-                                       
-                               return this.sequenceBreakPoints;
-                       }
-               
-               /**
-                * Clears breakpoint lisr
-                *
-                */
-         protected void clearSequenceBreakPoints()
-                       {
-                               if(this.sequenceBreakPoints != null)
-                                       {
-                                               this.sequenceBreakPoints.clear();
-                                               this.sequenceBreakPoints = null;
-                                       }
-                       }
-
-               /**
-                * Retrieves the  pdbidsproperty attribut
-                *
-                * @return Returns the pdbidsproperty.
-                */
-               public String getPdbidsproperty()
-                       {
-                               return this.pdbidsproperty;
-                       }
-               
-               /**
-                * Retrieves the working directory for output file.
-                * @return the path to the output/working directory
-                */
-               public abstract String getOutputDirectory();
-               
-               /**
-                * retrieves current sessionID
-                * @return the ID of the current session for the document grouping.
-                */
-               public abstract String getSessionID();
- }
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_domain.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_domain.java
deleted file mode 100755 (executable)
index 9d95fa3..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Created on 3 janv. 2006\r
- *  * EMBL-EBI\r
- * MSD Group\r
- * VAMSAS Project\r
- * VAMAV\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 3 janv. 2006\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping;\r
-\r
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.PDBUtil;\r
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.exceptions.UnableToGroupSequencesException;\r
-import uk.ac.ebi.msd.vamsas.vamav.exceptions.IncorrectVamavModuleInitialisation;\r
-import uk.ac.ebi.msd.vamsas.vamav.session.VAMAVSession;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.data.PDBEntry;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.MappingManager;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.StringBufferPool;\r
-\r
-import java.io.File;\r
-import java.util.ArrayList;\r
-import java.util.Hashtable;\r
-import java.util.Properties;\r
-\r
-/**\r
- * Groups sequence per PFAM domain.\r
- * \r
- * For each sequence provided, the UniProtID is retrieved (if not provided, as source) by MSD lite.\r
- * Then, the UniProt ID is mapped to PFAM domains, using the sanger web server.\r
- * \r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 3 janv. 2006 \r
- * \r
- */\r
-public class SequenceGrouping_domain extends SequenceGrouping\r
-       {\r
-\r
-               protected VAMAVSession vamavSession = null;\r
-               \r
-               \r
-               /**\r
-                *  \r
-                * Constructor of the  SequenceGrouping class, given a mapping manager \r
-                *\r
-                * @param _mappingManager the mapping manager to use for mapping \r
-                */\r
-                 public SequenceGrouping_domain(  MappingManager _mappingManager)\r
-                       {\r
-                               super(_mappingManager);\r
-                       }\r
-                 \r
-                 /**\r
-                        *  \r
-                        * Constructor of the  SequenceGrouping class, given a mapping manager \r
-                        *\r
-                        * @param _mappingManager the mapping manager to use for mapping \r
-                        * @param sessionID current session for which will be used the current sequence grouping.\r
-                        */\r
-                         public SequenceGrouping_domain(MappingManager _mappingManager, VAMAVSession session )\r
-                               {\r
-                                       super(_mappingManager);\r
-                                       this.logger.setSession(session.getSessionID());\r
-                                       this.vamavSession = session;\r
-                               }\r
-               \r
-               /**\r
-                * Inits the Sequence Grouping sub module, with a list of configuration properties.\r
-                */\r
-               public void init (Properties moduleProperties) throws IncorrectVamavModuleInitialisation\r
-                       {\r
-                               super.init(moduleProperties);\r
-                       }\r
-           \r
-\r
-               /** \r
-                * Adds a sequence to group\r
-                * @see uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping#addSequence(java.lang.String, java.lang.String)\r
-                */\r
-               @Override\r
-               public Hashtable<String, Object> addSequence(String sequence,\r
-                               String name) throws UnableToGroupSequencesException\r
-                       {\r
-                               // TODO Auto-generated method stub\r
-                               return null;\r
-                       }\r
-         /**\r
-            * Add a sequence for grouping, with an associated accessionID and its source.\r
-            * \r
-            * @param sequence chain sequence to add for grouping\r
-            * @param name name of the sequence to add\r
-            * @param accessionID accessionId associated to the sequence\r
-            * @param source source of the accessionID\r
-            * @return list of parameters to call the AstexViewer, if needed.  Null, otherwise.\r
-            * @throws UnableToGroupSequencesException if an error occurs during the adding.\r
-            * \r
-            *  @see uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping#addSequence(java.lang.String, java.lang.String, java.lang.String, java.lang.String)\r
-                \r
-            */\r
-               @Override\r
-               public Hashtable<String, Object> addSequence(String sequence,\r
-                               String name, String accessionID, String source)\r
-                               throws UnableToGroupSequencesException\r
-                       {\r
-                               \r
-                       if( sequence == null || sequence.length()<1)\r
-                               {\r
-                                       this.logger.sessionError("SequenceGrouping - addSequence: Can not add sequence / The sequence is unknown.");\r
-                                       return null;\r
-                               }\r
-                       if( name == null || name.length()<1)\r
-                               {\r
-                                       this.logger.sessionError("SequenceGrouping - addSequence: Can not add sequence / The name is unknown.");\r
-                                       return null;\r
-                               }\r
-                       if( source == null || source.length()<1)\r
-                               {\r
-                                       this.logger.sessionWarn("SequenceGrouping - addSequence: the accession ID source is not provided / try to determine PDBID from the sequence.");\r
-                                       return this.addSequence(sequence, name);\r
-                               }\r
-                       if( accessionID == null || accessionID.length()<1)\r
-                               {\r
-                                       this.logger.sessionWarn("SequenceGrouping - addSequence: the accession ID is not provided / try to determine PDBID from the sequence.");\r
-                                       return this.addSequence(sequence, name);\r
-                               }\r
-                       Hashtable<String, Object> parameters =  null;\r
-                       try\r
-                               {\r
-                                       ArrayList <PDBEntry> entries = null;\r
-                       \r
-                                       if("PDB".equals(source))\r
-                                               {\r
-                                                       PDBEntry entry = this.getMapping().getPDBEntryFromPDBID(accessionID);\r
-                                                       if( entry != null)\r
-                                                               {\r
-                                                                       entries = new ArrayList<PDBEntry>(1);\r
-                                                                       entries.add(entry);\r
-                                                               }\r
-                                               }\r
-                                       if ("UNIPROT".equalsIgnoreCase(source))\r
-                                               {\r
-                                                       entries = this.getMapping().retrievePDBIDFromUniprotAC(accessionID);\r
-                                               }\r
-                                       if( entries == null || entries.size()<1) \r
-                                               {\r
-                                                       this.logger.sessionError("No associated PDB ID to the accessionAC "+ accessionID + " from "+source);\r
-                                                       return this.addSequence(sequence, name);\r
-                                               }\r
-                                       \r
-//                                     retrieved associated domains\r
-                                       \r
-                                       \r
-                                       ArrayList<String> domains = this.mapping.retrievePFAMDomain(accessionID);\r
-                                       if (domains == null || domains.isEmpty())\r
-                                               {\r
-                                                       logger.sessionWarn("No domain associated to "+accessionID);\r
-                                                       logger.sessionWarn("The sequence can not be grouped.");\r
-                                                       return null;\r
-                                               }\r
-                                       \r
-                                       //boolean notFound = false;\r
-                                       //hasAlignmentSequences = true;\r
-                                       parameters = new Hashtable<String, Object>();\r
-                                               \r
-                                       int molNumber = 0;\r
-                                       StringBuffer pdbIDs = null;\r
-                                       if (entries != null || entries.size()<1)\r
-                                               {\r
-//                                                     Retrieves PDB chains, before adding them to group\r
-                                               //add molecule to AV parameters\r
-                                                       ArrayList<PDBUtil.Chain> associatedChains = new ArrayList<PDBUtil.Chain>();\r
-                                                       PDBUtil util = new PDBUtil(this.vamavSession);\r
-                                                       for (int entryNumber = entries.size() -1; entryNumber >=0; entryNumber --)\r
-                                                               {\r
-                                                                       PDBEntry entry =  entries.get(entryNumber);\r
-                                                                       \r
-                                                                       parameters.put("moleculeG"+molNumber,entry);\r
-                                                                       parameters.put("nameG"+molNumber, entry.getPdbID());\r
-                                                                       if( !logger.isProduction()) logger.sessionDebug("Adding PDB parameters "+parameters);\r
-                                                                       ArrayList<PDBUtil.Chain> chains = util.GetChain(entry);\r
-                                                                       \r
-                                                                       if( chains != null)\r
-                                                                               {\r
-                                                                                       this.logger.sessionDebug(" chains found ");\r
-                                                                                       associatedChains.addAll(chains);\r
-                                                                               }\r
-                                                                       else \r
-                                                                               this.logger.sessionDebug("no chains found ");\r
-                                               \r
-                                                                       \r
-                                                                       if( pdbIDs == null) pdbIDs = StringBufferPool.getString();\r
-                                                                       if(pdbIDs.length()>0)pdbIDs.append(", "+entry.getPdbID());\r
-                                                                       else pdbIDs.append(entry.getPdbID());\r
-                                                                       //entries.remove(entry);\r
-                                                               }\r
-                                                       \r
-                                                       //treating retrieved domains\r
-                                                       for (int domainNumber = domains.size() - 1; domainNumber >=0; domainNumber --)\r
-                                                               {//add sequence to the current domain\r
-                                                                       String domainID = domains.get(domainNumber);\r
-                                                                       if (domainID == null || domainID.length()<0)\r
-                                                                               {\r
-                                                                                       logger.sessionDebug("No domain. something wrong, while adding sequence to domain group.");\r
-                                                                                       continue;\r
-                                                                               }\r
-                                                                       this.addSequenceToGroup(domainID, sequence, name);\r
-                                                                       //adding PDB chains to the group\r
-                                                                       if( associatedChains!=null && !associatedChains.isEmpty())\r
-                                                                               {\r
-                                                                                       for (int chainNumber = associatedChains.size()-1; chainNumber>=0; chainNumber--)\r
-                                                                                               {\r
-                                                                                                       PDBUtil.Chain chain = associatedChains.get(chainNumber);\r
-                                                                                                       if (chain == null) continue;\r
-                                                                                                       \r
-                                                                                                       this.addSequenceToGroup(domainID, chain.getSequence(), chain.getName());\r
-                                                                                               }\r
-                                                                               }\r
-                                                                       if( entries != null && !entries.isEmpty())\r
-                                                                               {\r
-                                                                                       for (int entryNumber = entries.size() -1; entryNumber >=0; entryNumber --)\r
-                                                                                       {\r
-                                                                                               PDBEntry entry =  entries.get(entryNumber);\r
-                                                                                               if( entry == null) continue;\r
-                                                                                               \r
-                                                                                               this.addStructureToGroup(domainID, entry.getPdbID());\r
-                                                                                               //entries.remove(entry);\r
-                                                                                       }\r
-                                                                               }\r
-                                                               }\r
-                                                       //this.addSequenceToGroup(entry.getPdbID(), sequence, name);\r
-                                                       util = null;\r
-                                                       if(!"PDB".equals(source))parameters.put(this.pdbidsproperty,pdbIDs.toString());\r
-                                                       StringBufferPool.returnString(pdbIDs);\r
-                                                       entries.clear();\r
-                                                       entries = null;\r
-                                               }\r
-                                       \r
-                               //}\r
-                       /*catch (IncorrectVamavModuleInitialisation inE)\r
-                               {\r
-                                       logger.AppliError("Sequence Grouping addSequence - error during mapping execution. Can not proceed.", inE);\r
-                                       throw new UnableToGroupSequencesException();\r
-                               }*/\r
-                               }\r
-                       catch (Exception inE)\r
-                               {\r
-                                       this.logger.sessionError("Sequence Grouping addSequence - error during mapping execution. Can not proceed.", inE);\r
-                                       throw new UnableToGroupSequencesException();\r
-                               }\r
-                               return parameters;\r
-                       }\r
-\r
-                /** Retrieves the directory to store files in.\r
-                    * @return the output directory for created file by the sequence grouping processing.\r
-                    */\r
-                   public String getOutputDirectory()\r
-                       {\r
-                               File sessionDir = this.vamavSession.getSessionDirectory(); \r
-                               if( sessionDir != null)\r
-                                       return sessionDir.getAbsolutePath();\r
-                               return null; //should not happen, has directory file is attached during object creation. \r
-                       }\r
-               /**\r
-                * @see uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping#getSessionID()\r
-                */\r
-               @Override\r
-               public String getSessionID()\r
-                       {\r
-                               return this.vamavSession.getSessionID();\r
-                       }\r
-\r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_structure.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/SequenceGrouping_structure.java
deleted file mode 100755 (executable)
index c70ba70..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/* * EMBL-EBI
-* MSD Group
-* VAMSAS Project
-* VAMAV
-*/
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping;
-
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.PDBUtil;
-import uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.exceptions.UnableToGroupSequencesException;
-import uk.ac.ebi.msd.vamsas.vamav.exceptions.IncorrectVamavModuleInitialisation;
-import uk.ac.ebi.msd.vamsas.vamav.session.VAMAVSession;
-import uk.ac.ebi.msd.vamsas.vamav.util.data.PDBEntry;
-import uk.ac.ebi.msd.vamsas.vamav.util.mapping.MappingManager;
-import uk.ac.ebi.msd.vamsas.vamav.util.pool.StringBufferPool;
-
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Properties;
-
-/**
- *Group sequences per structure
- *
- * First, add sequences, with DB ref is provided ( addSequence methods)
- * then, 
- *storeGroup Method (To create atribute file and alignment files)
- *
- *Each time a sequence is added, it is added to the determined grou.
- * @version 1
- *@author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- */
-public class SequenceGrouping_structure  extends SequenceGrouping //implements uk.ac.ebi.msd.vamsas.vamav.VamaVModule{
-{
-       
-       
-       //private final VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());
-       protected VAMAVSession vamavSession = null;
-       
-       
-       /**
-        *  
-        * Constructor of the  SequenceGrouping class, given a mapping manager 
-        *
-        * @param _mappingManager the mapping manager to use for mapping 
-        */
-         public SequenceGrouping_structure(  MappingManager _mappingManager)
-               {
-                       super(_mappingManager);
-               }
-         
-         /**
-                *  
-                * Constructor of the  SequenceGrouping class, given a mapping manager 
-                *
-                * @param _mappingManager the mapping manager to use for mapping 
-                * @param sessionID current session for which will be used the current sequence grouping.
-                */
-                 public SequenceGrouping_structure(MappingManager _mappingManager, VAMAVSession session )
-                       {
-                               super(_mappingManager);
-                               this.logger.setSession(session.getSessionID());
-                               this.vamavSession = session;
-                       }
-       
-       /**
-        * Inits the Sequence Grouping sub module, with a list of configuration properties.
-        */
-       public void init (Properties moduleProperties) throws IncorrectVamavModuleInitialisation
-               {
-                       super.init(moduleProperties);
-               }
-    
-    /**
-     * Add a sequence for grouping.
-     * 
-     * @param sequence chain sequence to add
-     * @param name name of the sequence to add
-     * @return a list of parameters to call the AstexViewer
-     * @throws UnableToGroupSequencesException if an error occurs during the adding.
-     */
-    public Hashtable<String, Object>  addSequence(String sequence, String name) throws UnableToGroupSequencesException
-       {
-               if( sequence == null || sequence.length()<1)
-                       {
-                               this.logger.sessionWarn("SequenceGrouping addSequence - no Sequence Provided. Can not add.");
-                               return null;
-                       }
-               if( name == null || name.length()<1)
-                       {
-                               this.logger.sessionWarn("SequenceGrouping addSequence - no name Provided. Can not add.");
-                               return null;
-                       }
-               ArrayList<PDBEntry> entries = null;
-               try
-                       {
-                               entries = this.getMapping().retrievePDBIDFromSequence(sequence);
-                       }
-               catch (IncorrectVamavModuleInitialisation inE)
-                       {
-                               this.logger.sessionError("Sequence Grouping addSequence - error during mapping execution. Can not proceed.", inE);
-                               throw new UnableToGroupSequencesException();
-                       }
-               Hashtable<String, Object> parameters = null;
-               if (entries == null ) return null;
-               StringBuffer pdbIDs = StringBufferPool.getString();
-               for (int entryNumber = entries.size() -1; entryNumber>=0; entryNumber--)
-                       {
-                               PDBEntry entry = entries.get(entryNumber);
-                               if (entry == null) continue;
-                                       
-                               parameters = new Hashtable<String, Object>();
-                               int molNumber = 0;
-                               if( !parameters.containsValue(entry))
-                                       {
-                                               parameters.put("moleculeG"+molNumber,entry);
-                                               parameters.put("nameG"+molNumber, entry.getPdbID());
-                                               this.logger.sessionDebug("New molecule added "+entry);
-                                       
-                                               molNumber++;
-                                       }
-                               PDBUtil util = new PDBUtil(this.vamavSession);
-                               
-                               ArrayList<PDBUtil.Chain> chains = util.GetChain(entry);
-                               util = null;
-                               if( chains != null)
-                                       {
-                                                       /*System.out.println(" chains found ");*/
-                                               for (int chainN = chains.size()-1; chainN>=0; chainN --)
-                                                       {
-                                                               PDBUtil.Chain chain =chains.get(chainN);
-                                                                       if (chain == null)continue;
-                                                                       /*System.out.println("chain "+chain.getName()+ " "+chain.getSequence());*/
-                                                                       String groupName = chain.getName();
-                                                                       int pos = groupName.indexOf("_");
-                                                                       if( pos>0) groupName = groupName.substring(0,pos);
-                                                                       this.addSequenceToGroup(groupName,chain.getSequence(),chain.getName()); 
-                                                                       this.addStructureToGroup(groupName, entry.getPdbID());
-                                                       }
-                                       }
-                               else 
-                                       this.logger.sessionWarn("no chains found ");
-                               String id = entry.getPdbID();
-                               this.addSequenceToGroup(id, sequence, name);
-                               if(pdbIDs.length()<1) pdbIDs.append(id);
-                               else pdbIDs.append(", "+id);
-                       }
-               parameters.put(this.pdbidsproperty,pdbIDs.toString());
-                       StringBufferPool.returnString(pdbIDs);
-               return parameters;
-       }
-    
-    /**
-     * Add a sequence for grouping, with an associated accessionID and its source.
-     * 
-     * @param sequence chain sequence to add for grouping
-     * @param name name of the sequence to add
-     * @param accessionID accessionId associated to the sequence
-     * @param source source of the accessionID
-     * @return list of parameters to call the AstexViewer, if needed.  Null, otherwise.
-     * @throws UnableToGroupSequencesException if an error occurs during the adding.
-     */
-    public Hashtable<String, Object> addSequence(String sequence, String name, String accessionID, String source) throws UnableToGroupSequencesException
-       {
-               
-               if( sequence == null || sequence.length()<1)
-                       {
-                               this.logger.sessionError("SequenceGrouping - addSequence: Can not add sequence / The sequence is unknown.");
-                               return null;
-                       }
-               if( name == null || name.length()<1)
-                       {
-                               this.logger.sessionError("SequenceGrouping - addSequence: Can not add sequence / The name is unknown.");
-                               return null;
-                       }
-               if( source == null || source.length()<1)
-                       {
-                               this.logger.sessionWarn("SequenceGrouping - addSequence: the accession ID source is not provided / try to determine PDBID from the sequence.");
-                               return this.addSequence(sequence, name);
-                       }
-               if( accessionID == null || accessionID.length()<1)
-                       {
-                               this.logger.sessionWarn("SequenceGrouping - addSequence: the accession ID is not provided / try to determine PDBID from the sequence.");
-                               return this.addSequence(sequence, name);
-                       }
-               Hashtable<String, Object> parameters =  null;
-               try
-                       {
-                               ArrayList <PDBEntry> entries = null;
-               
-                               if("PDB".equals(source))
-                                       {
-                                               PDBEntry entry = this.getMapping().getPDBEntryFromPDBID(accessionID);
-                                               if( entry != null)
-                                                       {
-                                                               entries = new ArrayList<PDBEntry>(1);
-                                                               entries.add(entry);
-                                                       }
-                                       }
-                               if ("UNIPROT".equalsIgnoreCase(source))
-                                       {
-                                               entries = this.getMapping().retrievePDBIDFromUniprotAC(accessionID);
-                                       }
-                               if( entries == null || entries.size()<1) 
-                                       {
-                                               this.logger.sessionError("No associated PDB ID to the accessionAC "+ accessionID + " from "+source);
-                                               return this.addSequence(sequence, name);
-                                       }
-                               //boolean notFound = false;
-                               //hasAlignmentSequences = true;
-                               parameters = new Hashtable<String, Object>();
-                       
-                       //currenty only use the first entry
-                       //for ( int entryNumber = entries.size()-1; entryNumber>=0; entryNumber --)
-                               //{
-                               int molNumber = 0;
-                               StringBuffer pdbIDs = null;
-                               if (entries != null || entries.size()<1)
-                                       {
-                                               PDBUtil util = new PDBUtil(this.vamavSession);
-                                               for (int entryNumber = entries.size() -1; entryNumber >=0; entryNumber --)
-                                                       {
-                                                               PDBEntry entry =  entries.get(entryNumber);
-                                                               parameters.put("moleculeG"+molNumber,entry);
-                                                               parameters.put("nameG"+molNumber, entry.getPdbID());
-                                               
-                                                               ArrayList<PDBUtil.Chain> chains = util.GetChain(entry);
-                                               
-                                                               if( chains != null)
-                                                                       {
-                                                                               this.logger.sessionDebug(" chains found ");
-                                                       //              StringBuffer buff = StringBufferPool.getString();
-                                                                               for (int chainN = chains.size()-1; chainN>=0; chainN --)
-                                                                                       {
-                                                                                               PDBUtil.Chain chain = chains.get(chainN);
-                                                                                               if (chain == null)continue;
-                                                                                               String groupName = chain.getName();
-                                                                                               int pos = groupName.indexOf("_");
-                                                                                               if( pos>0) groupName = groupName.substring(0,pos);
-                                                                                               this.addSequenceToGroup(groupName, chain.getSequence(),chain.getName());  
-                                                                                               this.addStructureToGroup(groupName, entry.getPdbID());
-                                                                                               chain = null;
-                                                                                       }
-                                                                       }
-                                                               else 
-                                                                       this.logger.sessionDebug("no chains found ");
-                                       
-                                                               this.addSequenceToGroup(entry.getPdbID(), sequence, name);
-                                                               if( pdbIDs == null) pdbIDs = StringBufferPool.getString();
-                                                               if(pdbIDs.length()>0)pdbIDs.append(", "+entry.getPdbID());
-                                                               else pdbIDs.append(entry.getPdbID());
-                                                               entries.remove(entry);
-                                                       }
-                                               util = null;
-                                               if(!"PDB".equals(source))parameters.put(this.pdbidsproperty,pdbIDs.toString());
-                                               StringBufferPool.returnString(pdbIDs);
-                                       }
-                               
-                       //}
-               /*catch (IncorrectVamavModuleInitialisation inE)
-                       {
-                               logger.AppliError("Sequence Grouping addSequence - error during mapping execution. Can not proceed.", inE);
-                               throw new UnableToGroupSequencesException();
-                       }*/
-                       }
-               catch (Exception inE)
-                       {
-                               this.logger.sessionError("Sequence Grouping addSequence - error during mapping execution. Can not proceed.", inE);
-                               throw new UnableToGroupSequencesException();
-                       }
-                       return parameters;
-       }
-       
-    /**
-     * Retrieves the directory to store files in.
-     * @return the output directory for created file by the sequence grouping processing.
-     */
-    public String getOutputDirectory()
-       {
-               File sessionDir = this.vamavSession.getSessionDirectory(); 
-               if( sessionDir != null)
-                       return sessionDir.getAbsolutePath();
-               return null; //should not happen, has directory file is attached during object creation. 
-       }
-
-       /**
-        * Retrieves current sessionID
-        * @see uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.SequenceGrouping#getSessionID()
-        */
-       @Override
-       public String getSessionID()
-               {
-                       
-                       return this.vamavSession.getSessionID();
-               }
-    
-    
- }
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/exceptions/UnableToGroupSequencesException.java b/src/uk/ac/ebi/msd/vamsas/vamav/documentmanagement/grouping/exceptions/UnableToGroupSequencesException.java
deleted file mode 100755 (executable)
index de14afa..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Created on 22 nov. 2005\r
- *  * EMBL-EBI\r
- * MSD Group\r
- * VAMSAS Project\r
- * VAMAV\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 22 nov. 2005\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.documentmanagement.grouping.exceptions;\r
-\r
-/**\r
- * \r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 22 nov. 2005 \r
- * \r
- */\r
-public class UnableToGroupSequencesException extends Exception\r
-       {\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                */\r
-               public UnableToGroupSequencesException()\r
-                       {\r
-                               super();\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public UnableToGroupSequencesException(String arg0)\r
-                       {\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                * @param arg1\r
-                */\r
-               public UnableToGroupSequencesException(String arg0, Throwable arg1)\r
-                       {\r
-                               super(arg0, arg1);\r
-                       }\r
-\r
-               /**\r
-                * Constructor \r
-                *\r
-                * @param arg0\r
-                */\r
-               public UnableToGroupSequencesException(Throwable arg0)\r
-                       {\r
-                               super(arg0);\r
-                       }\r
-\r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/session/SessionManager.java b/src/uk/ac/ebi/msd/vamsas/vamav/session/SessionManager.java
deleted file mode 100755 (executable)
index 595c3e7..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-/* \r
- * /* \r
- * EMBL - European Bioinformatics institute\r
- * MSD Group\r
- * VAMSAS Project\r
- *\r
- *Created on 14 d�c. 2005\r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version  1  \r
- * @since 14 d�c. 2005\r
- */\r
-package uk.ac.ebi.msd.vamsas.vamav.session;\r
-\r
-import uk.ac.ebi.msd.vamsas.vamav.VAMAVClient;\r
-import uk.ac.ebi.msd.vamsas.vamav.VamaVModule;\r
-import uk.ac.ebi.msd.vamsas.vamav.exceptions.IncorrectVamavModuleInitialisation;\r
-import uk.ac.ebi.msd.vamsas.vamav.session.exceptions.UnableToOpenSession;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.file.FileCopy;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.file.description.FileFormatDescription;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.file.description.SimpleFileFormatDescription;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.properties.PropertyManager;\r
-import uk.ac.ebi.msd.vamsas.vamav.util.properties.exceptions.UnableToStorePropertiesException;\r
-\r
-import org.vamsas.client.ClientHandle;\r
-import org.vamsas.client.IClient;\r
-import org.vamsas.client.IClientFactory;\r
-import org.vamsas.client.InvalidSessionUrnException;\r
-import org.vamsas.client.NoDefaultSessionException;\r
-import org.vamsas.client.UserHandle;\r
-import org.vamsas.client.simpleclient.ArchiveUrn;\r
-import org.vamsas.client.simpleclient.SessionUrn;\r
-import org.vamsas.client.simpleclient.VamsasArchiveReader;\r
-import org.vamsas.client.simpleclient.VamsasSession;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.lang.reflect.Array;\r
-import java.net.MalformedURLException;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-import java.util.Properties;\r
-\r
-/**\r
- * Manager for VAMSAS session.\r
- * Creates Session to which is attached clients\r
- * \r
- * Avoid to reinit a session previously treated.\r
- * \r
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
- * @version 1\r
- * @since 14 d�c. 2005 \r
- * \r
- */\r
-public class SessionManager implements VamaVModule, IClientFactory\r
-       {\r
-\r
-/**\r
- * Definition string for the VAMAV client\r
- */\r
-               private final String clientName = "VAMSAS - AstexViewer@MSD-EBI";\r
-               private final String clientVersion = "0.6";\r
-               \r
-               /**\r
-                * List of  session ID and the associated session\r
-                *\r
-                */\r
-               private Hashtable<String, VAMAVSession> sessions = null;\r
-               \r
-               /**\r
-                * Property names\r
-                */\r
-               private final String modulePrefix = "sessionmanager";\r
-               \r
-               private final String sessionarenaProperty = "sessionarena";\r
-               \r
-               private final String sessiondirectoryProperty = "sessiondirectory";\r
-               private final String sessionLogFileProperty = "sessionlogfile";\r
-               private final String appletFileProperty = "appletfile";\r
-               private final String sessionDocumentFileNameProperty = "sessiondocumentfilename";\r
-               \r
-               /*private VAMAVClientFactory clientfactory = null;*/\r
-                \r
-               /**\r
-                * Logger to report messages\r
-                */\r
-                private final VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());\r
-                \r
-                /**\r
-                 * Tags to replace at run-time from rules\r
-                 */\r
-                private final String temporaryTag = "@temp@";\r
-                private final String sessionIDTag = "@sessionid@";\r
-                private final String sessionDirTag = "@sessiondir@";\r
-                private final String logExtensionTag = "@logfileextension@";\r
-                private final String documentExtensionTag = "@documentextension@";\r
-                \r
-                /**\r
-                 * Rules for runtime variables (directories, files, ..)\r
-                 */\r
-                \r
-                private String sessionArenaRule = this.temporaryTag;\r
-                private String sessionDirectoryRule = this.sessionIDTag;\r
-                \r
-                private String sessionLogFileRule = this.sessionDirTag+File.separator+this.sessionIDTag+"."+this.logExtensionTag;\r
-                private String sessionDocumentFileNameRule = this.sessionDirTag+File.separator+"vamsas"+"."+this.documentExtensionTag;\r
-                private String appletFile = "index.html";\r
-               \r
-                /**\r
-                 * Keep a track of opened session.\r
-                 * Stores session\r
-                 */\r
-                private Properties sessionTrack = null;\r
-                private final String trackFileName = "sessions.properties";\r
-                private final String trackDefaultDirectory = "sessions";\r
-                \r
-                /**\r
-                        * root directory of the application\r
-                        * Can be different of the current directory, in servlet server for example.\r
-                        */\r
-                       private static String baseDirectory = null;\r
-\r
-\r
-               private File sessionArena = null;\r
-  \r
-                /**\r
-                 * default constructor - called by CreateClientFactory only.\r
-                 *\r
-                 */\r
-                public SessionManager() {\r
-                  sessionArena = null;\r
-                }\r
-                /**\r
-                 * Create a SessionManager that works parent directory for all session directories\r
-                 * @param path\r
-                 */\r
-                public SessionManager(String path) throws IOException\r
-                 {\r
-                  // Check path is valid and read/writeable.\r
-                       File newarena = new File(path);\r
-                       if (newarena.exists() && newarena.isDirectory() && newarena.canRead() && newarena.canWrite()) \r
-                               {\r
-                                        sessionArena = newarena;\r
-                               } \r
-                       else\r
-                               {\r
-                                       sessionArena = null;\r
-                                       throw(new IOException("Cannot read and write to a directory called "+path));\r
-                               }\r
-                }\r
-\r
-               /**\r
-                * Retrieves the  modulePrefix attribut to init the current VAMAVModule\r
-                *\r
-                * @return Returns the modulePrefix.\r
-                */\r
-               public String getModulePrefix()\r
-                       {\r
-                               return this.modulePrefix;\r
-                       }\r
-\r
-\r
-\r
-               /**\r
-                * Inits the Session Manager module following given properties\r
-                * \r
-                * @see uk.ac.ebi.msd.vamsas.vamav.VamaVModule#init(java.util.Properties)\r
-                */\r
-               public void init(Properties properties) throws IncorrectVamavModuleInitialisation\r
-                       {\r
-                               logger.appliInfo("Init Session Manager: ");\r
-               /*/             try \r
-                               {\r
-                                       this.clientfactory = new VAMAVClientFactory("factory");\r
-                               }\r
-                       catch (IOException e) \r
-                               {\r
-                                       throw new  IncorrectVamavModuleInitialisation("Unable to create client factory");\r
-                               }*/\r
-                if (properties != null && properties.size()>0)\r
-                        {\r
-                                this.sessionDirectoryRule =  properties.getProperty(this.sessiondirectoryProperty, this.sessionDirectoryRule);\r
-                               \r
-                                this.sessionLogFileRule =  properties.getProperty(this.sessionLogFileProperty, this.sessionLogFileRule);\r
-                                this.appletFile =  properties.getProperty(this.appletFileProperty, this.appletFile);\r
-                                this.sessionDocumentFileNameRule = properties.getProperty(this.sessionDocumentFileNameProperty, this.sessionDocumentFileNameRule);\r
-                                        this.sessionArenaRule = properties.getProperty(this.sessionarenaProperty, this.sessionArenaRule);\r
-                        }\r
-                if( this.sessionArenaRule.contains(this.temporaryTag))\r
-                               {\r
-                                        logger.applidebug("temporary tag found");\r
-                                       try\r
-                                               {\r
-                                                       File tempDir = createTempDir("VAMAV");\r
-                                                       if( !logger.isProduction()) logger.applidebug("temporary directory "+tempDir.getAbsolutePath());\r
-                                                       String preparePath = tempDir.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\");\r
-                                                       this.sessionArenaRule = this.sessionArenaRule.replaceAll(this.temporaryTag,preparePath);\r
-                                                       logger.applidebug("session arena rule "+this.sessionArenaRule);\r
-                                               }\r
-                                       catch (IOException exception)\r
-                                               {\r
-                                                       this.logger.appliError("Session Manager/init: Unable to create temp directory.", exception);\r
-                                                       throw new IncorrectVamavModuleInitialisation(exception);\r
-                                               }\r
-                               }\r
-                else\r
-                        { logger.applidebug("No temporary tag");\r
-                               if (baseDirectory!= null)\r
-                               this.sessionArenaRule = baseDirectory.concat(File.separator).concat(this.sessionArenaRule);\r
-                        }\r
-                if(this.sessionLogFileRule!=null && this.sessionLogFileRule.length()>0 )\r
-                        {\r
-                               this.sessionLogFileRule = this.sessionLogFileRule.replaceAll(this.logExtensionTag,logger.getLogExtension());\r
-                        }\r
-                \r
-                Hashtable<String, String> variables = new Hashtable<String, String>();\r
-                variables.put(this.logExtensionTag, logger.getLogExtension());\r
-                variables.put(this.sessionDirTag, this.sessionDirectoryRule);\r
-                variables.put(this.sessionDocumentFileNameRule, this.sessionDirectoryRule);\r
-                this.replaceVariable(this.sessionDocumentFileNameRule, variables);\r
-                \r
-                       this.sessionTrack = new Properties();\r
-                       PropertyManager propManager = new PropertyManager();\r
-                       this.sessionTrack = propManager.loadProperties(this.trackFileName, this.trackDefaultDirectory);\r
-                       }\r
-               \r
-               /**\r
-                * Variables which can be found in property values, by correct value \r
-                * (except sessionId, which is no global to the application.) \r
-                * @param rule\r
-                * @return\r
-                */\r
-               private String replaceVariable(String rule, Hashtable<String, String> variables)\r
-                       {\r
-                               if(rule == null  )\r
-                                       {\r
-                                               logger.appliError("No rule provided to replace variables");\r
-                                               return null;\r
-                                       }\r
-                               if( rule.length()<1)\r
-                                       {\r
-                                               return rule;\r
-                                       }\r
-                               if( variables == null || variables.size()<1)\r
-                                       {\r
-                                               return rule;\r
-                                       }\r
-                               /**\r
-                                * Prepare rule, otherwise '\' character is removed by replaceAll\r
-                                */\r
-                               String preparePath = rule.replaceAll("\\\\", "\\\\\\\\");\r
-                               for (Enumeration keys = variables.keys(); keys.hasMoreElements();)\r
-                                       {\r
-                                               String var = (String)keys.nextElement();\r
-                                               rule = rule.replaceAll(var,variables.get(var).replaceAll("\\\\", "\\\\\\\\"));\r
-                                       }\r
-                               return rule;\r
-                               \r
-                       }\r
-               \r
-               \r
-               /**\r
-                * Reopens a session following the session ID for the new user\r
-                * \r
-                * @param firstName firstname of the user to open the session\r
-                * @param lastName lastname of the user\r
-                * @param sessionID ID of the session to open\r
-                * @return the created IClient according to the parameters provided\r
-                * @throws UnableToOpenSession if an error occurs while trying to open a session.\r
-                */\r
-               public VAMAVClient openSession(String firstName, String lastName, String sessionID) throws UnableToOpenSession\r
-                       {\r
-                               if(sessionID == null || sessionID.length()<1 )\r
-                                       {\r
-                                               this.logger.sessionFatal("Open Session - No sessionID provided: can not open session.");\r
-                                               return null;\r
-                                       }\r
-                               VAMAVSession session = this.getSessions().get(sessionID);\r
-                               VAMAVClient vorbaclient = null;\r
-                               if (session == null)\r
-                                       {\r
-                                               //this.logger.sessionFatal("Open Session - No previous session exists. Can not open session.");\r
-                                               //return null;\r
-                                               this.logger.appliInfo("Opening closed session");\r
-                                               String sessionDir = this.sessionTrack.getProperty(sessionID);\r
-                                               if( sessionDir == null || sessionDir.length()<1 )\r
-                                                       {\r
-                                                               this.logger.appliFatal("Open Session - No previous session exists. Can not open session.");\r
-                                                               return null;\r
-                                                       }\r
-                                               File dir = new File (sessionDir);\r
-                                               String appletFileName = this.appletFile.replaceAll(this.sessionIDTag, sessionID);\r
-                                               if (dir.exists() && dir.canRead() && dir.isDirectory() && Arrays.asList(dir.list()).contains(appletFileName))\r
-                                                       {//the directory contains some files\r
-//                                                             creating VAMSAS CLient\r
-                                                               try\r
-                                                                       {\r
-                                                                               session = new VAMAVSession(dir);\r
-                                                                               //session.setSessionDirectory(new File (sessionDir));\r
-                                                                               String preparePath = sessionDir.replaceAll("\\\\", "\\\\\\\\");\r
-                                                                               session.setSessionLogFile(new File (this.sessionLogFileRule.replaceAll(this.sessionIDTag, sessionID).replaceAll(this.sessionDirTag, preparePath)));\r
-                                                                       session.setAppletFileName(appletFileName);\r
-                                                                       session.setClosedSession(true);//.setSessionID( true);\r
-                                                                       this.getSessions().put(sessionID, session);\r
-                                                                       }\r
-                                                                       catch (IOException ioe)\r
-                                                                       {\r
-                                                                               this.logger.appliError("unable to access to the session directory.", ioe);\r
-                                                                               throw new UnableToOpenSession (ioe);\r
-                                                                       }\r
-                                                       }\r
-                                       }\r
-                               ClientHandle app = new ClientHandle(this.clientName,this.clientVersion);\r
-                                               \r
-                               if( firstName != null)\r
-                                       {\r
-                                               UserHandle user = new UserHandle(firstName,lastName);\r
-                                               vorbaclient = (VAMAVClient)this.getIClient(app, user, sessionID);\r
-                                       }\r
-                               else\r
-                                       {\r
-                                               /*try\r
-                                                       {*/\r
-                                                               vorbaclient = (VAMAVClient)this.getIClient(app);\r
-                                                               /*              }\r
-                                       catch (NoDefaultSessionException ndse)\r
-                                                       {\r
-                                                               this.logger.sessionError("Can not create client: ",ndse);\r
-                                                               this.logger.appliError("Can not create client: ",ndse);\r
-                                                               throw new UnableToOpenSession(ndse);\r
-                                                       }*/\r
-                                       }\r
-                               session.addAttachedClient(vorbaclient);\r
-                               return vorbaclient;\r
-                       }\r
-               \r
-               /**\r
-                * Opens a new VAMSAS session for the provided VAMSAS document\r
-                * \r
-                * \r
-                * @param firstName firstname of the user to open the session\r
-                * @param lastName lastname of the user\r
-                * @param sessionID ID of the session to open\r
-                * @return the created IClient according to the parameters provided\r
-                * @throws UnableToOpenSession if an error occurs while trying to open a session.\r
-                */\r
-               public VAMAVClient openSession(String firstName, String lastName, File documentPath) throws UnableToOpenSession\r
-                       {\r
-                               /**\r
-                                * check document path\r
-                                */\r
-                               if(documentPath == null || !documentPath.exists()) \r
-                                       {\r
-                                               this.logger.sessionFatal("No Document path provided or path incorrect. Can not open session.");\r
-                                               return null;\r
-                                       }\r
-               \r
-                               if (!documentPath.canRead() || !documentPath.isFile()) \r
-                                       {\r
-                                               this.logger.sessionFatal("No Document path provided or path incorrect. Can not open session. "+documentPath);\r
-                                               return null;\r
-                                       }\r
-                                       \r
-                                       if ( (firstName == null ||firstName.length()<1 )\r
-                                               && lastName == null||lastName.length()<1)\r
-                                       {\r
-                                               logger.appliError("No user information provided. Can not open session");\r
-                                               throw new UnableToOpenSession("No user information provided. Can not open session");\r
-                                       }\r
-                               logger.applidebug("Starting new session with data from "+documentPath+".");\r
-                               //ArchiveUrn vamdoc = new ArchiveUrn(documentPath);\r
-                               VamsasArchiveReader archive = new VamsasArchiveReader(documentPath);\r
-                                  // TODO: a real validity test. The below just checks it can be read.\r
-                               if (!archive.isValid())\r
-                                        throw new UnableToOpenSession(documentPath+" is not a valid vamsasDocument archive.");\r
-                               ArchiveUrn vamsasdocument = null;\r
-                               try\r
-                                       {\r
-                                                       vamsasdocument = new ArchiveUrn(documentPath);\r
-                                       }\r
-                               catch (MalformedURLException mue)\r
-                                       {\r
-                                               throw new UnableToOpenSession();\r
-                                       }\r
-\r
-                       \r
-                               ClientHandle app = new ClientHandle(this.clientName,this.clientVersion);\r
-                               UserHandle user = new UserHandle(firstName,lastName);\r
-\r
-                               try\r
-                                       {\r
-                                               this.logger.applidebug("Opening session for "+documentPath + " "+vamsasdocument.asFile() +" "+vamsasdocument.getSessionUrn());\r
-                                               return (VAMAVClient) this.openSession(app, user, vamsasdocument);\r
-                                       }\r
-                               catch (IOException ioe)\r
-                               {\r
-                                       throw new UnableToOpenSession(ioe);\r
-                               }\r
-                       }\r
-                       \r
-                       \r
-                       \r
-               public IClient openSession(ClientHandle applicationHandle, UserHandle userId, ArchiveUrn vamsasdocument) throws IOException\r
-                {\r
-                        this.logger.applidebug("openSession "+vamsasdocument.asFile());\r
-                               if (vamsasdocument == null) \r
-                               {\r
-                                       return null;\r
-                               }\r
-                       \r
-                               // create new session directory\r
-                               if (sessionArena==null)\r
-                                       throw new Error("Improperly initialised SimpleClientFactory object - null sessionArena.");\r
-                               File sessdir = File.createTempFile("sess", ".simpleclient", sessionArena);\r
-                               if (!(sessdir.delete() && sessdir.mkdir()))\r
-                                  throw new IOException("Could not make session directory "+sessdir);\r
-                                                               \r
-//                             create session\r
-                                                       //generate document copy in the session directory\r
-                               VAMAVSession session = null;\r
-                               try\r
-                                 {this.logger.applidebug("Creating VAMAVSession for "+sessdir);\r
-                                         session = new VAMAVSession(sessdir);\r
-                                         this.sessionTrack.setProperty(session.getSessionID(), sessdir.getAbsolutePath());\r
-                                       String preparePath = sessdir.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\");\r
-                       \r
-                                         session.setSessionLogFile(new File (this.sessionLogFileRule.replaceAll(this.sessionIDTag, session.getSessionID()).replaceAll(this.sessionDirTag, preparePath)));\r
-                                         session.setAppletFileName(this.appletFile);\r
-                                         this.getSessions().put(session.getSessionID(), session);\r
-                                       // copy document into session directory\r
-                                         File doc = vamsasdocument.asFile();\r
-                                         this.logger.applidebug("setting document "+doc.getPath());\r
-                                         this.logger.applidebug("setting document "+doc.getAbsolutePath());\r
-                                       session.setVamsasDocument(doc);\r
-                                 }\r
-                               catch (IOException ioe)\r
-                                 {\r
-                                   throw ioe;//new UnableToOpenSession(ioe);   \r
-                                 }\r
-                               IClient vorbaclient = this.getIClient(applicationHandle, userId, session);\r
-                               session.addAttachedClient((VAMAVClient)vorbaclient);\r
-                       //process the Vamsas Document to launch AstexViewer with suitable parameters\r
-                       return vorbaclient;\r
-                       }\r
-               \r
-               /**\r
-                  * make a new vamsas session from the data in the archive vamsasdocument \r
-                  * @param applicationHandle\r
-                  * @param userId\r
-                  * @param vamsasdocument\r
-                  * @return\r
-                  */\r
-               /*  public IClient openSession(ClientHandle applicationHandle, UserHandle userId, ArchiveUrn vamsasdocument) throws IOException {\r
-                       // verify applicationHandle and userId\r
-                       // TODO: verify applicationHandle and userId\r
-                       // verify vamsasdocument is a valid document.\r
-                       File vamdoc = vamsasdocument.asFile();\r
-                       this.logger.applidebug("Starting new session with data from "+vamsasdocument.getSessionUrn()+"(File is : "+vamdoc+")");\r
-                       VamsasArchiveReader archive = new VamsasArchiveReader(vamdoc);\r
-                       // TODO: a real validity test. The below just checks it can be read.\r
-                       if (!archive.isValid())\r
-                         throw new IOException(vamsasdocument.getSessionUrn()+" is not a valid vamsasDocument archive.");\r
-                       // create new session directory\r
-                       if (sessionArena==null)\r
-                         throw new Error("Improperly initialised SimpleClientFactory object - null sessionArena.");\r
-                       File sessdir = File.createTempFile("sess", ".simpleclient", sessionArena);\r
-                       if (!(sessdir.delete() && sessdir.mkdir()))\r
-                               throw new IOException("Could not make session directory "+sessdir);\r
-                       VAMAVSession sess = new VAMAVSession(sessdir);\r
-                       // copy document into session directory\r
-                       sess.setVamsasDocument(vamsasdocument.asFile());\r
-                       // create client instance and return.\r
-                       VAMAVClient client = new VAMAVClient(userId, applicationHandle, sess);\r
-    \r
-                       return client;\r
-                 }*/\r
-               \r
-               /**\r
-                * opens session according to a provided sessionID or reads a provided VAMSAS document \r
-                * \r
-                * if no sessionID provided, creates a new session and opens the provided document.\r
-                * if the session Id is unknown, creates a new session and opens the provided document.\r
-                * if the session exists, and the provided document is newer, the provide document will replaced \r
-                * the current document in use.\r
-                * if the session has ben closed, the document is opened in a new session.\r
-                * @param firstName user   firstname\r
-                * @param lastName user lastname\r
-                * @param documentPath path to a VAMSAS document\r
-                * @param sessionID ID of the session to open\r
-                * @return a VAMAVClient correspoding to the given parameters\r
-                * @throws UnableToOpenSession raises if an error during access to the document file\r
-                */\r
-               public VAMAVClient openSession(String firstName, String lastName, File documentPath, String sessionID) throws UnableToOpenSession\r
-                       {\r
-                               if(sessionID == null || sessionID.length()<1 )\r
-                                       {\r
-                                               logger.sessionWarn("Open Session - No sessionID provided: can not open session.");\r
-                                               return this.openSession(firstName, lastName, documentPath);\r
-                                       }\r
-                               VAMAVSession session = this.getSessions().get(sessionID);\r
-                               if (session == null)\r
-                                       {\r
-                                               return this.openSession(firstName, lastName, documentPath);\r
-                                       }\r
-                               \r
-                       /*\r
-                                                               VAMAVSession session = null;\r
-                                                               try\r
-                                                               {\r
-                                                                       session = new VAMAVSession(new File(sessionDir));\r
-                                                               }\r
-                                                               catch (IOException ioe)\r
-                                                               {\r
-                                                                       throw new UnableToOpenSession(ioe);     \r
-                                                               }*/\r
-               \r
-                                               \r
-                               VAMAVClient newClient = null;\r
-                               if (session.isOpen() && !session.isClosed())\r
-                                       {\r
-                                               FileFormatDescription description = new SimpleFileFormatDescription(documentPath);\r
-                                       Hashtable<String, String> variables = new Hashtable<String, String>();\r
-                                       variables.put(this.documentExtensionTag, description.getFileExtension());\r
-                                      // String sessionDocumentPath = this.replaceVariable(this.sessionDocumentFileNameRule, variables);\r
-                                          File sessionDoc = session.getVamsasDocumentFile();\r
-                                               //File sessionDoc = new File (sessionDocumentPath);\r
-                                               if (documentPath != null && documentPath.canRead() && documentPath.isFile() && documentPath.lastModified()< sessionDoc.lastModified())\r
-                                                       {//the provided document is newer than the document in the session directory.\r
-                                                       logger.sessionInfo("The provided document is newer than the previously treated document. Proceed new document.");\r
-                                                                       return this.openSession(firstName, lastName, documentPath);\r
-                                                               }\r
-                                                       newClient = (VAMAVClient)session.getAttachedClient(0).clone();\r
-                                                       if( firstName != null && firstName.length()<1 && lastName!=null && lastName.length()<1)\r
-                                                       {\r
-                                                               UserHandle user = new UserHandle(firstName,lastName);\r
-                                                               newClient.setUser(user);\r
-                                                       }\r
-                                                       try\r
-                                                               {\r
-                                                                       FileCopy copyManager = new FileCopy(session.getSessionID());\r
-                                                                       File newDoc = sessionDoc;\r
-                                                                       copyManager.copy(documentPath, newDoc);\r
-                                                                       documentPath = newDoc;\r
-                                                                       copyManager = null;\r
-                                                                       session.setVamsasDocumentFile(newDoc);\r
-                                                               }\r
-                                                       catch (IOException ioe)\r
-                                                               {\r
-                                                                       logger.appliError("Unable to copy VAMSAS Document.", ioe);\r
-                                                               }       \r
-                                       }\r
-                               else\r
-                                       newClient = this.openSession(firstName, lastName, documentPath);\r
-                               /*String sessionID = vorbaclient.getSessionUrn();\r
-                                               //                                      String sessionDir = this.sessionDirectoryRule.replaceAll(this.sessionIDTag, sessionID);\r
-                                               //                                      String preparePath = sessionDir.replaceAll("\\\\", "\\\\\\\\");\r
-                                               //                                      logger.applidebug("session directory "+sessionDir);\r
-                                                                                       String appletFileName = this.appletFile.replaceAll(this.sessionIDTag, sessionID);\r
-                               \r
-                       //      this.sessionTrack.setProperty(sessionID, sessionDir);\r
-                                               //                      session.setSessionDirectory(new File (sessionDir));\r
-                       //                                              session.setSessionLogFile(new File (this.sessionLogFileRule.replaceAll(this.sessionIDTag, sessionID).replaceAll(this.sessionDirTag, preparePath)));\r
-                                                       //              session.setSessionID(sessionID,false);\r
-                                                                       session.addAttachedClient(vorbaclient);\r
-                                                                       session.setAppletFileName(appletFileName);\r
-                                                                       this.getSessions().put(sessionID, session);\r
-                       \r
-                                                                       //Copying vamsas document file to session directory\r
-                                                                       FileFormatDescription description = new SimpleFileFormatDescription(documentPath);\r
-                                                                       Hashtable<String, String> variables = new Hashtable<String, String>();\r
-                                                                       variables.put(this.documentExtensionTag, description.getFileExtension());\r
-                                                                       variables.put(this.sessionDirTag, session.getSessionDirectory().getAbsolutePath());\r
-                                                                       String sessionDocumentPath = this.replaceVariable(this.sessionDocumentFileNameRule, variables);\r
-                                                                       logger.sessionDebug("Session document "+ sessionDocumentPath);\r
-                                                                       //String sessionDocumentPath = this.sessionDocumentFileNameRule.replaceAll(preparePath, appletFileName);//sessionDir+File.separator+"vamsas"+"."+description.getFileExtension();\r
-                                                                       try\r
-                                                                               {\r
-                                                                                       FileCopy copyManager = new FileCopy(sessionID);\r
-                                                                                       File newDoc = new File(sessionDocumentPath);\r
-                                                                                       copyManager.copy(documentPath, newDoc);\r
-                                                                                       documentPath = newDoc;\r
-                                                                                       copyManager = null;\r
-                                                                                       session.setVamsasDocumentFile(newDoc);\r
-                                                                               }\r
-                                                                       catch (IOException ioe)\r
-                                                                               {\r
-                                                                                       logger.appliError("Unable to copy VAMSAS Document.", ioe);\r
-                                                                               }       \r
-                               */\r
-                               session.addAttachedClient(newClient);\r
-                               return newClient;\r
-                       }\r
-           \r
-           \r
-           /**\r
-            * Creates a new session of a given user.\r
-            * \r
-            * @param firstName first name of the user to open the session for\r
-            * @param lastName lastname of the user \r
-            * @return the created IClient according to the parameters provided\r
-            * @throws UnableToOpenSession raises if an error occurs during the accessing to the VAMSAS document.\r
-            *///DONE 14/03/2006\r
-               public VAMAVClient createSession(String firstName, String lastName) throws UnableToOpenSession\r
-                       {\r
-                               // create new session directory\r
-                               if (sessionArena==null)\r
-                                       throw new Error("Improperly initialised SimpleClientFactory object - null sessionArena.");\r
-                               File sessdir =  null;\r
-                               try\r
-                                       {\r
-                                               sessdir = File.createTempFile("sess", ".simpleclient", sessionArena);\r
-                                               if (!(sessdir.delete() && sessdir.mkdir()))\r
-                                               throw new UnableToOpenSession("Could not make session directory "+sessdir);\r
-                                       }\r
-                               catch (IOException ioe)\r
-                               {\r
-                                       throw new UnableToOpenSession("Could not make session directory.");\r
-                               \r
-                               }\r
-                                                               \r
-//                             create session\r
-                               //generate document copy in the session directory\r
-                               VAMAVSession session = null;\r
-                               //VAMAVClient vorbaclient = null;\r
-                               try\r
-                                  {\r
-                                         session = new VAMAVSession(sessdir);\r
-                                         this.sessionTrack.setProperty(session.getSessionID(), sessdir.getAbsolutePath());\r
-                                       String preparePath = sessdir.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\");\r
-                       \r
-                                         session.setSessionLogFile(new File (this.sessionLogFileRule.replaceAll(this.sessionIDTag, session.getSessionID()).replaceAll(this.sessionDirTag, preparePath)));\r
-                                         session.setAppletFileName(this.appletFile);\r
-                                         this.getSessions().put(session.getSessionID(), session);\r
-                                 }\r
-                               catch (IOException ioe)\r
-                                 {\r
-                                       throw new UnableToOpenSession(ioe);     \r
-                                 }\r
-                               ClientHandle app = new ClientHandle(this.clientName,this.clientVersion);\r
-                               UserHandle user = new UserHandle(firstName,lastName);\r
-                               IClient vorbaclient = this.getIClient(app, user, session);\r
-                               session.addAttachedClient((VAMAVClient)vorbaclient);\r
-                               //process the Vamsas Document to launch AstexViewer with suitable parameters\r
-                               return (VAMAVClient) vorbaclient;\r
-\r
-                       }\r
-               \r
-               \r
-               \r
-                       /**\r
-                         * Create a new VAMAVCLient for a given clientHandle\r
-                         * \r
-                         * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)\r
-                         */\r
-                        public IClient getIClient(ClientHandle applicationHandle) //throws NoDefaultSessionException\r
-                                {      \r
-                                        try\r
-                                                {\r
-                                                        return new VAMAVClient(applicationHandle);\r
-                                                }\r
-                                        catch (InvalidSessionUrnException isue)\r
-                                                {\r
-                                                        this.logger.appliError("Unable to get client ",isue);\r
-                                                        this.logger.sessionError("Unable to get client ",isue);\r
-                                                       // throw new NoDefaultSessionException(isue);\r
-                                                }\r
-                                        return null;\r
-                                }\r
-\r
-                        /**\r
-                         * \r
-                         * Retrieves a client of a given session URN.\r
-                         * If does not exist, create a new one.\r
-                         * \r
-                         * @param applicationHandle client handle object\r
-                         * @param sessionUrn URN of the session to attach the client\r
-                         * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String)\r
-                         */\r
-                        //done 14 03 06\r
-                        public IClient getIClient(ClientHandle applicationHandle, String sessionUrn)\r
-                                {\r
-                                        // applicationHandle also contains sessionURN\r
-                          //   applicationHandle.getClientUrn()\r
-    \r
-                                       /*VAMAVClient client = null; /* this.getClient(sessionUrn);\r
-                                        if (client == null)\r
-                                                {\r
-                                                        client = new VAMAVClient(applicationHandle);\r
-                                                }*/\r
-                                        VAMAVClient client = null;\r
-                                        try\r
-                                                {\r
-                                                        VAMAVSession session =  this.getSessions().get(sessionUrn);\r
-                                                        client = new VAMAVClient(applicationHandle);\r
-                                                        session.addAttachedClient(client);\r
-                                                        client.setVAMAVSession(session);\r
-                                                }\r
-                                        catch (InvalidSessionUrnException isUExc)\r
-                                                {\r
-                                                        this.logger.sessionError("The provided Session URN is incorrect.", isUExc);\r
-                                                        this.logger.appliError("The provided Session URN is incorrect.", isUExc);\r
-                                                        client = null;\r
-                                                }\r
-                                        return client;\r
-                        }\r
-\r
-                        /**\r
-                         * DONE 14/03/2006\r
-                         * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String)\r
-                         */\r
-                        public IClient getIClient(ClientHandle applicationHandle, UserHandle userId,\r
-                                String sessionUrn) \r
-                                {\r
-                                       /* VAMAVClient client = this.getClient(sessionUrn);\r
-                                        if (client == null)\r
-                                                {\r
-                                                        client = new VAMAVClient(applicationHandle);\r
-                                                        client.setUser(userId);\r
-                                                }\r
-                                        if (userId == null)\r
-                                                {\r
-                                                        logger.appliError("There is non userID provided.");\r
-                                                }\r
-                                        else\r
-                                                {\r
-                                                        /*this.addUser(sessionUrn,userId);*/\r
-                                                /*}*/\r
-                                        VAMAVClient client = null;\r
-                                        try\r
-                                                {\r
-                                                        VAMAVSession session =  this.getSessions().get(sessionUrn);\r
-                                                        client = new VAMAVClient(userId, applicationHandle, session);\r
-                                                        session.addAttachedClient(client);\r
-                                                        client.setVAMAVSession(session);\r
-                                                }\r
-                                        catch (InvalidSessionUrnException isUExc)\r
-                                                {\r
-                                                        this.logger.sessionError("The provided Session URN is incorrect.", isUExc);\r
-                                                        this.logger.appliError("The provided Session URN is incorrect.", isUExc);\r
-                                                        client = null;\r
-                                                }\r
-                                        return client;\r
-                                }\r
\r
-                        /**\r
-                         * DONE\r
-                         * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)\r
-                         */\r
-                        public VAMAVClient getIClient(ClientHandle applicationHandle, UserHandle userId, VAMAVSession session) \r
-                                {\r
-                                        if (userId == null)\r
-                                                {\r
-                                                        logger.appliInfo("There is non userID provided.");\r
-                                                }\r
-                                        else\r
-                                                {\r
-                                               /*       String clientUrn = applicationHandle.getClientUrn();\r
-                                                        if (clientUrn != null && clientUrn.length()>0)\r
-                                                                this.addUser(clientUrn, userId);*/\r
-                                                }\r
-                                       if (session == null)\r
-                                          {\r
-                                                  this.logger.appliError("No session provided. Can not create client if not associated to a session.");\r
-                                                  return null;\r
-                                          }\r
-                                       \r
-                                       VAMAVClient client = null;\r
-                                       try\r
-                                               {\r
-                                                       // String sessionID = new SessionHandle().generateSessionID();\r
-                                                       client = new VAMAVClient(userId, applicationHandle, session);\r
-                                                       client.setUser(userId);\r
-                                               }\r
-                                        catch (InvalidSessionUrnException isUExc)\r
-                                                {\r
-                                                        this.logger.sessionError("Unable to create session due to incorrect session.", isUExc);\r
-                                                        this.logger.appliError("Unable to create session due to incorrect session.", isUExc);\r
-                                                        \r
-                                                        client = null;\r
-                                                }\r
-                                       // this.addClient(client.getSessionUrn(), client );\r
-                                       // applicationHandle.setClientUrn(sessionID);\r
-                                        logger.appliInfo("generated sessionID "+client.getSessionUrn());\r
-                                        return client;\r
-                                }\r
-               \r
-               /**\r
-                * Remove a client\r
-                * \r
-                * Do nothing WHY?\r
-                *  at a later stage?\r
-                * @param client the client to remove\r
-                */\r
-               public void RemoveClient(VAMAVClient client)\r
-                       {\r
-                               if (client == null)\r
-                                       {\r
-                                               this.logger.appliError("SessionManager - Can not remove client. Client is null");\r
-                                               return;\r
-                                       }\r
-                               \r
-                       }\r
-               \r
-               /**\r
-                * \r
-                * Finalize the current manager\r
-               */\r
-               @Override\r
-               protected void finalize()throws Throwable \r
-                       {\r
-                               try \r
-                                       {\r
-                                               this.kill();\r
-                                       } finally {\r
-                                               super.finalize();\r
-                                       }\r
-                       }\r
-               \r
-               /**\r
-                * Kill the current manager\r
-                *\r
-                */\r
-               private void kill()\r
-                       {\r
-                               this.close();\r
-                       }\r
-\r
-\r
-/**\r
- * Closes the current manager.\r
- * registers required data\r
- *\r
- */\r
-public void close()\r
-       {\r
-               if( this.sessionTrack != null && !this.sessionTrack.isEmpty())\r
-                       {\r
-                               PropertyManager propManager = new PropertyManager();\r
-                               try\r
-                                       {\r
-                                               propManager.storeProperties(trackFileName, sessionTrack, "", trackDefaultDirectory);\r
-                                       }\r
-                               catch (UnableToStorePropertiesException utspe)\r
-                                       {\r
-                                               logger.appliWarn("Unable to store session track");\r
-                                       }\r
-                                this.sessionTrack.clear();\r
-                       }\r
-                this.sessionTrack = null;\r
-               if (this.sessions!= null)\r
-                       {\r
-                               this.sessions.clear();\r
-                               this.sessions = null;\r
-                       }\r
-       }\r
-               \r
-               /**\r
-                * Retrieves the  sessions attribut\r
-                *\r
-                * @return Returns the sessions.\r
-                */\r
-               private Hashtable<String, VAMAVSession> getSessions()\r
-                       {\r
-                               if( this.sessions == null)\r
-                                       this.sessions = new Hashtable<String, VAMAVSession>();\r
-                               return this.sessions;\r
-                       }\r
-               \r
-               /**\r
-                * Creates a temp directory in a given directory.\r
-                * \r
-                * @param prefix prefix of the directory to create\r
-                * @param directory\r
-                * @throws IOException if an error occurs during file creation\r
-                * @return the temporary directory\r
-                */    \r
-               public  File createTempDir(String prefix, File directory) throws IOException\r
-                 {\r
-                         if( prefix == null)\r
-                                 {\r
-                                         logger.sessionError("Error: no prefix provided to create temp file.");\r
-                                         throw new IOException();\r
-                                 }\r
-                     File tempFile = null;\r
-                               if( directory == null )\r
-                                       tempFile = File.createTempFile(prefix, "");\r
-                               else\r
-                                       tempFile = File.createTempFile(prefix, "", directory);\r
-                     if (!tempFile.delete())\r
-                         throw new IOException();\r
-                     if (!tempFile.mkdir())\r
-                         throw new IOException();\r
-                     return tempFile;        \r
-                 }\r
-               \r
-                 /**\r
-                  * Creates a temp directory in the System temp directory.\r
-                  * @param prefix prefix of the temp directory name\r
-                  * @return the create file\r
-                  * @throws IOException if an error during file creation\r
-                  * \r
-                  */    \r
-               public  File createTempDir(String prefix) throws IOException\r
-               {\r
-                             return this.createTempDir(prefix, null);\r
-               }\r
-                 \r
-               /**\r
-                * Close the current session manager\r
-                *\r
-                */\r
-               public void closeManager()\r
-                       {\r
-                               if (this.sessions != null)\r
-                                       {\r
-                                               for ( Enumeration ids = this.sessions.keys() ; ids.hasMoreElements();)\r
-                                                       {\r
-                                                               String sessionID = (String)ids.nextElement();\r
-                                                               if( sessionID == null || sessionID.length()<1)continue;\r
-                                                               VAMAVSession session = this.sessions.remove(sessionID);\r
-                                                               if (session != null)\r
-                                                                       {\r
-                                                                               session.close();\r
-                                                                               session = null;\r
-                                                                       }\r
-                                                       }\r
-                                               this.sessions.clear();\r
-                                               this.sessions = null;\r
-                                       }\r
-                               \r
-                       }\r
-                /**Sets baseDirectory attribut\r
-                *\r
-                * @param _baseDirectory The baseDirectory to set.\r
-                */\r
-               public static void setBaseDirectory(String _baseDirectory)\r
-                       {\r
-                               baseDirectory = _baseDirectory;\r
-                               if( baseDirectory != null && baseDirectory.length()>0 && !baseDirectory.endsWith(File.separator))\r
-                                       {\r
-                                               baseDirectory = baseDirectory.concat(File.separator);\r
-                                       }\r
-                       }\r
-               \r
-               /**\r
-                * Retrieves the list of available sessions for the current session manager\r
-                */\r
-               public ArrayList<String> getAvailableSessions()\r
-               {\r
-                       ArrayList<String> sessionList  = null;\r
-                       for (Enumeration<String>  sessionIDs = sessions.keys();sessionIDs.hasMoreElements();)\r
-                               {\r
-                                       String sessionID = sessionIDs.nextElement();\r
-                                       if (sessionID == null || sessionID.length()<1)\r
-                                               {\r
-                                                       continue;\r
-                                               }\r
-                                       if (sessionList == null) sessionList = new ArrayList<String>();\r
-                                       sessionList.add(sessionID);\r
-                               }\r
-                       return sessionList;\r
-               }\r
-       /* (non-Javadoc)\r
-        * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)\r
-        */\r
-       public IClient getIClient(\r
-               ClientHandle applicationHandle,\r
-               UserHandle userId) {\r
-               // TODO Auto-generated method stub\r
-               return null;\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-          * @see org.vamsas.client.IClientFactory#getCurrentSessions()\r
-          */\r
-         public String[] getCurrentSessions() {\r
-           // TODO look in the arena and enumerate session handles for return.\r
-           return new String[] {};\r
-         }\r
-       }\r
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/session/VAMAVSession.java b/src/uk/ac/ebi/msd/vamsas/vamav/session/VAMAVSession.java
deleted file mode 100755 (executable)
index edd4c33..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * 
- * * EMBL - European Bioinformatics institute
- * MSD Group
- * VAMSAS Project
- *
- * Created on Feb 22, 2006
- *
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @version  2  
- * @since 22 Feb. 2006
- */
-package uk.ac.ebi.msd.vamsas.vamav.session;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.vamsas.client.simpleclient.SessionUrn;
-import org.vamsas.client.simpleclient.VamsasSession;
-
-import uk.ac.ebi.msd.vamsas.vamav.VAMAVClient;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLogger;
-import uk.ac.ebi.msd.vamsas.vamav.util.logger.VAMAVLoggerImpl;
-
-/**
- * This class represents a VAMSAS session,
- * with a session ID, which can be opened and closed. 
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- * @since 22 Feb. 2006
- * @version 2 
- * 
- */
-public class VAMAVSession extends VamsasSession {
-
-    /**
-     * ID of the current session
-     */
-       //private String sessionID = null;
-               
-               /**
-                * if the session is opened 
-                */
-       private boolean open = false;
-       
-       /**
-        * if the current session has been initialised.
-        */
-       private boolean init = false;
-               
-               /**
-                * log file containing session messages
-                * TODO merge with VAMSAS session log ?
-                */
-       private File sessionLogFile = null;
-       
-       /**
-        * Path to the HTML page used to call the AstexViewer@MSD-
-        * EBI as applet
-        */
-       private String appletFileName = null;
-       
-       /**
-        * Path to the Vamsas document file 
-        */
-       private File vamsasDocumentFile = null;
-               
-               /**
-                * Logger to report messages
-                */
-       private  VAMAVLogger logger = new VAMAVLoggerImpl(this.getClass());
-       
-       /**
-        * Structure grouping mode in use
-        */
-       private int groupingMode = -1;
-       
-       /**
-        * List of attached VAMAV Client
-        * 
-        */
-       private ArrayList<VAMAVClient> attachedClients = null;
-
-       private SessionUrn sessionURN = null;
-
-       /**
-        * Constructor specifying the session Directory
-        * 
-        * @param sessionDir session directory  containing all information relatives to the session
-        * @throws IOException if an error occurs during accessing to the session directory
-        */
-       public VAMAVSession(File sessionDir) throws IOException
-        {
-               super(sessionDir);
-               sessionURN = new SessionUrn(this);
-               this.logger.applidebug("setting logger seession");
-                                       this.logger.setSession(this);
-               }
-
-
-               /**
-                * Retrieves the  sessionID attribut
-                *
-                * ID of the current session
-                *
-                * @return Returns the sessionID.
-                */
-               public String getSessionID()
-                       {
-                               String id = null;
-                               if (this.sessionURN != null)
-                               {
-                                       String urn = this.sessionURN.asFile().getAbsolutePath();
-                                       //this.logger.applidebug("session urn "+urn);
-                                       
-                                       if ("\\".equals(File.separator))
-                                               {
-                                                       //remove last separator at last position if found
-                                                       if (urn.charAt(urn.length() - 1) == '/')urn = urn.substring(0, urn.length() - 1);
-                                                       urn = urn.replaceAll("/", "\\\\");
-                                                       //this.logger.applidebug("session urn "+urn);
-                                               }
-                                       int index = urn.lastIndexOf(File.separator);
-                                       
-                                       if (index >-1)
-                                       {//separator found, keep last part of the urn - filename
-                                               id = urn.substring(index+1, urn.length());
-                                       }
-                                       else
-                                       id = urn;
-                                       //this.logger.applidebug("session ID "+urn);
-                               }
-                               return id;
-                       }
-
-
-                /**
-                 * Sets sessionID attribut, ID of the current sesssion
-                *
-                * @param sessionID The sessionID to set.
-                */
-       /*      public void setSessionID(String sessionID)
-                       {
-                               //this.sessionID = sessionID;
-                               this.logger.applidebug("setting logger seession");
-                               this.logger.setSession(this);
-                       }
-*/
-
-               /**
-                *specifies if the session 
-                *has been closed.
-                *
-                * @param sessionID The sessionID to set.
-                */
-               public void setClosedSession( boolean closedSession)
-                       {
-                               //this.sessionID = sessionID;
-                               this.logger.applidebug("setting logger session");
-                               this.logger.setSession(this, closedSession);
-                       }
-
-
-               /**
-                * Retrieves the  open attribut
-                *Indicates if the session has been opened.
-                *
-                * @return Returns the open.
-                */
-               public boolean isOpen()
-                       {
-                               return this.open;
-                       }
-
-
-               /**
-                *Sets open attribut
-                *
-                * @param open The open to set.
-                */
-               public void sessionOpen()
-                       {
-                               this.open = true;
-                               this.init = true;
-                       }
-               
-               /**
-                *Sets open attribut
-                *
-                * @return true if the session has been opened then closed. false, otherwise.
-                */
-               public boolean isClosed()
-                       {
-                               return !this.open;
-                       }
-               
-               /**
-                * finalize the object
-                */
-               protected void finalize() throws Throwable 
-                       {
-                               try 
-                                       {
-                                               this.kill();
-                                       } finally {
-                                               super.finalize();
-                                       }
-                       }
-               
-               /**
-                * kills the current session
-                * Stores required information
-                *
-                */
-               private void kill()
-                       {
-                               if (this.attachedClients!= null)
-                                       {
-                                               for (int clientNumber = this.attachedClients.size() -1;clientNumber>=0; clientNumber-- )
-                                                       {
-                                                               VAMAVClient client = this.attachedClients.get(clientNumber) ;
-                                                               client = null;
-                                                       }
-                                               this.attachedClients.clear();
-                                               this.attachedClients = null;
-                                       }
-                               /*if( this.sessionID != null)
-                                       {
-                                               this.sessionID = this.sessionID.replaceAll(this.sessionID, "");
-                                               this.sessionID = null;
-                                       }*/
-                       }
-               
-               /**
-                * Retrieves the  attachedClients attribut, list of client
-                * associated to the current session
-                *
-                * @return Returns the attachedClients.
-                */
-               private ArrayList<VAMAVClient> getAttachedClients()
-                       {
-                               return this.attachedClients;
-                       }
-               
-               /**
-                * Retrieves an  attachedClient at a given index
-                *
-                *
-                * @param index index of the client to retrieved
-                * @return the attached client at the given index, if found. null otherwise.
-                */
-               public VAMAVClient getAttachedClient(int index )
-                       {
-                               if (this.getAttachedClients() == null || index<0 || index>this.getAttachedClients().size())
-                                       return null;
-                               return this.getAttachedClients().get(index);
-                       }
-               
-               /**
-                * Attached the client to a VAMAV Session
-                * 
-                * @param client client to add the current session.
-                */
-               public void addAttachedClient(VAMAVClient client)
-                       {
-                               if( this.getAttachedClients() == null)
-                                       {
-                                               this.attachedClients = new ArrayList<VAMAVClient>();
-                                       }
-                               this.getAttachedClients().add(client);
-                               client.setVAMAVSession(this);
-                       }
-
-               /**
-                * removes a client from the current session
-                * 
-                * @param client client to  remove
-                */
-               public void removeClient(VAMAVClient client)
-                       {
-                               if( this.getAttachedClients() == null )
-                                       {
-                                               logger.appliError("Unable to remove client. There is no client attached.");
-                                       }
-                               this.getAttachedClients().remove(client);
-                               if ( this.getAttachedClients().size()<1)
-                                       {
-                                               this.close();
-                                       }
-                       }
-
-               /**
-                * Retrieves the  sessionDirectory attribut
-                * 
-                * retrieves the session directory containing files relatives to the session
-                *
-                * @return Returns the sessionDirectory.
-                */
-               public File getSessionDirectory()
-                       {
-                               return this.sessionDir;
-                       }
-
-
-               /**
-                *Sets sessionDirectory attribut
-                *
-                *Sets the path to the session directory
-                *
-                * @param sessionDirectory The sessionDirectory to set.
-                */
-               public void setSessionDirectory(File sessionDirectory)
-                       {
-                               if( sessionDirectory!= null)
-                                       {
-                                               if(!sessionDirectory.exists()) 
-                                                       if(  !sessionDirectory.mkdirs())
-                                                               {
-                                                                       logger.sessionError("Unable to create session directory.");
-                                                               }
-                                               this.sessionDir = sessionDirectory;
-                                               if (!this.logger.isProduction()) this.logger.applidebug("session directory "+sessionDirectory.getAbsolutePath());
-                                               
-                                       }
-                       }
-
-               /**
-                * Retrieves the  sessionLogFile attribut
-                *
-                *Path the session log file containing reported messages relatives
-                *to the session
-                *
-                * @return Returns the sessionLogFile.
-                */
-               public File getSessionLogFile()
-                       {
-                               return this.sessionLogFile;
-                       }
-
-
-               /**
-                *Sets sessionLogFile attribut
-                *
-                *Sets the file containing all reported session messages
-                *
-                * @param sessionLogFile The sessionLogFile to set.
-                */
-               public void setSessionLogFile(File sessionLogFile)
-                       {
-                               this.sessionLogFile = sessionLogFile;
-                               if (sessionLogFile != null && !this.logger.isProduction())
-                                       {
-                                               this.logger.applidebug(sessionLogFile.getAbsolutePath());
-                                       }
-                               
-                       }
-               
-               /**
-                * Closes the current session
-                *Clears client list //TODO close attached clients
-                *
-                */
-               public void close ()
-                       {
-                               logger.sessionInfo("Closing session "+this.getSessionID()                                                                                            );
-                               this.open = false;
-                               if (this.getAttachedClients() != null)
-                                       {
-                                               this.getAttachedClients().clear();
-                                               this.attachedClients = null;
-                                       }
-                       }
-
-
-               /**
-                * Retrieves the  appletFileName attribut
-                *name of the file containing html page to call the AstexViewer@MSD-EBI
-                *
-                * @return Returns the appletFileName. 
-                */
-               public String getAppletFileName()
-                       {
-                               return this.appletFileName;
-                       }
-               
-               /**
-                * Retrieves the  appletFile object
-                *
-                * @return Returns the appletFile object
-                */
-               public File getAppletFile()
-                       {
-                               return new File (this.getSessionDirectory().getAbsolutePath()+File.separator+this.appletFileName);
-                       }
-
-
-               /**
-                *Sets appletFileName attribut
-                *
-                * @param appletFileName The appletFileName to set.
-                */
-               public void setAppletFileName(String appletFileName)
-                       {
-                               this.appletFileName = appletFileName;
-                       }
-
-
-               /**
-                * Retrieves the  vamsasDocument File 
-                *
-                * @return Returns the vamsasDocumentFile.
-                */
-               public File getVamsasDocumentFile()
-                       {
-                               return this.vamsasDocumentFile;
-                       }
-
-
-               /**
-                *Sets vamsasDocumentFile associated to /treated in the session
-                *
-                * @param vamsasDocumentFile The vamsasDocumentFile to set.
-                */
-               public void setVamsasDocumentFile(File vamsasDocumentFile)
-                       {
-                               this.vamsasDocumentFile = vamsasDocumentFile;
-                       }
-
-
-               /**
-                * Retrieves the  groupingMode currently used in the 
-                * session for process data
-                *
-                * @return Returns the groupingMode.
-                */
-               public int getGroupingMode()
-                       {
-                               return this.groupingMode;
-                       }
-
-
-               /**
-                *Sets groupingMode attribut
-                *
-                * @param groupingMode The groupingMode to set.
-                */
-               public void setGroupingMode(int groupingMode)
-                       {
-                               this.groupingMode = groupingMode;
-                       }
-
-
-               /**
-                * Retrieves the  init attribut
-                * Indicates if the current session has been initialised
-                * @return Returns the init.
-                */
-               public boolean isInit()
-                       {
-                               return this.init;
-                       }
-}
diff --git a/src/uk/ac/ebi/msd/vamsas/vamav/session/exceptions/UnableToOpenSession.java b/src/uk/ac/ebi/msd/vamsas/vamav/session/exceptions/UnableToOpenSession.java
deleted file mode 100755 (executable)
index 5156c5f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Created on Mar 9, 2006
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package uk.ac.ebi.msd.vamsas.vamav.session.exceptions;
-
-/**
- * @author pierre
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class UnableToOpenSession extends Exception {
-
-       /**
-        * 
-        */
-       public UnableToOpenSession() {
-               super();
-               // TODO Auto-generated constructor stub
-       }
-
-       /**
-        * @param message
-        */
-       public UnableToOpenSession(String message) {
-               super(message);
-               // TODO Auto-generated constructor stub
-       }
-
-       /**
-        * @param message
-        * @param cause
-        */
-       public UnableToOpenSession(String message, Throwable cause) {
-               super(message, cause);
-               // TODO Auto-generated constructor stub
-       }
-
-       /**
-        * @param cause
-        */
-       public UnableToOpenSession(Throwable cause) {
-               super(cause);
-               // TODO Auto-generated constructor stub
-       }
-
-}