Crossfire JXClient, Trunk
Public Member Functions | Static Public Attributes | Static Package Functions | Static Package Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.sun.jmx.examples.scandir.ScanDirConfig Class Reference
Inheritance diagram for com.sun.jmx.examples.scandir.ScanDirConfig:
Inheritance graph
Collaboration diagram for com.sun.jmx.examples.scandir.ScanDirConfig:
Collaboration graph

Public Member Functions

DirectoryScannerConfig addDirectoryScanner (String name, String dir, String filePattern, long sizeExceedsMaxBytes, long sinceLastModified)
 
String getConfigFilename ()
 
ScanManagerConfig getConfiguration ()
 
SaveState getSaveState ()
 
void load () throws IOException
 
void postDeregister ()
 
void postRegister (Boolean registrationDone)
 
void preDeregister () throws Exception
 
ObjectName preRegister (MBeanServer server, ObjectName name) throws Exception
 
DirectoryScannerConfig removeDirectoryScanner (String name) throws IOException, InstanceNotFoundException
 
void save () throws IOException
 
 ScanDirConfig (String filename)
 
 ScanDirConfig (String filename, ScanManagerConfig initialConfig)
 
void setConfiguration (ScanManagerConfig config)
 

Static Public Attributes

static final String NOTIFICATION_LOADED
 
static final String NOTIFICATION_MODIFIED
 
static final String NOTIFICATION_SAVED
 

Static Package Functions

static String guessConfigName (String configFileName, String defaultFile)
 

Static Package Attributes

static String DEFAULT = "DEFAULT"
 

Private Member Functions

void sendNotification (String type)
 

Static Private Member Functions

static String getBasename (String name)
 

Private Attributes

volatile ScanManagerConfig config
 
volatile String configname = null
 
String filename = null
 
volatile MBeanServer mbeanServer
 
volatile ObjectName objectName
 
volatile SaveState status = CREATED
 

Static Private Attributes

static final Logger LOG
 
static MBeanNotificationInfo[] NOTIFICATION_INFO
 
static final String NOTIFICATION_PREFIX
 

Detailed Description

The ScanDirConfig MBean is in charge of the scandir application configuration.

The ScanDirConfig MBean is able to load and save the scandir application configuration to and from an XML file.

It will let you also interactively modify that configuration, which you can later save to the file, by calling save, or discard, by reloading the file without saving - see load.

There can be as many ScanDirConfigMXBean registered in the MBeanServer as you like, but only one of them will be identified as the current configuration of the ScanManagerMXBean. You can switch to another configuration by calling {ScanManagerMXBean.setConfigurationMBean}.

Once the current configuration has been loaded (by calling load) or modified (by calling one of addDirectoryScanner, removeDirectoryScanner or setConfiguration) it can be pushed to the ScanManagerMXBean by calling {ScanManagerMXBean.applyConfiguration(true)} - true means that we apply the configuration from memory, without first reloading the file.

The ScanDirConfig uses the XML annotated Java Beans defined in the com.sun.jmx.examples.scandir.config package.

Note: The ScanDirConfig should probably use

java.nio.channels.FileLock

and lock its configuration file so that two ScanDirConfig object do not share the same file, but it doesn't. Feel free to improve the application in that way.

Author
Sun Microsystems, 2006 - All rights reserved.

Definition at line 103 of file ScanDirConfig.java.

Constructor & Destructor Documentation

◆ ScanDirConfig() [1/2]

com.sun.jmx.examples.scandir.ScanDirConfig.ScanDirConfig ( String  filename)

Creates a new ScanDirConfigMXBean.

ScanDirConfigMXBean

can be created by the {}, or directly by a remote client, using createMBean or registerMBean .

ScanDirConfigMXBean

created by the {} will be unregistered by the ScanManagerMXBean . ScanDirConfigMXBean created directly by a remote client will not be unregistered by the ScanManagerMXBean - this will remain to the responsibility of the code/client that created them.

This object is created empty, you should call load() if you want it to load its data from the configuration file.

Parameters
filenameThe configuration file used by this MBean. Can be null (in which case load() and save() will fail). Can point to a file that does not exists yet (in which case load() will fail if called before save(), and save() will attempt to create that file). Can point to an existing file, in which case load() will load that file and save() will save to that file.

Definition at line 202 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.filename.

◆ ScanDirConfig() [2/2]

com.sun.jmx.examples.scandir.ScanDirConfig.ScanDirConfig ( String  filename,
ScanManagerConfig  initialConfig 
)

Create a new ScanDirConfig MBean with an initial configuration.

Parameters
filenameThe name of the configuration file.
initialConfigan initial configuration.

