Crossfire JXClient, Trunk
ResultRecord.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * - Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * - Neither the name of Oracle nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * This source code is provided to illustrate the usage of a given feature
34  * or technique and has been deliberately simplified. Additional steps
35  * required for a production-quality application, such as security checks,
36  * input validation and proper error handling, might not be present in
37  * this sample code.
38  */
39 
40 
41 package com.sun.jmx.examples.scandir.config;
42 
43 import java.util.Date;
44 import javax.xml.bind.annotation.XmlElement;
45 import javax.xml.bind.annotation.XmlList;
46 import javax.xml.bind.annotation.XmlRootElement;
48 import java.io.File;
49 import java.util.Arrays;
50 
61 @XmlRootElement(name="ResultRecord",namespace=XmlConfigUtils.NAMESPACE)
63 
67  private String filename;
68 
72  private Date date;
73 
78  private String directoryScanner;
79 
83  private Action[] actions;
84 
88  public ResultRecord() {
89  }
90 
98  public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
99  File f) {
100  directoryScanner = scan.getName();
101  this.actions = actions;
102  date = new Date();
103  filename = f.getAbsolutePath();
104  }
105 
110  @XmlElement(name="Filename",namespace=XmlConfigUtils.NAMESPACE)
111  public String getFilename() {
112  return this.filename;
113  }
114 
120  public void setFilename(String filename) {
121  this.filename = filename;
122  }
123 
128  @XmlElement(name="Date",namespace=XmlConfigUtils.NAMESPACE)
129  public Date getDate() {
130  synchronized(this) {
131  return (date==null)?null:(new Date(date.getTime()));
132  }
133  }
134 
139  public void setDate(Date date) {
140  synchronized (this) {
141  this.date = (date==null)?null:(new Date(date.getTime()));
142  }
143  }
144 
152  @XmlElement(name="DirectoryScanner",namespace=XmlConfigUtils.NAMESPACE)
153  public String getDirectoryScanner() {
154  return this.directoryScanner;
155  }
156 
164  public void setDirectoryScanner(String directoryScanner) {
165  this.directoryScanner = directoryScanner;
166  }
167 
172  @XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
173  @XmlList
174  public Action[] getActions() {
175  return (actions == null)?null:actions.clone();
176  }
177 
182  public void setActions(Action[] actions) {
183  this.actions = (actions == null)?null:actions.clone();
184  }
185 
186  // Used for equality
187  private Object[] toArray() {
188  final Object[] thisconfig = {
189  filename, date, directoryScanner, actions
190  };
191  return thisconfig;
192  }
193 
194  @Override
195  public boolean equals(Object o) {
196  if (this == o) return true;
197  if (!(o instanceof ResultRecord)) return false;
198  return Arrays.deepEquals(toArray(),((ResultRecord)o).toArray());
199  }
200 
201  @Override
202  public int hashCode() {
203  return Arrays.deepHashCode(toArray());
204  }
205 }
com.sun.jmx.examples.scandir.config.ResultRecord.filename
String filename
Definition: ResultRecord.java:67
com.sun.jmx.examples.scandir.config.ResultRecord.setActions
void setActions(Action[] actions)
Definition: ResultRecord.java:182
com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action
Definition: DirectoryScannerConfig.java:81
com.sun.jmx.examples.scandir.config
Definition: DirectoryScannerConfig.java:41
com.sun.jmx.examples.scandir
com.sun.jmx.examples.scandir.config.ResultRecord.setDirectoryScanner
void setDirectoryScanner(String directoryScanner)
Definition: ResultRecord.java:164
com.sun.jmx.examples.scandir.config.ResultRecord.ResultRecord
ResultRecord(DirectoryScannerConfig scan, Action[] actions, File f)
Definition: ResultRecord.java:98
com.sun.jmx.examples.scandir.config.ResultRecord.date
Date date
Definition: ResultRecord.java:72
com.sun.jmx.examples
com.sun.jmx.examples.scandir.config.ResultRecord.equals
boolean equals(Object o)
Definition: ResultRecord.java:195
com.sun.jmx.examples.scandir.config.ResultRecord.actions
Action[] actions
Definition: ResultRecord.java:83
com.sun
com.sun.jmx.examples.scandir.config.ResultRecord.setDate
void setDate(Date date)
Definition: ResultRecord.java:139
com.sun.jmx.examples.scandir.config.ResultRecord.directoryScanner
String directoryScanner
Definition: ResultRecord.java:78
com.sun.jmx.examples.scandir.config.ResultRecord.getActions
Action[] getActions()
Definition: ResultRecord.java:174
com.sun.jmx.examples.scandir.config.ResultRecord.hashCode
int hashCode()
Definition: ResultRecord.java:202
class
About including and JRadioButtonMenuItem Metalworks is optimized to work with the Java look and such as that are specific to the Java look and feel Running then you should either specify the complete path to the java command or update your PATH environment variable as described in the installation instructions for the and many controls are non functional They are intended only to show how to construct the UI for such interfaces Things that do work in the Metalworks demo but also the sizes of many controls Also included with this demo is the PropertiesMetalTheme class
Definition: README.txt:54
com.sun.jmx.examples.scandir.config.ResultRecord
Definition: ResultRecord.java:62
com.sun.jmx.examples.scandir.config.ResultRecord.setFilename
void setFilename(String filename)
Definition: ResultRecord.java:120
com
com.sun.jmx
com.sun.jmx.examples.scandir.config.XmlConfigUtils.NAMESPACE
static final String NAMESPACE
Definition: XmlConfigUtils.java:69
com.sun.jmx.examples.scandir.config.ResultRecord.ResultRecord
ResultRecord()
Definition: ResultRecord.java:88
com.sun.jmx.examples.scandir.config.ResultRecord.toArray
Object[] toArray()
Definition: ResultRecord.java:187
com.sun.jmx.examples.scandir.config.XmlConfigUtils
Definition: XmlConfigUtils.java:62
com.sun.jmx.examples.scandir.config.DirectoryScannerConfig
Definition: DirectoryScannerConfig.java:67
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