net.sf.eBus.client.ServerMessage Maven / Gradle / Ivy
The newest version!
//
// Copyright 2014, 2016, 2020 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 java.io.Serializable;
import net.sf.eBus.messages.ELocalOnly;
import net.sf.eBus.messages.EMessageKey;
import net.sf.eBus.messages.ESystemMessage;
/**
* This message reports the
* {@link #remoteAddress remote Internet address and TCP port}
* of a connection newly accepted by {@link EServer} but not yet
* logged in.
*
* All such messages have the subject
* {@link ESystemMessage#SYSTEM_SUBJECT /eBus}. Subscribe
* to
* {@link #MESSAGE_KEY ServerMessage.class:/eBus} to receive this
* notification.
*
*
* Note: this notification is published
* locally only and is not sent to remote eBus applications.
*
*
* @see ConnectionMessage
*
* @author Charles Rapp
*/
@ELocalOnly
public final class ServerMessage
extends AbstractEBusMessage
implements Serializable
{
//---------------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Constants.
//
/**
* The server message key {@code ServerMessage.class}:/eBus.
* Use this key when opening a system message
* {@link net.sf.eBus.client.EFeed feed}.
*/
public static final EMessageKey MESSAGE_KEY =
new EMessageKey(ServerMessage.class,
ESystemMessage.SYSTEM_SUBJECT);
/**
* Serialization version identifier.
*/
private static final long serialVersionUID = 0x050200L;
//---------------------------------------------------------------
// Member methods.
//
//-----------------------------------------------------------
// Constructors.
//
/**
* Creates a new server message based on the builder
* settings.
* @param builder server message builder.
*/
private ServerMessage(final Builder builder)
{
super (builder);
} // end of ServerMessage(Builder)
//
// end of Constructors.
//-----------------------------------------------------------
/**
* Returns a new server message builder instance.
* @return message builder instance.
*/
public static Builder builder()
{
return (new Builder());
} // end of builder()
//---------------------------------------------------------------
// Inner classes.
//
/**
* Use this builder to create {@code ServerMessage}
* instances.
*/
public static final class Builder
extends AbstractEBusMessage.Builder
{
//-----------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Member methods.
//
//-------------------------------------------------------
// Constructors.
//
private Builder()
{
super (ServerMessage.class);
} // end of Builder()
//
// end of Constructors.
//-------------------------------------------------------
//-------------------------------------------------------
// Builder Method Overrides.
//
@Override
protected ServerMessage buildImpl()
{
return (new ServerMessage(this));
} // end of buildImpl()
//
// end of Builder Method Overrides.
//-------------------------------------------------------
} // end of class Builder
} // end of class ServerMessage