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 TypeMethodDescriptionvoid
linkAsync
(ResourceId resourceId, Path destination, Consumer<Void> success, Consumer<Throwable> failure) Links a singleResourceId
to aPath
destination.void
void
Fetches aIndexContext.Listing
of allPath
s and assocaitedResourceId
instances which match the providedPath
.void
setExecutorServiceFactory
(ExecutorServiceFactory<ExecutorService> executorServiceFactory) void
setResourceService
(ResourceService resourceService) void
start()
Starts thisIndexContext
.void
stop()
Stops thisIndexContext
.void
unlinkAsync
(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Unlinks the providedPath
and if this is the lastPath
reference 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, wait
Methods 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:IndexContext
Starts thisIndexContext
.- Specified by:
start
in interfaceIndexContext
-
stop
public void stop()Description copied from interface:IndexContext
Stops thisIndexContext
.- Specified by:
stop
in interfaceIndexContext
-
listAsync
public void listAsync(Path path, Consumer<List<IndexContext.Listing>> success, Consumer<Throwable> failure) Description copied from interface:IndexContext
Fetches aIndexContext.Listing
of allPath
s and assocaitedResourceId
instances which match the providedPath
. Unlike other methods for linking and unlinking, the providedPath
may be a wildcard as determined byPath.isWildcard()
. The suppliedList
should represent a complete buffering of allIndexContext.Listing
instances matching thePath
.- Specified by:
listAsync
in interfaceIndexContext
- Parameters:
path
- thePath
to matchsuccess
- aConsumer
which receives an instance ofIndexContext.Listing
failure
- aConsumer
which 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:IndexContext
Links a singleResourceId
to aPath
destination.- Specified by:
linkAsync
in interfaceIndexContext
- Parameters:
resourceId
- the sourceResourceId
to linkdestination
- thePath
of the destination to linksuccess
- aConsumer
which will be called on successful completionfailure
- aConsumer
which 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:
linkPathAsync
in interfaceIndexContext
- Parameters:
source
- the sourcePath
to linkdestination
- thePath
of the destination to linksuccess
- aConsumer
which will be called on successful completionfailure
- aConsumer
which will be called on a failure
-
unlinkAsync
public void unlinkAsync(Path path, Consumer<IndexContext.Unlink> success, Consumer<Throwable> failure) Description copied from interface:IndexContext
Unlinks the providedPath
and if this is the lastPath
reference to aResourceId
, then the cluster will remove and destroy the associatedResource
. Further details on the operation can be obtained through theIndexContext.Unlink
interface. 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:
unlinkAsync
in 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
-