Package javax.jcr

Examples of javax.jcr.Workspace


         ChromatticSession session = test1LF.getChromattic().openSession();
         FooEntity foo = session.create(FooEntity.class);
         assertEquals("portal-test", foo.getWorkspace());
         jcrSession = session.getJCRSession();
         assertTrue(jcrSession.isLive());
         Workspace workspace = jcrSession.getWorkspace();
         assertEquals("portal-test", workspace.getName());

         session.close();
         assertTrue(jcrSession.isLive());
      }
      finally
View Full Code Here


         assertEquals("portal-test", foo.getWorkspace());

         // Check related JCR session
         jcrSession = session.getJCRSession();
         assertTrue(jcrSession.isLive());
         Workspace workspace = jcrSession.getWorkspace();
         assertEquals("portal-test", workspace.getName());

         // Closing chromattic session should not close the underlying JCR session
         session.close();
         assertTrue(jcrSession.isLive());
View Full Code Here

                     final NodeId destParentNodeId,
                     final Name destName) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Workspace ws = sInfo.getSession().getWorkspace();
                String destPath = getDestinationPath(destParentNodeId, destName, sInfo);
                if (ws.getName().equals(srcWorkspaceName)) {
                    // inner-workspace copy
                    String srcPath = pathForId(srcNodeId, sInfo);
                    ws.copy(srcPath, destPath);
                } else {
                    SessionInfoImpl srcInfo = getSessionInfoImpl(obtain(sInfo, srcWorkspaceName));
                    try {
                        String srcPath = pathForId(srcNodeId, srcInfo);
                        ws.copy(srcWorkspaceName, srcPath, destPath);
                    } finally {
                        dispose(srcInfo);
                    }
                }
                return null;
View Full Code Here

                SessionInfoImpl srcInfo = getSessionInfoImpl(obtain(sessionInfo, srcWorkspaceName));
                try {
                String srcPath = pathForId(srcNodeId, srcInfo);
                String destPath = getDestinationPath(destParentNodeId, destName, sInfo);

                Workspace wsp = sInfo.getSession().getWorkspace();
                wsp.clone(srcWorkspaceName, srcPath, destPath, removeExisting);
                } finally {
                    dispose(srcInfo);
                }
                return null;
            }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void createWorkspace(SessionInfo sessionInfo, String name, String srcWorkspaceName) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException {
        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        Workspace wsp = sInfo.getSession().getWorkspace();
        if (srcWorkspaceName == null) {
            wsp.createWorkspace(name);
        } else {
            wsp.createWorkspace(name, srcWorkspaceName);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void deleteWorkspace(SessionInfo sessionInfo, String name) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException {
        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        Workspace wsp = sInfo.getSession().getWorkspace();
        wsp.deleteWorkspace(name);
    }
View Full Code Here

    @Before
    public void setUp() throws RepositoryException, InvalidSyntaxException {
        ObservationManager observationManager = mock(ObservationManager.class);

        Workspace workspace = mock(Workspace.class);
        when(workspace.getObservationManager()).thenReturn(observationManager);

        Session session = mock(Session.class);
        when(session.getWorkspace()).thenReturn(workspace);

        SlingRepository repository = mock(SlingRepository.class);
View Full Code Here

    }

    public static boolean registerNodeType(Session session, String systemId, Reader reader, boolean reregisterExisting)
        throws IOException, RepositoryException {
        try {
            Workspace wsp = session.getWorkspace();
            CndImporter.registerNodeTypes(reader, systemId, wsp.getNodeTypeManager(), wsp.getNamespaceRegistry(), session.getValueFactory(), reregisterExisting);
        } catch(RepositoryException re) {
            if(isReRegisterBuiltinNodeType(re)) {
                log.debug("Attempt to re-register built-in node type, RepositoryException ignored", re);
            } else {
                throw re;
View Full Code Here

        Session tmpSession = null;
        try {
            Credentials sc = getAdministrativeCredentials(this.adminUser);
            tmpSession = this.getRepository().login(sc);
            Workspace defaultWs = tmpSession.getWorkspace();
            defaultWs.createWorkspace(workspace);
            return true;
        } catch (Throwable t) {
            this.log(LogService.LOG_ERROR,
                "createWorkspace: Cannot create requested workspace "
                    + workspace, t);
View Full Code Here

        when(packageManager.assemble(any(Session.class), any(ExportOptions.class), any(File.class))).thenReturn(vaultPackage);
        when(packaging.getPackageManager()).thenReturn(packageManager);

        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        Session session = mock(Session.class);
        Workspace workspace = mock(Workspace.class);
        ObservationManager observationManager = mock(ObservationManager.class);
        when(workspace.getObservationManager()).thenReturn(observationManager);
        when(session.getWorkspace()).thenReturn(workspace);
        when(resourceResolver.adaptTo(Session.class)).thenReturn(session);

        ReplicationEventFactory eventFactory = mock(ReplicationEventFactory.class);
View Full Code Here

TOP

Related Classes of javax.jcr.Workspace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.