Package javax.jcr

Examples of javax.jcr.Workspace


    public QueryEngine(Session session, LuceneQueryFactory lqf,
            Map<String, Value> variables) throws RepositoryException {
        this.session = session;
        this.lqf = lqf;
        Workspace workspace = session.getWorkspace();
        this.ntManager = workspace.getNodeTypeManager();
        this.qomFactory = workspace.getQueryManager().getQOMFactory();
        this.valueFactory = session.getValueFactory();

        this.evaluator = new OperandEvaluator(valueFactory, variables);
    }
View Full Code Here


        }

        try {
            String itemPath = getLocator().getRepositoryPath();
            String destItemPath = destination.getLocator().getRepositoryPath();
            Workspace workspace = getRepositorySession().getWorkspace();
            if (getLocator().isSameWorkspace(destination.getLocator())) {
                workspace.copy(itemPath, destItemPath);
            } else {
                log.error("Copy between workspaces is not yet implemented (src: '" + getHref() + "', dest: '" + destination.getHref() + "')");
                throw new DavException(DavServletResponse.SC_NOT_IMPLEMENTED);
            }
        } catch (PathNotFoundException e) {
View Full Code Here

     * @return <code>true</code> if registration of all node types succeeded.
     */
    public static boolean registerNodeType(Session session, InputStream source)
            throws IOException, RepositoryException {

        Workspace workspace = session.getWorkspace();
        NodeTypeManager ntm = workspace.getNodeTypeManager();
        if (ntm instanceof JackrabbitNodeTypeManager) {
            JackrabbitNodeTypeManager jntm = (JackrabbitNodeTypeManager) ntm;
            try {
                jntm.registerNodeTypes(source,
                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
View Full Code Here

        Session tmpSession = null;
        try {
            SimpleCredentials sc = new SimpleCredentials(this.adminUser,
                this.adminPass);
            tmpSession = this.getRepository().login(sc);
            Workspace defaultWs = tmpSession.getWorkspace();
            if (defaultWs instanceof JackrabbitWorkspace) {
                ((JackrabbitWorkspace) defaultWs).createWorkspace(workspace);
                return true;
            }
View Full Code Here

   */
  public void setupRepository(Session session) throws RepositoryException {
    log.info("Setting up the repository, registering node types etc.");
    try {
      Node root = session.getRootNode();
      Workspace ws = session.getWorkspace();
 
      //no need to set it up again, skip it if it has.
      boolean registered = RulesRepositoryAdministrator.isNamespaceRegistered( session );
  
      if (!registered) {
        ws.getNamespaceRegistry().registerNamespace("drools", RulesRepository.DROOLS_URI);
 
        //Note, the order in which they are registered actually does matter !
        jcrRepositoryConfigurator.registerNodeTypesFromCndFile("/node_type_definitions/tag_node_type.cnd", session, ws);
        jcrRepositoryConfigurator.registerNodeTypesFromCndFile("/node_type_definitions/state_node_type.cnd", session, ws);
        jcrRepositoryConfigurator.registerNodeTypesFromCndFile("/node_type_definitions/versionable_node_type.cnd", session, ws);
View Full Code Here

        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
        stub(workspace2.getName()).toReturn("workspace1");

        // Use the same id and location ...
        javax.jcr.Node prius2 = cache2.findJcrNode(null, path("/Cars/Hybrid/Toyota Prius"));
        assertThat(prius2.isSame(prius), is(false));
View Full Code Here

        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
        stub(workspace2.getName()).toReturn("workspace2");

        // Use the same id and location; use 'Toyota Prius'
        // since the UUID is defined in 'cars.xml' and therefore will be the same
        javax.jcr.Node prius2 = cache2.findJcrNode(null, path("/Cars/Hybrid/Toyota Prius"));
        prius2.addMixin("mix:referenceable");
View Full Code Here

        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
        stub(workspace2.getName()).toReturn("workspace1");

        // Use the same id and location; use 'Nissan Altima'
        // since the UUIDs will be different (cars.xml doesn't define on this node) ...
        javax.jcr.Node altima2 = cache2.findJcrNode(null, path("/Cars/Hybrid/Nissan Altima"));
        altima2.addMixin("mix:referenceable");
View Full Code Here

        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository);
        stub(workspace2.getName()).toReturn("workspace1");

        // Use the same id and location ...
        javax.jcr.Node prius2 = cache2.findJcrNode(null, path("/Cars/Hybrid/Toyota Prius"));
        prius2.addMixin("mix:referenceable");
        prius.addMixin("mix:referenceable");
View Full Code Here

        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
        stub(workspace2.getName()).toReturn("workspace1");

        // Use the same id and location ...
        javax.jcr.Node prius2 = cache2.findJcrNode(null, path("/Cars/Hybrid/Toyota Prius"));
        assertThat(prius2.isSame(prius), is(false));
    }
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.