public static void main(String[] args)
{
// initialize the registry
RegistryEngine reg = new RegistryEngine();
reg.init();
try
{
// create & execute the GetAuthToken request
GetAuthToken authTokenRequest = new GetAuthToken("sviens","password");
AuthToken authToken = (AuthToken)reg.execute(authTokenRequest);
AuthInfo authInfo = authToken.getAuthInfo();
// generate a Name Vector
Vector nameVector = new Vector();
nameVector.add(new Name("Dow Chemical"));
// generate a BusinessService
BusinessService service = new BusinessService();
service.addName(new Name("Reaction Finder"));
service.addDescription(new Description("Finds side effects when combining chemicals"));
// generate a BusinessServices
BusinessServices services = new BusinessServices();
services.addBusinessService(service);
// generate a BusinessEntity
BusinessEntity businessEntity = new BusinessEntity();
businessEntity.setBusinessKey(null);
businessEntity.setNameVector(nameVector);
businessEntity.setBusinessServices(services);
// generate a BusinessEntity Vector
Vector businessEntityVector = new Vector();
businessEntityVector.add(businessEntity);
// create & execute the SaveBusiness request
SaveBusiness request = new SaveBusiness();
request.setAuthInfo(authInfo);
request.setBusinessEntityVector(businessEntityVector);
BusinessDetail detail = (BusinessDetail)reg.execute(request);
}
catch (Exception ex)
{
// write execption to the console
ex.printStackTrace();
}
finally
{
// destroy the registry
reg.dispose();
}
}