
net.sf.eBus.client.IEReplyFeed Maven / Gradle / Ivy
//
// Copyright 2017 Charles W. Rapp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package net.sf.eBus.client;
/**
* Provides a common view of single- and multi-key reply feeds,
* allowing such feeds to be referenced in a common way.
*
* @author Charles W. Rapp
*/
public interface IEReplyFeed
extends IEFeed
{
//---------------------------------------------------------------
// Member methods.
//
/**
* Returns {@code true} if this reply feed is both open and
* advertised; otherwise, returns {@code false}.
* @return {@code true} if this reply feed is open and
* advertised
*/
boolean isAdvertised();
/**
* Puts the new request callback in place. If {@code cb} is
* not {@code null}, requests will be passed to {@code cb}
* rather than
* {@link EReplier#request(EReplyFeed.ERequest)}. A
* {@code null cb} means that requests are passed to the
* {@link EReplier#request(EReplyFeed.ERequest)} override.
* @param cb the request callback. May be {@code null}.
* @throws IllegalStateException
* if this feed is either closed or advertised.
*/
void requestCallback(final RequestCallback cb);
/**
* Puts the cancel request callback in place. If {@code cb}
* is not {@code null}, requests will be passed to {@code cb}
* rather than
* {@link EReplier#cancelRequest(EReplyFeed.ERequest, boolean)}.
* A {@code null cb} means that cancellations are passed to
* the
* {@link EReplier#cancelRequest(EReplyFeed.ERequest, boolean)}
* override.
* @param cb the cancel request callback. May be
* {@code null}.
* @throws IllegalStateException
* if this feed is either closed or advertised.
*/
void cancelRequestCallback(final CancelRequestCallback cb);
/**
* Advertises this replier fed to the associated request
* subject. If this feed is currently advertised to the
* subject, then does nothing.
* @throws IllegalStateException
* if this feed is closed or if the client did not override
* {@link EReplier} methods nor put the required callbacks in
* place.
*
* @see #unadvertise()
* @see #updateFeedState(EFeedState)
* @see EFeed#close()
*/
void advertise();
/**
* Retracts this replier feed advertisement. Does nothing if
* this feed is not currently advertised.
* @throws IllegalStateException
* if this reply feed is closed.
*
* @see #advertise()
* @see #close()
*/
public void unadvertise();
/**
* Updates the replier feed state to the given value. If
* {@code update} equals the currently stored reply feed
* state, nothing is done. Otherwise, the updated value is
* stored. If this feed is advertised to the server and
* the subscription feed is up, then this update is forwarded
* to subscribed requestors.
* @param update the new reply feed state.
* @throws NullPointerException
* if {@code update} is {@code null}.
* @throws IllegalStateException
* if this feed was closed and is inactive or is not
* advertised.
*/
public void updateFeedState(final EFeedState update);
} // end of interface IEReplyFeed
© 2015 - 2025 Weber Informatics LLC | Privacy Policy