<commit_before>package org.accada.epcis.repository;

import java.io.IOException;
import java.rmi.RemoteException;
import java.sql.PreparedStatement;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.management.Notification;
import javax.management.timer.Timer;
import javax.xml.rpc.ServiceException;

import org.accada.epcis.soapapi.ActionType;
import org.accada.epcis.soapapi.ArrayOfString;
import org.accada.epcis.soapapi.EPCISQueryBodyType;
import org.accada.epcis.soapapi.EPCISServiceBindingStub;
import org.accada.epcis.soapapi.ImplementationException;
import org.accada.epcis.soapapi.NoSuchNameException;
import org.accada.epcis.soapapi.Poll;
import org.accada.epcis.soapapi.QueryParam;
import org.accada.epcis.soapapi.QueryParameterException;
import org.accada.epcis.soapapi.QueryResults;
import org.accada.epcis.soapapi.QueryTooComplexException;
import org.accada.epcis.soapapi.QueryTooLargeException;
import org.accada.epcis.soapapi.SecurityException;
import org.accada.epcis.soapapi.ValidationException;
import org.apache.axis.types.URI;
import org.apache.log4j.Logger;

/**
 * Implementation of triggers. The Schedule checks every 10 minuntes on the
 * trigger condition. If the trigger condition is met: execute the query
 * associated to the subscription The checking frequency may be changed in the
 * QueryOperationsModule.
 * 
 * @author <NAME>
 * 
 */
public class QuerySubscriptionTriggered extends QuerySubscriptionScheduled {

	private static final Logger LOG = Logger
			.getLogger(QuerySubscriptionTriggered.class);

	private static URI trigger;

	private static final long serialVersionUID = 1L;

	private static String triggerQuery;

	public QuerySubscriptionTriggered(String subscriptionID,
			QueryParam[] queryParams, URI dest, Boolean reportIfEmpty,
			GregorianCalendar initialRecordTime,
			GregorianCalendar lastTimeExecuted, String queryName, URI aTrigger,
			Schedule every10min) throws ImplementationException {
		super(subscriptionID, queryParams, dest, reportIfEmpty,
				initialRecordTime, lastTimeExecuted, every10min, queryName);
		this.trigger = aTrigger;
		prepareTriggerQuery();
	}

	private void prepareTriggerQuery() {
		// TODO This part may be clear in subsequent versions of the spec
	}

	/**
	 * @see org.accada.epcis.repository.QuerySubscriptionScheduled#handleNotification(javax.management.Notification, java.lang.Object)
	 *  First checks on the trigger condition: if fulfilled then execute Query.
	 */
	@Override
	public void handleNotification(Notification pNotification, Object pHandback) {
		EPCISServiceBindingStub epcisQueryService;
		 if (pHandback == null) {
	            LOG.error("The timer stating the next scheduled query execution time is null!");
	            return;
	        }
		 if (!doItAgain) {
	            ((Timer) pHandback).stop();
	        } else {<commit_msg>method prepareTriggerQuery unnecessary<commit_after>package org.accada.epcis.repository;

import java.io.IOException;
import java.rmi.RemoteException;
import java.sql.PreparedStatement;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.management.Notification;
import javax.management.timer.Timer;
import javax.xml.rpc.ServiceException;

import org.accada.epcis.soapapi.ActionType;
import org.accada.epcis.soapapi.ArrayOfString;
import org.accada.epcis.soapapi.EPCISQueryBodyType;
import org.accada.epcis.soapapi.EPCISServiceBindingStub;
import org.accada.epcis.soapapi.ImplementationException;
import org.accada.epcis.soapapi.NoSuchNameException;
import org.accada.epcis.soapapi.Poll;
import org.accada.epcis.soapapi.QueryParam;
import org.accada.epcis.soapapi.QueryParameterException;
import org.accada.epcis.soapapi.QueryResults;
import org.accada.epcis.soapapi.QueryTooComplexException;
import org.accada.epcis.soapapi.QueryTooLargeException;
import org.accada.epcis.soapapi.SecurityException;
import org.accada.epcis.soapapi.ValidationException;
import org.apache.axis.types.URI;
import org.apache.log4j.Logger;

/**
 * Implementation of triggers. The Schedule checks every 10 minuntes on the
 * trigger condition. If the trigger condition is met: execute the query
 * associated to the subscription The checking frequency may be changed in the
 * QueryOperationsModule.
 * 
 * @author <NAME>
 * 
 */
public class QuerySubscriptionTriggered extends QuerySubscriptionScheduled {

	private static final Logger LOG = Logger
			.getLogger(QuerySubscriptionTriggered.class);

	private static URI trigger;

	private static final long serialVersionUID = 1L;

	private static String triggerQuery;

	public QuerySubscriptionTriggered(String subscriptionID,
			QueryParam[] queryParams, URI dest, Boolean reportIfEmpty,
			GregorianCalendar initialRecordTime,
			GregorianCalendar lastTimeExecuted, String queryName, URI aTrigger,
			Schedule every10min) throws ImplementationException {
		super(subscriptionID, queryParams, dest, reportIfEmpty,
				initialRecordTime, lastTimeExecuted, every10min, queryName);
		this.trigger = aTrigger;
	}

	/**
	 * @see org.accada.epcis.repository.QuerySubscriptionScheduled#handleNotification(javax.management.Notification, java.lang.Object)
	 *  First checks on the trigger condition: if fulfilled then execute Query.
	 */
	@Override
	public void handleNotification(Notification pNotification, Object pHandback) {
		EPCISServiceBindingStub epcisQueryService;
		 if (pHandback == null) {
	            LOG.error("The timer stating the next scheduled query execution time is null!");
	            return;
	        }
		 if (!doItAgain) {
	            ((Timer) pHandback).stop();
	        } else {
{'fraction_non_alphanumeric': 0.08187656082768463, 'fraction_numerical': 0.0028540849090260435, 'mean_word_length': 5.141292442497262, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897910', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1567, 'n_words': 392}