public class SessionControl
extends java.lang.Object
Class for controlling the active session of the application, including process users input, run the reasoner (DLV engine), read/write to/from data layer (database), and return an output to users.
Functions:
Deprecated functions:
private java.util.ArrayList<SessionSchema> sessionLocalSchemas private java.util.ArrayList<SessionSchema> sessionRemoteSchemas private java.lang.String fileStorageUrl private DatabaseConnector dbConnector private HibernateConnector hibernateConnector private java.util.ArrayList<DatabaseConnector> remoteDbConnector private java.util.ArrayList<TCStatement> tcSuggestions private SessionSchema currentSchema private java.lang.String currentUser private long executionTime private boolean webApp private java.lang.String dlvPath
public void readDBSchemas(boolean localSchema) throws java.lang.ClassNotFoundException, java.io.IOException
Read saved schemas from database, then set session schemas (sessionLocalSchemas & sessionRemoteSchemas).
Called in schema/index.jsp.
Throws:
public void addDbConnection(java.lang.String dbUrl, java.lang.String dbUser, java.lang.String dbPassword) throws java.sql.SQLException, java.lang.ClassNotFoundException
Establish remote database connection, read all available schemas under that remote database, then add the schemas into local database.
Called in schema/index.jsp, action: adddb.
Throws:
public void addDbSchema(it.unibz.inf.magik.web.SessionSchema ss) throws java.sql.SQLException
Add the remote schema into local database.
Called in schema/editRelation.jsp, action: connect.
Throws:
private void hibernateSaveObject(java.lang.Object o)
Write objects to database via Hibernate.
Parameters:
public void deleteSchema(java.lang.String schemaName) throws java.sql.SQLException
Find schema by name then delete it from the list of schemas.
Called in schema/index.jsp, action: delete.
Parameters:
Throws:
public void addSchema(SessionSchema currSchema, java.lang.String newSchemaName) throws java.sql.SQLException
Add new schema.
Called in schema/index.jsp, action: add.
Parameters:
Throws:
public void updateSchema(Schema currSchema, java.lang.String newSchemaName) throws java.sql.SQLException
Find schema by name then update it.
Called in schema/index.jsp, action: edit.
Parameters:
Throws:
public void deleteRelation(java.lang.String relName)
Find relation by name then delete it from the list of relations.
Called in schema/edit.jsp, action: delete.
Parameters:
public void addRelation(java.lang.String relName, java.lang.String keys, java.lang.String description) throws ContextException
Add new relation.
Called in schema/edit.jsp, action: addrel.
Parameters:
Throws:
public void updateRelation(java.lang.String oldRelName, java.lang.String relName, java.lang.String keys, java.lang.String description) throws ContextException
Find relation by name then update it.
Called in schema/edit.jsp, action: editrel.
Parameters:
Throws:
public void deleteForeignKey(int fkidx)
Delete foreign key from array of foreign keys, by index.
Called in constraints/index.jsp, action: delete.
Parameters:
public void addForeignKey(int sourceRelIdx, int targetRelIdx, java.lang.String sourceAttr) throws ContextException
Add new foreign key.
Called in constraints/index.jsp, action: addfk.
Parameters:
Throws:
public void updateForeignKey(int fkIdx, int sourceRelIdx, int targetRelIdx, java.lang.String sourceAttr) throws ContextException
Update existing foreign key.
Called in constraints/index.jsp, action: editfk.
Parameters:
Throws:
public java.util.ArrayList<ForeignKey> readFK() throws java.sql.SQLException
Read foreign keys (from database schema and virtual foreign keys added by user).
Called in constraints/showFK.jsp.
Returns:
Throws:
public void deleteFDC(int fdcIdx)
Delete finite domain constraint from array of finite domain constraints, by index.
Called in constraints/index.jsp, action: delete.
Parameters:
public void addFDC(int relIdx, java.lang.String column, java.lang.String values) throws ContextException
Add new finite domain constraint.
Called in constraints/index.jsp, action: addfdc.
Parameters:
Throws:
public void updateFDC(int fdcIdx, int relIdx, java.lang.String column, java.lang.String values) throws ContextException
Update existing finite domain constraint.
Called in constraints/index.jsp, action: editfdc.
Parameters:
Throws:
public java.util.ArrayList<FiniteDomainConstraint> readFDC()
Read finite domain constraints.
Called in constraints/showFDC.jsp.
Returns:
Throws:
public void deleteTCStatement(int tcidx)
Delete TC statement from array of TC statements, by index.
Called in constraints/index.jsp, action: delete.
Parameters:
public void addTCStatement(int relIdx, java.lang.String headTerms, java.lang.String condition, java.lang.String description, java.lang.String name) throws ContextException
Add new TC Statement.
Called in constraints/index.jsp, action: addtc.
Parameters:
Throws:
public void addTCStatement(TCStatement tcs)
Add new TC Statement (add the suggested TCStatement after reasoning).
Called in constraints/index.jsp, action: reason.
Parameters:
public void updateTCStatement(int tcIdx, int relIdx, java.lang.String headTerms, java.lang.String condition, java.lang.String description, java.lang.String tcName) throws ContextException
Update existing TC statement.
Called in constraints/index.jsp, action: edittc.
Parameters:
Throws:
public java.util.ArrayList<TCStatement> readTCS()
Read TC statements.
Called in constraints/showTC.jsp.
Returns:
Throws:
public void deleteQuery(int qidx)
Delete query from array of queries, by index.
Called in constraints/index.jsp, action: delete.
Parameters:
public void addSQLQuery(java.lang.String qName, java.lang.String values, java.lang.String desc) throws ParseSQLQueryException, ContextException
Add new query (from SQL format).
Called in constraints/index.jsp, action: addq.
Parameters:
Throws:
public void addSQLQuery(Query q)
Add new query (add the suggested query after reasoning).
Called in constraints/index.jsp, action: reason.
Parameters:
public void updateSQLQuery(int qIdx, java.lang.String qName, java.lang.String values, java.lang.String desc) throws ParseSQLQueryException, ContextException
Update existing query (from SQL format).
Called in constraints/index.jsp, action: editq.
Parameters:
Throws:
public java.util.ArrayList<Query> readQuery() throws ParseSQLQueryException
Read queries.
Called in constraints/showQuery.jsp.
Returns:
Throws:
public java.lang.String encodingProgram(SessionSchema currSchema, Schema reasonSchema, int selQueryIdx) throws it.unical.mat.wrapper.DLVInvocationException, java.io.IOException, CycleException, PrimaryKeyViolationException
Get the encoding program.
Called in constraints/index.jsp, action: reason.
Returns:
Throws:
public java.lang.String printQueryResultHTML(SessionSchema currSchema, int selQueryIdx) throws java.sql.SQLException, java.lang.ClassNotFoundException
Display the result of evaluating SQL query.
Called in constraints/index.jsp, action: reason.
Returns:
Throws:
public boolean isQueryComplete(SessionSchema currSchema, Schema reasonSchema, int selQueryIdx, int maxQSpecSize) throws it.unical.mat.wrapper.DLVInvocationException, java.io.IOException, CycleException, PrimaryKeyViolationException ContextException ParseSQLQueryException
Get the result of query completeness reasoning.
Called in constraints/index.jsp, action: reason.
Parameters
Returns:
Throws:
public void approximateQuery(Query q, Schema currSchema, int maxQSpecSize) throws it.unical.mat.wrapper.DLVInvocationException, java.io.IOException, CycleException, PrimaryKeyViolationException ContextException ParseSQLQueryException
Get the complete query approximations of incomplete query.
Parameters
Throws:
public void importSampleSchema(java.lang.String appPath) throws java.sql.SQLException, ContextException, ParseSQLQueryException, java.io.IOException
Import pre-defined sample schema (school schema), including the sample constraints.
Called in schema/index.jsp, action: import.
Parameters:
Throws: