edu.udo.cs.miningmart.m4
Class M4Interface

java.lang.Object
  extended byedu.udo.cs.miningmart.m4.M4Interface
Direct Known Subclasses:
M4InterfaceImpl

public abstract class M4Interface
extends java.lang.Object

This is the main interface object. This is the starting point for using the M4Interface.

Version:
$Id: M4Interface.java,v 1.8 2006/04/11 14:10:12 euler Exp $
Author:
Timm Euler, Martin Scholz

Nested Class Summary
 class M4Interface.CaseLockedException
          This exception is thrown when a Case is locked.
 
Field Summary
static java.lang.String[] AVAILABLE_MATCHERS
          A public string array that declares the types of schema matchers that are available.
protected static Case currentCase
           
protected static CompilerAccess currentCompilerAccess
           
static java.lang.String MATCHER_EDITDISTANCE
           
static java.lang.String MATCHER_NGRAM
           
static java.lang.String MATCHER_SIMPLE
          Public constants that represent different schema matching algorithms
static java.lang.String MATCHER_SOUNDEX
           
static Print print
           
static java.lang.String SYSTEM_PROP_DB_CONFIG_PATH
          Name of the system property specifying the path to the dbConfig file
static java.lang.String SYSTEM_PROP_PRINT_VERBOSITY
          Name of the system property setting the print verbosity of log outputs
 
Constructor Summary
M4Interface()
           
 
Method Summary
abstract  boolean canRemoveM4Access(java.lang.String caseName)
          Check if the M4Access for the specified Case can be removed.
abstract  Case createCase(java.lang.String name, boolean setAsCurrentCase)
          Creates a new Case.
abstract  Operator createOperator(java.lang.String name)
          Creates a new Operator.
abstract  boolean existsCase(java.lang.String name)
          Checks wether a case with this name exists.
abstract  Case findCaseForReadOnlyAccess(java.lang.String name, boolean setAsCurrent)
          Returns a Case for read-only access.
abstract  Case findCaseForUpdate(java.lang.String name, boolean setAsCurrent)
          Returns a Case and locks it so it may be modified.
abstract  java.util.Collection findConnection(Concept theConcept, java.util.Collection namesOfDbObjects, java.lang.String matcher)
          Connects the given concept with one of the Db Objects (tables or views) whose names are given in the second parameter.
abstract  Operator findOperator(java.lang.String name)
          Returns an Operator that may be changed.
abstract  java.util.Collection getAllCaseNames()
          Find all Case names.
abstract  java.util.Collection getAllOperatorNames()
          Find all Operator names.
static Case getCurrentCase()
          Returns the Case that is used as the context for methods of the M4Interface that are Case dependent.
static CompilerAccess getCurrentCompilerAccess()
          Returns the CompilerAccess that is used as the context for methods of the M4Interface that are CompilerAccess dependent.
static M4Interface getInstance()
          Creates an instance of the M4Interface class.
abstract  DB getM4db()
           
abstract  java.util.Collection getNamesOfBusinessTablesAndViews()
           
abstract  OperatorGroup getOperatorGroup()
           
abstract  boolean isBusinessTable(java.lang.String name)
          Checks wether a table in the business schema with this name exists.
abstract  boolean isBusinessView(java.lang.String name)
          Checks wether a view in the business schema with this name exists.
abstract  boolean isCaseLockedForReading(java.lang.String name)
          Check if case can be locked for reading.
abstract  boolean isCaseLockedForWriting(java.lang.String name)
          Check if case can be locked for writing.
abstract  void releaseCase(java.lang.String name)
          Release a Case for access.
abstract  void releaseCaseWithoutStoring(java.lang.String name)
          Release a Case from access lock, but do not store it to the DB even if it has been changed.
static void removeCurrentCase()
          Makes the M4Interface forget its current case.
static void setCurrentCase(Case currentCase)
          Some methods of the M4Interface are Case dependend.
static void setCurrentCompilerAccess(CompilerAccess currentCompilerAccess)
          Some methods of the M4Interface are CompilerAccess dependend.
