eu.unicore.uas.json.ApplicationRequirement Maven / Gradle / Ivy
The newest version!
package eu.unicore.uas.json;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApplicationRequirement implements Requirement {
private final String appName, appVersion;
public ApplicationRequirement(String appName, String appVersion){
this.appName=appName;
this.appVersion=appVersion;
}
public String getDescription() {
return "Application: "+appName+(appVersion!=null?" v"+appVersion:"");
}
public boolean isFulfilled(JSONObject props) {
JSONArray apps = props.optJSONArray("applications");
if(apps==null || apps.length()==0)return false;
try {
for(int i=0; i