use of org.apache.sling.discovery.commons.providers.NonLocalInstanceDescription in project sling by apache.
the class Announcement method asInstance.
/** create an instancedescription from json **/
private static DefaultInstanceDescription asInstance(final JsonObject anInstance) {
final boolean isLeader = anInstance.getBoolean("isLeader");
final String slingId = anInstance.getString("slingId");
final JsonObject propertiesObj = anInstance.getJsonObject("properties");
Iterator<String> it = propertiesObj.keySet().iterator();
Map<String, String> properties = new HashMap<String, String>();
while (it.hasNext()) {
String key = it.next();
properties.put(key, propertiesObj.getString(key));
}
NonLocalInstanceDescription instance = new NonLocalInstanceDescription(null, isLeader, slingId, properties);
return instance;
}
Aggregations