public Map<Name, Property> on( Location location ) { return requests.readAllProperties(location, getCurrentWorkspaceName()).getPropertiesByName(); }
protected void assertNextRequestReadProperties( Location at, Property... properties ) { Request request = executedRequests.poll(); assertThat(request, is(instanceOf(ReadAllPropertiesRequest.class))); ReadAllPropertiesRequest readAll = (ReadAllPropertiesRequest)request; assertThat(readAll.at(), is(at)); Map<Name, Property> propsByName = new HashMap<Name, Property>(readAll.getPropertiesByName()); for (Property prop : properties) { assertThat(propsByName.remove(prop.getName()), is(prop)); } assertThat(propsByName.isEmpty(), is(true)); }
protected void indexProperties( String workspaceName, Location location ) { ReadAllPropertiesRequest readProps = new ReadAllPropertiesRequest(location, workspaceName); try { channel.addAndAwait(readProps); } catch (InterruptedException e) { // Clear the interrupted status of the thread and continue ... Thread.interrupted(); } checkRequestForErrors(readProps); // Now update the properties in the search engine ... location = readProps.getActualLocationOfNode(); Map<Name, Property> properties = readProps.getPropertiesByName(); UpdatePropertiesRequest request = new UpdatePropertiesRequest(location, workspaceName, properties, true); request.setActualLocationOfNode(location); process(request); checkRequestForErrors(readProps); }
@Test public void shouldAllowAddingProperties() { request = new ReadAllPropertiesRequest(validPathLocation, workspace1); request.addProperty(validProperty1); request.addProperty(validProperty2); assertThat(request.getProperties().size(), is(2)); assertThat(request.getProperties(), hasItems(validProperty1, validProperty2)); assertThat(request.getPropertiesByName().get(validProperty1.getName()), is(validProperty1)); assertThat(request.getPropertiesByName().get(validProperty2.getName()), is(validProperty2)); } }
/** * Process a request to read a single property of a node at the supplied location. * <p> * This method does nothing if the request is null. Unless overridden, this method converts the request that * {@link ReadAllPropertiesRequest reads the node} and simply returns the one property. * </p> * * @param request the read request */ public void process( ReadPropertyRequest request ) { if (request == null) return; ReadAllPropertiesRequest readNode = new ReadAllPropertiesRequest(request.on(), request.inWorkspace()); process(readNode); if (readNode.hasError()) { request.setError(readNode.getError()); return; } Property property = readNode.getPropertiesByName().get(request.named()); request.setProperty(property); // Set the actual location ... request.setActualLocationOfNode(readNode.getActualLocationOfNode()); setCacheableInfo(request); }
ReadAllPropertiesRequest readAll = (ReadAllPropertiesRequest)request; expires = computeExpirationTime(readAll); getOrCreateNode(readAll.getActualLocationOfNode(), expires).setProperties(readAll.getPropertiesByName()); break; case READ_PROPERTY:
ReadAllPropertiesRequest readAll = (ReadAllPropertiesRequest)request; expires = computeExpirationTime(readAll); getOrCreateNode(readAll.getActualLocationOfNode(), expires).setProperties(readAll.getPropertiesByName()); break; case READ_PROPERTY:
Map<Name, Property> properties = request.getPropertiesByName(); ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();