Class Resource<R extends Resource<R,N>,N extends ResourceNode<R,N>>

java.lang.Object
com.aoapps.appcluster.Resource<R,N>
Direct Known Subclasses:
CronResource

public abstract class Resource<R extends Resource<R,N>,N extends ResourceNode<R,N>> extends Object
Monitors the status of a resource by monitoring its role based on DNS entries and synchronizing the resource on an as-needed and/or scheduled basis.
Author:
AO Industries, Inc.
See Also:
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getCluster

      public AppCluster getCluster()
      Gets the cluster this resource is part of.
    • getId

      public String getId()
      The unique ID of this resource.
    • isEnabled

      public boolean isEnabled()
      Determines if both the cluster and this resource are enabled.
    • getDisplay

      public String getDisplay()
      Gets the display name of this resource.
    • getMasterRecords

      public Set<? extends Name> getMasterRecords()
      Gets the set of master records that must all by the same. The master node is determined by matching these records against the resource node configuration's node records.
    • getMasterRecordsTtl

      public int getMasterRecordsTtl()
      Gets the expected TTL value for the master record.
    • getEnabledNameservers

      public Set<? extends Nameserver> getEnabledNameservers()
      Gets the set of all nameservers used by all enabled nodes.
    • getDnsMonitor

      public ResourceDnsMonitor getDnsMonitor()
      Gets the DNS monitor for this resource.
    • getResourceNodes

      public Set<? extends N> getResourceNodes()
    • getStatus

      public ResourceStatus getStatus()
      Gets the status of this resource based on disabled, last monitoring results, and synchronization state.
    • getAllowMultiMaster

      public abstract boolean getAllowMultiMaster()
      Gets if this resource allows multiple master servers.
    • getType

      public String getType()
      Gets the replication type of this resource.
    • newResourceSynchronizer

      protected abstract ResourceSynchronizer<R,N> newResourceSynchronizer(N localResourceNode, N remoteResourceNode, ResourceConfiguration<R,N> resourceConfiguration) throws AppClusterConfigurationException
      Creates the resource synchronizer for this specific type of resource or null if never performs any synchronization between these two nodes.
      Throws:
      AppClusterConfigurationException
    • getSynchronizers

      public Collection<ResourceSynchronizer<R,N>> getSynchronizers()
      Gets the set of resource synchronizers.
    • getSynchronizerMap

      public Map<Node,ResourceSynchronizer<R,N>> getSynchronizerMap()
      Gets a map-view of the resource synchronizers keyed on remote node. If the local node is not part of the resource nodes, returns an empty map.