@Override public SearchEnvironments.Response call(SearchEnvironments.Request req) { SearchEnvironments.Response res = new SearchEnvironments.Response(); res.success = false; REInterface con = getREConnection(guestInterfaceKey); ArrayList<String> uids = new ArrayList<String>(); ArrayList<ArrayList<String>> filenames = new ArrayList<ArrayList<String>>(); ArrayList<ArrayList<String>> urls = new ArrayList<ArrayList<String>>(); String[] onts = con.searchEnvironments(req.searchID, uids, filenames, urls); if (onts != null) { for (String ont : onts) { StringArray saNames = new StringArray(); saNames.list = filenames.remove(0); res.filenames.add(saNames); StringArray saURLs = new StringArray(); saURLs.list = urls.remove(0); res.fileURLs.add(saURLs); res.environments.add(ont); } res.uids = uids; res.success = true; ros.logInfo("SearchEnvironments (search: " + req.searchID + "): Done"); } else { res.success = false; ros.logInfo("SearchEnvironments (search: " + req.searchID + "): Failed"); } return res; }
public static SearchObjects.Response searchObjects(SearchObjects.Request req) { SearchObjects.Response res = new SearchObjects.Response(); res.success = false; REInterface con = getREConnection(guestInterfaceKey); ArrayList<String> uids = new ArrayList<String>(); ArrayList<ArrayList<String>> filenames = new ArrayList<ArrayList<String>>(); ArrayList<ArrayList<String>> urls = new ArrayList<ArrayList<String>>(); String[] onts = con.searchObjects(req.searchID, uids, filenames, urls); if (onts != null) { for (String ont : onts) { StringArray saNames = new StringArray(); saNames.list = filenames.remove(0); res.filenames.add(saNames); StringArray saURLs = new StringArray(); saURLs.list = urls.remove(0); res.fileURLs.add(saURLs); res.objects.add(ont); } res.uids = uids; res.success = true; } else { res.success = false; } return res; }
@Override public SetEnvironment.Response call(SetEnvironment.Request req) { SetEnvironment.Response res = new SetEnvironment.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); ArrayList<String> filenames = new ArrayList<String>(); ArrayList<byte[]> dataArray = new ArrayList<byte[]>(); for (ros.pkg.re_msgs.msg.File file : req.files) { filenames.add(file.name); dataArray.add(file.data); } res.success = con.submitEnvironment( req.environment, req.cls, req.id, req.description, dataArray, filenames); if (res.success) { ros.logInfo("SetEnvironment (UID: " + req.cls + "." + req.id + "): Done"); } else { ros.logInfo("SetEnvironment (UID: " + req.cls + "." + req.id + "): Failed"); } } else { ros.logError("SetEnvironment (UID: " + req.cls + "." + req.id + "): API key is missing!"); } return res; }
public static QueryObjects.Response queryObjects(QueryObjects.Request req) { QueryObjects.Response res = new QueryObjects.Response(); res.result = ""; REInterface con = getREConnection(guestInterfaceKey); String result = con.queryObjectDB(req.query); if (result != null) { res.result = result; } return res; }
public static DelObject.Response delObject(DelObject.Request req) { DelObject.Response res = new DelObject.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); res.success = con.deleteObject(req.objectUID); } return res; }
@Override public QueryEnvironments.Response call(QueryEnvironments.Request req) { QueryEnvironments.Response res = new QueryEnvironments.Response(); res.result = ""; REInterface con = getREConnection(guestInterfaceKey); String result = con.queryEnvironmentDB(req.query); if (result != null) { res.result = result; ros.logInfo("QueryEnvironment (query:\n" + req.query + "): Done"); } else { ros.logInfo("QueryEnvironment (query:\n" + req.query + "): Failed"); } return res; }
public static UpdateObject.Response updateObject(UpdateObject.Request req) { UpdateObject.Response res = new UpdateObject.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); OWLOntology ont = OWLIO.loadOntologyFromString(req.object); if (ont != null) { res.success = con.updateObject(req.uid, ont, req.description); } else { res.success = false; } } return res; }
public static SetObject.Response setObject(SetObject.Request req) { SetObject.Response res = new SetObject.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); OWLOntology ont = OWLIO.loadOntologyFromString(req.object); ArrayList<String> filenames = new ArrayList<String>(); ArrayList<byte[]> dataArray = new ArrayList<byte[]>(); for (ros.pkg.re_msgs.msg.File file : req.files) { filenames.add(file.name); dataArray.add(file.data); } res.success = con.submitObject(ont, req.cls, req.id, req.description, dataArray, filenames); } return res; }
public static GetObject.Response getObject(GetObject.Request req) { GetObject.Response res = new GetObject.Response(); REInterface con = getREConnection(guestInterfaceKey); ArrayList<String> outFilenames = new ArrayList<String>(); ArrayList<String> outFileURLs = new ArrayList<String>(); String ont = con.requestObject(req.objectUID, outFilenames, outFileURLs); if (ont != null) { res.object = ont; res.filenames = outFilenames; res.fileURLs = outFileURLs; res.success = true; } else { res.success = false; } return res; }
@Override public UpdateEnvironment.Response call(UpdateEnvironment.Request req) { UpdateEnvironment.Response res = new UpdateEnvironment.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); res.success = con.updateEnvironment(req.uid, req.environment, req.description); if (res.success) { ros.logInfo("UpdateEnvironment (UID: " + req.uid + "): Done"); } else { ros.logInfo("UpdateEnvironment (UID: " + req.uid + "): Failed"); } } else { ros.logError("UpdateEnvironment (UID: " + req.uid + "): API key is missing!"); } return res; }
@Override public DelEnvironment.Response call(DelEnvironment.Request req) { DelEnvironment.Response res = new DelEnvironment.Response(); res.success = false; if (req.apiKey != null && req.apiKey.length() > 0) { REInterface con = getREConnection(req.apiKey); res.success = con.deleteEnvironment(req.environmentUID); if (res.success) { ros.logInfo("DelEnvironment (UID: " + req.environmentUID + "): Done"); } else { ros.logInfo("DelEnvironment (UID: " + req.environmentUID + "): Failed"); } } else { ros.logError("DelEnvironment (UID: " + req.environmentUID + "): API key is missing!"); } return res; }
@Override public GetEnvironment.Response call(GetEnvironment.Request req) { GetEnvironment.Response res = new GetEnvironment.Response(); REInterface con = getREConnection(guestInterfaceKey); ArrayList<String> outFilenames = new ArrayList<String>(); ArrayList<String> outFileURLs = new ArrayList<String>(); String ont = con.requestEnvironment(req.environmentUID, outFilenames, outFileURLs); if (ont != null) { res.environment = ont; res.filenames = outFilenames; res.fileURLs = outFileURLs; res.success = true; ros.logInfo("GetEnvironment (UID: " + req.environmentUID + "): Done"); } else { res.success = false; ros.logInfo("GetEnvironment (UID: " + req.environmentUID + "): Failed"); } return res; }