com.sap.mw.jco
Class JCO.BasicRepository

java.lang.Object
  |
  +--com.sap.mw.jco.JCO.BasicRepository
All Implemented Interfaces:
IRepository
Direct Known Subclasses:
JCO.Repository
Enclosing class:
JCO

public abstract static class JCO.BasicRepository
extends java.lang.Object
implements IRepository

Implementation of basic repository functionality such as caching and persistence. This class serves as a base class for more elaborate repositories. Derived classes have to call super(name) in their constructors in order to initialize the superclass properly !


Constructor Summary
JCO.BasicRepository(java.lang.String name)
          Constructs a new BasicRepository
 
Method Summary
 void addFunctionInterfaceToCache(IMetaData meta)
          Adds a function interface to the local cache.
 void addFunctionInterfaceToCache(java.lang.String key, IMetaData meta)
          Adds a function interface to the local cache.
 void addStructureDefinitionToCache(IMetaData meta)
          Adds a structure definition to the local cache.
 void addStructureDefinitionToCache(java.lang.String key, IMetaData meta)
          Adds a structure definition to the local cache.
 java.lang.String[] getCachedFunctionInterfaces()
          Returns the names of the cached functions as a string array
 java.lang.String[] getCachedStructureDefinitions()
          Returns the names of the cached structures as a string array
 IMetaData getFunctionInterface(java.lang.String function_name)
          Returns the meta data for the passed function
 IFunctionTemplate getFunctionTemplate(java.lang.String function_name)
          Returns the template for the passed function.
 java.lang.String getName()
          Returns the repository name
 IRepository getNextRepository()
          Returns the next repository that will be used if a function or structure could not be found in this one.
 IMetaData getStructureDefinition(java.lang.String structure_name)
          Returns the meta data for the passed structure
 IMetaData getTableDefinition(java.lang.String table_name)
          Returns the meta data for the passed table
 void load(java.lang.String filename)
          Load the repository from the specified file.
 void removeFunctionInterfaceFromCache(java.lang.String function_name)
          Removes a function interface from the local cache.
 void removeStructureDefinitionFromCache(java.lang.String structure_name)
          Removes a function interface from the local cache.
 void save(java.lang.String filename)
          Save the repository to the specified file.
 void setNextRepository(IRepository next)
          Sets the next repository that will be used if a function or structure could not be found in this one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCO.BasicRepository

public JCO.BasicRepository(java.lang.String name)
Constructs a new BasicRepository
Parameters:
name - the name of the repository
Method Detail

getName

public java.lang.String getName()
Returns the repository name
Specified by:
getName in interface IRepository
Returns:
the name of the repository

getFunctionTemplate

public IFunctionTemplate getFunctionTemplate(java.lang.String function_name)
Returns the template for the passed function.
Specified by:
getFunctionTemplate in interface IRepository
Parameters:
function_name - the name of the function for which the template is being returned.
Returns:
the template for the function or null if the function template could not be retrieved.
Throws:
JCO.Exception - if another error occurred during the retrieval of the function interface with the group field set appropiately.

getFunctionInterface

public IMetaData getFunctionInterface(java.lang.String function_name)
Returns the meta data for the passed function
Specified by:
getFunctionInterface in interface IRepository
Parameters:
function_name - the name of the function for which the meta data is being returned
Returns:
the meta data for the function or null if the function couldn't be found
Throws:
JCO.Exception - if an error occurred during the retrieval of the function interface.

getStructureDefinition

public IMetaData getStructureDefinition(java.lang.String structure_name)
Returns the meta data for the passed structure
Specified by:
getStructureDefinition in interface IRepository
Parameters:
structure_name - the name of the structure for which the meta data is being returned
Returns:
the meta data for the structure or null if the structure couldn't be found
Throws:
JCO.Exception - if an error occurred during the retrieval of the data structure definition.

getTableDefinition

public IMetaData getTableDefinition(java.lang.String table_name)
Returns the meta data for the passed table
Specified by:
getTableDefinition in interface IRepository
Parameters:
table_name - the name of the table for which the meta data is being returned
Returns:
the meta data for the table or null if not found
Throws:
JCO.Exception - if an error occurred during the retrieval of the table definition.

getNextRepository

public IRepository getNextRepository()
Returns the next repository that will be used if a function or structure could not be found in this one.
Specified by:
getNextRepository in interface IRepository
Returns:
the next repository to use or null if not set

setNextRepository

public void setNextRepository(IRepository next)
Sets the next repository that will be used if a function or structure could not be found in this one.
Specified by:
setNextRepository in interface IRepository
Parameters:
next - the next repository to use. Pass null if none.

addFunctionInterfaceToCache

public void addFunctionInterfaceToCache(IMetaData meta)
Adds a function interface to the local cache. Implementations that do not use a cache just provide an empty method.
Specified by:
addFunctionInterfaceToCache in interface IRepository
Parameters:
meta - the meta data of the interface to add to the cache

addFunctionInterfaceToCache

public void addFunctionInterfaceToCache(java.lang.String key,
                                        IMetaData meta)
Adds a function interface to the local cache. Implementations that do not use a cache just provide an empty method.
Parameters:
key - the key of the cache entry
meta - the meta data of the interface to add to the cache

addStructureDefinitionToCache

public void addStructureDefinitionToCache(IMetaData meta)
Adds a structure definition to the local cache. Implementations that do not use a cache just provide an empty method.
Specified by:
addStructureDefinitionToCache in interface IRepository
Parameters:
meta - the meta data of a structure to add to the cache

addStructureDefinitionToCache

public void addStructureDefinitionToCache(java.lang.String key,
                                          IMetaData meta)
Adds a structure definition to the local cache. Implementations that do not use a cache just provide an empty method.
Parameters:
key - the key of the cache entry
meta - the meta data of a structure to add to the cache

removeFunctionInterfaceFromCache

public void removeFunctionInterfaceFromCache(java.lang.String function_name)
Removes a function interface from the local cache. Implementations that do not use a cache just provide an empty method.
Specified by:
removeFunctionInterfaceFromCache in interface IRepository
Parameters:
function_name - the name of the function to be removed from the cache

removeStructureDefinitionFromCache

public void removeStructureDefinitionFromCache(java.lang.String structure_name)
Removes a function interface from the local cache. Implementations that do not use a cache just provide an empty method.
Specified by:
removeStructureDefinitionFromCache in interface IRepository
Parameters:
structure_name - the name of the structure to be removed from the cache

getCachedFunctionInterfaces

public java.lang.String[] getCachedFunctionInterfaces()
Returns the names of the cached functions as a string array
Specified by:
getCachedFunctionInterfaces in interface IRepository
Returns:
a string array of the cached functions or null if the cache is empty

getCachedStructureDefinitions

public java.lang.String[] getCachedStructureDefinitions()
Returns the names of the cached structures as a string array
Specified by:
getCachedStructureDefinitions in interface IRepository
Returns:
a string array of the cached structures or null if the cache is empty

save

public void save(java.lang.String filename)
          throws java.io.IOException
Save the repository to the specified file.
Specified by:
save in interface IRepository
Parameters:
filename - the file to save the repository to.
Throws:
java.io.IOException - in case of an I/O error.

load

public void load(java.lang.String filename)
          throws java.io.IOException
Load the repository from the specified file.
Specified by:
load in interface IRepository
Parameters:
filename - the file to load the repository from.
Throws:
java.io.IOException - in case of an I/O error.