HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Easing the Pain of Enterprise Application Deployment"
Vol. 8, Issue 10, p. 18

	



Listing 1

String getPoolName(String addr, long port) {

   Response resp;
   Vector soapParams = new Vector();
   IPPortDefinition vs = new IPPortDefinition();
   vs.setAddress(addr);
   vs.setPort(port);
    
   // Setting method parameters
   soapParams.addElement(new Parameter("virtual_server",
       IPPortDefinition.class, vs, null));
    
   // Set Call object method and parameters
   call.setMethodName("get_pool");
   call.setParams(soapParams);

   // Set Object URI and method name
   call.setTargetObjectURI(urnVS);
   // invokng SOAP method call
   resp = call.invoke(destURI,urnVS);

   // Checking response for status of service request
   if (resp.generatedFault()) {
     // Request failed, retreiving SOAP fault object
     Fault fault = resp.getFault();
     System.out.println("Fail to process set_state operation");
     System.out.println("Fault Code: " + fault.getFaultCode() +
       " Fault String: " + fault.getFaultString());
   } else {
     poolName = (String)resp.getReturnValue().getValue();
   }
   return poolName;
}

Listing 2

IPPortDefinition[] getMemberList(String poolName) {

   Response resp;
   Vector soapParams = new Vector();
   IPPortDefinition[] nodes = new IPPortDefinition[1];
   // Setting method parameters
   soapParams.addElement(new Parameter("pool_name", String.class,
      poolName, null));
    
   // Set Call object method and parameters
   call.setMethodName("get_member_list");
...
   nodes = (IPPortDefinition[])resp.getReturnValue().getValue();
   return nodes;
}

Listing 3

long getCurrentConnections(String nodeAddr, long nodePort) {
...
   node.setAddress(nodeAddr);
   node.setPort(nodePort);
   soapParams.addElement(new Parameter("node_def",
      IPPortDefinition.class, node, null));

   call.setMethodName("get_statistics");
...
   NodeStatistics stats = 
      (NodeStatistics)resp.getReturnValue().getValue();
   currentConnections = 
      stats.getConnection_stats().getCurrent_connections();
}

Listing 4

void createMonitorTemplate(String name, String template,
                int type, long timeout, long interval) {
...
   MonitorIPPort monIPP = new MonitorIPPort();
   monIPP.setIpport(member);
   monIPP.setAddress_type(type);

   CommonAttributes comAttr = new CommonAttributes();
   comAttr.setTimeout(timeout);
   comAttr.setInterval(interval);
   comAttr.setDest_ipport(monIPP);
   comAttr.setParent_template(template);
    
   // Setting method parameters
   soapParams.addElement(new Parameter("template_name", 
      String.class, tempName, null));
   soapParams.addElement(new Parameter("template_type", 
      Integer.class, tempType, null));
   soapParams.addElement(new Parameter("template_attributes", 
      CommonAttributes.class, comAttr, null));
    
   // Set Call object method and parameters
   call.setMethodName("create_template");
...
}

void createNodeAssoc(String[] tempNames, String node, long port) {
...
   MonitorIPPort mon = new MonitorIPPort();
   mon.setIpport(member);
   mon.setAddress_type(type);
    
   MonitorAssociation monAssoc = new MonitorAssociation();
   monAssoc.setNode_definition(mon);
   monAssoc.setTemplate_names(tempNames);

   // Setting method parameters
   soapParams.addElement(new Parameter("monitor_association", 
      MonitorAssociation.class, monAssoc, null));
    
   call.setMethodName("create_association");
...

}

 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.