Search in sources :

Example 11 with TexeraException

use of edu.uci.ics.texera.api.exception.TexeraException in project textdb by TextDB.

the class PlanStoreResource method updateQueryPlan.

@PUT
@Path("/{plan_name}")
public TexeraWebResponse updateQueryPlan(@PathParam("plan_name") String planName, String queryPlanBeanJson) {
    try {
        QueryPlanBean queryPlanBean = new ObjectMapper().readValue(queryPlanBeanJson, QueryPlanBean.class);
        // Updating the plan in the plan store
        planStore.updatePlan(planName, queryPlanBean.getDescription(), mapper.writeValueAsString(queryPlanBean.getQueryPlan()));
    } catch (IOException | TexeraException e) {
        throw new TexeraWebException(e.getMessage());
    }
    return new TexeraWebResponse(0, "Success");
}
Also used : TexeraWebResponse(edu.uci.ics.texera.web.response.TexeraWebResponse) IOException(java.io.IOException) TexeraException(edu.uci.ics.texera.api.exception.TexeraException) TexeraWebException(edu.uci.ics.texera.web.TexeraWebException) QueryPlanBean(edu.uci.ics.texera.web.response.planstore.QueryPlanBean) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 12 with TexeraException

use of edu.uci.ics.texera.api.exception.TexeraException in project textdb by TextDB.

the class ScanBasedSourceOperator method open.

@Override
public void open() throws TexeraException {
    if (isOpen) {
        return;
    }
    try {
        dataReader.open();
        isOpen = true;
    } catch (Exception e) {
        throw new DataflowException(e.getMessage(), e);
    }
}
Also used : DataflowException(edu.uci.ics.texera.api.exception.DataflowException) DataflowException(edu.uci.ics.texera.api.exception.DataflowException) TexeraException(edu.uci.ics.texera.api.exception.TexeraException) StorageException(edu.uci.ics.texera.api.exception.StorageException)

Example 13 with TexeraException

use of edu.uci.ics.texera.api.exception.TexeraException in project textdb by TextDB.

the class TwitterFeedOperator method open.

@Override
public void open() throws TexeraException {
    if (cursor != CLOSED) {
        return;
    }
    try {
        twitterConnector.getClient().connect();
        cursor = OPENED;
    } catch (Exception e) {
        throw new DataflowException(e.getMessage(), e);
    }
}
Also used : DataflowException(edu.uci.ics.texera.api.exception.DataflowException) TexeraException(edu.uci.ics.texera.api.exception.TexeraException) IOException(java.io.IOException) DataflowException(edu.uci.ics.texera.api.exception.DataflowException)

Example 14 with TexeraException

use of edu.uci.ics.texera.api.exception.TexeraException in project textdb by TextDB.

the class TwitterUtils method getPlaceLocation.

/**
 * To track tweets inside a geoBox defined by a List</Location>.
 * The string defines the coordinates in the order of "latitude_SW, longitude_SW, latitude_NE, longitude_NE".
 *
 * @param inputLocation
 * @return
 * @throws TexeraException
 */
public static List<Location> getPlaceLocation(String inputLocation) throws TexeraException {
    List<Location> locationList = new ArrayList<>();
    if (inputLocation == null || inputLocation.isEmpty()) {
        return locationList;
    }
    List<String> boudingCoordinate = Arrays.asList(inputLocation.trim().split(","));
    if (boudingCoordinate.size() != 4 || boudingCoordinate.stream().anyMatch(s -> s.trim().isEmpty())) {
        throw new DataflowException("Please provide valid location coordinates");
    }
    List<Double> boundingBox = new ArrayList<>();
    boudingCoordinate.stream().forEach(s -> boundingBox.add(Double.parseDouble(s.trim())));
    locationList.add(new Location(new Coordinate(boundingBox.get(1), boundingBox.get(0)), new Coordinate(boundingBox.get(3), boundingBox.get(2))));
    return locationList;
}
Also used : Arrays(java.util.Arrays) Coordinate(com.twitter.hbc.core.endpoint.Location.Coordinate) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TexeraException(edu.uci.ics.texera.api.exception.TexeraException) IOException(java.io.IOException) Location(com.twitter.hbc.core.endpoint.Location) ArrayList(java.util.ArrayList) List(java.util.List) DataflowException(edu.uci.ics.texera.api.exception.DataflowException) AttributeType(edu.uci.ics.texera.api.schema.AttributeType) Schema(edu.uci.ics.texera.api.schema.Schema) JsonNode(com.fasterxml.jackson.databind.JsonNode) Attribute(edu.uci.ics.texera.api.schema.Attribute) Coordinate(com.twitter.hbc.core.endpoint.Location.Coordinate) ArrayList(java.util.ArrayList) DataflowException(edu.uci.ics.texera.api.exception.DataflowException) Location(com.twitter.hbc.core.endpoint.Location)

Example 15 with TexeraException

use of edu.uci.ics.texera.api.exception.TexeraException in project textdb by TextDB.

the class Join method close.

@Override
public void close() throws TexeraException {
    if (cursor == CLOSED) {
        return;
    }
    try {
        innerOperator.close();
        outerOperator.close();
    } catch (Exception e) {
        throw new DataflowException(e.getMessage(), e);
    }
    // Set the inner tuple list back to null on close.
    innerTupleList = null;
    innerTupleListCursor = 0;
    cursor = CLOSED;
}
Also used : DataflowException(edu.uci.ics.texera.api.exception.DataflowException) DataflowException(edu.uci.ics.texera.api.exception.DataflowException) TexeraException(edu.uci.ics.texera.api.exception.TexeraException)

Aggregations

TexeraException (edu.uci.ics.texera.api.exception.TexeraException)25 DataflowException (edu.uci.ics.texera.api.exception.DataflowException)17 IOException (java.io.IOException)12 Tuple (edu.uci.ics.texera.api.tuple.Tuple)11 Schema (edu.uci.ics.texera.api.schema.Schema)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 AttributeType (edu.uci.ics.texera.api.schema.AttributeType)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 Attribute (edu.uci.ics.texera.api.schema.Attribute)5 TexeraWebException (edu.uci.ics.texera.web.TexeraWebException)5 IField (edu.uci.ics.texera.api.field.IField)4 QueryPlanBean (edu.uci.ics.texera.web.response.planstore.QueryPlanBean)4 SchemaConstants (edu.uci.ics.texera.api.constants.SchemaConstants)3 IOperator (edu.uci.ics.texera.api.dataflow.IOperator)3 ISink (edu.uci.ics.texera.api.dataflow.ISink)3 StorageException (edu.uci.ics.texera.api.exception.StorageException)3 IntegerField (edu.uci.ics.texera.api.field.IntegerField)3 Collectors (java.util.stream.Collectors)3