CommuniGate Pro
 


 

CommuniGate Pro Java Interface



The CommuniGate Pro CLI API can be used to automate the Server management and to integrate the CommuniGate Pro and other services.

The following document, scripts and samples should help you to integrate CommuniGate Pro with programs and applets written in Java language.

The com.SBK.CGPro package

The CGProCLI.jar is the package archive that contains the necessary components for CommuniGate Pro scripting. It includes the CGProCLI class with the routines to connect to the CommuniGate Pro server over the network, to send CommuniGate Pro CLI commands and to convert command parameters from the Java internal format into the CommuniGate Pro CLI format, and to convert command results back into the Java internal format; and the CGProException class which contains the exception thrown by CGProCLI class routines.

You should use the

 import com.SBK.CGPro.*;
statement in the beginning of your program to import the package, and the
 new CGProCLI(host,port,login,password)
command to establish an authenticated connection with the CommuniGate Pro server and to create an interface object. Then you can send commands to the server by calling various interface object methods.

Sample Programs:

You can use the following sample Java Applets that employ the com.SBK.CGPro package:

AppletDescription
ListAccounts.html This Java applet lists the accounts of the specified CGPro domain
CreateAccount.html This Java applet shows a custom Auto-Signup page and registers a user with the CommuniGate Pro Server

You can use the following sample Java Servlets that employ the com.SBK.CGPro package:

Source fileCompiled classDescription
ListAccountsServlet.java ListAccountsServlet.jar This Java servlet lists the accounts of the specified CGPro domain
ListTotalsServlet.java ListTotalsServlet.jar This Java servlet tells the number of accounts, groups and forwarders in each CommuniGate Pro domain and their total numbers.
CreateAccountServlet.java CreateAccountServlet.jar This Java servlet shows a custom Auto-Signup page and registers a user with the CommuniGate Pro Server

The Package commands

Package Service Commands

CGProCLI CGroCLI(String CGPaddress, int PeerPort, String username, String password) throws CGProException
Use this command to connect to CommuniGate Pro and log into its PWD server.
Parameters:

CGPaddress:
Domain name or IP address to connect to. The address can be follwed by port number.

port:
Port number (use 106 for PWD).

username:
The administrator or user account name. The name can contain a domain part.

password:
the administrator or user account password.

Returns:
a reference to a new class.

Example:

  CGProCLI cli=null;  
  try {
    cli= new CGProCLI("company.com",106,"postmaster@company.com","pass");
  } catch (Exception x) {
    System.out.println(x.getMessage());
  }

void logout()
Use this command to close the CommuniGate Pro CLI session.

Example:

  if(cli!=null) cli.logout();

static String encodeString(String str)
Use this command to encode strings into CGPro string format. This command replaces \n characters with \e and nonprintable characters with \nnn and converts 2-byte characters into UTF-8 byte sequence.
Example:
  System.out.println(CGProCLI.encodeString("line1\nline2"));

static String decodeString(String str)
Use this command to decode CGPro strings into printable form. This command replaces \e and \nnn subsequences into appropriate characters, and converts bytes into 2-byte characters.
Example:
  System.out.println(CGProCLI.decodeString("line1\eline2"));

