27 #include "../../dataaccess/datasource/DataSource.h"
28 #include "../../dataaccess/datasource/DataSourceFactory.h"
29 #include "../cache/AbstractCachePolicyFactory.h"
30 #include "../drivers/database/DatabaseGraphMetadata.h"
31 #include "../loader/AbstractGraphLoaderStrategyFactory.h"
32 #include "../Exception.h"
33 #include "../Globals.h"
50 params.push_back(std::pair<std::string, std::string>(
"GRAPH_DATA_SOURCE_TYPE",
""));
51 params.push_back(std::pair<std::string, std::string>(
"GRAPH_ID",
""));
52 params.push_back(std::pair<std::string, std::string>(
"GRAPH_NAME",
""));
53 params.push_back(std::pair<std::string, std::string>(
"GRAPH_DESCRIPTION",
""));
54 params.push_back(std::pair<std::string, std::string>(
"GRAPH_STORAGE_MODE",
""));
55 params.push_back(std::pair<std::string, std::string>(
"GRAPH_STRATEGY_LOADER",
""));
56 params.push_back(std::pair<std::string, std::string>(
"GRAPH_CACHE_POLICY",
""));
78 std::map<std::string, std::string>::const_iterator it;
79 std::map<std::string, std::string>::const_iterator itend = gInfo.end();
82 it = gInfo.find(
"GRAPH_DATA_SOURCE_TYPE");
84 std::auto_ptr<te::da::DataSource> dsPtr;
89 dsPtr->setConnectionInfo(dsInfo);
98 it = gInfo.find(
"GRAPH_ID");
103 int id = atoi(it->second.c_str());
107 catch(
const std::exception& e)
109 std::string errorMessage =
TR_GRAPH(
"Error saving graph metadata: ");
110 errorMessage += e.what();
112 throw Exception(errorMessage);
122 it = gInfo.find(
"GRAPH_CACHE_POLICY");
130 it = gInfo.find(
"GRAPH_STRATEGY_LOADER");
144 std::map<std::string, std::string>::const_iterator it;
145 std::map<std::string, std::string>::const_iterator itend = gInfo.end();
148 it = gInfo.find(
"GRAPH_DATA_SOURCE_TYPE");
150 std::auto_ptr<te::da::DataSource> dsPtr;
155 dsPtr->setConnectionInfo(dsInfo);
164 it = gInfo.find(
"GRAPH_NAME");
167 gMetadata->
setName(it->second);
170 it = gInfo.find(
"GRAPH_DESCRIPTION");
176 it = gInfo.find(
"GRAPH_STORAGE_MODE");
193 catch(
const std::exception& e)
195 std::string errorMessage =
TR_GRAPH(
"Error saving graph metadata: ");
196 errorMessage += e.what();
198 throw Exception(errorMessage);
203 it = gInfo.find(
"GRAPH_CACHE_POLICY");
211 it = gInfo.find(
"GRAPH_STRATEGY_LOADER");
This is the abstract factory for Graphs.
This is the concrete factory for the directed Graph type.
static AbstractGraphLoaderStrategy * make()
It creates and returns default graph loader strategy.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
This is a implementation of a Directed Graph. By convention a directed graph provides access to out-e...
static void finalize()
It finalizes the factory: the singleton instance will be destroyed and will be unregistered from the ...
DirectedGraphFactory()
Constructor.
This class define the main functions necessary to save and load the graph data and metadata informati...
te::graph::AbstractGraph * build()
Builder Function used to create the class object.
static DirectedGraphFactory * sm_factory
Static instance used to register the factory.
void setStorageMode(GraphStorageMode value)
Set the graph storage mode (defined in Enums file)
An static class with global definitions for the TerraLib Graph Module.
#define TE_GRAPH_STORAGE_MODE_BY_VERTEX
This definition is used to set the vertex storage mode.
static std::auto_ptr< DataSource > make(const std::string &dsType)
static void initialize()
It initializes the factory: the singleton instance will be registered in the abstract factory ...
This is the concrete factory for the directed Graph type.
#define TR_GRAPH(message)
It marks a string in order to get translated. This is a special mark used in the Graph module of Terr...
const std::string & getType() const
Returns the type (name) of this factory.
void load(int id)
Function used to load the graph information given a graph id.
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > ¶ms) const
It returns the list of parameters accepted as graph info.
static AbstractCachePolicy * make()
It creates and returns default cache policy.
void setName(std::string name)
Set the graph name.
static const std::string sm_factoryGraphTypeDirectedGraph
Directed Graph Factory Name.
#define TE_GRAPH_STORAGE_MODE_BY_EDGE
This definition is used to set the edge storage mode.
This is a implementation of a Directed Graph. By convention a directed graph provides access to out-e...
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
te::graph::AbstractGraph * create(const std::map< std::string, std::string > &dsInfo, const std::map< std::string, std::string > &gInfo)
This method must be implemented by subclasses (graph types).
void setDescription(std::string desc)
Set the graph description.
This class is used to set the main functions of a cache policy.
te::graph::AbstractGraph * iOpen(const std::map< std::string, std::string > &dsInfo, const std::map< std::string, std::string > &gInfo)
This method must be re-implemented by subclasses in order to have a finner control for the graph obje...
Class used to define the graph metadata informations over a SGBD source.
void save()
Function used to save the graph information.