Definition at line 211 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.filename, and com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_INFO.

Member Function Documentation

◆ addDirectoryScanner()

DirectoryScannerConfig com.sun.jmx.examples.scandir.ScanDirConfig.addDirectoryScanner ( String  name,
String  dir,
String  filePattern,
long  sizeExceedsMaxBytes,
long  sinceLastModified 
)

Adds a new directory scanner to the current configuration data.

This method updates the configuration data in memory, adding a DirectoryScannerConfig to the {directory scanner list}. The #getSaveState state} is switched to { SaveState#MODIFIED MODIFIED}.

Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.

This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.

Parameters
nameA name for the new directory scanner. This is the value that will be later used in the DirectoryScannerMXBean ObjectName for the name= key.
dirThe root directory at which this scanner will start scanning.
filePatternA regular expression to match against a selected file name.
sizeExceedsMaxBytesOnly file whose size exceeds that limit will be selected. <code.0 or a negative value means no limit.
sinceLastModifiedSelect files which haven't been modified for that number of milliseconds - i.e.
sinceLastModified=3600000
will exclude files which have been modified in the last hour. The date of last modification is ignored if 0 or a negative value is provided.
See also
getSaveState()
Returns
The added DirectoryScannerConfig.
Exceptions
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 363 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, com.sun.jmx.examples.scandir.ScanDirConfig.LOG, name(), com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_MODIFIED, com.sun.jmx.examples.scandir.config.ScanManagerConfig.putScan(), com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification(), com.sun.jmx.examples.scandir.config.FileMatch.setFilePattern(), com.sun.jmx.examples.scandir.config.FileMatch.setLastModifiedBefore(), com.sun.jmx.examples.scandir.config.FileMatch.setSizeExceedsMaxBytes(), and com.sun.jmx.examples.scandir.ScanDirConfig.status.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddDirectoryScanner().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBasename()

static String com.sun.jmx.examples.scandir.ScanDirConfig.getBasename ( String  name)
staticprivate

Definition at line 410 of file ScanDirConfig.java.

References name().

Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.guessConfigName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getConfigFilename()

String com.sun.jmx.examples.scandir.ScanDirConfig.getConfigFilename ( )

Gets the name of the configuration file.

If the configuration file doesn't exists, load will fail and save will attempt to create the file.

Returns
The configuration file name for this MBean.
Exceptions
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 340 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.filename.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testGetConfigFilename().

Here is the caller graph for this function:

◆ getConfiguration()

ScanManagerConfig com.sun.jmx.examples.scandir.ScanDirConfig.getConfiguration ( )

Gets the current configuration data.

This method returns the configuration data which is currently held in memory.

Call load to reload the data from the configuration file, and save to save the data to the configuration file.

