Package javax.jcr

Examples of javax.jcr.NoSuchWorkspaceException


        for (int i = 0; i < wsps.length && !accessible; i++) {
            accessible = wsps[i].equals(workspaceName);
        }

        if (!accessible) {
            throw new NoSuchWorkspaceException("Unknown workspace: '" + workspaceName + "'.");
        }
    }
View Full Code Here


            // expected
        }
        try {
            createTemplate().execute(new JcrCallback() {
                public Object doInJcr(Session session) throws RepositoryException {
                    throw new NoSuchWorkspaceException();
                }
            });
            fail("Should have thrown DataAccessResourceFailureException");
        } catch (DataAccessResourceFailureException ex) {
            // expected
View Full Code Here

    private void checkValidWorkspace(String workspaceName)
            throws RepositoryException {
        String[] workspaceNames =
                getSession().getWorkspace().getAccessibleWorkspaceNames();
        if (!asList(workspaceNames).contains(workspaceName)) {
            throw new NoSuchWorkspaceException(
                    "Workspace " + workspaceName + " does not exist");
        }
    }
View Full Code Here

            workspaceName = defaultWorkspaceName;
        }

        // TODO: support multiple workspaces. See OAK-118
        if (!defaultWorkspaceName.equals(workspaceName)) {
            throw new NoSuchWorkspaceException(workspaceName);
        }

        LoginContextProvider lcProvider = securityProvider.getConfiguration(AuthenticationConfiguration.class).getLoginContextProvider(this);
        LoginContext loginContext = lcProvider.getLoginContext(credentials, workspaceName);
        loginContext.login();
View Full Code Here

        WorkspaceInfo wspInfo;
        synchronized (wspInfos) {
            wspInfo = wspInfos.get(workspaceName);
            if (wspInfo == null) {
                throw new NoSuchWorkspaceException(workspaceName);
            }
        }

        try {
            wspInfo.initialize();
        } catch (RepositoryException e) {
            log.error("Unable to initialize workspace '" + workspaceName + "'", e);
            throw new NoSuchWorkspaceException(workspaceName);
        }
        return wspInfo;
    }
View Full Code Here

        WorkspaceInfo wspInfo;
        synchronized (wspInfos) {
            wspInfo = (WorkspaceInfo) wspInfos.get(workspaceName);
            if (wspInfo == null) {
                throw new NoSuchWorkspaceException(workspaceName);
            }
        }

        try {
            initWorkspace(wspInfo);
        } catch (RepositoryException e) {
            log.error("Unable to initialize workspace '" + workspaceName + "'", e);
            throw new NoSuchWorkspaceException(workspaceName);
        }
        return wspInfo;
    }
View Full Code Here

      if (workspaceName == null)
      {
         workspaceName = config.getDefaultWorkspaceName();
         if (workspaceName == null)
            throw new NoSuchWorkspaceException("Both workspace and default-workspace name are null! ");
      }

      if (!isWorkspaceInitialized(workspaceName))
         throw new NoSuchWorkspaceException("Workspace '" + workspaceName + "' not found. "
            + "Probably is not initialized. If so either Initialize it manually or turn on the RepositoryInitializer");

      SessionFactory sessionFactory = repositoryContainer.getWorkspaceContainer(workspaceName).getSessionFactory();
      return sessionFactory.createSession(state);
   }
View Full Code Here

    */
   private boolean canRemoveWorkspace(String workspaceName, boolean allowRemoveSystemWorkspace)
      throws NoSuchWorkspaceException
   {
      if (repositoryContainer.getWorkspaceEntry(workspaceName) == null)
         throw new NoSuchWorkspaceException("No such workspace " + workspaceName);

      if (!allowRemoveSystemWorkspace && workspaceName.equals(config.getSystemWorkspaceName()))
         return false;

      SessionRegistry sessionRegistry =
View Full Code Here

    * {@inheritDoc}
    */
   public boolean canRemoveWorkspace(String workspaceName) throws NoSuchWorkspaceException
   {
      if (repositoryContainer.getWorkspaceEntry(workspaceName) == null)
         throw new NoSuchWorkspaceException("No such workspace " + workspaceName);

      if (workspaceName.equals(config.getSystemWorkspaceName()))
         return false;

      SessionRegistry sessionRegistry =
View Full Code Here

      if (workspaceName == null)
      {
         workspaceName = config.getDefaultWorkspaceName();
         if (workspaceName == null)
            throw new NoSuchWorkspaceException("Both workspace and default-workspace name are null! ");
      }

      if (!isWorkspaceInitialized(workspaceName))
         throw new NoSuchWorkspaceException("Workspace '" + workspaceName + "' not found. "
            + "Probably is not initialized. If so either Initialize it manually or turn on the RepositoryInitializer");

      SessionFactory sessionFactory = repositoryContainer.getWorkspaceContainer(workspaceName).getSessionFactory();
      return sessionFactory.createSession(state);
   }
View Full Code Here

TOP

Related Classes of javax.jcr.NoSuchWorkspaceException

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.