Crossfire JXClient, Trunk
|
Go to the documentation of this file.
41 package com.sun.jmx.examples.scandir;
50 import java.io.IOException;
51 import java.io.InputStream;
52 import java.io.OutputStream;
53 import java.util.Date;
54 import java.util.logging.Level;
55 import java.util.logging.Logger;
56 import javax.management.*;
57 import javax.xml.bind.JAXBException;
109 private static final Logger
LOG =
149 new MBeanNotificationInfo(
151 Notification.class.getName(),
152 "Emitted when the configuration is saved"),
153 new MBeanNotificationInfo(
155 Notification.class.getName(),
156 "Emitted when the configuration is loaded"),
157 new MBeanNotificationInfo(
159 Notification.class.getName(),
160 "Emitted when the configuration is modified"),
214 this.config = initialConfig;
219 public void load() throws IOException {
221 throw new UnsupportedOperationException(
"load");
234 public void save() throws IOException {
236 throw new UnsupportedOperationException(
"load");
237 synchronized (
this) {
246 synchronized (
this) {
255 final Notification n =
new Notification(type,source,
257 "The configuration is "+
258 type.substring(type.lastIndexOf(
'.')+1));
291 if (
config ==
null)
return null;
298 synchronized (
this) {
346 synchronized (
this) {
364 long sizeExceedsMaxBytes,
long sinceLastModified) {
367 scanner.setRootDirectory(dir);
368 if (filePattern!=
null||sizeExceedsMaxBytes>0||sinceLastModified>0) {
372 if (sinceLastModified > 0)
374 -sinceLastModified));
375 scanner.addIncludeFiles(filter);
377 synchronized (
this) {
388 throws IOException, InstanceNotFoundException {
390 synchronized (
this) {
393 throw new IllegalArgumentException(
name+
": scanner not found");
411 final int dot =
name.indexOf(
'.');
412 if (dot<0)
return name;
414 return name.substring(0,dot);
419 if (configFileName ==
null)
return DEFAULT;
420 final File f =
new File(configFileName);
423 if (confname !=
null && confname.length()>0)
return confname;
425 final File f2 =
new File(defaultFile);
426 if (f.equals(f2))
return DEFAULT;
428 if (guess ==
null)
return DEFAULT;
429 if (guess.length()==0)
return DEFAULT;
431 }
catch (Exception x) {
DirectoryScannerConfig addDirectoryScanner(String name, String dir, String filePattern, long sizeExceedsMaxBytes, long sinceLastModified)
void setSizeExceedsMaxBytes(long sizeLimitInBytes)
ScanManagerConfig getConfiguration()
synchronized ScanManagerConfig readFromFile()
String getConfigFilename()
volatile ScanManagerConfig config
DirectoryScannerConfig putScan(DirectoryScannerConfig scan)
static final String NOTIFICATION_SAVED
volatile MBeanServer mbeanServer
static String guessConfigName(String configFileName, String defaultFile)
in the editor and run the same with Tools Run menu You will see an alert box with the message world In addition to being a simple script editor scriptpad can be used to connect to a JMX MBean server("Tools->JMX Connect" menu). User can specify JMX hostname and port. After connecting
volatile ObjectName objectName
volatile SaveState status
DirectoryScannerConfig removeDirectoryScanner(String name)
void setFilePattern(String filePattern)
ObjectName preRegister(MBeanServer server, ObjectName name)
static final String NOTIFICATION_MODIFIED
void setConfiguration(ScanManagerConfig config)
void postRegister(Boolean registrationDone)
static String getBasename(String name)
DirectoryScannerConfig removeScan(String name)
synchronized void writeToFile(ScanManagerConfig bean)
ScanDirConfig(String filename)
ScanDirConfig(String filename, ScanManagerConfig initialConfig)
ScanManagerConfig copy(String newname)
static final String NOTIFICATION_PREFIX
static synchronized long getNextSeqNumber()
void setLastModifiedBefore(Date lastModifiedBefore)
static final String NOTIFICATION_LOADED
static ScanManagerConfig xmlClone(ScanManagerConfig bean)
static MBeanNotificationInfo[] NOTIFICATION_INFO
volatile String configname
void sendNotification(String type)
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
static ScanManagerConfig read(File f)