Class ClusterXML

java.lang.Object
com.j_spaces.core.cluster.ClusterXML

public class ClusterXML extends Object
Copyright (c) 2010 GigaSpaces Technologies Ltd. All rights reserved The software source code is proprietary and confidential information of GigaSpaces. You may use the software source code solely under the terms and limitations of The license agreement granted to you by GigaSpaces.
  • Field Details

  • Constructor Details

    • ClusterXML

      public ClusterXML(SpaceURL spaceURL, String clusterConfigUrl, String spaceName) throws IOException, SAXException, ParserConfigurationException, CreateException
      This constructor is used for both cases: when cluster parameters are passed viw SpaceFinder and for the case when cluster URL is passed.
      Throws:
      IOException
      SAXException
      ParserConfigurationException
      CreateException
    • ClusterXML

      public ClusterXML(int _totalMembers, int _backupMembers, String _clusterSchemaName, String _clusterName, String _distCacheConfigName) throws IOException, SAXException, ParserConfigurationException, CreateException
      SEMI-DYNAMIC CLUSTERING ONLY !!! =================================== Constructor- Used when the cluster is setuped using the SpaceFinder and The cluster_schema etc. attributes are passed as well. In this case we do not load any cluster xml file from the resource bundle but we build a Dom tree in the memory using the inputs from the SpaceFinder. Then, together with the cluster schema XSL file (which is loaded from the resource bundle, using the cluster_schema name) we execute the XSLT parser and get the Cluster config dom tree, used as input in the ClusterXML existed logic.
      Parameters:
      _totalMembers - stands for the SpaceURL primary instances part of the ?total_numbers option
      _backupMembers - stands for the SpaceURL backups part of the ?total_numbers option, total_members={number of primary instances, number of backup instances per primary} In this example the value is 4,2 which means that this cluster contains up to 4 primary instances each containing 2 backup instances.
      _clusterSchemaName - stands for the SpaceURL ?cluster_schema option
      _clusterName - stands for the SpaceURL space/container ?schema option
      Throws:
      IOException
      SAXException
      ParserConfigurationException
      CreateException
      See Also:
      • com.j_spaces.kernel.JSpaceUtilities.buildClusterXMLDom()
    • ClusterXML

      public ClusterXML(String clusterConfigURLs) throws IOException, SAXException, ParserConfigurationException, CreateException
      Constructor.
      Parameters:
      clusterConfigURLs - The URLs is a (white space separated) list of URLs that indicate the location of the cluster configuration file.
      Throws:
      IOException
      SAXException
      ParserConfigurationException
      CreateException
    • ClusterXML

      public ClusterXML(Document doc, String clusterConfigFile)
      This constructor should receive a root document object that represent the cluster xml file.
  • Method Details

    • useClusterSchema

      public boolean useClusterSchema()
      Return true if used cluster schema, otherwise false.
    • isGenerateMembersDynamically

      public boolean isGenerateMembersDynamically()
    • getClusterSchemaName

      public String getClusterSchemaName()
      Return cluster schema name.
      Returns:
      If used return String value, otherwise null
    • getClusterMemberNames

      public String[] getClusterMemberNames()
      Return the String array objects that contain all cluster member names.
    • getGroupMemberNames

      public String[] getGroupMemberNames()
      Return the String array objects that contain all cluster member names for all groups.
    • createClusterPolicy

      public ClusterPolicy createClusterPolicy(String clusterMemberName) throws CreateException
      Creating cluster policy object.
      Parameters:
      clusterMemberName - Cluster member name for creating
      Throws:
      CreateException
    • getFirstMatchElement

      public static Element getFirstMatchElement(Element elem, String elemName)
    • getNodeValueIfExists

      public static String getNodeValueIfExists(Element parentNode, String nodeName)
    • getNodeValueIfExists

      public static String getNodeValueIfExists(Element parentNode, String nodeName, String defaultValue)
    • getNodeValueIfExists

      public static String getNodeValueIfExists(Document doc, String nodeName)
    • calculateOneWayReplicationValue

      public static boolean calculateOneWayReplicationValue(String replicationMode)
    • calculateSyncReplicationValue

      public static boolean calculateSyncReplicationValue(String replicationMode)
    • calculateReplicationMode

      public static String calculateReplicationMode(boolean isSyncReplication, boolean isOneWayReplication)
    • createReplDescPolicy

      public ReplicationPolicy.ReplicationPolicyDescription createReplDescPolicy(String sourceMemberName, Element groupMemberNode, List<String> groupMemList) throws CreateException
      Creates replication policy description for every repl group member.
      Parameters:
      sourceMemberName - Name of member for which creating ReplicationPolicyDescription
      groupMemberNode - Member XML Element
      Returns:
      ReplicationPolicy.ReplicationPolicyDescription
      Throws:
      CreateException
    • getXMLRootDocument

      public Document getXMLRootDocument()
      return root Document of parsed XML file.
    • getClusterFileURL

      public String getClusterFileURL()
      returns current cluster config file.
    • addMember

      public void addMember(String ownerMemberName, String targetMemberName, String targetMemberURL) throws ClusterException
      Add targetMember member in the same replication group of ownerMemberName member and update Cluster XML file.
      Parameters:
      ownerMemberName - The owner member.
      targetMemberName - The target member to add.
      targetMemberURL - The target member URL.
      Throws:
      ClusterException - Throws if ownderMemberName not found in no replication group, or failed to update cluster xml file.
    • removeMember

      public void removeMember(String targetMemberName) throws ClusterException
      Remove targetMemberName member from replication group and update Cluster XML file.
      Parameters:
      targetMemberName - The member to remove from XML file.
      Throws:
      ClusterException - Throws if the targetMemberName not found in no replication group or failed to update Cluster XML file.
    • changeMember

      public void changeMember(String sourceMember, String targetMember, String targetMemberURL) throws ClusterException
      Change member info in replication group and update xml file.
      Parameters:
      sourceMember - Source member name.
      targetMember - Target name
      targetMemberURL - Target URL
      Throws:
      ClusterException - Throws if sourceMember not found in XML file.
      See Also:
    • getClusterConfigDebugOutput

      public StringBuilder getClusterConfigDebugOutput()
      Returns:
      Returns the clusterConfigDebugOutput of the Cluster Configuration structure if debug mode is turned on.
    • supportsBackup

      public static boolean supportsBackup(String clusterSchema)
    • getFailOverPolicies

      public static List<String> getFailOverPolicies()