See also
getSaveState()
Returns
The current configuration data in memory.
Exceptions
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 245 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, and com.sun.jmx.examples.scandir.config.XmlConfigUtils.xmlClone().

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddDirectoryScanner(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testGetXmlConfigString(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testLoad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSaveState()

SaveState com.sun.jmx.examples.scandir.ScanDirConfig.getSaveState ( )

Gets the save state of the current configuration data.

CREATED means that the configuration data was just created. It has not been loaded from the configuration file. Calling load will load the data from the configuration file. Calling save will write the empty data to the configuration file.

LOADED means that the configuration data was loaded from the configuration file.

MODIFIED means that the configuration data was modified since it was last loaded or saved. Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will write the modified data to the configuration file.

SAVED means that the configuration data was saved to the configuration file.

This state doesn't indicate whether this MBean configuration data was applied by the ScanManagerMXBean.

Exceptions
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.
Returns
The save state of the
ScanDirConfigMXBean
.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 401 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.status.

◆ guessConfigName()

static String com.sun.jmx.examples.scandir.ScanDirConfig.guessConfigName ( String  configFileName,
String  defaultFile 
)
staticpackage

◆ load()

void com.sun.jmx.examples.scandir.ScanDirConfig.load ( ) throws IOException

Loads the configuration from the {configuration file}. Any unsaved modification will be lost. The state is switched to LOADED.

This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.

See also
getSaveState()
Exceptions
IOExceptionThe configuration couldn't be loaded from the file, e.g. because the file doesn't exist or isn't readable.
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 219 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, com.sun.jmx.examples.scandir.ScanDirConfig.configname, com.sun.jmx.examples.scandir.config.ScanManagerConfig.copy(), com.sun.jmx.examples.scandir.ScanDirConfig.filename, com.sun.jmx.examples.scandir.config.ScanManagerConfig.getName(), com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_LOADED, com.sun.jmx.examples.scandir.config.XmlConfigUtils.readFromFile(), com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification(), and com.sun.jmx.examples.scandir.ScanDirConfig.status.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testLoad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postDeregister()

void com.sun.jmx.examples.scandir.ScanDirConfig.postDeregister ( )

Allows the MBean to perform any operations needed after having been unregistered in the MBean server.

This implementation does nothing

Definition at line 335 of file ScanDirConfig.java.

◆ postRegister()

void com.sun.jmx.examples.scandir.ScanDirConfig.postRegister ( Boolean  registrationDone)

Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

This implementation does nothing

Parameters
registrationDoneIndicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration has failed.

Definition at line 315 of file ScanDirConfig.java.

◆ preDeregister()

void com.sun.jmx.examples.scandir.ScanDirConfig.preDeregister ( ) throws Exception

Allows the MBean to perform any operations it needs before being unregistered by the MBean server.

This implementation does nothing

Exceptions
ExceptionThis exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.

Definition at line 326 of file ScanDirConfig.java.

◆ preRegister()

ObjectName com.sun.jmx.examples.scandir.ScanDirConfig.preRegister ( MBeanServer  server,
ObjectName  name 
) throws Exception

Allows the MBean to perform any operations it needs before being registered in the MBean server. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBean server.

Parameters
serverThe MBean server in which the MBean will be registered.
nameThe object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBean methods in the MBeanServer interface is null. In that case, this method will try to guess its MBean name by examining its configuration data. If its configuration data is null (nothing was provided in the constructor) or doesn't contain a name, this method returns
null
, and registration will fail.

Otherwise, if

wasn't

null

or if a default name could be constructed, the name of the configuration will be set to the value of the ObjectName's

key, and the configuration data will always be renamed to reflect this change.

Returns
The name under which the MBean is to be registered.
Exceptions
ExceptionThis exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.

Definition at line 288 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, com.sun.jmx.examples.scandir.ScanDirConfig.configname, com.sun.jmx.examples.scandir.config.ScanManagerConfig.copy(), com.sun.jmx.examples.scandir.config.ScanManagerConfig.getName(), com.sun.jmx.examples.scandir.ScanDirConfig.mbeanServer, name(), com.sun.jmx.examples.scandir.ScanDirConfig.objectName, and server().

Here is the call graph for this function:

◆ removeDirectoryScanner()

DirectoryScannerConfig com.sun.jmx.examples.scandir.ScanDirConfig.removeDirectoryScanner ( String  name) throws IOException, InstanceNotFoundException

Removes a directory scanner from the current configuration data.

This method updates the configuration data in memory, removing a DirectoryScannerConfig from the {directory scanner list}. The #getSaveState state} is switched to { SaveState#MODIFIED MODIFIED}.

Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.

This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.

Parameters
nameThe name of the new directory scanner. This is the value that is used in the DirectoryScannerMXBean ObjectName for the name= key.
Returns
The removed DirectoryScannerConfig.
Exceptions
IllegalArgumentExceptionif there's no directory scanner by that name in the current configuration data.
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 387 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, name(), com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_MODIFIED, com.sun.jmx.examples.scandir.config.ScanManagerConfig.removeScan(), com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification(), and com.sun.jmx.examples.scandir.ScanDirConfig.status.

Here is the call graph for this function:

◆ save()

void com.sun.jmx.examples.scandir.ScanDirConfig.save ( ) throws IOException

Saves the configuration to the {configuration file}. If the configuration file doesn't exists, this method will attempt to create it. Otherwise, the existing file will be renamed by appending a '~' to its name, and a new file will be created, in which the configuration will be saved. The state is switched to SAVED.

This action has no effect on the ScanManagerMXBean.

See also
getSaveState()
Exceptions
IOExceptionThe configuration couldn't be saved to the file, e.g. because the file couldn't be created.
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 234 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, com.sun.jmx.examples.scandir.ScanDirConfig.filename, com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_SAVED, com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification(), com.sun.jmx.examples.scandir.ScanDirConfig.status, and com.sun.jmx.examples.scandir.config.XmlConfigUtils.writeToFile().

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddDirectoryScanner().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendNotification()

void com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification ( String  type)
private

◆ setConfiguration()

void com.sun.jmx.examples.scandir.ScanDirConfig.setConfiguration ( ScanManagerConfig  config)

Sets the current configuration data.

This method replaces the configuration data in memory. The state is switched to {MODIFIED}.

Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.

This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.

Parameters
configThe new configuration data.
See also
getSaveState()
Exceptions
IOExceptionA connection problem occurred when accessing the underlying resource.
InstanceNotFoundExceptionThe underlying MBean is not registered in the MBeanServer.

Implements com.sun.jmx.examples.scandir.ScanDirConfigMXBean.

Definition at line 345 of file ScanDirConfig.java.

References com.sun.jmx.examples.scandir.ScanDirConfig.config, com.sun.jmx.examples.scandir.ScanDirConfig.configname, com.sun.jmx.examples.scandir.config.ScanManagerConfig.copy(), com.sun.jmx.examples.scandir.config.ScanManagerConfig.getName(), com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_MODIFIED, com.sun.jmx.examples.scandir.ScanDirConfig.sendNotification(), and com.sun.jmx.examples.scandir.ScanDirConfig.status.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddDirectoryScanner(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testGetXmlConfigString().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ config

volatile ScanManagerConfig com.sun.jmx.examples.scandir.ScanDirConfig.config
private

◆ configname

volatile String com.sun.jmx.examples.scandir.ScanDirConfig.configname = null
private

◆ DEFAULT

String com.sun.jmx.examples.scandir.ScanDirConfig.DEFAULT = "DEFAULT"
staticpackage

◆ filename

String com.sun.jmx.examples.scandir.ScanDirConfig.filename = null
private

◆ LOG

final Logger com.sun.jmx.examples.scandir.ScanDirConfig.LOG
staticprivate
Initial value:
=
Logger.getLogger(ScanDirConfig.class.getName())

A logger for this class.

Definition at line 109 of file ScanDirConfig.java.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.addDirectoryScanner().

◆ mbeanServer

volatile MBeanServer com.sun.jmx.examples.scandir.ScanDirConfig.mbeanServer
private

◆ NOTIFICATION_INFO

MBeanNotificationInfo [] com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_INFO
staticprivate
Initial value:
= {
new MBeanNotificationInfo(
new String[] {NOTIFICATION_SAVED},
Notification.class.getName(),
"Emitted when the configuration is saved"),
new MBeanNotificationInfo(
new String[] {NOTIFICATION_LOADED},
Notification.class.getName(),
"Emitted when the configuration is loaded"),
new MBeanNotificationInfo(
new String[] {NOTIFICATION_MODIFIED},
Notification.class.getName(),
"Emitted when the configuration is modified"),
}

Definition at line 148 of file ScanDirConfig.java.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.ScanDirConfig().

◆ NOTIFICATION_LOADED

final String com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_LOADED
static
Initial value:
=

The com.sun.jmx.examples.scandir.config.loaded notification indicates that the configuration data was loaded.

Definition at line 133 of file ScanDirConfig.java.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.load(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener().

◆ NOTIFICATION_MODIFIED

final String com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_MODIFIED
static

◆ NOTIFICATION_PREFIX

final String com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_PREFIX
staticprivate
Initial value:
=
ScanManagerConfig.class.getPackage().getName()

Definition at line 120 of file ScanDirConfig.java.

◆ NOTIFICATION_SAVED

final String com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_SAVED
static
Initial value:

The com.sun.jmx.examples.scandir.config.saved notification indicates that the configuration data was saved.

Definition at line 127 of file ScanDirConfig.java.

Referenced by com.sun.jmx.examples.scandir.ScanDirConfig.save(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener().

◆ objectName

volatile ObjectName com.sun.jmx.examples.scandir.ScanDirConfig.objectName
private

◆ status

volatile SaveState com.sun.jmx.examples.scandir.ScanDirConfig.status = CREATED
private

The documentation for this class was generated from the following file:
com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_SAVED
static final String NOTIFICATION_SAVED
Definition: ScanDirConfig.java:127
com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_MODIFIED
static final String NOTIFICATION_MODIFIED
Definition: ScanDirConfig.java:140
com.sun.jmx.examples.scandir.ScanDirConfig.ScanDirConfig
ScanDirConfig(String filename)
Definition: ScanDirConfig.java:202
com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_PREFIX
static final String NOTIFICATION_PREFIX
Definition: ScanDirConfig.java:120
com.sun.jmx.examples.scandir.ScanDirConfig.NOTIFICATION_LOADED
static final String NOTIFICATION_LOADED
Definition: ScanDirConfig.java:133
name
A Simple Chat Server Example the server takes input from a it handles the startup and handles incoming connections on the listening sockets It keeps a list of connected client and provides methods for sending a message to them Client represents a connected it provides methods for reading writing from to the underlying socket It also contains a buffer of input read from the user DataReader provides the interface of the two states a user can be in Waiting for a name(and not receiving any messages while doing so, implemented by NameReader) and waiting for messages from the user(implemented by MessageReader). ClientReader contains the "main loop" for a connected client. NameReader is the initial state for a new client