Search in sources :

Example 1 with NonLocalInstanceDescription

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;
}
Also used : HashMap(java.util.HashMap) JsonObject(javax.json.JsonObject) NonLocalInstanceDescription(org.apache.sling.discovery.commons.providers.NonLocalInstanceDescription)

Aggregations

HashMap (java.util.HashMap)1 JsonObject (javax.json.JsonObject)1 NonLocalInstanceDescription (org.apache.sling.discovery.commons.providers.NonLocalInstanceDescription)1