private PDocument getPDocument(DocumentName documentName, Long key) { try { MDSInstance instance = storeInitializer.getMDSInstance(); MDSSession session = createSession(instance); PManager pManager = instance.getPersistenceManager(); PContext pContext = session.getPContext(); if (key > 0) { return pManager.getVersionSupport().getDocument(pContext, documentName, key); } else { return pManager.getDocument(pContext, documentName); } } catch (MDSAccessException e) { throw new IllegalArgumentException("Could not read ", e); } }
private MDSSession createSession(MDSInstance instance) { SessionOptions sessionOptions = new SessionOptions( IsolationLevel.READ_COMMITTED, Locale.getDefault(), CustConfig.NO_CUSTOMIZATIONS); UserStateHandler userStateHandler = new UserStateHandler() { public Object getAttribute(String string) { return null; } public void setAttribute(String string, Object object) {} }; return instance.createSession(sessionOptions, userStateHandler); }