AML is a library that provides the basic infrastructure to manage Service Level Agreements. It offers support to analyze SLAs, providing a variety of document operations as consistency, compliance, dead terms, etc.
Mandatory requirements:
Recommended:
Read the following user guide to know how to use this library properly. See the Javadoc for more information.
First of all, you need to declare and initialize an AgreementManager:
AgreementManager manager = new AgreementManager();
You can pass a configuration file to the manager as a parameter. This file has to be written in JSON format.
{
"defaultInputFormat": "IAGREE",
"CSPReasoner": "CPLEX",
"CSPWebReasonerEndpoint": "http://150.214.188.130:8080/CSPWebReasoner",
"DLReasoner": "none",
"ANDConstraintsBreaking" : "true"
}
To create a template, an offer or an agreement, use the manager as follow:
AgreementModel model = manager.createAgreementTemplate("Template's content");
AgreementModel model = manager.createAgreementOffer("Offer's content");
AgreementModel model = manager.createAgreement("Agreement's content");
To create a template, an offer or an agreement from a file, use these methods instead:
AgreementModel model = manager.createAgreementTemplateFromFile("path/to/file.at");
AgreementModel model = manager.createAgreementOfferFromFile("path/to/file.ao");
AgreementModel model = manager.createAgreementFromFile("path/to/file.ag");
AgreementModel is a superclass that contains the following subclasses: AgreementTemplate, AgreementOffer and Agreement. We can cast our model to one of these three types depending on our case.
Note that when we create models, we are not registering it. So if we need to use it later, we won't be able to retrieve it.
If you want that a model persists, you should use register methods.
manager.register(model);
In this case, you'll be able to retrieve your model specifying its ID. If you prefer to specify a custom name, use the following method instead:
manager.register("MyModel", model);
To create a template, an offer or an agreement from a file, use these methods instead:
manager.registerFromFile(file);
manager.registerFromFile("path/to/file");
To retrieve a model, simply use one of these three methods, depending on your case:
manager.getAgreementTemplate("MyModel");
manager.getAgreementOffer("MyModel");
manager.getAgreement("MyModel");
Generate an offer from a template is as easy as use the method generateAgreementOffer from the type AgreementTemplate.
AgreementTemplate myTemplate = manager.createAgreementTemplateFromFile("path/to/file.at");
AgreementOffer myOffer = myTemplate.generateAgreementOffer("Consumer name");
In the same way, we can generate an agreement from an offer using the method generateAgreement:
AgreementOffer myOffer = manager.createAgreementOfferFromFile("path/to/file.ao");
Agreement myAgreement = myOffer.generateAgreement("Consumer name");
To contribute to this project, read our development policies