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
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);
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);
}
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);
}
}
<module ref="hasthi-agent"/>
<parameter name="hasthi.boostrapHost" locked="false">tyr12.cs.indiana.edu</parameter>
<parameter name="hasthi.axis2tomcatendpoint" locked="false">http://linbox3.extreme.indiana.edu:7777/</parameter>
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.