void sendCommand(String command) throws CGProException
Use this call to send a direct command to CommuniGatePro CLI.
Example:
  try {
    cli.sendCommand("CreateAccount john@company.com {RealName=\"John X Smith\";}");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Object getResponseData() throws CGProException
Use this call to get the output caused by sendCommand call (if any).
Example:
  try {
    cli.sendCommand("ListAccounts company.com");
    Hashtable accounts=(Hashtable)cli.getResponseData();
    for(Enumeration e = accounts.keys(); e.hasMoreElements();) {
      System.out.println((String)e.nextElement());
    }   
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDebug(boolean trace)
Use this call to cause all traffic between CGPro and the Java to be printed in the Java console.
Example:
  cli.setDebug(true);

static void setSecureLogin(boolean secure)
Use this call to switch between APOP and clear text login methods. The default method is APOP which is secure.
Example:
  CGProCLI cli=null;  
  try {
    CGProCLI.setSecureLogin(false);
    cli= new CGProCLI("company.com",106,"postmaster@company.com","pass");
  } catch (Exception x) {
    System.out.println(x.getMessage());
  }

int getErrCode()
Use this call to get the result code.
Example:
  try {
    cli.sendCommand("blah blah blah");
  }catch(CGProException e) {
    System.out.println("error code="+cli.getErrCode());
    System.out.println("error message="+e.getMessage());
  }

String version()
Use this call to learn the class internal version number.
Example:
  System.out.println(cli.version());


The following commands resemble the CommuniGate Pro Server CLI commands, and use the Java "Hashtable" and "Vector" classes for the CommuniGate Pro "dictionary" and "array" objects. See the CommuniGate Pro CLI manual section for the details.

Account Administration Commands

void createAccount(String accountName, Hashtable settings, String accountType,boolean external)
Example:
  Hashtable settings=new Hashtable();
  settings.put("RealName","Jojn X. Smith");
  settings.put("MaxAccountSize","100K");
    Vector accModes=new Vector();
    accModes.addElement("Mail");
    accModes.addElement("POP");
    accModes.addElement("IMAP");
    accModes.addElement("PWD");
    accModes.addElement("WebMail");     
  settings.put("AccessModes",accModes);
  try {
    cli.createAccount("john@company.com",settings,null,false);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameAccount(String oldAccountName, String newAccountName) throws CGProException
Example:
  try {
    String domain="@company.com";
    cli.renameAccount("john"+domain,"js"+domain);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteAccount(String accountName) throws CGProException
Example:
  try {
    cli.deleteAccount("js@company.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

setAccountType(String accountName, String accountType) throws CGProException
Example:
  try {
    cli.setAccountType("js@company.com","AGrade"); //MultiMailbox | AGrade | BGrade | CGrade
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountSettings(String accountName) throws CGProException
Example:
  
  try {
    Hashtable settings=cli.getAccountSettings("js@company.com");
    for(Enumeration e = settings.keys(); e.hasMoreElements();) {
      String key=(String)e.nextElement();
      Object value=settings.get(key);
      System.out.println(key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountEffectiveSettings(String accountName) throws CGProException

void updateAccountSettings(String accountName, Hashtable settings) throws CGProException
Example:
  Hashtable settings=new Hashtable();
  settings.put("Password","pass");
  settings.put("MaxAccountSize","200K");
  try {
    cli.updateAccountSettings("john@company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountSettings(String accountName, Hashtable settings) throws CGProException

void setAccountPassword(String accountName, String newPassword) throws CGProException
Example:
  try {
    cli.setAccountPassword("john@company.com","jSmitH");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

boolean verifyAccountPassword(String accountName, String password) throws CGProException
Example:
  try {
    if(cli.verifyAccountPassword("john@company.com","jSmitH")==true) System.out.println("OK");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector getAccountAliases(String accountName) throws CGProException
Example:
  try {
    Vector aliases=cli.getAccountAliases("john@company.com");
    System.out.println(aliases);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector getAccountTelnums(String accountName) throws CGProException

void setAccountAliases(String accountName, Vector aliases) throws CGProException
Example:
  try {
    Vector aliases=cli.getAccountAliases("john@company.com");
    aliases.addElement("jsmith");
    cli.setAccountAliases("john@company.com",aliases);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountTelnums(String accountName, Vector telnums) throws CGProException

Vector getAccountMailRules(String accountName) throws CGProException
Example:
  try {
    Vector rules=cli.getAccountMailRules("john@company.com");
    for(int idx=0;idx<rules.size();idx++) {
      Vector rule=(Vector)rules.elementAt(idx);
      System.out.println("\nName="+rule.elementAt(1)+" Priority="+rule.elementAt(0));
      Vector conditions=(Vector)rule.elementAt(2);
      Vector actions=(Vector)rule.elementAt(3);

      System.out.println("  If");
      for(int idxc=0;idxc<conditions.size();idxc++) {
        System.out.println("   "+conditions.elementAt(idxc));
      }
      System.out.println("  Then");
      for(int idxa=0;idxa<actions.size();idxa++) {
        System.out.println("   "+actions.elementAt(idxa));
      }

    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountMailRules(String accountName, Vector rules) throws CGProException
Example:
  try {
    Vector rules=new Vector();
    Vector rule1=new Vector();
    Vector conditions=new Vector();
    Vector actions=new Vector();
     
     Vector condition1=new Vector();
      condition1.addElement("Subject");
      condition1.addElement("is");
      condition1.addElement("*URGENT*");
     Vector condition2=new Vector();
      condition2.addElement("From");
      condition2.addElement("is");
      condition2.addElement("boss@company.com");
    conditions.addElement(condition1);
    conditions.addElement(condition2);
  
     Vector action1=new Vector();
      action1.addElement("Mark");
      action1.addElement("Flagged");
     Vector action2=new Vector();
      action2.addElement("Reply with");
      action2.addElement("OK, boss.");
    actions.addElement(action1);
    actions.addElement(action2);
  
    rule1.addElement("5");  //priority
    rule1.addElement("MyRule");  //rule name
    rule1.addElement(conditions);
    rule1.addElement(actions);
    
    rules.addElement(rule1);
    cli.setAccountRules("john@company.com",rules);

  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateAccountMailRule(String accountName, Vector rule) throws CGProException

Vector getAccountSignalRules(String accountName) throws CGProException

void setAccountSignalRules(String accountName, Vector rules) throws CGProException

void updateAccountSignalRule(String accountName, Vector rule) throws CGProException

Hashtable getAccountRPOPs(String accountName) throws CGProException
Example:
  try {
    Hashtable records=cli.getAccountRPOPs("john@company.com");
    for(Enumeration e = records.keys(); e.hasMoreElements();) {
      String key=(String)e.nextElement();
      Hashtable value=(Hashtable)records.get(key);
      System.out.println("Settings for "+key+":");
      for(Enumeration e2 = value.keys(); e2.hasMoreElements();) {
        String key2=(String)e2.nextElement();
        Object value2=value.get(key2);
        System.out.println(" "+key2+"="+value2);
      }
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountRPOPs(String accountName, Hashtable records) throws CGProException

Hashtable getAccountRSIPs(String accountName) throws CGProException

void setAccountRSIPs(String accountName, Hashtable records) throws CGProException
Example:
  try {
    Hashtable records=new Hashtable();
     Hashtable aRec=new Hashtable();
     aRec.put("fromName","+123456789@domain.com");
     aRec.put("period","2h");
     aRec.put("domain","sip.provider.dom");
     aRec.put("authName","user");
     aRec.put("password","pass");
     aRec.put("targetName","altuser@domainx.dom");
    records.put("aRecord",aRec);
    cli.setAccountRSIPs("john@company.com",records);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public void updateScheduledTask(String accountName, Hashtable taskData) throws CGProException

Vector getAccountRights(String accountName) throws CGProException
Example:
  try {
    Vector rights=cli.getAccountRights("john@company.com");
    if(rights.size()==0)
        System.out.println("no rights."); 
      else
        System.out.println(rights);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountRights(String accountName, Vector rights) throws CGProException
Example:
  try {
    Vector rights=cli.getAccountRights("john@company.com");
    rights.addElement("Domain");
    rights.addElement("CanCreateAccounts");
    cli.setAccountRights("john@company.com",rights);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Object getAccountInfo(String accountName,String key) throws CGProException
Example:
  try {
    String account="john@company.com";
    System.out.println("Storage:"+cli.getAccountInfo(account,"StorageUsed"));  
    System.out.println("Subscription:"+cli.getAccountInfo(account,"Subscription"));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountPrefs(String accountName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountPrefs("john@company.com");
    for(Enumeration e = settings.keys(); e.hasMoreElements();) {
      String key=(String)e.nextElement();
      Object value=settings.get(key);
      System.out.println(key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

setAccountPrefs(String accountName, Hashtable settings) throws CGProException

updateAccountPrefs(String accountName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();  
    settings.put("Frames","YES");
    settings.put("DraftsBox","DRAFTS");
    settings.put("SentBox","OUTBOX");
    settings.put("Signature","Sincerely yours,\\e John");
    cli.updateAccountPrefs("john@company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountEffectivePrefs(String accountName) throws CGProException

void killAccountSessions(String accountName) throws CGProException

Hashtable getAccountACL(String accountName, String authAccountName) throws CGProException

void setAccountACL(String accountName, String authAccountName, Hashtable newACL) throws CGProException

String getAccountACLRights(String accountName, String authAccountName) throws CGProException

String getAccountLocation(String accountName) throws CGProException
Example:
  try {
    String path=cli.getAccountLocation("user");
    System.out.println("The account directory is /var/CommuniGate/Accounts/"+path);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getAccountPresence(String accountName) throws CGProException


Group Administration Commands

Vector listGroups(String domainName) throws CGProException
Example:
  try {
    System.out.println(cli.listGroups(null)); //list groups for the main domain
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createGroup(String groupName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();  
    settings.put("RealName","Sales staff");
    settings.put("FinalDelivery","YES");
    settings.put("RemoveToAndCc","YES");
    settings.put("SetReplyTo","YES");
      Vector members=new Vector();
      members.addElement("john");
      members.addElement("sales_box#mary");
      members.addElement("bill@partner.dom");
    settings.put("Members",members);

    cli.createGroup("sales@company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameGroup(String oldGroupName, String newGroupName) throws CGProException
Example:
  try {
    cli.renameGroup("sales@company.com","support");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteGroup(String groupName) throws CGProException
Example:
  try {
    cli.deleteGroup("support@company.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getGroup(String groupName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getGroup("sales@company.com");
    for(Enumeration e = settings.keys(); e.hasMoreElements();) {
      String key=(String)e.nextElement();
      Object value=settings.get(key);
      System.out.println(key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setGroup(String groupName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=cli.getGroup("sales@company.com");
      Vector members=(Vector)settings.get("Members");
      members.addElement("john");
    settings.put("Members",members);
    cli.setGroup("sales@company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Forwarder Administration Commands

Vector listForwarders(String domainName) throws CGProException
Example:
  try {
    System.out.println(cli.listForwarders(null)); //list forwarders for the main domain
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createForwarder(String forwarderName, String address) throws CGProException
Example:
  try {
    cli.createForwarder("john@company.com","john@external.site.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameForwarder(String oldForwarderName, String newForwarderName) throws CGProException

void deleteForwarder(String forwarderName) throws CGProException
Example:
  try {
    cli.deleteForwarder("john@company.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getForwarder(String forwarderName) throws CGProException
Example:
  try {
    System.out.println("Address is "+cli.getForwarder("john@company.com"));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector findForwarders(String domainName,String forwarderAddress) throws CGProException
Example:
  try {
    System.out.println(cli.findForwarders("company.com","john@external.site.com"));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Domain Set Administration Commands

Vector listDomains() throws CGProException
Example:
  try {
    System.out.println(cli.listDomains()); 
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String mainDomainName() throws CGProException
Example:
  try {
    System.out.println("The main domain name is "+cli.mainDomainName()); 
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getDomainDefaults() throws CGProException
Example:
  try {
    Hashtable settings=cli.getDomainDefaults();  
    System.out.println("The default domain settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateDomainDefaults(Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("MailToUnknown","Rejected");
    cli.updateDomainDefaults(settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDomainDefaults(Hashtable settings) throws CGProException

Hashtable getClusterDomainDefaults() throws CGProException

void updateClusterDomainDefaults(Hashtable settings) throws CGProException

void setClusterDomainDefaults(Hashtable settings) throws CGProException

Hashtable getServerAccountDefaults() throws CGProException
Example:
  try {
    Hashtable settings=cli.getServerAccountDefaults();  
    System.out.println("The default settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateServerAccountDefaults(Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("AccessModes","All");
    cli.updateServerAccountsDefaults(settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setServerAccountDefaults(Hashtable settings) throws CGProException

Hashtable getClusterAccountDefaults() throws CGProException

void updateClusterAccountDefaults(Hashtable settings) throws CGProException

void setClusterAccountDefaults(Hashtable settings) throws CGProException

public Hashtable getServerAccountPrefs() throws CGProException

public void updateServerAccountPrefs(Hashtable settings) throws CGProException

public void setServerAccountPrefs(Hashtable settings) throws CGProException

public Hashtable getClusterAccountPrefs() throws CGProException

public void updateClusterAccountPrefs(Hashtable settings) throws CGProException

public void setClusterAccountPrefs(Hashtable settings) throws CGProException

void createDomain(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    cli.createDomain("www.company.com",null);  //create domain with default settings
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameDomain(String oldDomainName, String newDomainName) throws CGProException
Example:
  try {
    cli.renameDomain("www.company.com","new.company.com");  
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteDomain(String domainName,boolean force) throws CGProException
Example:
  try {
    cli.deleteDomain("new.company.com",true);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createSharedDomain(String domainName, Hashtable settings) throws CGProException

void createDirectoryDomain(String domainName, Hashtable settings) throws CGProException

void reloadDirectoryDomains() throws CGProException
Example:
  try {
    cli.reloadDirectoryDomains();  
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable listServerTelnums(String filter,int limit) throws CGProException

Hashtable listClusterTelnums(String filter,int limit) throws CGProException

Vector getServerTrustedCerts() throws CGProException

void setServerTrustedCerts(Vector certificates) throws CGProException

Vector getClusterTrustedCerts() throws CGProException

void setClusterTrustedCerts(Vector certificates) throws CGProException

Hashtable getDirectoryIntegration() throws CGProException
Example:
  try {
    Hashtable settings=cli.getDirectoryIntegration();  
    System.out.println("The directory integration settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDirectoryIntegration(Hashtable settings) throws CGProException

Hashtable getClusterDirectoryIntegration() throws CGProException

void setClusterDirectoryIntegration(Hashtable settings) throws CGProException


Domain Administration Commands

Hashtable getDomainSettings(String domainName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getDomain(null);  //get main domain settings
    for(Enumeration e = settings.keys(); e.hasMoreElements();) {
      String key=(String)e.nextElement();
      Object value=settings.get(key);
      System.out.println(key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getDomainEffectiveSettings(String domainName) throws CGProException

void updateDomainSettings(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("WebUserCache","NO");
    cli.updateDomain("www.company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDomainSettings(String domainName, Hashtable settings) throws CGProException

Hashtable getAccountDefaults(String domainName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountDefaults("company.com");  
    System.out.println("The default account settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateAccountDefaults(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("MaxAccountSize","100K");
    cli.updateAccountDefaults("company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountDefaults(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountDefaults("company.com");
    settings.put("MaxAccountSize","100K");
    cli.setAccountDefaults("company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountDefaultPrefs(String domainName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountDefaultPrefs("company.com");  
    System.out.println("The default WebUser settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountDefaultPrefs(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountDefaultPrefs("company.com");  
    settings.put("Charset","ISO-8859-1");
    settings.put("DeleteMode","Immediately");
    cli.setAccountDefaultPrefs("company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateAccountDefaultPrefs(String domainName, Hashtable settings) throws CGProException

Hashtable getAccountTemplate(String domainName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountTemplate("company.com");  
    System.out.println("The template account settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateAccountTemplate(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("InitialMessage","Welcome to CommuniGate Pro!!!");
    settings.put("MaxAccountSize","unlimited");
      Vector mboxes=new Vector();
      mboxes.addElement("SentItems");
      mboxes.addElement("Drafts");
    settings.put("InitialMailboxes",mboxes);  
    cli.updateAccountTemplate("company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setAccountTemplate(String domainName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=cli.getAccountTemplate("company.com");  
    settings.put("InitialMessage","Welcome to CommuniGate Pro!!!");
    settings.put("MaxAccountSize","unlimited");
      Vector mboxes=new Vector();
      mboxes.addElement("SentItems");
      mboxes.addElement("Drafts");
    settings.put("InitialMailboxes",mboxes);  
    cli.setAccountTemplate("company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public Vector getDomainMailRules(String domainName) throws CGProException

public void setDomainMailRules(String domainName, Vector rules) throws CGProException

void updateDomainSignalRule(String DomainName, Vector rule) throws CGProException

Vector getDomainSignalRules(String DomainName) throws CGProException

void setDomainSignalRules(String DomainName, Vector rules) throws CGProException

void updateDomainSignalRule(String DomainName, Vector rule) throws CGProException

Vector getDomainAliases(String domainName) throws CGProException
Example:
  try {
    System.out.println(cli.getDomainAliases("company.com"));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDomainAliases(String domainName, Vector aliases) throws CGProException
Example:
  try {
    Vector aliases=cli.getDomainAliases("company.com");
    aliases.addElement("mail.company.com");
    aliases.addElement("smtp.company.com");
    cli.setDomainAliases("company.com",aliases);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector listAdminDomains(String domainName) throws CGProException

Hashtable listAccounts() throws CGProException

Hashtable listAccounts(String domainName) throws CGProException
Example:
  try {
    Hashtable accounts=cli.listAccounts("company.com");
    for(Enumeration e = accounts.keys(); e.hasMoreElements();) {
      System.out.println((String)e.nextElement());
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector listDomainObjects(String domainName,String filter,int limit,String objectTypes,String cookie) throws CGProException

Hashtable listDomainTelnums(String domainName,String filter,int limit) throws CGProException

void insertDirectoryRecords(String domainName) throws CGProException

void deleteDirectoryRecords(String domainName) throws CGProException

String getDomainLocation(String domainName) throws CGProException
Example:
  try {
    String path=cli.getDomainLocation("company.com");
    System.out.println("The domain directory is /var/CommuniGate/"+path);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void suspendDomain(String domainName) throws CGProException

void resumeDomain(String domainName) throws CGProException


Mailbox Administration Commands

Hashtable listMailboxes(String accountName,String filter,String auth) throws CGProException
Example:
  try {
    Hashtable boxes=cli.listMailboxes("john@company.com",null,null);  
    System.out.println("The John's mailboxes are:");
    for(Enumeration e = boxes.keys() ; e.hasMoreElements() ;) {
       String name=(String)e.nextElement();
       Object value=boxes.get(name);
       System.out.println("  "+name+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createMailbox(String accountName,String mailboxName,String auth) throws CGProException
Example:
  try {
    cli.createMailbox("john@company.com","My favorite items",null);  
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameMailbox(String accountName,String oldMailboxName,String newMailboxName,String auth) throws CGProException
void renameMailboxes(String accountName,String oldMailboxName,String newMailboxName,String auth) throws CGProException
Example:
  try {
    cli.renameMailbox("john@company.com","My favorite items","MyItems",null);  
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteMailbox(String accountName,String mailboxName,String auth) throws CGProException
void deleteMailboxes(String accountName,String mailboxName,String auth) throws CGProException
Example:
  try {
    cli.deleteMailbox("john@company.com","MyItems",null);  
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getMailboxInfo(String accountName,String mailboxName,String auth) throws CGProException
Example:
  try {
    Hashtable settings=cli.getMailboxInfo("john@company.com","INBOX",null); 
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getMailboxACL(String accountName,String mailboxName,String auth) throws CGProException
Example:
  try {
    System.out.println(cli.getMailboxACL("john@company.com","INBOX",null));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setMailboxACL(String accountName,String mailboxName,Hashtable newACL,String auth) throws CGProException
Example:
  try {
    Hashtable acl=cli.getMailboxACL("john@company.com","INBOX",null);  
    acl.put("boss","ipcda");
    acl.put("+susan","lrsw");
        
    cli.setMailboxACL("john@company.com","INBOX",acl,null);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getMailboxRights(String accountName,String mailboxName,String auth) throws CGProException
Example:
  try {
    String rights=cli.getMailboxRights("john@company.com","INBOX","boss");
    if(rights.length()==0) System.out.println("The boss account has no rights to access this mailbox");
                   else System.out.println("the Boss' rights are: "+rights);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setMailboxClass(String accountName,String mailboxName,String newClass,String auth) throws CGProException
Example:
  try {
    cli.setMailboxClass("john@company.com","Calendar","IPF.Appointment",null);  
   } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector getMailboxSubscription(String accountName) throws CGProException
Example:
  try {
    Vector subscription=cli.getMailboxSubscription("john@company.com");
    System.out.println("The subscribed mailboxes are: "+subscription);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setMailboxSubscription(String accountName,Vector newSubscription) throws CGProException
Example:
  try {
    Vector subscription=cli.getMailboxSubscription("john@company.com");
    subscription.add("~user@company.com/INBOX");
    cli.setMailboxSubscription("john@company.com",subscription);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getMailboxAliases(String accountName) throws CGProException

void setMailboxAliases(String accountName,Hashtable newAliases) throws CGProException
Example:
  try {
    Hashtable aliases=cli.getMailboxAliases("john@company.com");
    aliases.put("ExternalUserInbox","~user@company.com/INBOX");
    cli.setMailboxAliases("john@company.com",aliases);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Alert Administration Commands

Hashtable getDomainAlerts(String domainName) throws CGProException
Example:
  try {
    Hashtable alerts=cli.getDomainAlerts("company.com");
    for(Enumeration e = alerts.keys() ; e.hasMoreElements() ;) {
       String time=(String)e.nextElement();
       String message=(String)alerts.get(time);
       System.out.println(time+" "+message);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setDomainAlerts(String domainName, Hashtable alerts) throws CGProException
Example:
  try {
    Hashtable alerts=new Hashtable();
    alerts.put("20001225235959","Merry Christmas!");
    alerts.put("20000101000000","Happy New Year!");
    cli.setDomainAlerts("company.com",alerts);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void postDomainAlert(String domainName, String alert) throws CGProException
Example:
  try {
    cli.postDomainAlert("company.com","We're shutting down in 10 minutes!");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void removeDomainAlert(String domainName, String timeStamp) throws CGProException
Example:
  try {
    cli.removeDomainAlert("company.com","20001225235959");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountAlerts(String accountName) throws CGProException

void setAccountAlerts(String accountName, Hashtable alerts) throws CGProException

void postAccountAlert(String accountName, String alert) throws CGProException

void removeAccountAlert(String accountName, String timeStamp) throws CGProException

Hashtable getServerAlerts() throws CGProException

void setServerAlerts(Hashtable alerts) throws CGProException

void postServerAlert(String alert) throws CGProException

void removeServerAlert(String timeStamp) throws CGProException

Hashtable getClusterAlerts() throws CGProException

void setClusterAlerts(Hashtable alerts) throws CGProException

void postClusterAlert(String alert) throws CGProException

void removeClusterAlert(String timeStamp) throws CGProException


File Storage Administration

Vector readStorageFile(String accountName,String fileName) throws CGProException
Example:
  try {
    Vector fInfo=cli.readStorageFile("john@company.com","logo.gif");
    String fDate=(String)fInfo.elementAt(1);
    String year=(String)fDate.substring(0,4);
    String month=(String)fDate.substring(5,7);
    String day=fDate.substring(8,10);
    System.out.println("File modification date: "+month+"/"+day+"/"+year);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector readStorageFile(String accountName,String fileName,int offset,int sliceSize) throws CGProException

void writeStorageFile(String accountName,String fileName,String data) throws CGProException

void writeStorageFile(String accountName,String fileName,String data,int offset) throws CGProException

void renameStorageFile(String accountName,String fileName,String newFileName) throws CGProException
Example:
  try {
    cli.renameStorageFile("john@company.com","StalkerLogo.gif","logo.gif");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteStorageFile(String accountName,String fileName) throws CGProException
Example:
  try {
    cli.deleteStorageFile("john@company.com","logo.gif");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable listStorageFiles(String accountName,String path) throws CGProException
Example:
  try {
    Hashtable files=cli.StorageFiles("john@company.com",null); 
    for(Enumeration e = files.keys(); e.hasMoreElements();) {
       String file=(String)e.nextElement();
       Object value=files.get(file);
       System.out.println("  "+file+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector getStorageFileInfo(String accountName) throws CGProException
Example:
  try {
    Vector info=cli.getStorageFileInfo("john@company.com");
    String nBytes=(String)info.elementAt(0);
    String nFiles=(String)info.elementAt(1);
    System.out.println("There are "+nFiles+" files "+nBytes+" bytes total.");    
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public Vector readStorageFileAttr(String accountName,String fileName) throws CGProException

public void updateStorageFileAttr(String accountName,String fileName,Vector attrs) throws CGProException

public Vector getFileSubscription(String accountName) throws CGProException

public void setFileSubscription(String accountName,Vector newSubscription) throws CGProException


Mailing Lists Administration Commands

Vector listLists(String domainName) throws CGProException
Example:
  try {
    Vector lists=cli.listLists(null);
    System.out.println("The main domain lists:");
    for(Enumeration e = lists.elements(); e.hasMoreElements();) {
       String list=(String)e.nextElement();
       System.out.println("  "+list);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getDomainLists(String domainName) throws CGProException
Example:
  try {
    Hashtable lists=cli.getDomainLists(null);
    System.out.println("The main domain lists:");
    for(Enumeration e = lists.keys(); e.hasMoreElements();) {
       String list=(String)e.nextElement();
       String value=(String)lists.get(list);
       if(value.equals("-1")) value="unknown"; //number of subscribers
       System.out.println("  "+list+"("+value+")");
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getAccountLists(String accountName) throws CGProException
Example:
  try {
    Hashtable lists=cli.getAccountLists("john@company.com");
    System.out.println("The john's lists:");
    for(Enumeration e = lists.keys(); e.hasMoreElements();) {
       String list=(String)e.nextElement();
       String value=(String)lists.get(list);
       if(value.equals("-1")) value="unknown"; //number of subscribers
       System.out.println("  "+list+"("+value+")");
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createList(String listName,String accountName) throws CGProException
Example:
  try {
    cli.createList("TestList@company.com","john");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameList(String listName,String newListName) throws CGProException
Example:
  try {
    cli.renameList("TestList@company.com","InfoList");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void deleteList(String listName) throws CGProException
Example:
  try {
    cli.deleteList("InfoList@company.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getList(String listName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getList("TestList@company.com"); 
    System.out.println("The list settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateList(String listName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("RealName","the test list");
    cli.updateList("TestList@company.com",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void list(String listName, String operation,String subscriberAddress,boolean silently,boolean confirm) throws CGProException
Example:
  try {
    cli.list("TestList@company.com","subscribe","\"John Smith\" <john@company.com>",false,false);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector listSubscribers(String listName, String filter,int limit) throws CGProException
Example:
  try {
    Vector subscribers=cli.listSubscribers("TestList@company.com",null,0);
    System.out.println(subscribers);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public Hashtable getSubscriberInfo(String listName,String subscriberAddress) throws CGProException

public void setPostingMode(String listName, String subscriberAddress,String mode) throws CGProException
Example:
  try {
    cli.setPostingMode("TestList@company.com","john@company.com","UNMODERATED");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public void processBounce(String listName, String subscriberAddress,boolean fatal) throws CGProException


Web Skins Administration

Vector listDomainSkins(String domainName) throws CGProException
Example:
  try {
    Vector skins=cli.listDomainSkins("company.com");
    System.out.println(skins);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createDomainSkin(String domainName,String skinName) throws CGProException
Example:
  try {
    cli.createDomainSkin("company.com","my skin");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void renameDomainSkin(String domainName,String skinName,String newName) throws CGProException

void deleteDomainSkin(String domainName,String skinName) throws CGProException

Hashtable listDomainSkinFiles(String domainName,String skinName) throws CGProException
Example:
  try {
    Hashtable files=cli.listDomainSkinFiles("company.com","my skin"); 
    System.out.println("The skin files are:");
    for(Enumeration e = files.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=files.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Vector readDomainSkinFile(String domainName,String skinName,String fileName) throws CGProException
Example:
  try {
    Vector file=cli.readDomainSkinFile("company.com","my skin","Logo.gif); 
    System.out.println("Date (YyyyMmDdHhMmSs):"+file.elementAt(1));
    System.out.println("Base64 data:"+file.elementAt(0));    
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void storeDomainSkinFile(String domainName,String skinName,String fileName,String base64data) throws CGProException

void deleteDomainSkinFile(String domainName,String skinName,String fileName) throws CGProException

Vector listServerSkins() throws CGProException
Example:
  try {
    Vector skins=cli.listServerSkins();
    System.out.println(skins);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void createServerSkin(String skinName) throws CGProException

void renameServerSkin(String skinName,String newName) throws CGProException

void deleteServerSkin(String skinName) throws CGProException

Hashtable listServerSkinFiles(String skinName) throws CGProException

Vector readServerSkinFile(String skinName,String fileName) throws CGProException

void storeServerSkinFile(String skinName,String fileName,String base64data) throws CGProException

void deleteServerSkinFile(String skinName,String fileName) throws CGProException

Vector listClusterSkins() throws CGProException

void createClusterSkin(String skinName) throws CGProException

void renameClusterSkin(String skinName,String newName) throws CGProException

void deleteClusterSkin(String skinName) throws CGProException

Hashtable listClusterSkinFiles(String skinName) throws CGProException

Vector readClusterSkinFile(String skinName,String fileName) throws CGProException

void storeClusterSkinFile(String skinName,String fileName,String base64data) throws CGProException

void deleteClusterSkinFile(String skinName,String fileName) throws CGProException


Web Interface Tuning Commands

Hashtable listWebUserInterface(String domainName,String path) throws CGProException
Example:
  try {
    Hashtable files=cli.listWebUserInterface("company.com",null); 
    for(Enumeration e = files.keys(); e.hasMoreElements();) {
       String file=(String)e.nextElement();
       Object value=files.get(file);
       System.out.println("  "+file+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getWebUserInterface(String domainName,String fileName) throws CGProException
Example:
  try {
    System.out.println(cli.getWebUserInterface("*","Logo.gif")); 
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void putWebUserInterface(String domainName,String fileName,String data) throws CGProException

void deleteWebUserInterface(String domainName,String fileName) throws CGProException
Example:
  try {
    cli.deleteWebUserInterface("*","Logo.gif"); 
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void clearWebUserCache(String domainName) throws CGProException
Example:
  try {
    cli.clearWebUserCache("company.com"); 
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Web Interface Integration Commands

String createWebUserSession(String accountName,String ipAddress) throws CGProException

String createWebUserSession(String accountName,String ipAddress,String mode,String skin) throws CGProException

String createXIMSSSession(String accountName,String ipAddress,String origAddress) throws CGProException

public Vector listAccountSessions(String accountName,String ipAddress,String proxiedAddress,String protocol,String transport,String client) throws CGProException

Hashtable getSession(String sessionID,String domain) throws CGProException

void killSession(String sessionID,String domain) throws CGProException
Example:
  try {
    String sessionID=cli.createWebUserSession("john@company.com","127.0.0.1","WML","mySkin");
    System.out.println("The new session ID ="+sessionID); 

    Hashtable settings=cli.getSession(sessionID);
    System.out.println("The session settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
    cli.killSession(sessionID);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Real-Time Application Administration Commands

void CreateDomainPBX(String domainName,String language) throws CGProException

void DeleteDomainPBX(String domainName) throws CGProException

Hashtable ListDomainPBXFiles(String domainName,String language) throws CGProException

String ReadDomainPBXFile(String domainName,String fileName) throws CGProException

void StoreDomainPBXFile(String domainName,String fileName,String data) throws CGProException

void DeleteDomainPBXFile(String domainName,String fileName) throws CGProException

void CreateServerPBX(String language) throws CGProException

void DeleteServerPBX(String language) throws CGProException

Hashtable ListServerPBXFiles(String language) throws CGProException

String ReadServerPBXFile(String fileName) throws CGProException

void StoreServerPBXFile(String fileName,String data) throws CGProException

void DeleteServerPBXFile(String fileName) throws CGProException

void CreateClusterPBX(String language) throws CGProException

void DeleteClusterPBX() throws CGProException

Hashtable ListClusterPBXFiles(String language) throws CGProException

String ReadClusterPBXFile(String fileName) throws CGProException

void StoreClusterPBXFile(String fileName,String data) throws CGProException

void DeleteClusterPBXFile(String fileName) throws CGProException

Hashtable ListStockPBXFiles(String language) throws CGProException

String ReadStockPBXFile(String fileName) throws CGProException


Real-Time Application Control Commands

String startPBXTask(String accountName, String programName, String entryName, Object parameter) throws CGProException

void sendTaskEvent(String taskID, String eventName, Object parameter) throws CGProException

void killNode(String taskID) throws CGProException

Object readNodeStatus(String taskID) throws CGProException


Server Setting Commands

public Vector listModules() throws CGProException

Hashtable getModule(String moduleName) throws CGProException
Example:
  try {
    Hashtable settings=cli.getModule("SMTP");  
    System.out.println("The SMTP settings are:");
    for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
       String key=(String)e.nextElement();
       Object value=settings.get(key);
       System.out.println("  "+key+"="+value);
    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void updateModule(String moduleName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=new Hashtable();
    settings.put("LogLevel","3");
    cli.updateModule("SMTP",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setModule(String moduleName, Hashtable settings) throws CGProException
Example:
  try {
    Hashtable settings=cli.getModule("SMTP");
    settings.put("LogLevel","3");
    cli.updateModule("SMTP",settings);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getBlacklistedIPs() throws CGProException
Example:
  try {
    String addresses=cli.getBlacklistedIPs();
    System.out.println(addresses);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getLANIPs() throws CGProException

String getClientIPs() throws CGProException

String getWhiteHoleIPs() throws CGProException

String getNATedIPs() throws CGProException

String getDebugIPs() throws CGProException

String getDeniedIPs() throws CGProException

Hashtable getProtection() throws CGProException
Example:
  try {
      Hashtable settings=cli.getProtection();
      for(Enumeration e = settings.keys() ; e.hasMoreElements() ;) {
        String key=(String)e.nextElement();
        Object value=settings.get(key);
        System.out.println("  "+key+"="+value);
      }
    } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getBanned() throws CGProException

void setBlacklistedIPs(String addresses) throws CGProException
Example:
  try {
    cli.setBlacklistedIPs("11.22.33.44\\e33.44.55.66");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setLANIPs(String addresses) throws CGProException

void setClientIPs(String addresses) throws CGProException
Example:
  try {
    cli.setClientIPs("10.0.0.1-10.0.0.255");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setWhiteHoleIPs(String addresses) throws CGProException

void setNATedIPs(String addresses) throws CGProException

void setDebugIPs(String addresses) throws CGProException

void setDeniedIPs(String addresses) throws CGProException

void setProtection(Hashtable settings) throws CGProException

void setBanned(Hashtable settings) throws CGProException

String getClusterBlacklistedIPs() throws CGProException

String getClusterLANIPs() throws CGProException

String getClusterClientIPs() throws CGProException

String getClusterWhiteHoleIPs() throws CGProException

String getClusterNATedIPs() throws CGProException

String getClusterDebugIPs() throws CGProException

String getClusterDeniedIPs() throws CGProException

Hashtable getClusterProtection() throws CGProException

Hashtable getClusterBanned() throws CGProException

void setClusterBlacklistedIPs(String addresses) throws CGProException

void setClusterLANIPs(String addresses) throws CGProException

void setClusterClientIPs(String addresses) throws CGProException

void setClusterWhiteHoleIPs(String addresses) throws CGProException

void setClusterNATedIPs(String addresses) throws CGProException

void setClusterDebugIPs(String addresses) throws CGProException

void setClusterDeniedIPs(String addresses) throws CGProException

void setClusterProtection(Hashtable settings) throws CGProException

Vector getServerMailRules() throws CGProException
Example:
  try {
    Vector rules=cli.getServerMailRules();
    for(int idx=0;idx<rules.size();idx++) {
      Vector rule=(Vector)rules.elementAt(idx);
      System.out.println("\nName="+rule.elementAt(1)+" Priority="+rule.elementAt(0));
      Vector conditions=(Vector)rule.elementAt(2);
      Vector actions=(Vector)rule.elementAt(3);

      System.out.println("  If");
      for(int idxc=0;idxc<conditions.size();idxc++) {
        System.out.println("   "+conditions.elementAt(idxc));
      }
      System.out.println("  Then");
      for(int idxa=0;idxa<actions.size();idxa++) {
        System.out.println("   "+actions.elementAt(idxa));
      }

    }
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setServerMailRules(Vector rules) throws CGProException

void updateServerMailRule(Vector rule) throws CGProException

Vector getServerSignalRules() throws CGProException

void setServerSignalRules(Vector rules) throws CGProException

void updateServerSignalRule(Vector rule) throws CGProException

Vector getClusterMailRules() throws CGProException

void setClusterMailRules(Vector rules) throws CGProException

void updateClusterMailRule(Vector rule) throws CGProException

Vector getClusterSignalRules() throws CGProException

void setClusterSignalRules(Vector rules) throws CGProException

void updateClusterSignalRule(Vector rule) throws CGProException

void refreshOSData() throws CGProException
Example:
  try {
    cli.refreshOSData();
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

String getRouterTable() throws CGProException
Example:
  try {
    String data=cli.getRouterTable();
    System.out.println(data);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void setRouterTable(String table) throws CGProException
Example:
  try {
    String data=cli.getRouterTable();
    if(!data.substring(data.length()-2,data.length()).equals("\\e")) data+="\\e";
    data+="<addr>=addr@domain.com\\e";
    cli.setRouterTable(data);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public Hashtable getRouterSettings() throws CGProException

public void setRouterSettings(Hashtable settings) throws CGProException

String getClusterRouterTable() throws CGProException

void setClusterRouterTable(String table) throws CGProException

public Hashtable getServerIntercept() throws CGProException

public void setServerIntercept(Hashtable settings) throws CGProException

public Hashtable getClusterIntercept() throws CGProException

public void setClusterIntercept(Hashtable settings) throws CGProException

Vector route(String address,boolean mail) throws CGProException
Example:
  try {
    Vector route=cli.route("user@domain.net",false);
    System.out.println("Module  ="+route.elementAt(0));
    System.out.println("Host    ="+route.elementAt(1));
    System.out.println("Address ="+route.elementAt(2));
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Monitoring Commands

String getSNMPElement(String elemName) throws CGProException
Example:
  try {
    String msgs=cli.getSNMPElement("1.3.6.1.4.1.5678.2.1.1.1.10");
    System.out.println("incoming SMTP messages: "+msgs);
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Object getStatElement(String elemName) throws CGProException

String getNextStatName(String elemName) throws CGProException

Hashtable getDialogInfo(String dialogID) throws CGProException

void shutdown() throws CGProException
Example:
  try {
    cli.shutdown();
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Statistics Commands

Hashtable getAccountStat(String accountName) throws CGProException
Example:
  try {
    Hashtable stats=cli.getAccountStat("john@company.com");
    String nMessages=(String)stats.get("MessagesReceived");
    String nBytes=(String)stats.get("BytesReceived");
    System.out.println("The user had received "+nMessages+" messages "+nBytes+" bytes total.");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void resetAccountStat(String accountName) throws CGProException
Example:
  try {
    cli.resetAccountStat("john@company.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getDomainStat(String domainName) throws CGProException
Example:
  try {
    Hashtable stats=cli.getDomainStat("company.com");
    String nMessages=(String)stats.get("MessagesReceived");
    String nBytes=(String)stats.get("BytesReceived");
    System.out.println("The domain had received "+nMessages+" messages "+nBytes+" bytes total.");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void resetDomainStat(String domainName) throws CGProException
Example:
  try {
    cli.resetDomainStat("*");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }


Miscellaneous Commands

void writeLog(int level,String message) throws CGProException
Example:
  try {
    cli.writeLog(1,"This is my log message!");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void releaseSMTPQueue(String queueName) throws CGProException
Example:
  try {
    cli.releaseSMTPQueue("mail.server.com");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

void rejectQueueMessage(String messageID,String errorText) throws CGProException
Example:
  try {
    cli.rejectQueueMessage("12345","your message is rejected");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

Hashtable getMessageQueueInfo(String moduleName,String queueName) throws CGProException

public String getCurrentController() throws CGProException
Example:
  try {
    System.out.println(cli.getCurrentController());
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public String getTempClientIPs() throws CGProException
Example:
  try {
    System.out.println(cli.getTempClientIPs());
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public String getTempBlacklistedIPs() throws CGProException

public void setTempBlacklistedIPs(String theIPs) throws CGProException

public void removeAccountSubset(String accountName,String subset) throws CGProException
Example:
  try {
    cli.removeAccountSubset("user@domain.com","RepliedAddresses");
  } catch(CGProException e) {
    System.out.println(e.getMessage());
  }

public void dataset(String accountName, Hashtable parameters) throws CGProException

public void roster(String accountName, Hashtable parameters) throws CGProException

public void balance(String accountName, Hashtable parameters) throws CGProException
CommuniGate Pro Guide. Copyright © 2020, AO SBK