public Object call() throws RepositoryException { service.dispose(subscription); return null; } }, "dispose(Subscription)", new Object[]{});
public Object call() throws RepositoryException { return service.getIdFactory(); } }, "getIdFactory()", new Object[]{});
public Object call() throws RepositoryException { return service.getQValueFactory(); } }, "getQValueFactory()", new Object[]{});
public QNodeDefinition getRootNodeDefinition() throws RepositoryException { if (rootNodeDefinition == null) { IdFactory idFactory = service.getIdFactory(); PathFactory pf = service.getPathFactory(); rootNodeDefinition = service.getNodeDefinition( sessionInfo, idFactory.createNodeId((String) null, pf.getRootPath())); } return rootNodeDefinition; }
/** * * @param listener The listener to be removed. * @throws RepositoryException If an error occurs. */ public void removeEventListener(InternalEventListener listener) throws RepositoryException { synchronized (listeners) { listeners.remove(listener); if (listeners.isEmpty()) { service.dispose(subscription); subscription = null; } else { service.updateEventFilters(subscription, getEventFilters(listeners)); } } }
public void testEmptyValueArray2() throws RepositoryException { NodeId nid = getNodeId(testPath); Name propName = resolver.getQName("mvProperty"); Batch b = rs.createBatch(si, nid); b.addProperty(nid, propName, new QValue[] { rs.getQValueFactory().create(true)}); rs.submit(b); PropertyId pid = getPropertyId(nid, propName); b = rs.createBatch(si, pid); b.setValue(pid, new QValue[0]); rs.submit(b); PropertyInfo pi = rs.getPropertyInfo(si, pid); assertTrue(pi.isMultiValued()); assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues())); }
@Override protected void tearDown() throws Exception { try { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(testPath)); rs.submit(b); } finally { rs.dispose(si); super.tearDown(); } }
public void testCopy() throws RepositoryException { NodeId nid = null; try { NodeId srcId = getNodeId(testPath); NodeId destParentId = getNodeId("/"); rs.copy(si, si.getWorkspaceName(), srcId, destParentId, resolver.getQName("destname")); nid = getNodeId("/destname"); NodeInfo nInfo = rs.getNodeInfo(si, nid); Iterator<? extends ItemInfo> it = rs.getItemInfos(si, nid); assertTrue(it.hasNext()); NodeInfo nInfo2 = (NodeInfo) it.next(); assertEquals(nInfo.getId(), nInfo2.getId()); assertEquals(nInfo.getNodetype(), nInfo2.getNodetype()); } finally { if (nid != null) { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(nid); rs.submit(b); } } }
/** * @see Repository#login(javax.jcr.Credentials, String) */ public Session login(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException { SessionInfo info = config.getRepositoryService().obtain(credentials, workspaceName); try { if (info instanceof XASessionInfo) { return new XASessionImpl((XASessionInfo) info, this, config); } else { return new SessionImpl(info, this, config); } } catch (RepositoryException ex) { config.getRepositoryService().dispose(info); throw ex; } }
@Override protected void setUp() throws Exception { super.setUp(); rs = helper.getRepositoryService(); si = helper.getAdminSessionInfo(); NamespaceResolver nsResolver = new AbstractNamespaceResolver() { public String getURI(String prefix) throws NamespaceException { return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix; } public String getPrefix(String uri) throws NamespaceException { return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri; } }; resolver = new DefaultNamePathResolver(nsResolver); try { rs.getNodeInfo(si, getNodeId(testPath)); } catch (RepositoryException e) { Batch b = rs.createBatch(si, getNodeId("/")); b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null); rs.submit(b); } // todo: retrieve second wsp-name from config sInfo = rs.obtain(si, "test"); }
protected void setUp() throws Exception { super.setUp(); RepositoryService service = helper.getRepositoryService(); factory = service.getQValueFactory(); rootPath = service.getPathFactory().getRootPath(); testName = service.getNameFactory().create(Name.NS_JCR_URI, "data"); reference = getProperty("reference"); }
public void testUseConsumedBatch() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); b.addProperty(nid, resolver.getQName("any"), rs.getQValueFactory().create(1.34)); rs.submit(b); try { b.remove(nid); rs.submit(b); fail(); } catch (IllegalStateException e) { // success } } //--------------------------------------------------------------------------
public WorkspaceManager(RepositoryConfig config, SessionInfo sessionInfo, boolean observationSupported) throws RepositoryException { this.config = config; this.service = config.getRepositoryService(); this.sessionInfo = sessionInfo; this.observationSupported = observationSupported; this.nameFactory = service.getNameFactory(); this.pathFactory = service.getPathFactory(); idFactory = service.getIdFactory(); nsRegistry = new NamespaceRegistryImpl(this); ntRegistry = createNodeTypeRegistry(nsRegistry); definitionProvider = createDefinitionProvider(getEffectiveNodeTypeProvider()); TransientItemStateFactory stateFactory = createItemStateFactory(); this.isf = stateFactory; this.hierarchyManager = createHierarchyManager(stateFactory, idFactory); // If cache behavior is observation register a hierarchy listener which is // notified about all changes. Otherwise just add a hierarchy listener which // is only notified on changes for which client event listeners have been // installed. Note: this listener has to be the first one called in order // for the hierarchy to be consistent with the event (See JCR-2293). InternalEventListener listener = createHierarchyListener(hierarchyManager); CacheBehaviour cacheBehaviour = config.getCacheBehaviour(); if (cacheBehaviour == CacheBehaviour.OBSERVATION) { addEventListener(listener); } else { listeners.add(listener); } }
public void testCopyAcrossWorkspaces() throws RepositoryException { // todo: retrieve second wsp-name from config sInfo = rs.obtain(si, "test"); NodeId srcId = getNodeId(testPath); NodeId destParentId = getNodeId("/"); rs.copy(sInfo, si.getWorkspaceName(), srcId, destParentId, resolver.getQName("destname")); copiedId = getNodeId("/destname"); NodeInfo nInfo = rs.getNodeInfo(sInfo, copiedId); Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, copiedId); assertTrue(it.hasNext()); NodeInfo nInfo2 = (NodeInfo) it.next(); assertEquals(nInfo.getId(), nInfo2.getId()); assertEquals(nInfo.getNodetype(), nInfo2.getNodetype()); } }
public Object call() throws RepositoryException { return service.obtain(credentials, workspaceName); } }, "obtain(Credentials, String)", new Object[]{credentials, workspaceName});
public void testSetMixin() throws RepositoryException { NodeId nid = getNodeId(testPath); Batch b = rs.createBatch(si, nid); b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null); NodeId id = getNodeId(testPath + "/anyNode"); b.setMixins(id, new Name[] {NameConstants.MIX_LOCKABLE}); rs.submit(b); b = rs.createBatch(si, id); b.setMixins(id, new Name[0]); rs.submit(b); NodeInfo nInfo = rs.getNodeInfo(si, id); assertEquals(0, nInfo.getMixins().length); }
public NodeState createRootState(NodeEntry entry) throws ItemNotFoundException, RepositoryException { IdFactory idFactory = service.getIdFactory(); PathFactory pf = service.getPathFactory(); return createNodeState(idFactory.createNodeId((String) null, pf.getRootPath()), entry); }
public void testClone() throws RepositoryException { NodeId srcId = getNodeId(testPath); NodeId destParentId = getNodeId("/"); rs.clone(sInfo, si.getWorkspaceName(), srcId, destParentId, resolver.getQName("destname"), true); clonedId = getNodeId("/destname"); NodeInfo nInfo = rs.getNodeInfo(sInfo, clonedId); Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, clonedId); assertTrue(it.hasNext()); NodeInfo nInfo2 = (NodeInfo) it.next(); assertEquals(nInfo.getId(), nInfo2.getId()); assertEquals(nInfo.getNodetype(), nInfo2.getNodetype()); } }
private void removeTestNode(String path) throws RepositoryException { Batch b = rs.createBatch(si, getNodeId("/")); b.remove(getNodeId(path)); rs.submit(b); }
public Object call() throws RepositoryException { return service.getRepositoryDescriptors(); } }, "getRepositoryDescriptors()", new Object[]{});