org.pentaho.platform.dataaccess.datasource.wizard.service.impl
Class InMemoryDatasourceServiceImpl

java.lang.Object
  extended by org.pentaho.platform.dataaccess.datasource.wizard.service.impl.InMemoryDatasourceServiceImpl
All Implemented Interfaces:
IDatasourceService

public class InMemoryDatasourceServiceImpl
extends Object
implements IDatasourceService


Field Summary
static String DEFAULT_UPLOAD_FILEPATH_FILE_NAME
           
static org.pentaho.metadata.repository.IMetadataDomainRepository METADATA_DOMAIN_REPO
           
static String UPLOAD_FILE_PATH
           
 
Constructor Summary
InMemoryDatasourceServiceImpl()
           
 
Method Summary
 boolean deleteLogicalModel(String domainId, String modelName)
          Delete the Logical Mode identified by the Domain ID and the Model Name
 SerializedResultSet doPreview(String connectionName, String query, String previewLimit)
          Returns the serialized version of SQL ResultSet.
 BusinessData generateInlineEtlLogicalModel(String modelName, String relativeFilePath, boolean headersPresent, String delimiter, String enclosure)
          Returns the generated csv based logical model along with the sample data for the given connection name and query
 BusinessData generateLogicalModel(String modelName, String connectionName, String query, String previewLimit)
          This method gets the business data which are the business columns, columns types and sample preview data
 List<LogicalModelSummary> getLogicalModels()
          Returns the list of Logical Models.
 org.pentaho.metadata.repository.IMetadataDomainRepository getMetadataDomainRepository()
           
 BogoPojo gwtWorkaround(BogoPojo pojo)
          This is a method for the Gwt workaround.
 boolean hasPermission()
          Returns whether the current user has the authority to create/edit/delete datasources
 BusinessData loadBusinessData(String domainId, String modelId)
          Returns the save logical model for a given Domain ID and Model ID
 boolean saveLogicalModel(org.pentaho.metadata.model.Domain domain, boolean overwrite)
          Save the generated model.
 void setMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository metadataDomainRepository)
           
 boolean testDataSourceConnection(String connectionName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METADATA_DOMAIN_REPO

public static final org.pentaho.metadata.repository.IMetadataDomainRepository METADATA_DOMAIN_REPO

DEFAULT_UPLOAD_FILEPATH_FILE_NAME

public static final String DEFAULT_UPLOAD_FILEPATH_FILE_NAME
See Also:
Constant Field Values

UPLOAD_FILE_PATH

public static final String UPLOAD_FILE_PATH
See Also:
Constant Field Values
Constructor Detail

InMemoryDatasourceServiceImpl

public InMemoryDatasourceServiceImpl()
Method Detail

deleteLogicalModel

public boolean deleteLogicalModel(String domainId,
                                  String modelName)
                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Delete the Logical Mode identified by the Domain ID and the Model Name

Specified by:
deleteLogicalModel in interface IDatasourceService
Returns:
true if the deletion of model was successful otherwise false.
Throws:
DatasourceServiceException

doPreview

public SerializedResultSet doPreview(String connectionName,
                                     String query,
                                     String previewLimit)
                              throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the serialized version of SQL ResultSet.

Specified by:
doPreview in interface IDatasourceService
Parameters:
connectionName - - Name of the connection
query - - Query which needs to be executed
previewLimit - - Number of row which needs to be returned for this query
Returns:
SerializedResultSet - This object contains the data, column name and column types
Throws:
DatasourceServiceException

testDataSourceConnection

public boolean testDataSourceConnection(String connectionName)
                                 throws DatasourceServiceException
Throws:
DatasourceServiceException

generateLogicalModel

public BusinessData generateLogicalModel(String modelName,
                                         String connectionName,
                                         String query,
                                         String previewLimit)
                                  throws DatasourceServiceException
This method gets the business data which are the business columns, columns types and sample preview data

Specified by:
generateLogicalModel in interface IDatasourceService
Parameters:
modelName, - connection, query, previewLimit
Returns:
BusinessData
Throws:
DatasourceServiceException

getMetadataDomainRepository

public org.pentaho.metadata.repository.IMetadataDomainRepository getMetadataDomainRepository()

setMetadataDomainRepository

public void setMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository metadataDomainRepository)

generateInlineEtlLogicalModel

public BusinessData generateInlineEtlLogicalModel(String modelName,
                                                  String relativeFilePath,
                                                  boolean headersPresent,
                                                  String delimiter,
                                                  String enclosure)
                                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the generated csv based logical model along with the sample data for the given connection name and query

Specified by:
generateInlineEtlLogicalModel in interface IDatasourceService
Parameters:
modelName - - Name of the model to be generated
relativeFilePath - - Relative path to the file that needs to be uploaded
headersPresent - - Are headers present in the file or not
delimiter - - Delimiter that was used in the file
enclosure - - Enclosure that was used in the file
Returns:
BusinessData - This object contains the data, column name, column types and sample data
Throws:
DatasourceServiceException

loadBusinessData

public BusinessData loadBusinessData(String domainId,
                                     String modelId)
                              throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the save logical model for a given Domain ID and Model ID

Specified by:
loadBusinessData in interface IDatasourceService
Parameters:
domainId - - ID of the domain to be generated
modelId - - ID of the model to be generated
Returns:
BusinessData - This object contains the data, column name, column types and sample data
Throws:
DatasourceServiceException

saveLogicalModel

public boolean saveLogicalModel(org.pentaho.metadata.model.Domain domain,
                                boolean overwrite)
                         throws DatasourceServiceException
Description copied from interface: IDatasourceService
Save the generated model. This could be either Relational or CSV based model

Specified by:
saveLogicalModel in interface IDatasourceService
Parameters:
domain - - generated Domain
overwrite - - should the domain be overwritten or not
Returns:
true if the model was saved successfully otherwise false
Throws:
DatasourceServiceException

hasPermission

public boolean hasPermission()
Description copied from interface: IDatasourceService
Returns whether the current user has the authority to create/edit/delete datasources

Specified by:
hasPermission in interface IDatasourceService
Returns:
true if the user has permission otherwise false

getLogicalModels

public List<LogicalModelSummary> getLogicalModels()
                                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the list of Logical Models. This method is used by the client app to display list of models

Specified by:
getLogicalModels in interface IDatasourceService
Returns:
List of LogicalModelSummary.
Throws:
DatasourceServiceException

gwtWorkaround

public BogoPojo gwtWorkaround(BogoPojo pojo)
Description copied from interface: IDatasourceService
This is a method for the Gwt workaround. This should not be used by any client at all

Specified by:
gwtWorkaround in interface IDatasourceService
Returns:
BogoPojo