Package dev.getelements.elements.rt
Class SimpleIndexContext
java.lang.Object
dev.getelements.elements.rt.SimpleIndexContext
- All Implemented Interfaces:
IndexContext
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface dev.getelements.elements.rt.IndexContext
IndexContext.Listing, IndexContext.Unlink -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlinkAsync(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceIdto aPathdestination.voidvoidFetches aIndexContext.Listingof allPaths and assocaitedResourceIdinstances which match the providedPath.voidsetExecutorServiceFactory(ExecutorServiceFactory<ExecutorService> executorServiceFactory) voidsetResourceService(ResourceService resourceService) voidstart()Starts thisIndexContext.voidstop()Stops thisIndexContext.voidunlinkAsync(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Unlinks the providedPathand if this is the lastPathreference to aResourceId, then the cluster will remove and destroy the associatedResource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.rt.IndexContext
link, linkPath, list, unlink
-
Constructor Details
-
SimpleIndexContext
public SimpleIndexContext()
-
-
Method Details
-
start
public void start()Description copied from interface:IndexContextStarts thisIndexContext.- Specified by:
startin interfaceIndexContext
-
stop
public void stop()Description copied from interface:IndexContextStops thisIndexContext.- Specified by:
stopin interfaceIndexContext
-
listAsync
public void listAsync(Path path, Consumer<List<IndexContext.Listing>> success, Consumer<Throwable> failure) Description copied from interface:IndexContextFetches aIndexContext.Listingof allPaths and assocaitedResourceIdinstances which match the providedPath. Unlike other methods for linking and unlinking, the providedPathmay be a wildcard as determined byPath.isWildcard(). The suppliedListshould represent a complete buffering of allIndexContext.Listinginstances matching thePath.- Specified by:
listAsyncin interfaceIndexContext- Parameters:
path- thePathto matchsuccess- aConsumerwhich receives an instance ofIndexContext.Listingfailure- aConsumerwhich receives an exception indicating a failure reason.
-
linkAsync
public void linkAsync(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Description copied from interface:IndexContextLinks a singleResourceIdto aPathdestination.- Specified by:
linkAsyncin interfaceIndexContext- Parameters:
resourceId- the sourceResourceIdto linkdestination- thePathof the destination to linksuccess- aConsumerwhich will be called on successful completionfailure- aConsumerwhich will be called on a failure
-
linkPathAsync
public void linkPathAsync(Path source, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Description copied from interface:IndexContext- Specified by:
linkPathAsyncin interfaceIndexContext- Parameters:
source- the sourcePathto linkdestination- thePathof the destination to linksuccess- aConsumerwhich will be called on successful completionfailure- aConsumerwhich will be called on a failure
-
unlinkAsync
public void unlinkAsync(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Description copied from interface:IndexContextUnlinks the providedPathand if this is the lastPathreference to aResourceId, then the cluster will remove and destroy the associatedResource. Further details on the operation can be obtained through theIndexContext.Unlinkinterface. If the result is a complete removal, then this will have the same end result asResourceContext.destroy(ResourceId)orResourceContext.destroyAsync(Consumer, Consumer, ResourceId).- Specified by:
unlinkAsyncin interfaceIndexContext- Parameters:
path- the path to unlinksuccess- aConsumer<IndexContext.Unlink>to receive the successful operationfailure- aConsumer<Throwable>to receive an exception if one was generated
-
getExecutorService
-
getExecutorServiceFactory
-
setExecutorServiceFactory
@Inject public void setExecutorServiceFactory(@Named("dev.getelements.elements.rt.executor") ExecutorServiceFactory<ExecutorService> executorServiceFactory) -
getResourceService
-
setResourceService
-