1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
public final class Core implements Icore, Iadmincore {
private idbmanager myDBM ;
public idbmanager getMyDBM() {
return myDBM;
}
public void setMyDBM(idbmanager aDBM) throws LsfCoreException{
if(aDBM != null)
this.myDBM = aDBM;
else
throw new LsfCoreException("DBManager ne peut être null");
}
public Core(File myDBFile) throws LsfCoreException{
// TODO : Boolean hasFile et verif pour lancer l'admin core sans fichier prédéfini
try
{
idbmanager tempDBM = new dbmanager(myDBFile);
this.setMyDBM(tempDBM);
}
catch (Exception e)
{
throw new LsfCoreException(e.getMessage());
}
}
public Core() throws LsfCoreException
{
}
@Override
public Boolean usable()
{
try
{
return(myDBM != null);
}
catch (Exception e)
{
return false;
}
}
public void setDBFile(File aFile)
{
if(this.myDBM != null)
{
try {
this.myDBM.close();
} catch (LsfDBException ex) {
Logger.getLogger(Core.class.getName()).log(Level.SEVERE, null, ex);
}
}
this.myDBM = new dbmanager(aFile);
}
.................
@Override
public String getVersion() throws LsfCoreException
{
try {
return this.myDBM.getVersion();
} catch (LsfDBException ex) {
Logger.getLogger(Core.class.getName()).log(Level.SEVERE, null, ex);
throw new LsfCoreException(ex.getMessage());
}
}
} |
Partager