-
Notifications
You must be signed in to change notification settings - Fork 8
Discovery API
In order to gather information on the SOA, EasySOA offers an API allowing to register or fetch services and other specific document types of the registry. It is primarily used by the various service discovery components.
The EasySOA API is made available through an unified interface available both from Nuxeo and any remote Java client. Access to this interface can be gained through two implementations of the factory pattern:
-
org.easysoa.api.EasySOALocalApiFactory.createLocalApi() in the
easysoa-registry-api/easysoa-registry-api-local
project. -
org.easysoa.api.EasySOARemoteApiFactory.createRemoteApi() in the
easysoa-registry-api/easysoa-registry-api-remote
project.
The interfaces can be found in the easysoa-registry-api/easysoa-registry-api-core
project. The main classes of interest are:
- org.easysoa.api.EasySOAApiSession: The main API interface
- org.easysoa.api.EasySOADocument: A wrapper for accessing documents
- org.easysoa.doctypes.*: Various classes that especially contain the properties of each doctype
When accessing properties through the EasySOADocument.getProperty() method, you can build the properties keys using the doctype constants, e.g. Service.SCHEMA_PREFIX + Service.PROP_URL
.
A REST interface is provided by EasySOA, as a supplement to the REST Automation API made by Nuxeo. It is mainly used by our remote implementation of the EasySOA API, but can be used as well by any remote client.
Fetching documents 'from Nuxeo' (local API, requires a CoreSession
instance):
EasySOAApiSession api = EasySOALocalApiFactory.createLocalApi(session);
List<EasySOADocument> documents = api.queryDocuments("SELECT * FROM Service");
The same using the remote API (needs user credentials):
EasySOAApiSession api = EasySOARemoteApiFactory.createRemoteApi("Administrator", "Administrator");
List<EasySOADocument> documents = api.queryDocuments("SELECT * FROM Service");
Registering some services (example taken from the remote API examples).
Map<String, String> properties = new HashMap<String, String>();
properties.put(Service.PROP_URL, "http://www.myservices.com/api/service");
properties.put(Service.PROP_TITLE, "MyService");
EasySOADocument service = api.notifyService(properties);