Codota Logo
StreamsQuery.isActive
Code IndexAdd Codota to your IDE (free)

How to use
isActive
method
in
org.apache.rya.streams.api.entity.StreamsQuery

Best Java code snippets using org.apache.rya.streams.api.entity.StreamsQuery.isActive (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: apache/incubator-rya

private void append(final StringBuilder string, final StreamsQuery query) {
  requireNonNull(string);
  requireNonNull(query);
  string.append("    Streams Query {\n")
     .append("        Query ID: ").append(query.getQueryId()).append(",\n")
     .append("        Is Active: ").append(query.isActive()).append(",\n")
     .append("        SPARQL: ").append(query.getSparql()).append("\n")
     .append("    }");
}
origin: apache/incubator-rya

/**
 * Pretty formats a {@link StreamsQuery}.
 *
 * @param query - The query to format. (not null)
 * @return The pretty formatted string.
 * @throws Exception A problem was encountered while pretty formatting the SPARQL.
 */
public static String format(final StreamsQuery query) throws Exception {
  requireNonNull(query);
  // Pretty format the SPARQL query.
  final ParsedQuery parsedQuery = new SPARQLParser().parseQuery(query.getSparql(), null);
  final String prettySparql = new SPARQLQueryRenderer().render(parsedQuery);
  final String[] lines = prettySparql.split("\n");
  // Create the formatted string.
  query.getQueryId();
  query.isActive();
  String.format(" QueryId: %s", query.getQueryId());
  final StringBuilder builder = new StringBuilder();
  builder.append(" Query ID: ").append( query.getQueryId() ) .append("\n");
  builder.append("Is Active: ").append( query.isActive() ).append("\n");
  builder.append("Is Insert: ").append( query.isInsert() ).append("\n");
  builder.append("   SPARQL: ").append( lines[0] ).append("\n");
  for(int i = 1; i < lines.length; i++) {
    builder.append("           ").append(lines[i]).append("\n");
  }
  return builder.toString();
}
origin: apache/incubator-rya

@CliCommand(value = STREAM_QUERIES_START_CMD, help = "Start processing a SPARQL query using the Rya Streams subsystem.")
public String startQuery(
    @CliOption(key= {"queryId"}, mandatory = true, help = "The ID of the query to start processing.")
    final String queryId) {
  final RyaStreamsClient streamsClient = state.getShellState().getRyaStreamsCommands().get();
  try {
    // Ensure the query exists.
    final UUID id = UUID.fromString(queryId);
    final java.util.Optional<StreamsQuery> streamsQuery = streamsClient.getGetQuery().getQuery(id);
    if(!streamsQuery.isPresent()) {
      throw new RuntimeException("No Rya Streams query exists for ID " + queryId);
    }
    // Ensure it isn't already started.
    if(streamsQuery.get().isActive()) {
      return "That query is already running.";
    }
    // Start it.
    streamsClient.getStartQuery().start(id);
    return "The query will be processed by the Rya Streams subsystem.";
  } catch (final RyaStreamsException e) {
    throw new RuntimeException("Unable to start the Query.", e);
  }
}
origin: apache/incubator-rya

@CliCommand(value = STREAM_QUERIES_STOP_CMD, help = "Stop processing a SPARQL query using the Rya Streams subsystem.")
public String stopQuery(
    @CliOption(key= {"queryId"}, mandatory = true, help = "The ID of the query to stop processing.")
    final String queryId) {
  final RyaStreamsClient streamsClient = state.getShellState().getRyaStreamsCommands().get();
  try {
    // Ensure the query exists.
    final UUID id = UUID.fromString(queryId);
    final java.util.Optional<StreamsQuery> streamsQuery = streamsClient.getGetQuery().getQuery(id);
    if(!streamsQuery.isPresent()) {
      throw new RuntimeException("No Rya Streams query exists for ID " + queryId);
    }
    // Ensure it isn't already stopped.
    if(!streamsQuery.get().isActive()) {
      return "That query is already stopped.";
    }
    // Stop it.
    streamsClient.getStopQuery().stop(id);
    return "The query will no longer be processed by the Rya Streams subsystem.";
  } catch (final RyaStreamsException e) {
    throw new RuntimeException("Unable to start the Query.", e);
  }
}
origin: apache/incubator-rya

  log.info("Rya Instance " + ryaInstance + " created Rya Streams query " + newQueryState + ".");
  final StreamsQuery newQuery = newQueryState.get();
  if(newQuery.isActive()) {
    final QueryEvent executeNewQuery = QueryEvent.executing(ryaInstance, newQuery);
    offerUntilAcceptedOrShutdown(queryWorkQueue, executeNewQuery, blockingValue, blockingUnits, shutdownSignal);
if(newQueryState.isPresent()) {
  final StreamsQuery updatedQuery = newQueryState.get();
  if(updatedQuery.isActive()) {
    log.info("Rya Instance " + ryaInstance + " updated Rya Streams query with ID " +
        updatedQuery.getQueryId() + " to be active.");
origin: apache/incubator-rya

.forEach(query -> {
  final QueryEvent queryEvent = query.isActive() ?
      QueryEvent.executing(ryaInstance, query) : QueryEvent.stopped(ryaInstance, query.getQueryId());
  log.debug("LogEventWorker - offering: " + queryEvent);
org.apache.rya.streams.api.entityStreamsQueryisActive

Popular methods of StreamsQuery

  • getQueryId
  • getSparql
  • isInsert
  • <init>
    Constructs an instance of StreamsQuery.

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now