@Override public Session getSession() { return getWrappedWorkspace().getSession(); }
/** * Returns the {@link ClientEventPoll} instance used by this (client-side) * observation manager. This method creates the instance on the first call * and starts the poller thread to wait for remote events. * * @return poller instance */ private synchronized ClientEventPoll getClientEventPoll() { if (poller == null) { poller = new ClientEventPoll(remote, workspace.getSession()); poller.start(); } return poller; }
/** * Tests Workspace.getQueryManager. This should just return correctly a * QueryManager object. */ public void testGetQueryManager() throws RepositoryException { Workspace ws = getHelper().getReadOnlySession().getWorkspace(); try { assertNotNull("Workspace does not return a QueryManager object.", ws.getQueryManager()); } finally { ws.getSession().logout(); } }
private static ObservationManager getObservationManager(String workspace) throws RepositoryException { Workspace wks = getSession(workspace).getWorkspace(); return wks.getSession().isLive() ? wks.getObservationManager() : null; }
@Override public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException { super.move(srcAbsPath, destAbsPath); updateLastModified(super.getWrappedWorkspace().getSession(), destAbsPath, true); }
private void logLockStatus(Content content, boolean isLock) throws RepositoryException { if (log.isDebugEnabled()) { // this log obtains too much data to processed all the time when not enabled log.debug("{} {} {}locked {}:{}", new Object[]{content.getWorkspace().getSession(), isLock ^ content.isLocked() ? "DIDN'T" : "DID", isLock ? "" : "un", content.getWorkspace().getName(), content.getHandle()}); } }
/** * Magnolia uses by default workspace move operation to move nodes. This is a util method to move a node inside a session. */ public static void moveInSession(Content src, String dest) throws RepositoryException { src.getWorkspace().getSession().move(src.getHandle(), dest); }
private void logLockStatus(Content content, boolean isLock) throws RepositoryException { if (log.isDebugEnabled()) { // this log obtains too much data to processed all the time when not enabled log.debug("{} {} {}locked {}:{}", new Object[] { content.getWorkspace().getSession(), isLock ^ content.isLocked() ? "DIDN'T" : "DID", isLock ? "" : "un", content.getWorkspace().getName(), content.getHandle() }); } }
/** {@inheritDoc} */ public RemoteQueryManager getQueryManager() throws RepositoryException, RemoteException { try { QueryManager queryManager = workspace.getQueryManager(); return getFactory().getRemoteQueryManager( workspace.getSession(), queryManager); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
@Test public void sessionWrapperIsNotLost() throws Exception { // GIVEN // WHEN Session s1 = session.getWorkspace().getSession(); Session s2 = session.getWorkspace().getSession().getWorkspace().getSession(); Session s3 = session.getNode("/test").getSession(); Session s4 = session.getWorkspace().getSession().getNode("/test").getSession(); // THEN assertSessionIsWrapped(s1); assertSessionIsWrapped(s2); assertSessionIsWrapped(s3); assertSessionIsWrapped(s4); }
public RemoteVersionManager getVersionManager() throws RepositoryException, RemoteException { try { if (remoteVersionManager == null) { VersionManager versionManager = workspace.getVersionManager(); remoteVersionManager = getFactory().getRemoteVersionManager(workspace.getSession(), versionManager); } return remoteVersionManager; } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
@Test public void workspaceWrapperIsNotLost() throws Exception { // GIVEN // WHEN Workspace ws1 = session.getWorkspace(); Workspace ws2 = session.getWorkspace().getSession().getWorkspace(); Workspace ws3 = session.getNode("/test").getSession().getWorkspace(); Workspace ws4 = session.getWorkspace().getSession().getNode("/test").getSession().getWorkspace(); // THEN assertWorkspaceIsWrapped(ws1); assertWorkspaceIsWrapped(ws2); assertWorkspaceIsWrapped(ws3); assertWorkspaceIsWrapped(ws4); }
@Override public Session getSession() throws RepositoryException { return this.mockNodeData.getParent().getWorkspace().getSession(); }
@Override public Session getSession() throws RepositoryException { return mockContent.getHierarchyManager().getWorkspace().getSession(); }
private Value createValue(Object valueObj) throws RepositoryException, UnsupportedRepositoryOperationException { ValueFactory valueFactory = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE).getWorkspace().getSession().getValueFactory(); return NodeDataUtil.createValue(valueObj, valueFactory); }
private Value createValue(Object valueObj) throws Exception { ValueFactory valueFactory = MgnlContext.getJCRSession("website").getWorkspace().getSession().getValueFactory(); return PropertyUtil.createValue(valueObj, valueFactory); }
private Value createValue(Object valueObj) throws RepositoryException, UnsupportedRepositoryOperationException { ValueFactory valueFactory = MgnlContext.getJCRSession("website").getWorkspace().getSession().getValueFactory(); return NodeDataUtil.createValue(valueObj, valueFactory); }
@Test public void testConstructionProperlyWiresWorkspaceToSession() { final MockSession mockSession = new MockSession("test"); assertEquals(mockSession, mockSession.getWorkspace().getSession()); }
@Override public Content createForum(String name, String title, boolean withMessageNesting) throws RepositoryException { final HierarchyManager hm = getHierarchyManager(); final String cleanName = Path.getUniqueLabel(hm.getWorkspace().getSession(), "/", cleanup(name)); final Content repoRoot = hm.getRoot(); final Content newForum = repoRoot.createContent(cleanName, FORUM_NODETYPE); newForum.createNodeData("title", title); newForum.setNodeData(ALLOWS_NESTING_MESSAGES, withMessageNesting); repoRoot.save(); if (config.isCreateRolesForNewForums()) { createForumRoles(newForum); } return newForum; }
@Test public void returnsWrappedSessionFromWorkspace() throws Exception { // GIVEN ContentDecoratorSessionWrapper wrappedSession = new ContentDecoratorSessionWrapper(new MockSession("website"), new CustomTestContentDecorator()); // WHEN Session session = wrappedSession.getWorkspace().getSession(); // THEN assertTrue(session instanceof ContentDecoratorSessionWrapper); } }