Example usage for java.util.zip DataFormatException DataFormatException

List of usage examples for java.util.zip DataFormatException DataFormatException

Introduction

In this page you can find the example usage for java.util.zip DataFormatException DataFormatException.

Prototype

public DataFormatException(String s) 

Source Link

Document

Constructs a DataFormatException with the specified detail message.

Usage

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Tags a task// w w w . ja  v  a2s  .co m
 * 
 * @param id - the task id
 * @param tag - the tag
 * @return
 * @throws Exception
 */
public TaskTag taskTag(int id, String tag) throws Exception {
    MultipartEntity params = new MultipartEntity();
    params.addPart("task_id", new StringBody("" + id));
    params.addPart("tag", new StringBody(tag));

    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "task/tag", params, getApiKey(),
            verboseLevel);

    if (apiResult instanceof TaskTag) {
        return (TaskTag) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to TaskTag");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Untags a task//from   www .j a  va 2 s. c  om
 * 
 * @param id - the task id
 * @param tag - the tag to be removed
 * @return
 * @throws Exception
 */
public TaskUntag taskUntag(int id, String tag) throws Exception {
    MultipartEntity params = new MultipartEntity();
    params.addPart("task_id", new StringBody("" + id));
    params.addPart("tag", new StringBody(tag));

    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "task/untag", params, getApiKey(),
            verboseLevel);

    if (apiResult instanceof TaskUntag) {
        return (TaskUntag) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to TaskUntag");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Flow description//from  w  ww.  j av a  2  s .co m
 * 
 * @param flow_id - the id of the flow. 
 * @return
 * @throws Exception
 */
public Flow flowGet(int flow_id) throws Exception {
    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "flow/" + flow_id, getApiKey(),
            verboseLevel);
    if (apiResult instanceof Flow) {
        return (Flow) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to Implementation");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Tags a flow.//from  w w w .j av  a 2s  .  com
 * 
 * @param id - the flow id
 * @param tag - the tag to be added to the flow
 * @return
 * @throws Exception
 */
public FlowTag flowTag(int id, String tag) throws Exception {
    MultipartEntity params = new MultipartEntity();
    params.addPart("flow_id", new StringBody("" + id));
    params.addPart("tag", new StringBody(tag));

    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "flow/tag", params, getApiKey(),
            verboseLevel);

    if (apiResult instanceof FlowTag) {
        return (FlowTag) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to FlowTag");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * removes a tag from a flow//from   www .ja  v a  2s  .co  m
 * 
 * @param id - the flow id
 * @param tag - the tag to be removed
 * @return
 * @throws Exception
 */
public FlowUntag flowUntag(int id, String tag) throws Exception {
    MultipartEntity params = new MultipartEntity();
    params.addPart("flow_id", new StringBody("" + id));
    params.addPart("tag", new StringBody(tag));

    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "flow/untag", params, getApiKey(),
            verboseLevel);

    if (apiResult instanceof FlowUntag) {
        return (FlowUntag) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to FlowUntag");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Returns all flows of the logged in user
 * /*  ww  w .  j  a  va2  s . com*/
 * @return ImplementationOwned - An object containing all implementation_ids
 *         that are owned by the current user.
 * @throws Exception
 *             - Can be: API Error (see documentation at openml.org), server
 *             down, etc.
 */
public FlowOwned flowOwned() throws Exception {
    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "flow/owned", getApiKey(),
            verboseLevel);
    if (apiResult instanceof FlowOwned) {
        return (FlowOwned) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to ImplementationOwned");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Deletes a flow//from w w w  . j  a  v  a 2  s .c  om
 * 
 * @param id
 *            - The numeric id of the implementation to be deleted.
 * @return ImplementationDelete - An object containing the id of the deleted
 *         implementation
 * @throws Exception
 *             - Can be: API Error (see documentation at openml.org), server
 *             down, etc.
 */
public FlowDelete flowDelete(int id) throws Exception {
    Object apiResult = HttpConnector.doApiDelete(OPENML_URL + API_PART + "flow/" + id, getApiKey(),
            verboseLevel);
    if (apiResult instanceof FlowDelete) {
        return (FlowDelete) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to ImplementationDelete");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

public FlowDelete flowForceDelete(int id) throws Exception {
    Object apiResult = HttpConnector.doApiDelete(OPENML_URL + API_PART + "flow/" + id + "/force", getApiKey(),
            verboseLevel);/*  w  ww.j a v a  2 s  . c  om*/
    if (apiResult instanceof FlowDelete) {
        return (FlowDelete) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to ImplementationDelete");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Checks whether a flow exists, by name/external_version combination
 * //from  w w w  .ja  v  a2 s  .com
 * @param name
 *            - The name of the implementation to be checked
 * @param external_version
 *            - The external version (workbench version). If not a proper
 *            revision number is available, it is recommended to use a MD5
 *            hash of the source code.
 * @return ImplementationExists - An object describing whether this
 *         implementation is already known on the server.
 * @throws Exception
 *             - Can be: API Error (see documentation at openml.org), server
 *             down, etc.
 */
public FlowExists flowExists(String name, String external_version) throws Exception {
    Object apiResult = HttpConnector.doApiRequest(
            OPENML_URL + API_PART + "flow/exists/" + name + "/" + external_version, getApiKey(), verboseLevel);
    if (apiResult instanceof FlowExists) {
        return (FlowExists) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to ImplementationExists");
    }
}

From source file:org.openml.apiconnector.io.OpenmlConnector.java

/**
 * Uploads a flow//from   w  ww  . jav a2s.com
 * 
 * @param description
 *            - An XML file describing the implementation. See documentation
 *            at openml.org.
 * @param binary
 *            - A file containing the implementation binary.
 * @param source
 *            - A file containing the implementation source.
 * @return UploadImplementation - An object containing information on the
 *         implementation upload.
 * @throws Exception
 *             - Can be: API Error (see documentation at openml.org), server
 *             down, etc.
 */
public UploadFlow flowUpload(File description, File binary, File source) throws Exception {
    MultipartEntity params = new MultipartEntity();
    params.addPart("description", new FileBody(description));
    if (source != null)
        params.addPart("source", new FileBody(source));
    if (binary != null)
        params.addPart("binary", new FileBody(binary));

    Object apiResult = HttpConnector.doApiRequest(OPENML_URL + API_PART + "flow", params, getApiKey(),
            verboseLevel);
    if (apiResult instanceof UploadFlow) {
        return (UploadFlow) apiResult;
    } else {
        throw new DataFormatException("Casting Api Object to UploadImplementation");
    }
}