lio.core
Class LiOResourceFactory

java.lang.Object
  extended by lio.core.LiOResourceFactory

public class LiOResourceFactory
extends java.lang.Object

This class is used to arrange all facilities related to load resources needed by a search algorithm and other resources recursively. Here is used the singleton pattern because only one instance of this class is needed in one execution. So you don't have to make an instance of LiOResourceFactory but use static method getHandle


Method Summary
 boolean applySearchConf(LiOSearch alg)
          Let update LiOSearch algorithm's parameters before run it from configuration file or command line parameters
 boolean applySearchOutputConf(SearchOutput so)
           
 boolean applyStopConditionConf(StopCondition sc)
           
 java.lang.Object createFromFile(java.lang.String fileName)
          Tries to create a new instance of an object from a path to .class file or a full qualified class name.
 LiOResource createResource(java.lang.String pResource)
          Returns the default resource given by either configuration file or default file in that order.
 LiOResource createResource(java.lang.String pResource, java.lang.String pInstantiation)
          Returns the resource by looking for a concrete instantiation, but if isn't possible then returns the default resource.
 LiOResource createSearchAlgorithm(java.lang.String pSA)
          Create the search algorithm encode in the class name passed as argument
static LiOResourceFactory getHandle()
          This method use lazy construction to return an instance of LiOResourceFactory.
 java.util.List<java.lang.String> getListOfNonDependentResources(java.lang.String pKindOfResource)
          Gets a list of built-in resources which match with a kind of resource.
 java.util.List<java.lang.String> getListOfResources(java.lang.String pKindOfResource)
          Gets a list of built-in resources which match with a kind of resource.
 java.util.List<java.lang.String> getListOfResources(java.lang.String pKindOfResource, java.lang.String pKindOfData)
          Gets a list of built-in resources which match with a kind of resource and a kind of data type.
 java.util.List<java.lang.String> getProblemsList()
           
 java.util.List<java.lang.String> getSearchAlgList()
           
 java.lang.String getSearchAlgorithmName()
           
 java.lang.String getTaskName()
           
 boolean saveConfToFile(LiOSearch search, java.lang.String file)
          Save actual configuration of a search algorithm to a file
 boolean setCmdParam(java.lang.String cmdParam)
          Update a configuration parameter from command line
 void setConfFile(java.lang.String pConfFile)
          Loads a search configuration by reading a configuration file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHandle

public static LiOResourceFactory getHandle()
This method use lazy construction to return an instance of LiOResourceFactory.

Returns:
an instance of this class

saveConfToFile

public boolean saveConfToFile(LiOSearch search,
                              java.lang.String file)
Save actual configuration of a search algorithm to a file

Parameters:
search - search algorithm
file - file to be stored
Returns:
success of the operation

setConfFile

public void setConfFile(java.lang.String pConfFile)
Loads a search configuration by reading a configuration file

Parameters:
pConfFile - name of the file containing the configuration of the search.

setCmdParam

public boolean setCmdParam(java.lang.String cmdParam)
Update a configuration parameter from command line

Parameters:
cmdParam - this is the command line parameter which is an String representing a configuration parameter and its value

getListOfResources

public java.util.List<java.lang.String> getListOfResources(java.lang.String pKindOfResource,
                                                           java.lang.String pKindOfData)
Gets a list of built-in resources which match with a kind of resource and a kind of data type.

Parameters:
pKindOfResource - kind of resource
pKindOfData - kind of data
Returns:
a list of strings with resources

getListOfResources

public java.util.List<java.lang.String> getListOfResources(java.lang.String pKindOfResource)
Gets a list of built-in resources which match with a kind of resource.

Parameters:
pKindOfResource - kind of resource
Returns:
a list of strings with resources

getListOfNonDependentResources

public java.util.List<java.lang.String> getListOfNonDependentResources(java.lang.String pKindOfResource)
Gets a list of built-in resources which match with a kind of resource.

Parameters:
pKindOfResource - kind of resource
Returns:
a list of strings with resources

getProblemsList

public java.util.List<java.lang.String> getProblemsList()
Returns:
the list of problems included in the library

getSearchAlgList

public java.util.List<java.lang.String> getSearchAlgList()
Returns:
the list of search algorithms included in the library

createResource

public LiOResource createResource(java.lang.String pResource)
Returns the default resource given by either configuration file or default file in that order.

Parameters:
pResource - kind of resource
Returns:
a LiOResource

createSearchAlgorithm

public LiOResource createSearchAlgorithm(java.lang.String pSA)
Create the search algorithm encode in the class name passed as argument

Parameters:
pSA - name of the search algorithm
Returns:
the search algorithm

createResource

public LiOResource createResource(java.lang.String pResource,
                                  java.lang.String pInstantiation)
Returns the resource by looking for a concrete instantiation, but if isn't possible then returns the default resource.

Parameters:
pResource - kind of resource
pInstantiation - concrete implementation of that resource.
Returns:
a LiOResource.

createFromFile

public java.lang.Object createFromFile(java.lang.String fileName)
Tries to create a new instance of an object from a path to .class file or a full qualified class name.

Parameters:
fileName - path to a .class file or a full qualified class name
Returns:
an instance of an object.

applySearchConf

public boolean applySearchConf(LiOSearch alg)
Let update LiOSearch algorithm's parameters before run it from configuration file or command line parameters

Parameters:
alg - algorithm which is updated
Returns:
true if operation succeed

applySearchOutputConf

public boolean applySearchOutputConf(SearchOutput so)

applyStopConditionConf

public boolean applyStopConditionConf(StopCondition sc)

getSearchAlgorithmName

public java.lang.String getSearchAlgorithmName()

getTaskName

public java.lang.String getTaskName()