Dump ATG publishing cluster state

The ATG publishing infrastructure maintains a cluster state file on each target. This is used to sync up with the Business Control Center (“BCC”) content, and ensure they match. When troubleshooting, it can be helpful to print the contents of the cluster state file. What is below will do that. It also prints all methods, so you can add what you also need. It may be useful to simply execute each getter and print its return value(s).

import java.io.*;
import java.lang.reflect.*;

public class clusterDump {

  public static void main(String[] args) {
    FileInputStream fIn=null;
    ObjectInputStream oIn=null;

    try{
      fIn= new FileInputStream(args[0]);
      oIn = new ObjectInputStream(fIn);

      atg.deployment.common.ClusterStatus cluster = (atg.deployment.common.ClusterStatus) oIn.readObject();
      Class c = cluster.getClass();
      Method m[] = c.getDeclaredMethods();
      for (int i = 0; i < m.length; i++) {
        System.out.println(m[i]);
      }
      System.out.println("Cluster ID = " + cluster.getClusterID());
      System.out.println("Deployed snapshot = " + cluster.getDeployedSnapshot());
      String[] depProject = cluster.getDeploymentProjectIDs();
      for (int j = 0; j < depProject.length; j++) {
        System.out.println("Deployed project " + depProject[j]);
      }
    }
    catch(Exception e){
      e.printStackTrace();
    }
  }
}

Set the CLASSPATH to the following, changing the locations to where your EAR is located.

export CLASSPATH=.:/opt/jboss/kits/current/atglib/_PublishingAgent.base_slib_sclasses.jar:/opt/jboss/kits/current/atglib/_DAS_slib_sclasses.jar

The output of a run looks like the following...

-bash-4.1$ java clusterDump /opt/atg/ATG-Data/servers/p_ecm_01/PublishingAgent/data/cluster-stat-Express-PROD-CMH
protected java.lang.Object atg.deployment.common.ClusterStatus.clone() throws java.lang.CloneNotSupportedException
void atg.deployment.common.ClusterStatus.write()
void atg.deployment.common.ClusterStatus.delete()
static java.util.Map atg.deployment.common.ClusterStatus.read(atg.deployment.common.event.DeploymentEventSender,java.io.File,atg.nucleus.logging.ApplicationLogging)
public java.lang.String atg.deployment.common.ClusterStatus.getClusterID()
public java.lang.String atg.deployment.common.ClusterStatus.getDeployedSnapshot()
public java.lang.String[] atg.deployment.common.ClusterStatus.getDeploymentProjectIDs()
public void atg.deployment.common.ClusterStatus.setClusterID(java.lang.String)
public void atg.deployment.common.ClusterStatus.setDeploymentToSnapshot(java.lang.String)
public java.lang.String atg.deployment.common.ClusterStatus.getDeploymentToSnapshot()
public void atg.deployment.common.ClusterStatus.setDeploymentFromSnapshot(java.lang.String)
public java.lang.String atg.deployment.common.ClusterStatus.getDeploymentFromSnapshot()
public void atg.deployment.common.ClusterStatus.setDeploymentProjectIDs(java.lang.String[])
public void atg.deployment.common.ClusterStatus.setPrerequisiteDeploymentProjectIDs(java.lang.String[])
public java.lang.String[] atg.deployment.common.ClusterStatus.getPrerequisiteDeploymentProjectIDs()
public void atg.deployment.common.ClusterStatus.setDeployedSnapshot(java.lang.String)
public void atg.deployment.common.ClusterStatus.setDeployedSnapshotTimestamp(long)
public long atg.deployment.common.ClusterStatus.getDeployedSnapshotTimestamp()
public void atg.deployment.common.ClusterStatus.setAssetDestinations(java.util.Set)
public java.util.Set atg.deployment.common.ClusterStatus.getAssetDestinations()
public void atg.deployment.common.ClusterStatus.setClusterState(int)
public int atg.deployment.common.ClusterStatus.getClusterState()
public java.lang.String atg.deployment.common.ClusterStatus.getClusterStateString()
public static java.lang.String atg.deployment.common.ClusterStatus.clusterStateToString(int)
atg.deployment.common.ClusterStatus atg.deployment.common.ClusterStatus.getSafeCopy()
void atg.deployment.common.ClusterStatus.deploymentReset()
Cluster ID = PROD-XYZ
Deployed snapshot = 52808
Deployed project prj590041

You can do the same thing for the dep-stat file, using what is below.

import java.io.*;
import java.lang.reflect.*;

public class depStatDump {

  public static void main(String[] args) {
    FileInputStream fIn=null;
    ObjectInputStream oIn=null;

    try{
      fIn= new FileInputStream(args[0]);
      oIn = new ObjectInputStream(fIn);

      atg.deployment.common.Status cluster = (atg.deployment.common.Status) oIn.readObject();
/*
      Class c = cluster.getClass();
      Method m[] = c.getDeclaredMethods();
      for (int i = 0; i < m.length; i++) {
        System.out.println(m[i]);
      }
*/
      System.out.println("Deployed Snapshot = " + cluster.getDeployedSnapshot());
      System.out.println("Deployed snapshot time = " + new java.util.Date(cluster.getDeployedSnapshotTimestamp()));
      String[] depProject = cluster.getDeploymentProjectIDs();
      for (int j = 0; j < depProject.length; j++) {
        System.out.println("Deployed project " + depProject[j]);
      }
    }
    catch(Exception e){
      e.printStackTrace();
    }
  }
}

1 comment for “Dump ATG publishing cluster state

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.