Interface CloudServiceImpl

  • All Known Implementing Classes:
    DefaultCloudServiceImpl

    public interface CloudServiceImpl
    This class must be implemented in order to create an implementation to resolve the cloud interface.
    Author:
    javaito
    • Method Summary

      Modifier and Type Method Description
      void createCache​(java.lang.String cacheName, java.util.Set<CloudCacheStrategy> strategies)
      Creates a instance of cache into the cloud using the specific strategy to specify the behavior of the cache instance.
      void dispatchEvent​(DistributedEvent event)
      Dispatch the event instance to the cloud.
      void forkWorker​(java.util.Map<java.lang.String,​java.lang.Object> workerConfig)
      This method start a worker over the cloud implementation to make a task and finish.
      CloudCache getCache​(java.lang.String cacheName)
      Return the instance of cache named with specific name.
      java.util.concurrent.locks.Condition getCondition​(java.lang.String conditionName, java.util.concurrent.locks.Lock lock)
      Return the distributed lock condition over specific lock object.
      Counter getCounter​(java.lang.String counterName)
      This method provides an implementation of distributed counter.
      java.util.concurrent.locks.Lock getLock​(java.lang.String lockName)
      Return the implementation of the Lock interface distributed.
      <K,​V>
      java.util.Map<K,​V>
      getMap​(java.lang.String mapName)
      This method provides an implementation of distributed map.
      <V> java.util.Queue<V> getQueue​(java.lang.String queueName)
      This method provides an implementation of distributed queue.
      java.lang.String getRegexFromDistributedLayer​(java.lang.Class<? extends LayerInterface> layerClass, java.lang.String implName)
      Returns the object that represent the distributed layer.
      <V> java.util.Set<V> getSet​(java.lang.String setName)
      This method provides an implementation of distributed set.
      boolean isLayerPublished​(java.lang.Class<? extends LayerInterface> layerClass, java.lang.String implName)
      This method verifies if the layer and name indicated are published into the cloud.
      <O> O layerInvoke​(java.lang.Class<? extends LayerInterface> layerClass, java.lang.String implName, java.lang.reflect.Method method, java.lang.Object... parameters)
      Invokes the remote instance of a layer.
      void lock​(java.lang.String resourceName)
      This method takes a resource an lock this for all the thread around the cluster and this resource has locked for all the thread for execution.
      void publishDistributedLayer​(java.lang.Class<? extends LayerInterface> layerClass, java.lang.String implName, java.lang.String regex)
      Publish a distributed layer into the cloud.
      void publishMe()
      This method must start the process of interaction with other services.
      void publishPlugin​(byte[] jarFile)
      This method send the plugin for all the nodes into the cloud.
      void shutdown()
      Shutdown hook
      void unlock​(java.lang.String resourceName)
      This method unlocks a previously locked resource.
    • Method Detail

      • getMap

        <K,​V> java.util.Map<K,​V> getMap​(java.lang.String mapName)
        This method provides an implementation of distributed map. All the nodes on the cluster shares this instance.
        Type Parameters:
        K - Type of the map's key.
        V - Type of the map's values.
        Parameters:
        mapName - Name of the map.
        Returns:
        Return the instance of the distributed map.
      • getQueue

        <V> java.util.Queue<V> getQueue​(java.lang.String queueName)
        This method provides an implementation of distributed queue. All the nodes on the cluster shares this instance.
        Type Parameters:
        V - Type of the queue's values.
        Parameters:
        queueName - Name of the queue.
        Returns:
        Return the instance of the distributed queue.
      • getSet

        <V> java.util.Set<V> getSet​(java.lang.String setName)
        This method provides an implementation of distributed set. All the nodes on the cloud shares this instance.
        Type Parameters:
        V - Type of the set's values.
        Parameters:
        setName - Name of the set.
        Returns:
        Return the instance of the distributed set.
      • getCounter

        Counter getCounter​(java.lang.String counterName)
        This method provides an implementation of distributed counter. All the nodes on the cloud shares this instance.
        Parameters:
        counterName - Name of the counter.
        Returns:
        Return thr instance of the counter.
      • lock

        void lock​(java.lang.String resourceName)
           throws java.lang.InterruptedException
        This method takes a resource an lock this for all the thread around the cluster and this resource has locked for all the thread for execution. This method is blocked until you can get the lock.
        Parameters:
        resourceName - The name of the resource to lock.
        Throws:
        java.lang.InterruptedException - Interrupted exception
      • unlock

        void unlock​(java.lang.String resourceName)
             throws java.lang.InterruptedException
        This method unlocks a previously locked resource.
        Parameters:
        resourceName - The name of the resource locked.
        Throws:
        java.lang.InterruptedException - Interrupted exception.
      • getLock

        java.util.concurrent.locks.Lock getLock​(java.lang.String lockName)
        Return the implementation of the Lock interface distributed.
        Parameters:
        lockName - Name of the lock.
        Returns:
        Distributed lock implementation.
      • getCondition

        java.util.concurrent.locks.Condition getCondition​(java.lang.String conditionName,
                                                          java.util.concurrent.locks.Lock lock)
        Return the distributed lock condition over specific lock object.
        Parameters:
        conditionName - Lock condition name.
        lock - Specific lock object.
        Returns:
        Return the lock condition.
      • createCache

        void createCache​(java.lang.String cacheName,
                         java.util.Set<CloudCacheStrategy> strategies)
        Creates a instance of cache into the cloud using the specific strategy to specify the behavior of the cache instance.
        Parameters:
        cacheName - Name of the cache instance.
        strategies - Set with the strategies for the cache instance.
      • getCache

        CloudCache getCache​(java.lang.String cacheName)
        Return the instance of cache named with specific name.
        Parameters:
        cacheName - Name of the instance of cache.
        Returns:
        Instance of cache.
      • dispatchEvent

        void dispatchEvent​(DistributedEvent event)
        Dispatch the event instance to the cloud.
        Parameters:
        event - Event instance.
      • publishDistributedLayer

        void publishDistributedLayer​(java.lang.Class<? extends LayerInterface> layerClass,
                                     java.lang.String implName,
                                     java.lang.String regex)
        Publish a distributed layer into the cloud.
        Parameters:
        layerClass - Layer class.
        implName - Layer implementation name.
        regex - Regex for match the implementation.
      • publishPlugin

        void publishPlugin​(byte[] jarFile)
        This method send the plugin for all the nodes into the cloud.
        Parameters:
        jarFile - Byte array that represents the jar file.
      • isLayerPublished

        boolean isLayerPublished​(java.lang.Class<? extends LayerInterface> layerClass,
                                 java.lang.String implName)
        This method verifies if the layer and name indicated are published into the cloud.
        Parameters:
        layerClass - Layer class.
        implName - Layer implementation name.
        Returns:
        Returns true if the layer is published and false in the otherwise.
      • getRegexFromDistributedLayer

        java.lang.String getRegexFromDistributedLayer​(java.lang.Class<? extends LayerInterface> layerClass,
                                                      java.lang.String implName)
        Returns the object that represent the distributed layer.
        Parameters:
        layerClass - Layer class.
        implName - Layer implementation name.
        Returns:
        Regex if exist or null.
      • layerInvoke

        <O> O layerInvoke​(java.lang.Class<? extends LayerInterface> layerClass,
                          java.lang.String implName,
                          java.lang.reflect.Method method,
                          java.lang.Object... parameters)
        Invokes the remote instance of a layer.
        Type Parameters:
        O - Expected return data type.
        Parameters:
        layerClass - Layer interface class.
        implName - Implementation name.
        method - Method to invoke.
        parameters - Parameters to invoke.
        Returns:
        Invocation result.
      • publishMe

        void publishMe()
        This method must start the process of interaction with other services.
      • forkWorker

        void forkWorker​(java.util.Map<java.lang.String,​java.lang.Object> workerConfig)
        This method start a worker over the cloud implementation to make a task and finish.
        Parameters:
        workerConfig - Map with all the parameters to configure a worker instance.
      • shutdown

        void shutdown()
        Shutdown hook