0% found this document useful (0 votes)
5 views2 pages

MongoDB Connection and DAO Setup Guide

The document discusses setting up connections to MongoDB databases and initializing DAO objects for data access. It loads configuration from XML files, unmarshals the data, and uses it to set connections on DBFactory and DAOFactory instances.

Uploaded by

Lp Kido
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

MongoDB Connection and DAO Setup Guide

The document discusses setting up connections to MongoDB databases and initializing DAO objects for data access. It loads configuration from XML files, unmarshals the data, and uses it to set connections on DBFactory and DAOFactory instances.

Uploaded by

Lp Kido
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

oseDbFactory =

[Link]([Link]
[Link].MONGO_OSE);
[Link]().setConnection(DBFactory.TYPE_MONGODB,
connectionWebDB());
[Link](connectionOdinDB());

webTransactionDAO = (WebTransactionDAO<Document>)
[Link]([Link]);
webUserDAO = (WebUserDAO<Document>)
[Link]([Link]);
webBorradorDAO = (WebBorradorDAO<Document>)
[Link]([Link]);
webVoidedDAO =(WebVoidedDAO<Document>)
[Link]([Link]);

parameterDAO = (ParameterDAO<Document>)
[Link]();

Document status=null;
try {
JsonNode statusNode = [Link]("Status");
status = [Link](new
ObjectMapper().writeValueAsString(statusNode));

}catch(Exception e) {}

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


JAXBException {
JAXBContext jaxbContext = [Link](clazz);
Unmarshaller jaxbUnmarshaller = [Link]();
return [Link](file);
}

public static DBConfigType connectionOdinDB() {


DBConfigType dbConfigType=null;
File fileose = new File("/home/dortiz/[Link]");
try {
dbConfigType = (DBConfigType) unmarshaller(fileose,
[Link]);
}catch (Exception e) {
[Link](e);
}
return dbConfigType;
}

public static DBConfigType connectionWebDB() {


DBConfigType dbConfigType=null;
File fileose = new File("/home/dortiz/[Link]");
MongoDatabase db = null;
try {
dbConfigType = (DBConfigType) unmarshaller(fileose,
[Link]);
}catch (Exception e) {
[Link](e);
}
return dbConfigType;
}

You might also like