List of usage examples for java.util.zip DataFormatException DataFormatException
public DataFormatException(String s)
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Resets the evaluation of a run (admin right required) * /*from w w w .j a va 2 s . c o m*/ * @param run_id * @return * @throws Exception */ public RunReset runReset(int run_id) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "run/reset/" + run_id, getApiKey(), verboseLevel); if (apiResult instanceof RunReset) { return (RunReset) apiResult; } else { throw new DataFormatException("Casting Api Object to RunReset"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * A list with the parameter settings of a setup * /* ww w . j a v a 2 s . c om*/ * @param a file equivalent to run description, but only featuring the parts important to parameters * @return * @throws Exception */ public SetupExists setupExists(File description) throws Exception { MultipartEntity params = new MultipartEntity(); if (verboseLevel >= Constants.VERBOSE_LEVEL_XML) { System.out.println(Conversion.fileToString(description) + "\n=========="); } params.addPart("description", new FileBody(description)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "setup/exists", params, getApiKey(), verboseLevel); if (apiResult instanceof SetupExists) { return (SetupExists) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupExists"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * A list with the parameter settings of a setup * //from w w w . ja v a2 s . c o m * @param setup_id * @return * @throws Exception */ public SetupParameters setupParameters(int setup_id) throws Exception { Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "setup/" + setup_id, getApiKey(), verboseLevel); if (apiResult instanceof SetupParameters) { return (SetupParameters) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupParameters"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Tags a setup// w w w . j a va 2 s . c om * * @param id - the setup id * @param tag - the tag * @return * @throws Exception */ public SetupTag setupTag(int id, String tag) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("setup_id", new StringBody("" + id)); params.addPart("tag", new StringBody(tag)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "setup/tag", params, getApiKey(), verboseLevel); if (apiResult instanceof SetupTag) { return (SetupTag) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupTag"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Removes a tag from a setup//from w w w . ja v a 2s .c om * * @param id - the setup id * @param tag - the tag to be removed * @return * @throws Exception */ public SetupUntag setupUntag(int id, String tag) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("setup_id", new StringBody("" + id)); params.addPart("tag", new StringBody(tag)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "setup/untag", params, getApiKey(), verboseLevel); if (apiResult instanceof SetupUntag) { return (SetupUntag) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupUntag"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Deletes a setup. Only applicable when no runs are attached. * // w w w .j a v a 2 s . c om * @param id * - The numeric id of the setup to be deleted. * @return SetupDelete - An object containing the id of the deleted * setup * @throws Exception * - Can be: API Error (see documentation at openml.org), server * down, etc. */ public SetupDelete setupDelete(int id) throws Exception { Object apiResult = HttpConnector.doApiDelete(OPENML_URL + API_PART + "setup/" + id, getApiKey(), verboseLevel); if (apiResult instanceof SetupDelete) { return (SetupDelete) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupDelete"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Returns a list of predictions on which two setups disagree * /*from w w w. ja va 2 s . com*/ * @param setupA - a setup id * @param setupB - a setup id * @param task_id - the task id * @param task_size - // TODO * @param differences // TODO * @return * @throws Exception */ public SetupDifferences setupDifferences(int setupA, int setupB, int task_id, int task_size, int differences) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("task_id", new StringBody("" + task_id)); params.addPart("task_size", new StringBody("" + task_size)); params.addPart("differences", new StringBody("" + differences)); Object apiResult = HttpConnector.doApiRequest( OPENML_URL + API_PART + "setup/differences/" + setupA + "/" + setupB, params, getApiKey(), verboseLevel); if (apiResult instanceof SetupDifferences) { return (SetupDifferences) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupDifferences"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
/** * Returns a list of predictions on which two setups disagree * /*from w w w. j a v a2 s . c o m*/ * @param setupA - a setup id * @param setupB - a setup id * @param task_id - the task id * @return * @throws Exception */ public SetupDifferences setupDifferences(Integer setupA, Integer setupB, Integer task_id) throws Exception { String suffix = setupA + "/" + setupB; if (task_id != null) { suffix += "/" + task_id; } Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "setup/differences/" + suffix, getApiKey(), verboseLevel); if (apiResult instanceof SetupDifferences) { return (SetupDifferences) apiResult; } else { throw new DataFormatException("Casting Api Object to SetupDifferences"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
public FileUpload fileUpload(File file) throws Exception { MultipartEntity params = new MultipartEntity(); if (verboseLevel >= Constants.VERBOSE_LEVEL_ARFF) { System.out.println(Conversion.fileToString(file) + "\n==========\n"); }//from www .j a v a 2 s . c om params.addPart("file", new FileBody(file)); Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "file/upload", params, getApiKey(), verboseLevel); if (apiResult instanceof FileUpload) { return (FileUpload) apiResult; } else { throw new DataFormatException("Casting Api Object to UploadFile"); } }
From source file:org.openml.apiconnector.io.OpenmlConnector.java
public Job jobRequest(String workbench, String task_type_id, String task_tag, String setup_tag, Integer setup_id) throws Exception { MultipartEntity params = new MultipartEntity(); params.addPart("workbench", new StringBody(workbench)); params.addPart("task_type_id", new StringBody(task_type_id)); if (task_tag != null) { params.addPart("task_tag", new StringBody(task_tag)); }/*from w ww.ja v a 2 s . c om*/ if (setup_tag != null) { params.addPart("setup_tag", new StringBody(setup_tag)); } if (setup_id != null) { params.addPart("setup_id", new StringBody(setup_id + "")); } Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "job/request", params, getApiKey(), verboseLevel); if (apiResult instanceof Job) { return (Job) apiResult; } else { throw new DataFormatException("Casting Api Object to Job"); } }