congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StreamsQuery.getQueryId
Code IndexAdd Tabnine to your IDE (free)

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

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

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

  final String id1 = query1.getQueryId().toString();
  final String id2 = query2.getQueryId().toString();
  return id1.compareTo(id2);
});
origin: apache/incubator-rya

@Override
public void startQuery(final String ryaInstance, final StreamsQuery query) throws QueryExecutorException {
  requireNonNull(ryaInstance);
  requireNonNull(query);
  checkState(state() == State.RUNNING, "The service must be RUNNING to execute this method.");
  lock.lock();
  try {
    // Make sure the Statements topic exists for the query.
    final Set<String> topics = Sets.newHashSet(
        KafkaTopics.statementsTopic(ryaInstance),
        KafkaTopics.queryResultsTopic(ryaInstance, query.getQueryId()));
    // Make sure the Query Results topic exists for the query.
    // Since this is running in the JVM, the properties are left empty
    //   so the cleanup.policy will default to delete to reduce memory usage.
    createKafkaTopic.createTopics(topics, 1, 1, Optional.empty());
    // Setup the Kafka Streams job that will execute.
    final KafkaStreams streams = streamsFactory.make(ryaInstance, query);
    streams.start();
    // Mark which Rya Instance the Query ID is for.
    ryaInstanceById.put(query.getQueryId(), ryaInstance);
    // Add the Query ID to the collection of running queries for the Rya instance.
    idByRyaInstance.put(ryaInstance, query.getQueryId());
    // Add the running Kafka Streams job for the Query ID.
    byQueryId.put(query.getQueryId(), streams);
  } catch (final KafkaStreamsFactoryException e) {
    throw new QueryExecutorException("Could not start query " + query.getQueryId(), e);
  } finally {
    lock.unlock();
  }
}
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

  @Override
  public KafkaStreams make(final String ryaInstance, final StreamsQuery query) throws KafkaStreamsFactoryException {
    requireNonNull(ryaInstance);
    requireNonNull(query);

    // Setup the Kafka Stream program.
    final Properties streamsProps = new Properties();

    // Configure the Kafka servers that will be talked to.
    streamsProps.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServersConfig);

    // Use the Query ID as the Application ID to ensure we resume where we left off the last time this command was run.
    streamsProps.put(StreamsConfig.APPLICATION_ID_CONFIG, "RyaStreams-Query-" + query.getQueryId());

    // Always start at the beginning of the input topic.
    streamsProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

    // Setup the topology that processes the Query.
    final String statementsTopic = KafkaTopics.statementsTopic(ryaInstance);
    final String resultsTopic = KafkaTopics.queryResultsTopic(ryaInstance, query.getQueryId());

    try {
      final TopologyBuilder topologyBuilder = topologyFactory.build(query.getSparql(), statementsTopic, resultsTopic, new RandomUUIDFactory());
      return new KafkaStreams(topologyBuilder, new StreamsConfig(streamsProps));
    } catch (final MalformedQueryException | TopologyBuilderException e) {
      throw new KafkaStreamsFactoryException("Could not create a KafkaStreams processing topology for query " + query.getQueryId(), e);
    }
  }
}
origin: apache/incubator-rya

if(updatedQuery.isActive()) {
  log.info("Rya Instance " + ryaInstance + " updated Rya Streams query with ID " +
      updatedQuery.getQueryId() + " to be active.");
  final QueryEvent executeUpdatedQuery = QueryEvent.executing(ryaInstance, updatedQuery);
  offerUntilAcceptedOrShutdown(queryWorkQueue, executeUpdatedQuery, blockingValue, blockingUnits, shutdownSignal);
} else {
  log.info("Rya Instance " + ryaInstance + " updated Rya Streams query with ID " +
      updatedQuery.getQueryId() + " to be inactive.");
  final QueryEvent stopUpdatedQuery = QueryEvent.stopped(ryaInstance, updatedQuery.getQueryId());
  offerUntilAcceptedOrShutdown(queryWorkQueue, stopUpdatedQuery, blockingValue, blockingUnits, shutdownSignal);
origin: apache/incubator-rya

    QueryEvent.executing(ryaInstance, query) : QueryEvent.stopped(ryaInstance, query.getQueryId());
log.debug("LogEventWorker - offering: " + queryEvent);
origin: apache/incubator-rya

final StreamsQuery old = queriesCache.get(queryId);
final StreamsQuery updated = new StreamsQuery(
    old.getQueryId(),
    old.getSparql(),
    change.getIsActive().get(),
origin: org.apache.rya/rya.streams.api

final StreamsQuery old = queriesCache.get(queryId);
final StreamsQuery updated = new StreamsQuery(
    old.getQueryId(),
    old.getSparql(),
    change.getIsActive().get());
origin: apache/incubator-rya

return "The added query's ID is " + streamsQuery.getQueryId();
org.apache.rya.streams.api.entityStreamsQuerygetQueryId

Popular methods of StreamsQuery

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

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
  • getExternalFilesDir (Context)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now