protected static void setInstance(M4Interface m4Instance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentCase

protected static Case currentCase

currentCompilerAccess

protected static transient CompilerAccess currentCompilerAccess

print

public static transient Print print

SYSTEM_PROP_PRINT_VERBOSITY

public static final java.lang.String SYSTEM_PROP_PRINT_VERBOSITY
Name of the system property setting the print verbosity of log outputs

See Also:
Constant Field Values

SYSTEM_PROP_DB_CONFIG_PATH

public static final java.lang.String SYSTEM_PROP_DB_CONFIG_PATH
Name of the system property specifying the path to the dbConfig file

See Also:
Constant Field Values

MATCHER_SIMPLE

public static final java.lang.String MATCHER_SIMPLE
Public constants that represent different schema matching algorithms

See Also:
Constant Field Values

MATCHER_SOUNDEX

public static final java.lang.String MATCHER_SOUNDEX
See Also:
Constant Field Values

MATCHER_EDITDISTANCE

public static final java.lang.String MATCHER_EDITDISTANCE
See Also:
Constant Field Values

MATCHER_NGRAM

public static final java.lang.String MATCHER_NGRAM
See Also:
Constant Field Values

AVAILABLE_MATCHERS

public static final java.lang.String[] AVAILABLE_MATCHERS
A public string array that declares the types of schema matchers that are available.

Constructor Detail

M4Interface

public M4Interface()
Method Detail

getInstance

public static M4Interface getInstance()
Creates an instance of the M4Interface class. This method needs to be called before being able to use the M4Interface.

Returns:
M4Interface the M4Interface that is created.

setInstance

protected static void setInstance(M4Interface m4Instance)

createCase

public abstract Case createCase(java.lang.String name,
                                boolean setAsCurrentCase)
                         throws M4Exception
Creates a new Case. The name of the Case must be unique within the M4 Schema.

Parameters:
name - The name of the Case that should be created.
setAsCurrentCase - If this parameter is set to TRUE, the newly created case is set as the current case, and can be retrieved using getCurrentCase(). Otherwise the only handle to the new case is the returned object.
Returns:
Case the Case that is created.
Throws:
M4Exception

createOperator

public abstract Operator createOperator(java.lang.String name)
                                 throws M4Exception
Creates a new Operator. The name of the Operator must be unique within the M4 Schema.

Parameters:
name - The name of the Operator that should be created.
Returns:
Operator the Operator that is created.
Throws:
CreateException - when an error occurs during creation of the object.
NameExistsException - when the provided name already exists.
M4Exception

getAllCaseNames

public abstract java.util.Collection getAllCaseNames()
Find all Case names.

Returns:
Collection of Case names.

getNamesOfBusinessTablesAndViews

public abstract java.util.Collection getNamesOfBusinessTablesAndViews()
                                                               throws M4Exception
Returns:
a Collection of Strings, namely the names of all tables and views in the business data schema except those that were created by the compiler (ie, are listed in the trash table).
Throws:
M4Exception

isBusinessTable

public abstract boolean isBusinessTable(java.lang.String name)
                                 throws M4Exception
Checks wether a table in the business schema with this name exists.

Parameters:
name - the name of the table
Returns:
true if the table exists, false otherwise
Throws:
M4Exception

isBusinessView

public abstract boolean isBusinessView(java.lang.String name)
                                throws M4Exception
Checks wether a view in the business schema with this name exists.

Parameters:
name - the name of the view
Returns:
true if the view exists, false otherwise
Throws:
M4Exception

existsCase

public abstract boolean existsCase(java.lang.String name)
Checks wether a case with this name exists.

Returns:
true if the case exists, false otherwise.

getM4db

public abstract DB getM4db()

getOperatorGroup

public abstract OperatorGroup getOperatorGroup()

findOperator

public abstract Operator findOperator(java.lang.String name)
Returns an Operator that may be changed. As Operators are much less frequently added or changed by users than Cases a findOperatorForUpdate() method is not provided here.

Parameters:
name - The name of the Operator that should be retrieved.
Returns:
Operator the Operator that is found or null if it is not found.

getAllOperatorNames

public abstract java.util.Collection getAllOperatorNames()
Find all Operator names.

Returns:
Collection of Operator names.

findCaseForReadOnlyAccess

public abstract Case findCaseForReadOnlyAccess(java.lang.String name,
                                               boolean setAsCurrent)
                                        throws M4Interface.CaseLockedException
Returns a Case for read-only access. Read-only access administration is done in a database table; it is not enforced by the M4Interface however! This means it is left to the programmer to disallow changes. Many users are allowed to read a Case as long as nobody else is writing to the Case. No writer to a Case is allowed if there is at least one reader.

Parameters:
name - The name of the Case that should be retrieved.
setAsCurrent - Boolean indicating retrieved case should be set as current. The current Case is used as the context for M4Interface methods that depend on the Case. Normally this value should be set to true. Note that the current Case context can also be set using the setCurrentCase method.
Returns:
Case the Case that is found or null if it is not found.
Throws:
M4Interface.CaseLockedException - when a Case is already locked for reading.

findCaseForUpdate

public abstract Case findCaseForUpdate(java.lang.String name,
                                       boolean setAsCurrent)
                                throws M4Interface.CaseLockedException
Returns a Case and locks it so it may be modified. Many users are allowed to read a Case as long as nobody else is writing to the Case. No writer to a Case is allowed if there is at least one reader.

Parameters:
name - The name of the Case that should be retrieved.
setAsCurrent - If the retrieved Case should be set as the current Case context for M4Interface methods that depend on the Case. Normally this value should be set to true. Note that the current Case context can also be set using the setCurrentCase method.
Returns:
Case the Case that is found or null if it is not found.
Throws:
M4Interface.CaseLockedException - when a Case is already locked for writing.

canRemoveM4Access

public abstract boolean canRemoveM4Access(java.lang.String caseName)
Check if the M4Access for the specified Case can be removed.


isCaseLockedForReading

public abstract boolean isCaseLockedForReading(java.lang.String name)
Check if case can be locked for reading.


isCaseLockedForWriting

public abstract boolean isCaseLockedForWriting(java.lang.String name)
Check if case can be locked for writing.


releaseCase

public abstract void releaseCase(java.lang.String name)
Release a Case for access. The Case is stored to the DB.

Parameters:
name - the name of the case to be released

releaseCaseWithoutStoring

public abstract void releaseCaseWithoutStoring(java.lang.String name)
Release a Case from access lock, but do not store it to the DB even if it has been changed.

Parameters:
name - the name of the case to be released

getCurrentCase

public static Case getCurrentCase()
Returns the Case that is used as the context for methods of the M4Interface that are Case dependent. Normally the returned Case is the Case currently accessed by the user.

Returns:
the currently accessed Case.

setCurrentCase

public static void setCurrentCase(Case currentCase)
Some methods of the M4Interface are Case dependend. By setting the current Case the context for these methods to work in is set. The current Case can also be set using the getCaseForReadOnly or getCaseForUpdate methods.

Parameters:
currentCase - The Case to be set as the current one.

removeCurrentCase

public static void removeCurrentCase()
Makes the M4Interface forget its current case.


setCurrentCompilerAccess

public static void setCurrentCompilerAccess(CompilerAccess currentCompilerAccess)
Some methods of the M4Interface are CompilerAccess dependend. By setting the current CompilerAccess the context for these methods to work in is set.

Parameters:
currentCompilerAccess - The CompilerAccess to be set as the current one.

getCurrentCompilerAccess

public static CompilerAccess getCurrentCompilerAccess()
Returns the CompilerAccess that is used as the context for methods of the M4Interface that are CompilerAccess dependent. Normally the returned CompilerAccess is the CompilerAccess currently accessed by the user.

Returns:
the currently accessed CompilerAccess.

findConnection

public abstract java.util.Collection findConnection(Concept theConcept,
                                                    java.util.Collection namesOfDbObjects,
                                                    java.lang.String matcher)
                                             throws M4Exception
Connects the given concept with one of the Db Objects (tables or views) whose names are given in the second parameter. If the given concept already has a connection to a Columnset, that connection is removed. A new Columnset is created that represents one of the tables or views, or a join result (see below), and is connected to the concept given in the first parameter. The Db Object is chosen by schema matching. The third parameter determines which matcher is used; its value must be one of the public constants defined in this class. The returned Collection will be empty in many cases. However, if it contains two columnsets, this means that these two columnsets were joined and the result matched the given Concept better than any of the single tables/views. In this case the given Concept is connected to a Columnset that represents a view of the join result.

Parameters:
theConcept - Concept to be connected
namesOfDbObjects - Names of business schema tables and views among which to select the best-matching one
matcher - The type of schema matching algorithm to be used (must be one of the corresponding public constants of this class)
Returns:
A Collection that is NULL iff the given Concept was matched directly to one of the given Db Objects, and that contains two Columnsets iff two of the given Db Objects were joined (following existing foreign key relationships in the database schema) and the resulting view matched the given concept better than any single table/view.
Throws:
M4Exception


Copyright © 2001-2005