TConnection con = tds.getConnection();
return con;
}
public void select(Observer pObserver, String pQuery, PMParams pParams) throws PMException {
TConnection conn = null;
try {
JAXBContextImpl c = getManager().getFactory();
setJAXBContext(c);
JMUnmarshallerHandlerImpl h = (JMUnmarshallerHandlerImpl) c.createUnmarshaller().getUnmarshallerHandler();
DocumentDefaultHandler.setUnmarshallerHandler(h);
ElementDefaultHandler.initData();
conn = getTConnection();
TXMLObjectAccessor accessor = conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
TResponse response = accessor.query(TQuery.newInstance(pQuery));
for (TXMLObjectIterator iter = response.getXMLObjectIterator();
iter.hasNext(); ) {
TXMLObject object = iter.next();
pObserver.notify(((TJMElement) object.getElement()).getJMElement());
}
} catch (TServerNotAvailableException e) {
throw new PMException(e);
} catch (NamingException e) {
throw new PMException(e);
} catch (TQueryException e) {
throw new PMException(e);
} catch (TNoSuchXMLObjectException e) {
throw new PMException(e);
} catch (TIteratorException e) {
throw new PMException(e);
} catch (JAXBException e) {
throw new PMException(e);
} finally {
if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
setJAXBContext(null);
DocumentDefaultHandler.setUnmarshallerHandler(null);
ElementDefaultHandler.initData();
}
}