Crossfire JXClient, Trunk
ResultLogConfig.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.Arrays;
44 import javax.xml.bind.annotation.XmlElement;
45 import javax.xml.bind.annotation.XmlRootElement;
46 
58 @XmlRootElement(name="ResultLogConfig",
59  namespace=XmlConfigUtils.NAMESPACE)
60 public class ResultLogConfig {
61 
62  //
63  // A logger for this class.
64  //
65  // private static final Logger LOG =
66  // Logger.getLogger(ResultLogConfig.class.getName());
67 
72  private String logFileName;
73 
78  private long logFileMaxRecords;
79 
85  private int memoryMaxRecords;
86 
90  public ResultLogConfig() {
91  }
92 
98  @XmlElement(name="LogFileName",namespace=XmlConfigUtils.NAMESPACE)
99  public String getLogFileName() {
100  return this.logFileName;
101  }
102 
108  public void setLogFileName(String logFileName) {
109  this.logFileName = logFileName;
110  }
111 
118  @XmlElement(name="LogFileMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
119  public long getLogFileMaxRecords() {
120  return this.logFileMaxRecords;
121  }
122 
130  public void setLogFileMaxRecords(long logFileMaxRecords) {
131  this.logFileMaxRecords = logFileMaxRecords;
132  }
133 
142  @XmlElement(name="MemoryMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
143  public int getMemoryMaxRecords() {
144  return this.memoryMaxRecords;
145  }
146 
155  public void setMemoryMaxRecords(int memoryMaxRecords) {
156  this.memoryMaxRecords = memoryMaxRecords;
157  }
158 
159  private Object[] toArray() {
160  final Object[] thisconfig = {
161  memoryMaxRecords,logFileMaxRecords,logFileName
162  };
163  return thisconfig;
164  }
165 
166  @Override
167  public boolean equals(Object o) {
168  if (o == this) return true;
169  if (!(o instanceof ResultLogConfig)) return false;
170  final ResultLogConfig other = (ResultLogConfig)o;
171  return Arrays.deepEquals(toArray(),other.toArray());
172  }
173 
174  @Override
175  public int hashCode() {
176  return Arrays.deepHashCode(toArray());
177  }
178 }
com.sun.jmx.examples.scandir.config.ResultLogConfig.setLogFileMaxRecords
void setLogFileMaxRecords(long logFileMaxRecords)
Definition: ResultLogConfig.java:130
com.sun.jmx.examples.scandir.config.ResultLogConfig.toArray
Object[] toArray()
Definition: ResultLogConfig.java:159
com.sun.jmx.examples.scandir.config.ResultLogConfig.ResultLogConfig
ResultLogConfig()
Definition: ResultLogConfig.java:90
com.sun.jmx.examples.scandir.config.ResultLogConfig.equals
boolean equals(Object o)
Definition: ResultLogConfig.java:167
com.sun.jmx.examples.scandir.config.XmlConfigUtils
Definition: XmlConfigUtils.java:62
com.sun.jmx.examples.scandir.config.ResultLogConfig.setMemoryMaxRecords
void setMemoryMaxRecords(int memoryMaxRecords)
Definition: ResultLogConfig.java:155
com.sun.jmx.examples.scandir.config.ResultLogConfig
Definition: ResultLogConfig.java:60
com.sun.jmx.examples.scandir.config.ResultLogConfig.logFileName
String logFileName
Definition: ResultLogConfig.java:72
com.sun.jmx.examples.scandir.config.ResultLogConfig.logFileMaxRecords
long logFileMaxRecords
Definition: ResultLogConfig.java:78
com.sun.jmx.examples.scandir.config.XmlConfigUtils.NAMESPACE
static final String NAMESPACE
Definition: XmlConfigUtils.java:69
com.sun.jmx.examples.scandir.config.ResultLogConfig.hashCode
int hashCode()
Definition: ResultLogConfig.java:175
com.sun.jmx.examples.scandir.config.ResultLogConfig.memoryMaxRecords
int memoryMaxRecords
Definition: ResultLogConfig.java:85
com.sun.jmx.examples.scandir.config.ResultLogConfig.setLogFileName
void setLogFileName(String logFileName)
Definition: ResultLogConfig.java:108