/** * Submit a request to the supplied source, and block until the request has been processed. This method is typically used when * a federated request is forked into multiple source-specific requests, but the output of a source-specific request is * required before forking other source-specific requests. This pattern is common in requests that update one source and any * information not stored by that source needs to be stored in another source. * * @param request the request to be submitted; may not be null * @param sourceName the name of the source; may not be null * @throws InterruptedException if the current thread is interrupted while waiting * @see #submit(Request, String) * @see #submit(Request, String, CountDownLatch) */ protected void submitAndAwait( Request request, String sourceName ) throws InterruptedException { assert request != null; CompositeRequestChannel channel = channelBySourceName.get(sourceName); if (channel == null) { channel = new CompositeRequestChannel(sourceName); channelBySourceName.put(sourceName, channel); channel.start(executor, getExecutionContext(), connectionFactory); } channel.addAndAwait(request); }
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); }
/** * Index (or re-index) all of the content in all of the workspaces within the source. This method operates synchronously and * returns when the requested indexing is completed. * * @return this object for convenience in method chaining; never null * @throws RepositorySourceException if there is a problem accessing the content * @throws SearchEngineException if there is a problem updating the indexes * @throws IllegalArgumentException if the context is null, or if depth per read is not positive */ public SearchEngineIndexer indexAllWorkspaces() throws RepositorySourceException, SearchEngineException { // Get the names of all the workspaces ... GetWorkspacesRequest getWorkspaces = new GetWorkspacesRequest(); try { channel.addAndAwait(getWorkspaces); checkRequestForErrors(getWorkspaces); } catch (InterruptedException e) { // Clear the interrupted status of the thread and continue ... Thread.interrupted(); return this; } // Index all of the workspaces ... Path rootPath = context.getValueFactories().getPathFactory().createRootPath(); Location rootLocation = Location.create(rootPath); for (String workspaceName : getWorkspaces.getAvailableWorkspaceNames()) { index(workspaceName, rootLocation); } return this; }
channel.addAndAwait(readSubgraph); checkRequestForErrors(readSubgraph); } catch (InterruptedException e) { readSubgraph = new ReadBranchRequest(location, workspaceName, depthPerRead); try { channel.addAndAwait(readSubgraph); } catch (InterruptedException e) {