All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.eBus.client.IEFeed Maven / Gradle / Ivy

The newest version!
//
// 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;

import net.sf.eBus.messages.EMessageKey;

/**
 * Common base interface for single- and multi-subject feeds.
 * Allows feeds to be referenced in a common manner.
 *
 * @author Charles W. Rapp
 */

public interface IEFeed
{
//---------------------------------------------------------------
// Member methods.
//

    /**
     * Returns the unique feed identifier. The uniqueness is
     * limited to within the client and for the feed lifespan
     * only. When a feed is closed, the feed identifier may be
     * reused.
     * @return the feed identifier.
     */
    int feedId();

    /**
     * Returns the feed scope.
     * @return feed scope.
     */
    EFeed.FeedScope scope();

    /**
     * Returns the eBus client referenced by this feed.
     * @return eBus client.
     */
    EClient eClient();

    /**
     * Returns {@code true} if this feed is still active and
     * {@code false} if inactive. Clients may only use active
     * feeds. Once a feed is closed, it is marked inactive and
     * may not be used by the client again.
     * @return {@code true} if this feed is active.
     */
    boolean isActive();

    /**
     * Returns {@code true} if this feed is "in place"
     * (advertised or subscribed) and {@code false} otherwise.
     * When this feed is closed, the feed is automatically
     * un-advertised/un-subscribed.
     * @return {@code true} if the feed is in place.
     */
    boolean inPlace();

    /**
     * Returns {@code true} if the feed is up and {@code false}
     * otherwise.
     * @return {@code true} if the feed is up.
     */
    boolean isFeedUp();

    /**
     * Returns the current feed state.
     * @return feed state.
     */
    EFeedState feedState();

    /**
     * Returns the message key associated with this feed.
     * @return feed message key.
     */
    EMessageKey key();

    /**
     * Permanently closes the feed. After closing, this feed may
     * no longer be used.
     */
    void close();
} // end of interface IEFeed





© 2015 - 2024 Weber Informatics LLC | Privacy Policy