MCPcopy Create free account
hub / github.com/ddf-project/DDF / getConfigHandler

Method getConfigHandler

core/src/main/java/io/ddf/misc/Config.java:108–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106
107
108 public static IHandleConfig getConfigHandler() {
109 if (sConfigHandler == null) {
110 String configFileName = System.getenv(ConfigConstant.DDF_INI_ENV_VAR.toString());
111 if (Strings.isNullOrEmpty(configFileName)) configFileName = ConfigConstant.DDF_INI_FILE_NAME.toString();
112 sConfigHandler = new ConfigHandler(ConfigConstant.DDF_CONFIG_DIR.toString(), configFileName);
113
114 if (sConfigHandler.getConfig() == null) {
115 // HACK: prep a basic default config!
116 Configuration config = new Configuration();
117
118 config.getSection(ConfigConstant.SECTION_GLOBAL.toString()) //
119 .set("Namespace", "adatao") //
120 .set("RuntimeDir", "ddf-runtime") //
121 .set("BasicPersistenceDir", "basic-ddf-db") //
122 .set("DDF", "io.ddf.DDF") //
123 .set("io.ddf.DDF", "io.ddf.DDFManager") //
124 .set("ISupportStatistics", "io.ddf.analytics.AStatisticsSupporter") //
125 .set("IHandleRepresentations", "io.ddf.content.RepresentationHandler") //
126 .set("IHandleSchema", "io.ddf.content.SchemaHandler") //
127 .set("IHandleViews", "io.ddf.content.ViewHandler") //
128 .set("IHandlePersistence", "io.basic.ddf.content.PersistenceHandler") //
129 .set("IHandleMetaData", "io.ddf.content.MetaDataHandler") //
130 ;
131
132 config.getSection("basic") //
133 .set("DDF", "io.basic.ddf.BasicDDF") //
134 .set("DDFManager", "io.basic.ddf.BasicDDFManager") //
135 ;
136
137 config.getSection("spark") //
138 .set("DDF", "io.ddf.spark.SparkDDF") //
139 .set("DDFManager", "io.ddf.spark.SparkDDFManager") //
140 .set("ISupportStatistics", "io.ddf.spark.analytics.BasicStatisticsSupporter") //
141 .set("IHandleMetaData", "io.ddf.spark.content.MetaDataHandler") //
142 .set("IHandleRepresentations", "io.ddf.spark.content.RepresentationHandler") //
143 .set("IHandleSchema", "io.ddf.spark.content.SchemaHandler") //
144 .set("IHandleSql", "io.ddf.spark.etl.SqlHandler") //
145 .set("IHandleViews", "io.ddf.spark.content.ViewHandler") //
146 .set("ISupportML", "io.ddf.spark.ml.MLSupporter") //
147 ;
148
149 // TODO
150 config.getSection("jdbc") //
151 .set("DDF", "io.ddf.jdbc.JDBCDDF") //
152 .set("DDFManager", "io.ddf.jdbc.JDBCDDFManager") //
153 .set("IHandleSql", "io.ddf.jdbc.etl.SqlHandler") //
154 ;
155
156 sConfigHandler.setConfig(config);
157 }
158 }
159
160 return sConfigHandler;
161 }
162
163
164 /**

Callers 6

testLoadConfigMethod · 0.95
testReadConfigMethod · 0.95
newHandlerMethod · 0.95
getValueMethod · 0.95
setMethod · 0.95

Calls 5

getSectionMethod · 0.95
getConfigMethod · 0.65
setMethod · 0.65
setConfigMethod · 0.65
toStringMethod · 0.45

Tested by 2

testLoadConfigMethod · 0.76
testReadConfigMethod · 0.76