Class Store

  • Direct Known Subclasses:
    AccumuloStore, FederatedStore, MapStore, ProxyStore

    public abstract class Store
    extends Object
    A Store backs a Graph and is responsible for storing the Elements and handling Operations. Operations and their corresponding OperationHandlers are registered in a map and used to handle provided operations - allowing different store implementations to handle the same operations in their own store specific way. Optional functionality can be added to store implementations defined by the StoreTraits.
    • Constructor Detail

      • Store

        public Store()
      • Store

        public Store​(Boolean addCoreOpHandlers)
    • Method Detail

      • createStore

        public static Store createStore​(String graphId,
                                        byte[] schema,
                                        Properties storeProperties)
      • updateJsonSerialiser

        public static void updateJsonSerialiser​(StoreProperties storeProperties)
      • updateJsonSerialiser

        public void updateJsonSerialiser()
      • execute

        public void execute​(Operation operation,
                            Context context)
                     throws OperationException
        Executes a given operation and returns the result.
        Parameters:
        operation - the operation to execute.
        context - the context executing the operation
        Throws:
        OperationException - thrown by the operation handler if the operation fails.
      • execute

        public <O> O execute​(Output<O> operation,
                             Context context)
                      throws OperationException
        Executes a given operation and returns the result.
        Type Parameters:
        O - the output type of the operation
        Parameters:
        operation - the operation to execute.
        context - the context executing the operation
        Returns:
        the result of executing the operation
        Throws:
        OperationException - thrown by the operation handler if the operation fails.
      • executeJob

        public JobDetail executeJob​(Operation operation,
                                    Context context)
                             throws OperationException
        Executes a given operation job and returns the job detail.
        Parameters:
        operation - the operation to execute.
        context - the context executing the job.
        Returns:
        the job detail.
        Throws:
        OperationException - thrown if jobs are not configured.
      • executeJob

        public JobDetail executeJob​(Job job,
                                    Context context)
                             throws OperationException
        Executes a given Job containing an Operation and/or Repeat and returns the job detail.
        Parameters:
        job - the job to execute.
        context - the context executing the job.
        Returns:
        the job detail.
        Throws:
        OperationException - thrown if there is an error running the job.
      • runAsync

        public void runAsync​(Runnable runnable)
      • getJobTracker

        public JobTracker getJobTracker()
      • getCaches

        public List<Cache<?,​?>> getCaches()
      • isSupported

        public boolean isSupported​(Class<? extends Operation> operationClass)
        Parameters:
        operationClass - the operation class to check
        Returns:
        true if the provided operation is supported.
      • getSupportedOperations

        public Set<Class<? extends Operation>> getSupportedOperations()
        Returns:
        a collection of all the supported Operations.
      • populateElement

        public Element populateElement​(Element lazyElement)
        Ensures all identifier and property values are populated on an element by triggering getters on the element for all identifier and properties in the Schema forcing a lazy element to load all of its values.
        Parameters:
        lazyElement - the lazy element
        Returns:
        the fully populated unwrapped element
      • getGraphId

        public String getGraphId()
      • getSchema

        public Schema getSchema()
        Get this Store's internal Schema.

        This is optimised and will usually differ from the original schema used to create the store initially.

        Returns:
        the instance of Schema used for describing the type of Elements to be stored and how to aggregate the elements.
      • setOriginalSchema

        public void setOriginalSchema​(Schema originalSchema)
        Set the Store's original Schema.

        This is used to keep an (unoptimised, unchanged) copy of the original schema used to create the store initially.

        Parameters:
        originalSchema - the Schema to be set as the original schema used to create this store
      • getOriginalSchema

        public Schema getOriginalSchema()
        Get the Store's original Schema.
        Returns:
        the Schema used to create this store, null if not set
      • setGraphLibrary

        public void setGraphLibrary​(GraphLibrary library)
      • optimiseSchema

        public void optimiseSchema()
      • validateSchemas

        public void validateSchemas()
      • createContext

        public Context createContext​(User user)