Class Replication

You might also like

You are on page 1of 2

oseDbFactory =

pe.com.efact.ose.replication.db.DBFactory.getDBInstance(pe.com.efact.ose.replicatio
n.constants.DataBaseType.MONGO_OSE);
DBFactory.getInstance().setConnection(DBFactory.TYPE_MONGODB,
connectionWebDB());
oseDbFactory.setConnection(connectionOdinDB());

webTransactionDAO = (WebTransactionDAO<Document>)
DAOFactory.getWebTransactionDAO(DataBaseType.MONGODB);
webUserDAO = (WebUserDAO<Document>)
DAOFactory.getWebUserDAO(DataBaseType.MONGODB);
webBorradorDAO = (WebBorradorDAO<Document>)
DAOFactory.getWebBorradorDAO(DataBaseType.MONGODB);
webVoidedDAO =(WebVoidedDAO<Document>)
DAOFactory.getVoidedDAO(DataBaseType.MONGODB);

parameterDAO = (ParameterDAO<Document>)
oseDbFactory.getParameterDAO();

Document status=null;
try {
JsonNode statusNode = rootNode.get("Status");
status = Document.parse(new
ObjectMapper().writeValueAsString(statusNode));

}catch(Exception e) {}

private static Object unmarshaller(File file, Class<?> clazz) throws


JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return jaxbUnmarshaller.unmarshal(file);
}

public static DBConfigType connectionOdinDB() {


DBConfigType dbConfigType=null;
File fileose = new File("/home/dortiz/db-config-odin.xml");
try {
dbConfigType = (DBConfigType) unmarshaller(fileose,
DBConfigType.class);
}catch (Exception e) {
System.err.println(e);
}
return dbConfigType;
}

public static DBConfigType connectionWebDB() {


DBConfigType dbConfigType=null;
File fileose = new File("/home/dortiz/db-config.xml");
MongoDatabase db = null;
try {
dbConfigType = (DBConfigType) unmarshaller(fileose,
DBConfigType.class);
}catch (Exception e) {
System.err.println(e);
}
return dbConfigType;
}

You might also like