|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectp3j.database.hibernate.P3MDatabase
public class P3MDatabase
Implementation of IP3MDatabase
based on Hibernate.
Created: August 17, 2008
Constructor Summary | |
---|---|
P3MDatabase()
Constructor using the default configuration file. |
|
P3MDatabase(String configurationFile)
Constructor for custom configuration. |
Method Summary | |
---|---|
void |
clear()
Clears the database. |
void |
clearCache(Object o)
Clears the given object from cache. |
void |
close()
Closes the database connection. |
protected void |
dbChanged()
DB-write hook for switching flushing on or off. |
void |
delete(Object o)
Deletes an object with hibernate. |
void |
deleteAllResults(ProjectionModel projection)
Delete all results of the projection. |
boolean |
deleteMatrix(Matrix matrix)
Deletes given matrix from the database. |
boolean |
deleteParameter(Parameter parameter)
Deletes given parameter from database. |
boolean |
deleteParameterAssignment(ParameterAssignment assignment)
Deletes given parameter assignment. |
boolean |
deleteParameterInstance(ParameterInstance instance)
Deletes given parameter instances from the data base. |
boolean |
deleteProjection(ProjectionModel projection)
Delete projection from database. |
void |
deleteResult(ResultsOfTrial resultOfTrial)
Deletes a result. |
boolean |
deleteSet(Set set)
Deletes given set from database. |
boolean |
deleteSeType(SetType setType)
Delete SetType from database. |
List<Matrix> |
getAllMatrices()
Retrieves all input matrices from the database. |
List<ParameterAssignment> |
getAllParameterAssignments(ParameterInstance param)
Retrieves all ParameterAssignment entities for a certain
ParameterInstance . |
List<ParameterInstance> |
getAllParameterInstances()
Retrieves list with all parameter instances. |
List<Parameter> |
getAllParameters()
Retrieves list with all parameters. |
List<ProjectionModel> |
getAllProjections()
Retrieves list of all projections from the database. |
List<ResultsOfTrial> |
getAllResults(ProjectionModel projection)
Retrieves all results for the given projection. |
List<Set> |
getAllSets()
Retrieves all sets from database. |
List<SetType> |
getAllSetTypes()
Retrieve all Settypes from data base. |
static String |
getHibernateConfigFile()
Gets the hibernate configuration file. |
Matrix |
getMatrix(Matrix2D value)
Get matrix with a certain value from database. |
Parameter |
getParameter(String name)
Retrieves a parameter with the given name from the database. |
ParameterInstance |
getParameterInstance(Parameter param,
int generation)
Retrieves a parameter instance from the database. |
ProjectionModel |
getProjectionByID(int id)
Retrieves projection by id. |
IProjectionResultsIterator |
getResultIterator(ProjectionModel projection)
Gets the result iterator. |
void |
init(james.core.data.DBConnectionData dbConn)
Initialize database connection. |
Matrix |
newMatrix(Matrix2D value)
Creates a new matrix if a matrix with the same values is not already existing in the system. |
Parameter |
newParameter(String name,
boolean genDep,
MatrixDimension height,
MatrixDimension width,
Population population)
Creates a new parameter (if not already existent) and returns it. |
ParameterAssignment |
newParameterAssignment(ParameterInstance paramInstance,
String name,
String description,
double probability,
double deviation,
Matrix2D value)
Creates a new parameter assignment. |
ParameterInstance |
newParameterInstance(int comparisonIndex,
Parameter param,
int generation)
Creates new parameter instance. |
void |
newProjection(ProjectionModel projection)
Adds new projection to database, automatically adds any Parameter
or ParameterInstance entities that have not yet been created. |
Set |
newSet(List<ParameterInstance> defParams,
String name,
String desc,
double prob)
Creates a new set. |
SetType |
newSetType(String name,
String description)
Create new Settype. |
void |
open()
Establishes database connection. |
void |
save(Object o)
Saves an object with hibernate. |
void |
saveParameterAssignment(ParameterAssignment assignment)
Saves given parameter assignment. |
void |
saveProjection(ProjectionModel projection)
Saves projection. |
void |
saveSet(Set set)
Updates the set. |
void |
saveSetType(SetType setType)
Updates the Settype. |
void |
saveTrialResults(ResultsOfTrial resultOfTrial)
Saves results of a single trial. |
static void |
setHibernateConfigFile(String hibernateConfigFile)
Sets the hibernate configuration file. |
static Exception |
testConnection(james.core.data.DBConnectionData dbConnData)
Test connection to database. |
static Exception |
testConnection(String dbURL,
String dbUserName,
String dbPassword)
Test connection to database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public P3MDatabase()
public P3MDatabase(String configurationFile)
configurationFile
- the name of the configuration fileMethod Detail |
---|
public void init(james.core.data.DBConnectionData dbConn)
IP3MDatabase
init
in interface IP3MDatabase
dbConn
- the connection detailspublic void open()
IP3MDatabase
open
in interface IP3MDatabase
public void clear()
IP3MDatabase
clear
in interface IP3MDatabase
public void close()
IP3MDatabase
close
in interface IP3MDatabase
protected void dbChanged()
public void save(Object o)
o
- the object to be savedpublic void delete(Object o)
o
- the object to be deletedpublic Parameter newParameter(String name, boolean genDep, MatrixDimension height, MatrixDimension width, Population population)
IP3MDatabase
newParameter
in interface IP3MDatabase
name
- name of the parametergenDep
- flag to determine generation dependencyheight
- height of parameter valueswidth
- width of parameter valuespopulation
- the population to which this parameter refers
public Parameter getParameter(String name)
IP3MDatabase
getParameter
in interface IP3MDatabase
name
- the name of the parameter to be retrieved
public List<Parameter> getAllParameters()
IP3MDatabase
getAllParameters
in interface IP3MDatabase
Parameter
instances stored in the databasepublic boolean deleteParameter(Parameter parameter)
IP3MDatabase
deleteParameter
in interface IP3MDatabase
parameter
- the parameter to be deleted
public ParameterInstance newParameterInstance(int comparisonIndex, Parameter param, int generation)
IP3MDatabase
newParameterInstance
in interface IP3MDatabase
comparisonIndex
- comparison index of the instanceparam
- the associated parametergeneration
- the generation of the instance
public ParameterInstance getParameterInstance(Parameter param, int generation)
IP3MDatabase
getParameterInstance
in interface IP3MDatabase
param
- the associated parametergeneration
- the generation for which the parameter shall be instantiated
public List<ParameterInstance> getAllParameterInstances()
IP3MDatabase
getAllParameterInstances
in interface IP3MDatabase
public boolean deleteParameterInstance(ParameterInstance instance)
IP3MDatabase
deleteParameterInstance
in interface IP3MDatabase
instance
- the instance to be deleted
public Matrix newMatrix(Matrix2D value)
IP3MDatabase
newMatrix
in interface IP3MDatabase
value
- the value of the matrix
public Matrix getMatrix(Matrix2D value)
IP3MDatabase
getMatrix
in interface IP3MDatabase
value
- the value of the matrix
public List<Matrix> getAllMatrices()
IP3MDatabase
getAllMatrices
in interface IP3MDatabase
public boolean deleteMatrix(Matrix matrix)
IP3MDatabase
deleteMatrix
in interface IP3MDatabase
matrix
- the matrix to be deleted
public ParameterAssignment newParameterAssignment(ParameterInstance paramInstance, String name, String description, double probability, double deviation, Matrix2D value)
IP3MDatabase
newParameterAssignment
in interface IP3MDatabase
paramInstance
- the associated parameter instancename
- the name of the assignmentdescription
- the description of the assignmentprobability
- the probability of the assignmentdeviation
- the assumption-inherent deviation, i.e. the noisevalue
- the assigned value
public List<ParameterAssignment> getAllParameterAssignments(ParameterInstance param)
IP3MDatabase
ParameterAssignment
entities for a certain
ParameterInstance
.
getAllParameterAssignments
in interface IP3MDatabase
param
- the parameter instance
public boolean deleteParameterAssignment(ParameterAssignment assignment)
IP3MDatabase
deleteParameterAssignment
in interface IP3MDatabase
assignment
- the assignment to be deleted
public void saveParameterAssignment(ParameterAssignment assignment)
IP3MDatabase
saveParameterAssignment
in interface IP3MDatabase
assignment
- the parameter assignmentpublic Set newSet(List<ParameterInstance> defParams, String name, String desc, double prob)
IP3MDatabase
newSet
in interface IP3MDatabase
defParams
- parameter instance for which assignments can be definedname
- name of the setdesc
- description of the setprob
- probability of the set
public void saveSet(Set set)
IP3MDatabase
ParameterAssignmentSet
instances as well.
saveSet
in interface IP3MDatabase
set
- the set to be updatedpublic List<Set> getAllSets()
IP3MDatabase
getAllSets
in interface IP3MDatabase
public boolean deleteSet(Set set)
IP3MDatabase
deleteSet
in interface IP3MDatabase
set
- the set to be deleted
public SetType newSetType(String name, String description)
IP3MDatabase
newSetType
in interface IP3MDatabase
name
- name of the Settype to be createddescription
- description of the Settype to be created
public List<SetType> getAllSetTypes()
IP3MDatabase
getAllSetTypes
in interface IP3MDatabase
public void saveSetType(SetType setType)
IP3MDatabase
Set
instances as well.
saveSetType
in interface IP3MDatabase
setType
- the Settype to be updatedpublic boolean deleteSeType(SetType setType)
IP3MDatabase
SetType
from database.
deleteSeType
in interface IP3MDatabase
setType
- the Settype to be deleted
public void newProjection(ProjectionModel projection)
IP3MDatabase
Parameter
or ParameterInstance
entities that have not yet been created.
newProjection
in interface IP3MDatabase
projection
- the new projectionpublic boolean deleteProjection(ProjectionModel projection)
IP3MDatabase
deleteProjection
in interface IP3MDatabase
projection
- the projection to be deleted
public List<ProjectionModel> getAllProjections()
IP3MDatabase
getAllProjections
in interface IP3MDatabase
public ProjectionModel getProjectionByID(int id)
IP3MDatabase
getProjectionByID
in interface IP3MDatabase
id
- the id of the projection
public void saveProjection(ProjectionModel projection)
IP3MDatabase
saveProjection
in interface IP3MDatabase
projection
- the projection to be saved/updatedpublic static Exception testConnection(james.core.data.DBConnectionData dbConnData)
dbConnData
- the database connection data
public static Exception testConnection(String dbURL, String dbUserName, String dbPassword)
dbURL
- the URL of the databasedbUserName
- the DB user namedbPassword
- the DB password
public void saveTrialResults(ResultsOfTrial resultOfTrial)
IP3MDatabase
saveTrialResults
in interface IP3MDatabase
resultOfTrial
- the result of the trialpublic List<ResultsOfTrial> getAllResults(ProjectionModel projection)
IP3MDatabase
getAllResults
in interface IP3MDatabase
projection
- the projection
public void deleteResult(ResultsOfTrial resultOfTrial)
IP3MDatabase
deleteResult
in interface IP3MDatabase
resultOfTrial
- the result of trialpublic void deleteAllResults(ProjectionModel projection)
IP3MDatabase
deleteAllResults
in interface IP3MDatabase
projection
- the projectionpublic IProjectionResultsIterator getResultIterator(ProjectionModel projection)
IP3MDatabase
getResultIterator
in interface IP3MDatabase
projection
- the projection for which the results shall be gathered
public void clearCache(Object o)
IP3MDatabase
clearCache
in interface IP3MDatabase
o
- the object to be cleared from cachepublic static String getHibernateConfigFile()
public static void setHibernateConfigFile(String hibernateConfigFile)
hibernateConfigFile
- the new hibernate configuration file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |