Screen Casts on Hasthi LEAD integration

  1. Screencast 1: Hasthi UI, Rules & System Profile explained
  2. Screencast 2: Recovering LEAD workflow demo
  3. Screencast 3: Hasthi dasbaord

LEAD Error Statistics

details can be found in this web page.

Integrate Hasthi Agent with Resources

Hasthi has many types of agents, following shows how to integrate the in-memory agent with our services. When integration is complete, please fill this form to provide details about the installation

Integrate with XSUL services

  1. Download XSUL based distribution
  2. Unzip and add included jars to your classpath. Most jar versions are flexible, so if you have different version of the same jar, e.g. log4j jar most probabaly that is ok. Hasthi types jar is complied with xmlbeans-2.3, but if needed I can give you a 2.2 compiled one.
  3. Integrate with your code base

    Integrate with XSUL2

    If you use XSUL2, you will have a code like following. To find the code, search for references for XmlBeansBasedService class
    XmlBeansBasedService xbeanBasedService = new XmlBeansBasedService("xregistry", cwsdlLoc,
                            new XregistryXmlBeansWrapper(globalContext));
    cmsvc = httpServices.addService(xbeanBasedService)
    
    Replace the code with the following, you have to lad the mngBootstrapNode from your configuration, and for this installation it should point to tyr12.cs.indiana.edu.
                    		
    String mngBootstrapNode = .... //loaded from configuration
    ExtendedXbeanBasedService extendedXbeanBasedService = new ExtendedXbeanBasedService("xregistry", cwsdlLoc,
                    new XregistryXmlBeansWrapper(globalContext));
    cmsvc = httpServices.addService(extendedXbeanBasedService);
    extendedXbeanBasedService.initManagmentAgent(mngBootstrapNode,httpBasedServices);
    

    Integrate With XSUL1

    If say you use XSUL1 style if you have a class that extends from xsul.processor.soap_over_http.SoapHttpDynamicInfosetProcessor. In there you have to wrap your message-processing-code with the following.
    1. Define a class parameter private XsulBasedWSDMProcessor processor
    2. Override the start() method of the SoapHttpDynamicInfosetProcessor, to look like following
      public void start(){
      	super.start();
      	String mngBootstrapNode = .... //loaded from configuration
      	QName serviceName = .. //your service name
      	Properties properties = new Properties();
      	properties.put(HasthiOptions.BOOTSTRAP_NODE,mngBootstrapNode);
      	Xsul1SystemHandle systemHandle = new Xsul1SystemHandle(serviceName, serviceName, this);
      	ManagementAgentContext context = new ManagementAgentContext(baseContext);
      	processor = new XsulBasedWSDMProcessor(context);
      	processor.addResource(systemHandle);
      }
      
    3. If you are not using processHttpXml(..) method in the SoapHttpDynamicInfosetProcessor, add following method. Otherwise talk to me
    4.    
      public XmlDocument processHttpXml(HttpServerRequest req, HttpServerResponse res,
              XmlDocument document) throws DynamicInfosetProcessorException {
          try {
              XSULMessageContext hasthiMessageContext = new XSULMessageContext(document, "");
              if (processor.isKnownMessage(hasthiMessageContext)) {
                  SoapUtil soapUtil = SoapUtil.selectSoapFragrance(document, new SoapUtil[] {
                          Soap12Util.getInstance(), Soap11Util.getInstance() });
                  XmlObject responseAsXmlbeans = processor.processeMessage(hasthiMessageContext);
                  return soapUtil.wrapBodyContent(XBeansUtil
                          .xmlObjectToXmlElement(responseAsXmlbeans));
              } else {
                  try {
                      long start = System.currentTimeMillis();
                      ((ManagedServiceHandle) (systemHandle)).requestRecived();
                      XmlDocument resposne = super.processHttpXml(req, res, document);
                      ((ManagedServiceHandle) (systemHandle)).requestSucessful(System
                              .currentTimeMillis()
                              - start);
                      return resposne;
                  } catch (Exception e) {
                      ((ManagedServiceHandle) (systemHandle)).requestFalied();
                      throw new MessageProcessingException(e.getMessage(), e);
                  }
              }
          } catch (HasthiException e) {
              throw new DynamicInfosetInvokerException(e.getMessage(), e);
          }
      }
      

    Integrate with Axis2

    1. Download Axis2 based distribution
    2. Shutdown your tomcat
    3. unzip and copy jarfiles in the distribution lib directory to the $TOMCAT_HOME/webapps/axis2/WEB-INF/lib and copy the hasthi-agent.mar file to the $TOMCAT_HOME/webapps/axis2/WEB-INF/modules
    4. Edit the $TOMCAT_HOME/webapps/axis2/WEB-INF/conf/axis2.xml to do following
      • Add following to the Global Modules, search for "Global Modules" and add the a entry like following with the addressing entry (<module ref="addressing"/>).
        <module ref="hasthi-agent"/>
      • Add following among other parameters in the top of the file. You have to replace the http://linbox3.extreme.indiana.edu:7777/ with the address of your tomcat.
         
        <parameter name="hasthi.boostrapHost" locked="false">tyr12.cs.indiana.edu</parameter>
        <parameter name="hasthi.axis2tomcatendpoint" locked="false">http://linbox3.extreme.indiana.edu:7777/</parameter>
            					
    5. Restart tomcat, and go to http://tyr12.cs.indiana.edu:9002 and you should see your service in the listing of this web page. This agent only handle axis2 with a one service. If more than one is there, it will show the name of the first service it found. So remove the default version service in axis2 and only leave our services in Axis2.
    6. If anything goes worng, ask for my help

    LookingUp Dependencies and Notify Errors

    Hasthi also acts as a service registry, and using Hasthi, a service can find a service instance given the service type with the “ResolveServiceDependancy” operation. For an example, portal can use Hasthi to find the current registry location using this operation. For most services, the locations of other services are provided via LEAD context header; therefore, this feature is not needed. However, this could be useful in some cases; for an example, Mylead agent can use this to find the message broker or portal can use this to find all services. Following code shows how to do this with Hasthi Client.

    		
    HasthiClient client = new HasthiClient("http://tyr12.cs.indiana.edu:9002");
    String[] concreateServiceInstances  = client.lookupAServiceInstances(new QName("Version"));
    System.out.println(Arrays.toString(concreateServiceInstances));
    

    Also following code can be used to notify Hasthi about any failures

            
    HasthiClient client = new HasthiClient("http://tyr12.cs.indiana.edu:9002");        
    client.notifyError("InternarlServerError");
    

    I can write REST API to do both actions, if someone needs that please talk to me.