Table of Contents

Session Control

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:

Class Attributes

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

Class Constructors

SessionControl

public SessionControl()
               throws javax.naming.NamingException

Throws:

Class Methods

readDBSchemas

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:


addDbConnection

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:


addDbSchema

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:


hibernateSaveObject

private void hibernateSaveObject(java.lang.Object o)

Write objects to database via Hibernate.
Parameters:


deleteSchema

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:


addSchema

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:


updateSchema

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:


deleteRelation

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:


addRelation

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:


updateRelation

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:


deleteForeignKey

public void deleteForeignKey(int fkidx)

Delete foreign key from array of foreign keys, by index.
Called in constraints/index.jsp, action: delete.
Parameters:


addForeignKey

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:


updateForeignKey

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:


readFK

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:


deleteFDC

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:


addFDC

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:


updateFDC

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:


readFDC

public java.util.ArrayList<FiniteDomainConstraint> readFDC()

Read finite domain constraints.
Called in constraints/showFDC.jsp.
Returns:

Throws:


deleteTCStatement

public void deleteTCStatement(int tcidx)

Delete TC statement from array of TC statements, by index.
Called in constraints/index.jsp, action: delete.
Parameters:


addTCStatement

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:


addTCStatement

public void addTCStatement(TCStatement tcs)

Add new TC Statement (add the suggested TCStatement after reasoning).
Called in constraints/index.jsp, action: reason.
Parameters:


updateTCStatement

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:


readTCS

public java.util.ArrayList<TCStatement> readTCS()

Read TC statements.
Called in constraints/showTC.jsp.
Returns:

Throws:


deleteQuery

public void deleteQuery(int qidx)

Delete query from array of queries, by index.
Called in constraints/index.jsp, action: delete.
Parameters:


addSQLQuery

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:


addSQLQuery

public void addSQLQuery(Query q)

Add new query (add the suggested query after reasoning).
Called in constraints/index.jsp, action: reason.
Parameters:


updateSQLQuery

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:


readQuery

public java.util.ArrayList<Query> readQuery()
                                     throws ParseSQLQueryException

Read queries.
Called in constraints/showQuery.jsp.
Returns:

Throws:


encodingProgram

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:


printQueryResultHTML

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:


isQueryComplete

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:


approximateQuery

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:


importSampleSchema

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:

Back to Top | Back to Home Page