@@ -0,0 +1,2386 @@
+/*%0A * Copyright 2011 Meyer Kizner%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A * http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.prealpha.xylophone.shared;%0A%0Aimport com.google.gwt.user.client.rpc.IsSerializable;%0A%0A/**%0A * Represents a subscription to partial and complete %7B@link Result%7Ds from an%0A * %7B@link Action%7D, usually one that is long-running. Subscriptions should only%0A * be created by and used with a specific %7B@link Dispatcher%7D.%0A * %0A * @param %3CR%3E%0A *            the result type for this subscription%0A * @author Meyer Kizner%0A * @see Dispatcher%0A * %0A */%0Apublic final class Subscription%3CR extends Result%3E implements IsSerializable %7B%0A%09/**%0A%09 * A unique identifier for this subscription which is assigned by the%0A%09 * server. Non-%7B@code final%7D to allow for GWT serialization, but never%0A%09 * altered in practice.%0A%09 */%0A%09private int identifier;%0A%0A%09// serialization support%0A%09@SuppressWarnings(%22unused%22)%0A%09private Subscription() %7B%0A%09%7D%0A%0A%09/**%0A%09 * Constructs a new %7B@code Subscription%7D with the specified unique%0A%09 * identifier. To preserve the uniqueness of these identifiers, only%0A%09 * %7B@link Dispatcher%7D implementations should construct new%0A%09 * %7B@code Subscription%7D objects.%0A%09 * %0A%09 * @param identifier%0A%09 *            the unique identifier for this subscription%0A%09 */%0A%09public Subscription(int identifier) %7B%0A%09%09this.identifier = identifier;%0A%09%7D%0A%0A%09/**%0A%09 * @return the unique identifier for this subscription%0A%09 */%0A%09public int getIdentifier() %7B%0A%09%09return identifier;%0A%09%7D%0A%0A%09@Override%0A%09public int hashCode() %7B%0A%09%09final int prime = 31;%0A%09%09int result = 1;%0A%09%09result = prime * result + identifier;%0A%09%09return result;%0A%09%7D%0A%0A%09@Override%0A%09public boolean equals(Object obj) %7B%0A%09%09if (this == obj) %7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09if (obj == null) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09if (!(obj instanceof Subscription)) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09Subscription%3C?%3E other = (Subscription%3C?%3E) obj;%0A%09%09if (identifier != other.identifier) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09return true;%0A%09%7D%0A%7D%0A

Add the Subscription class, for the implementation of a publish/subscribe model in Dispatcher