// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/messaging/Role.java
// public abstract class Role {
//     protected final RDFAgent agent;
// 
//     public Role(final RDFAgent agent) {
//         this.agent = agent;
//     }
// }
// 
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/ErrorExplanation.java
// public class ErrorExplanation {
//     private final Type type;
//     private final String message;
// 
//     public enum Type {
//         ExternalError("external-error"),
//         InteractionExplired("interaction-expired"),
//         InternalError("internal-error"),
//         InvalidMessage("invalid-message"),
//         NotImplemented("not-implemented"),
//         Unavailable("unavailable");
// 
//         private final String fipaName;
// 
//         private Type(final String fipaName) {
//             this.fipaName = fipaName;
//         }
// 
//         public String getFipaName() {
//             return fipaName;
//         }
// 
//         public static Type getByFipaName(final String fipaName) {
//             for (Type t : values()) {
//                 if (t.fipaName.equals(fipaName)) {
//                     return t;
//                 }
//             }
// 
//             return null;
//         }
//     }
// 
//     public ErrorExplanation(final Type type,
//                             final String message) {
//         this.type = type;
//         this.message = message;
// 
//         if (null == type) {
//             throw new IllegalArgumentException("null type");
//         }
// 
//         if (null == message) {
//             throw new IllegalArgumentException("null message");
//         }
// 
//         if (0 == message.length()) {
//             throw new IllegalArgumentException("empty message");
//         }
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String toString() {
//         return type + " (" + message + ")";
//     }
// }
// 
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/RDFAgent.java
// public abstract class RDFAgent {
//     protected final AgentId identity;
// 
//     public RDFAgent(final RDFAgentsPlatform platform,
//                     final AgentId id) throws RDFAgentException {
// 
//         if (0 == id.getTransportAddresses().length) {
//             throw new IllegalArgumentException("at least one transport address must be specified");
//         }
// 
//         identity = id;
//     }
// 
//     public AgentId getIdentity() {
//         return identity;
//     }
// 
//     public abstract void setQueryProvider(QueryProvider<Value, Dataset> queryProvider);
// 
//     public abstract void setPubsubProvider(PubsubProvider<Value, Dataset> pubsubProvider);
// 
//     public static class RDFAgentException extends Exception {
//         public RDFAgentException(final Throwable cause) {
//             super(cause);
//         }
//     }
// 
//     // TODO: remove/shutdown method
// }


import net.fortytwo.rdfagents.messaging.Role;
import net.fortytwo.rdfagents.model.ErrorExplanation;
import net.fortytwo.rdfagents.model.RDFAgent;
package net.fortytwo.rdfagents.messaging.subscribe.old;


/**
 * An agent role for subscribing to streams of updates from other agents.
 * Subscriptions in RDFAgents follow FIPA's
 * <a href="http://www.fipa.org/specs/fipa00035/SC00035H.html">Subscribe Interaction Protocol</a>.
 * For more details, see <a href="http://fortytwo.net/2011/rdfagents/spec#pubsub">the specification</a>.
 *
 * @author Joshua Shinavier (http://fortytwo.net)
 */
public abstract class SubscriberOld<Q, A> extends Role {
    public SubscriberOld(final RDFAgent client) {
        super(client);
    }

    /**
     * Submits a query to a remote agent, initiating a new query interaction.
     *
     * @param request  the query request the be submitted
     * @param callback a handler for all possible outcomes of the query request.
     *                 Note: its methods typically execute in a thread other than the calling thread.
     */
    public abstract void submit(SubscribeRequestOld<Q> request,
                                QueryCallback<A> callback);

    /**
     * Submits a cancellation request for a previously submitted query.
     *
     * @param request  the previously submitted query request to be cancelled
     * @param callback a handler for all possible outcomes of the cancellation request.
     *                 Note: its methods typically execute in a thread other than the calling thread.
     */
    public abstract void cancel(SubscribeRequestOld<Q> request,
                                CancellationCallback callback);

    /**
     * A handler for all possible outcomes of a query request.
     *
     * @param <A> a class of query answers
     */
    public interface QueryCallback<A> {
        /**
         * Indicates success of the query request and provides the query answer.
         *
         * @param answer the answer to the submitted query
         */
        void success(A answer);

        /**
         * Indicates that the remote participant has agreed to answer the query.
         */
        void agreed();

        /**
         * Indicates that the remote participant has refused to answer the query.
         *
         * @param explanation an explanation of the refusal, provided by the remote participant
         */
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/messaging/Role.java
// public abstract class Role {
//     protected final RDFAgent agent;
// 
//     public Role(final RDFAgent agent) {
//         this.agent = agent;
//     }
// }
// 
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/ErrorExplanation.java
// public class ErrorExplanation {
//     private final Type type;
//     private final String message;
// 
//     public enum Type {
//         ExternalError("external-error"),
//         InteractionExplired("interaction-expired"),
//         InternalError("internal-error"),
//         InvalidMessage("invalid-message"),
//         NotImplemented("not-implemented"),
//         Unavailable("unavailable");
// 
//         private final String fipaName;
// 
//         private Type(final String fipaName) {
//             this.fipaName = fipaName;
//         }
// 
//         public String getFipaName() {
//             return fipaName;
//         }
// 
//         public static Type getByFipaName(final String fipaName) {
//             for (Type t : values()) {
//                 if (t.fipaName.equals(fipaName)) {
//                     return t;
//                 }
//             }
// 
//             return null;
//         }
//     }
// 
//     public ErrorExplanation(final Type type,
//                             final String message) {
//         this.type = type;
//         this.message = message;
// 
//         if (null == type) {
//             throw new IllegalArgumentException("null type");
//         }
// 
//         if (null == message) {
//             throw new IllegalArgumentException("null message");
//         }
// 
//         if (0 == message.length()) {
//             throw new IllegalArgumentException("empty message");
//         }
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String toString() {
//         return type + " (" + message + ")";
//     }
// }
// 
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/RDFAgent.java
// public abstract class RDFAgent {
//     protected final AgentId identity;
// 
//     public RDFAgent(final RDFAgentsPlatform platform,
//                     final AgentId id) throws RDFAgentException {
// 
//         if (0 == id.getTransportAddresses().length) {
//             throw new IllegalArgumentException("at least one transport address must be specified");
//         }
// 
//         identity = id;
//     }
// 
//     public AgentId getIdentity() {
//         return identity;
//     }
// 
//     public abstract void setQueryProvider(QueryProvider<Value, Dataset> queryProvider);
// 
//     public abstract void setPubsubProvider(PubsubProvider<Value, Dataset> pubsubProvider);
// 
//     public static class RDFAgentException extends Exception {
//         public RDFAgentException(final Throwable cause) {
//             super(cause);
//         }
//     }
// 
//     // TODO: remove/shutdown method
// }


// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/messaging/subscribe/old/SubscriberOld.java
import net.fortytwo.rdfagents.messaging.Role;
import net.fortytwo.rdfagents.model.ErrorExplanation;
import net.fortytwo.rdfagents.model.RDFAgent;

package net.fortytwo.rdfagents.messaging.subscribe.old;


/**
 * An agent role for subscribing to streams of updates from other agents.
 * Subscriptions in RDFAgents follow FIPA's
 * <a href="http://www.fipa.org/specs/fipa00035/SC00035H.html">Subscribe Interaction Protocol</a>.
 * For more details, see <a href="http://fortytwo.net/2011/rdfagents/spec#pubsub">the specification</a>.
 *
 * @author Joshua Shinavier (http://fortytwo.net)
 */
public abstract class SubscriberOld<Q, A> extends Role {
    public SubscriberOld(final RDFAgent client) {
        super(client);
    }

    /**
     * Submits a query to a remote agent, initiating a new query interaction.
     *
     * @param request  the query request the be submitted
     * @param callback a handler for all possible outcomes of the query request.
     *                 Note: its methods typically execute in a thread other than the calling thread.
     */
    public abstract void submit(SubscribeRequestOld<Q> request,
                                QueryCallback<A> callback);

    /**
     * Submits a cancellation request for a previously submitted query.
     *
     * @param request  the previously submitted query request to be cancelled
     * @param callback a handler for all possible outcomes of the cancellation request.
     *                 Note: its methods typically execute in a thread other than the calling thread.
     */
    public abstract void cancel(SubscribeRequestOld<Q> request,
                                CancellationCallback callback);

    /**
     * A handler for all possible outcomes of a query request.
     *
     * @param <A> a class of query answers
     */
    public interface QueryCallback<A> {
        /**
         * Indicates success of the query request and provides the query answer.
         *
         * @param answer the answer to the submitted query
         */
        void success(A answer);

        /**
         * Indicates that the remote participant has agreed to answer the query.
         */
        void agreed();

        /**
         * Indicates that the remote participant has refused to answer the query.
         *
         * @param explanation an explanation of the refusal, provided by the remote participant
         */
        void refused(ErrorExplanation explanation);