use of com.ramussoft.core.persistent.UniversalPersistentFactory in project ramus by Vitaliy-Yakovchuk.
the class EngineFactory method createUniversalPersistentFactory.
private void createUniversalPersistentFactory(JDBCTemplate template, String pluginsString) throws SQLException {
UniversalPersistentFactory factory = new UniversalPersistentFactory(template);
Collection<PersistentsPlugin> pls = getPersistentPlugins();
ArrayList<PersistentsPlugin> plugins = new ArrayList<PersistentsPlugin>();
plugins.addAll(pls);
if (pluginsString != null) {
StringTokenizer st = new StringTokenizer(pluginsString, ", ");
while (st.hasMoreTokens()) {
try {
String className = st.nextToken();
Class<?> clazz = Class.forName(className);
PersistentsPluginProvider plugin = (PersistentsPluginProvider) clazz.newInstance();
plugins.addAll(plugin.getPersistentsPlugins());
} catch (Exception e) {
e.printStackTrace();
}
}
}
for (PluginProvider pp : suits) {
if (pp instanceof PersistentsPluginProvider) {
plugins.addAll(((PersistentsPluginProvider) pp).getPersistentsPlugins());
}
}
for (PersistentsPlugin pp : plugins) {
List<Class> list = new ArrayList<Class>();
pp.addPersistents(list, factory);
factory.addClasses(list);
}
factory.rebuild();
}
Aggregations