diff options
author | Robert Greig <rgreig@apache.org> | 2007-04-20 12:51:33 +0000 |
---|---|---|
committer | Robert Greig <rgreig@apache.org> | 2007-04-20 12:51:33 +0000 |
commit | a469da53c9de68e52794c47ef26d9d20b7fff934 (patch) | |
tree | 0cba915e1202c597e7d3dcc203c4fa18276d0a98 | |
parent | b35d61bbd09573c6d3a076299f67aacbd819d60f (diff) | |
download | qpid-python-a469da53c9de68e52794c47ef26d9d20b7fff934.tar.gz |
Copied some whitespace only differences from M2 to trunk.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@530779 13f79535-47bb-0310-9956-ffa450edef68
6 files changed, 235 insertions, 273 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java index eac7ed21f2..931c15a664 100644 --- a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java +++ b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java @@ -1,44 +1,45 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 * - * 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. + * 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 org.apache.log4j; -import org.apache.log4j.helpers.OptionConverter; -import org.apache.log4j.helpers.CountingQuietWriter; -import org.apache.log4j.helpers.LogLog; -import org.apache.log4j.spi.LoggingEvent; -import org.apache.qpid.framing.FieldTable; - +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.Writer; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.GZIPOutputStream; -import java.text.SimpleDateFormat; -import java.io.IOException; -import java.io.Writer; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; + +import org.apache.log4j.helpers.CountingQuietWriter; +import org.apache.log4j.helpers.LogLog; +import org.apache.log4j.helpers.OptionConverter; +import org.apache.log4j.spi.LoggingEvent; + +import org.apache.qpid.framing.FieldTable; /** * <p>CompositeRollingAppender combines RollingFileAppender and DailyRollingFileAppender<br> It can function as either @@ -83,7 +84,7 @@ public class QpidCompositeRollingAppender extends FileAppender static final int BY_DATE = 2; static final int BY_COMPOSITE = 3; - //Not currently used + // Not currently used static final String S_BY_SIZE = "Size"; static final String S_BY_DATE = "Date"; static final String S_BY_COMPOSITE = "Composite"; @@ -146,7 +147,6 @@ public class QpidCompositeRollingAppender extends FileAppender /** FileName provided in configuration. Used for rolling properly */ protected String baseFileName; - /** Do we want to .gz our backup files. */ protected boolean compress = false; @@ -163,15 +163,13 @@ public class QpidCompositeRollingAppender extends FileAppender /** The default constructor does nothing. */ public QpidCompositeRollingAppender() - { - } + { } /** * Instantiate a <code>CompositeRollingAppender</code> and open the file designated by <code>filename</code>. The * opened filename will become the ouput destination for this appender. */ - public QpidCompositeRollingAppender(Layout layout, String filename, - String datePattern) throws IOException + public QpidCompositeRollingAppender(Layout layout, String filename, String datePattern) throws IOException { this(layout, filename, datePattern, true); } @@ -183,8 +181,7 @@ public class QpidCompositeRollingAppender extends FileAppender * <p>If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by * <code>filename</code> will be truncated before being opened. */ - public QpidCompositeRollingAppender(Layout layout, String filename, boolean append) - throws IOException + public QpidCompositeRollingAppender(Layout layout, String filename, boolean append) throws IOException { super(layout, filename, append); } @@ -193,8 +190,8 @@ public class QpidCompositeRollingAppender extends FileAppender * Instantiate a CompositeRollingAppender and open the file designated by <code>filename</code>. The opened filename * will become the ouput destination for this appender. */ - public QpidCompositeRollingAppender(Layout layout, String filename, - String datePattern, boolean append) throws IOException + public QpidCompositeRollingAppender(Layout layout, String filename, String datePattern, boolean append) + throws IOException { super(layout, filename, append); this.datePattern = datePattern; @@ -305,7 +302,7 @@ public class QpidCompositeRollingAppender extends FileAppender qw = new CountingQuietWriter(writer, errorHandler); } - //Taken verbatum from DailyRollingFileAppender + // Taken verbatum from DailyRollingFileAppender int computeCheckPeriod() { RollingCalendar c = new RollingCalendar(); @@ -319,17 +316,18 @@ public class QpidCompositeRollingAppender extends FileAppender c.setType(i); Date next = new Date(c.getNextCheckMillis(epoch)); String r1 = sdf.format(next); - //LogLog.debug("Type = "+i+", r0 = "+r0+", r1 = "+r1); - if (r0 != null && r1 != null && !r0.equals(r1)) + // LogLog.debug("Type = "+i+", r0 = "+r0+", r1 = "+r1); + if ((r0 != null) && (r1 != null) && !r0.equals(r1)) { return i; } } } + return TOP_OF_TROUBLE; // Deliberately head for trouble... } - //Now for the new stuff + // Now for the new stuff /** * Handles append time behavior for CompositeRollingAppender. This checks if a roll over either by date (checked * first) or time (checked second) is need and then appends to the file last. @@ -351,7 +349,7 @@ public class QpidCompositeRollingAppender extends FileAppender if (rollSize) { - if ((fileName != null) && ((CountingQuietWriter) qw).getCount() >= maxFileSize) + if ((fileName != null) && (((CountingQuietWriter) qw).getCount() >= maxFileSize)) { rollOverSize(); } @@ -410,20 +408,24 @@ public class QpidCompositeRollingAppender extends FileAppender rollingStyle = style; switch (rollingStyle) { - case BY_SIZE: - rollDate = false; - rollSize = true; - break; - case BY_DATE: - rollDate = true; - rollSize = false; - break; - case BY_COMPOSITE: - rollDate = true; - rollSize = true; - break; - default: - errorHandler.error("Invalid rolling Style, use 1 (by size only), 2 (by date only) or 3 (both)"); + + case BY_SIZE: + rollDate = false; + rollSize = true; + break; + + case BY_DATE: + rollDate = true; + rollSize = false; + break; + + case BY_COMPOSITE: + rollDate = true; + rollSize = true; + break; + + default: + errorHandler.error("Invalid rolling Style, use 1 (by size only), 2 (by date only) or 3 (both)"); } } @@ -439,7 +441,7 @@ public class QpidCompositeRollingAppender extends FileAppender rollingStyle = BY_COMPOSITE; } } - */ + */ public boolean getStaticLogFileName() { return staticLogFileName; @@ -477,11 +479,10 @@ public class QpidCompositeRollingAppender extends FileAppender { executor = Executors.newFixedThreadPool(1); - compressor = new Compressor(); + compressor = new Compressor(); } } - public boolean getZeroBased() { return zeroBased; @@ -504,6 +505,7 @@ public class QpidCompositeRollingAppender extends FileAppender { td.mkdirs(); } + backupFilesToPath = path; } @@ -519,9 +521,10 @@ public class QpidCompositeRollingAppender extends FileAppender { curSizeRollBackups = -1; } + curTimeRollBackups = 0; - //part A starts here + // part A starts here String filter; if (staticLogFileName || !rollDate) { @@ -556,9 +559,9 @@ public class QpidCompositeRollingAppender extends FileAppender if (staticLogFileName) { int endLength = files[i].length() - index; - if (baseFileName.length() + endLength != files[i].length()) + if ((baseFileName.length() + endLength) != files[i].length()) { - //file is probably scheduledFilename + .x so I don't care + // file is probably scheduledFilename + .x so I don't care continue; } } @@ -574,18 +577,19 @@ public class QpidCompositeRollingAppender extends FileAppender } catch (Exception e) { - //this happens when file.log -> file.log.yyyy-mm-dd which is normal - //when staticLogFileName == false + // this happens when file.log -> file.log.yyyy-mm-dd which is normal + // when staticLogFileName == false LogLog.debug("Encountered a backup file not ending in .x " + files[i]); } } } + LogLog.debug("curSizeRollBackups starts at: " + curSizeRollBackups); - //part A ends here + // part A ends here - //part B not yet implemented + // part B not yet implemented - //part C + // part C if (staticLogFileName && rollDate) { File old = new File(baseFileName); @@ -600,8 +604,9 @@ public class QpidCompositeRollingAppender extends FileAppender } } } + LogLog.debug("curSizeRollBackups after rollOver at: " + curSizeRollBackups); - //part C ends here + // part C ends here } @@ -612,29 +617,28 @@ public class QpidCompositeRollingAppender extends FileAppender public void activateOptions() { - //REMOVE removed rollDate from boolean to enable Alex's change + // REMOVE removed rollDate from boolean to enable Alex's change if (datePattern != null) { now.setTime(System.currentTimeMillis()); sdf = new SimpleDateFormat(datePattern); int type = computeCheckPeriod(); - //printPeriodicity(type); + // printPeriodicity(type); rc.setType(type); - //next line added as this removes the name check in rollOver + // next line added as this removes the name check in rollOver nextCheck = rc.getNextCheckMillis(now); } else { if (rollDate) { - LogLog.error("Either DatePattern or rollingStyle options are not set for [" + - name + "]."); + LogLog.error("Either DatePattern or rollingStyle options are not set for [" + name + "]."); } } existingInit(); - if (rollDate && fileName != null && scheduledFilename == null) + if (rollDate && (fileName != null) && (scheduledFilename == null)) { scheduledFilename = fileName + sdf.format(now); } @@ -662,7 +666,7 @@ public class QpidCompositeRollingAppender extends FileAppender this.closeFile(); // keep windows happy. - //delete the old stuff here + // delete the old stuff here if (staticLogFileName) { @@ -670,23 +674,25 @@ public class QpidCompositeRollingAppender extends FileAppender if (datePattern == null) { errorHandler.error("Missing DatePattern option in rollOver()."); + return; } - //is the new file name equivalent to the 'current' one - //something has gone wrong if we hit this -- we should only - //roll over if the new file will be different from the old + // is the new file name equivalent to the 'current' one + // something has gone wrong if we hit this -- we should only + // roll over if the new file will be different from the old String dateFormat = sdf.format(now); if (scheduledFilename.equals(fileName + dateFormat)) { errorHandler.error("Compare " + scheduledFilename + " : " + fileName + dateFormat); + return; } // close current file, and rename it to datedFilename this.closeFile(); - //we may have to roll over a large number of backups here + // we may have to roll over a large number of backups here String from, to; for (int i = 1; i <= curSizeRollBackups; i++) { @@ -709,9 +715,9 @@ public class QpidCompositeRollingAppender extends FileAppender { // This will also close the file. This is OK since multiple // close operations are safe. - curSizeRollBackups = 0; //We're cleared out the old date and are ready for the new + curSizeRollBackups = 0; // We're cleared out the old date and are ready for the new - //new scheduled name + // new scheduled name scheduledFilename = fileName + sdf.format(now); this.setFile(baseFileName, false); } @@ -734,8 +740,10 @@ public class QpidCompositeRollingAppender extends FileAppender { LogLog.debug("Attempting to compress file with same output name."); } + return; } + File target = new File(to); if (target.exists()) { @@ -755,10 +763,10 @@ public class QpidCompositeRollingAppender extends FileAppender file.renameTo(target); } } + LogLog.debug(from + " -> " + to); } - protected void compress(String file) { File f = new File(file); @@ -773,6 +781,7 @@ public class QpidCompositeRollingAppender extends FileAppender { _compress.offer(new CompressJob(from, target)); } + startCompression(); } else @@ -805,7 +814,7 @@ public class QpidCompositeRollingAppender extends FileAppender * <p>If the maximum number of size based backups is reached (<code>curSizeRollBackups == maxSizeRollBackups</code) * then the oldest file is deleted -- it's index determined by the sign of countDirection.<br> If * <code>countDirection</code> < 0, then files {<code>File.1</code>, ..., <code>File.curSizeRollBackups -1</code>} - * are renamed to {<code>File.2</code>, ..., <code>File.curSizeRollBackups</code>}. Moreover, <code>File</code> is + * are renamed to {<code>File.2</code>, ..., <code>File.curSizeRollBackups</code>}. Moreover, <code>File</code> is * renamed <code>File.1</code> and closed.<br> * * A new file is created to receive further log output. @@ -851,20 +860,20 @@ public class QpidCompositeRollingAppender extends FileAppender // Rename fileName to fileName.1 rollFile(fileName, fileName + ".1", compress); - } //REMOVE This code branching for Alexander Cerna's request + } // REMOVE This code branching for Alexander Cerna's request else if (countDirection == 0) { - //rollFile based on date pattern + // rollFile based on date pattern curSizeRollBackups++; now.setTime(System.currentTimeMillis()); scheduledFilename = fileName + sdf.format(now); rollFile(fileName, scheduledFilename, compress); } else - { //countDirection > 0 - if (curSizeRollBackups >= maxSizeRollBackups && maxSizeRollBackups > 0) + { // countDirection > 0 + if ((curSizeRollBackups >= maxSizeRollBackups) && (maxSizeRollBackups > 0)) { - //delete the first and keep counting up. + // delete the first and keep counting up. int oldestFileIndex = curSizeRollBackups - maxSizeRollBackups + 1; deleteFile(fileName + '.' + oldestFileIndex); } @@ -930,6 +939,7 @@ public class QpidCompositeRollingAppender extends FileAppender { out.write(buf, 0, len); } + in.close(); // Complete the GZIP file @@ -944,6 +954,7 @@ public class QpidCompositeRollingAppender extends FileAppender { target.delete(); } + rollFile(from.getPath(), to.getPath(), false); } } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java index 3e93243a1d..2f04a01f53 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java @@ -7,9 +7,9 @@ * to you 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 @@ -20,7 +20,6 @@ */ package org.apache.qpid; -import org.apache.log4j.Logger; import org.apache.qpid.protocol.AMQConstant; /** @@ -61,7 +60,7 @@ public class AMQException extends Exception public AMQException(String message) { super(message); - //fixme This method needs removed and all AMQExceptions need a valid error code + // fixme This method needs removed and all AMQExceptions need a valid error code _errorCode = AMQConstant.getConstant(-1); } @@ -74,7 +73,7 @@ public class AMQException extends Exception public AMQException(String msg, Throwable t) { super(msg, t); - //fixme This method needs removed and all AMQExceptions need a valid error code + // fixme This method needs removed and all AMQExceptions need a valid error code _errorCode = AMQConstant.getConstant(-1); } @@ -90,26 +89,6 @@ public class AMQException extends Exception _errorCode = errorCode; } - /* - public AMQException(Logger logger, String msg, Throwable t) - { - this(msg, t); - logger.error(getMessage(), this); - } - - public AMQException(Logger logger, String msg) - { - this(msg); - logger.error(getMessage(), this); - } - - public AMQException(Logger logger, AMQConstant errorCode, String msg) - { - this(errorCode, msg); - logger.error(getMessage(), this); - } - */ - /** * Gets the AMQ protocol exception code associated with this exception. * diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java index 7c85a08e11..022e7b8a76 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -21,8 +20,6 @@ */ package org.apache.qpid.configuration; -import org.apache.log4j.Logger; - import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; @@ -50,19 +47,4 @@ public class PropertyException extends AMQException { super(errorCode, msg); } - - /*public PropertyException(Logger logger, String msg, Throwable t) - { - super(logger, msg, t); - } - - public PropertyException(Logger logger, String msg) - { - super(logger, msg); - } - - public PropertyException(Logger logger, AMQConstant errorCode, String msg) - { - super(logger, errorCode, msg); - }*/ } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java index c462dec2a3..171da76771 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -21,8 +20,6 @@ */ package org.apache.qpid.framing; -import org.apache.log4j.Logger; - import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; @@ -37,14 +34,4 @@ public class AMQFrameDecodingException extends AMQException { super(errorCode, message, t); } - - /*public AMQFrameDecodingException(Logger log, String message) - { - super(log, message); - } - - public AMQFrameDecodingException(Logger log, String message, Throwable t) - { - super(log, message, t); - }*/ } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java index faa7cc1e82..916b476185 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java @@ -20,16 +20,16 @@ */
package org.apache.qpid.framing;
-import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
-
import org.apache.log4j.Logger;
+
import org.apache.mina.common.ByteBuffer;
+import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
+
public class VersionSpecificRegistry
{
private static final Logger _log = Logger.getLogger(VersionSpecificRegistry.class);
-
private final byte _protocolMajorVersion;
private final byte _protocolMinorVersion;
@@ -48,26 +48,31 @@ public class VersionSpecificRegistry _protocolVersionConverter = loadProtocolVersionConverters(major, minor);
}
- private static ProtocolVersionMethodConverter loadProtocolVersionConverters(byte protocolMajorVersion, byte protocolMinorVersion)
+ private static ProtocolVersionMethodConverter loadProtocolVersionConverters(byte protocolMajorVersion,
+ byte protocolMinorVersion)
{
try
{
Class<ProtocolVersionMethodConverter> versionMethodConverterClass =
- (Class<ProtocolVersionMethodConverter>) Class.forName("org.apache.qpid.framing.MethodConverter_"+protocolMajorVersion + "_" + protocolMinorVersion);
+ (Class<ProtocolVersionMethodConverter>) Class.forName("org.apache.qpid.framing.MethodConverter_"
+ + protocolMajorVersion + "_" + protocolMinorVersion);
+
return versionMethodConverterClass.newInstance();
}
catch (ClassNotFoundException e)
{
_log.warn("Could not find protocol conversion classes for " + protocolMajorVersion + "-" + protocolMinorVersion);
- if(protocolMinorVersion != 0)
+ if (protocolMinorVersion != 0)
{
protocolMinorVersion--;
+
return loadProtocolVersionConverters(protocolMajorVersion, protocolMinorVersion);
}
else if (protocolMajorVersion != 0)
{
protocolMajorVersion--;
+
return loadProtocolVersionConverters(protocolMajorVersion, protocolMinorVersion);
}
else
@@ -75,7 +80,6 @@ public class VersionSpecificRegistry return null;
}
-
}
catch (IllegalAccessException e)
{
@@ -83,7 +87,7 @@ public class VersionSpecificRegistry }
catch (InstantiationException e)
{
- throw new IllegalStateException("Unable to load protocol version converter: ", e);
+ throw new IllegalStateException("Unable to load protocol version converter: ", e);
}
}
@@ -115,69 +119,68 @@ public class VersionSpecificRegistry public void registerMethod(final short classID, final short methodID, final AMQMethodBodyInstanceFactory instanceFactory)
{
- if(_registry.length <= classID)
+ if (_registry.length <= classID)
{
AMQMethodBodyInstanceFactory[][] oldRegistry = _registry;
- _registry = new AMQMethodBodyInstanceFactory[classID+1][];
+ _registry = new AMQMethodBodyInstanceFactory[classID + 1][];
System.arraycopy(oldRegistry, 0, _registry, 0, oldRegistry.length);
}
- if(_registry[classID] == null)
+ if (_registry[classID] == null)
{
- _registry[classID] = new AMQMethodBodyInstanceFactory[methodID > DEFAULT_MAX_METHOD_ID ? methodID + 1 : DEFAULT_MAX_METHOD_ID + 1];
+ _registry[classID] =
+ new AMQMethodBodyInstanceFactory[(methodID > DEFAULT_MAX_METHOD_ID) ? (methodID + 1)
+ : (DEFAULT_MAX_METHOD_ID + 1)];
}
- else if(_registry[classID].length <= methodID)
+ else if (_registry[classID].length <= methodID)
{
AMQMethodBodyInstanceFactory[] oldMethods = _registry[classID];
- _registry[classID] = new AMQMethodBodyInstanceFactory[methodID+1];
- System.arraycopy(oldMethods,0,_registry[classID],0,oldMethods.length);
+ _registry[classID] = new AMQMethodBodyInstanceFactory[methodID + 1];
+ System.arraycopy(oldMethods, 0, _registry[classID], 0, oldMethods.length);
}
_registry[classID][methodID] = instanceFactory;
}
-
- public AMQMethodBody get(short classID, short methodID, ByteBuffer in, long size)
- throws AMQFrameDecodingException
+ public AMQMethodBody get(short classID, short methodID, ByteBuffer in, long size) throws AMQFrameDecodingException
{
AMQMethodBodyInstanceFactory bodyFactory;
try
{
bodyFactory = _registry[classID][methodID];
}
- catch(NullPointerException e)
+ catch (NullPointerException e)
{
throw new AMQFrameDecodingException(null, "Class " + classID + " unknown in AMQP version " + _protocolMajorVersion
+ "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID + ".", e);
}
- catch(IndexOutOfBoundsException e)
+ catch (IndexOutOfBoundsException e)
{
- if(classID >= _registry.length)
+ if (classID >= _registry.length)
{
throw new AMQFrameDecodingException(null, "Class " + classID + " unknown in AMQP version " + _protocolMajorVersion
+ "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID
+ ".", e);
+
}
else
{
throw new AMQFrameDecodingException(null, "Method " + methodID + " unknown in AMQP version "
+ _protocolMajorVersion + "-" + _protocolMinorVersion + " (while trying to decode class " + classID
+ " method " + methodID + ".", e);
+
}
}
-
if (bodyFactory == null)
{
throw new AMQFrameDecodingException(null, "Method " + methodID + " unknown in AMQP version " + _protocolMajorVersion
+ "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID + ".", null);
}
-
return bodyFactory.newInstance(_protocolMajorVersion, _protocolMinorVersion, classID, methodID, in, size);
-
}
public ProtocolVersionMethodConverter getProtocolVersionMethodConverter()
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java index da70dc736c..efd4a7e9a6 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java @@ -1,4 +1,3 @@ -/* Copyright Rupert Smith, 2005 to 2006, all rights reserved. */ /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -8,9 +7,9 @@ * to you 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 @@ -30,110 +29,111 @@ import static org.apache.qpid.management.ui.Constants.CONNECTION_PROTOCOLS; */ public class Constants { - public static final String APPLICATION_NAME = "Qpid Management Console"; - - public static final String ACTION_REMOVE_MBEANNODE = "Remove from list"; - public static final String VALUE = "value"; - public static final String TYPE = "type"; - public static final String NODE_TYPE_SERVER = "server"; - public static final String NODE_TYPE_DOMAIN = "domain"; - public static final String NODE_TYPE_MBEANTYPE = "mbeantype"; + public final static String APPLICATION_NAME = "Qpid Management Console"; + + public final static String ACTION_REMOVE_MBEANNODE = "Remove from list"; + public final static String VALUE = "value"; + public final static String TYPE = "type"; + public final static String NODE_TYPE_SERVER = "server"; + public final static String NODE_TYPE_DOMAIN = "domain"; + public final static String NODE_TYPE_MBEANTYPE = "mbeantype"; // currently used only for virtual host instances, but will work as general also - public static final String NODE_TYPE_TYPEINSTANCE = "mbeantype_instance"; - public static final String MBEAN = "mbean"; - public static final String ATTRIBUTE = "Attribute"; - public static final String ATTRIBUTES = "Attributes"; - public static final String NOTIFICATIONS = "Notifications"; - public static final String RESULT = "Result"; - public static final String VIRTUAL_HOST = "VirtualHost"; - public static final String DEFAULT_VH = "Default"; - public static final String DEFAULT_USERNAME = "guest"; - public static final String DEFAULT_PASSWORD = "guest"; - - public static final String USERNAME = "Username"; - public static final String PASSWORD = "Password"; - + public final static String NODE_TYPE_TYPEINSTANCE = "mbeantype_instance"; + public final static String MBEAN = "mbean"; + public final static String ATTRIBUTE = "Attribute"; + public final static String ATTRIBUTES = "Attributes"; + public final static String NOTIFICATIONS = "Notifications"; + public final static String RESULT = "Result"; + public final static String VIRTUAL_HOST = "VirtualHost"; + public final static String DEFAULT_VH = "Default"; + public final static String DEFAULT_USERNAME = "guest"; + public final static String DEFAULT_PASSWORD = "guest"; + + public final static String USERNAME = "Username"; + public final static String PASSWORD = "Password"; + // Attributes and operations are used to customize the GUI for Qpid. If these are changes in the // Qpid server, then these should be updated accordingly - public static final String ATTRIBUTE_QUEUE_OWNER = "owner"; - public static final String ATTRIBUTE_QUEUE_DEPTH = "QueueDepth"; - public static final String ATTRIBUTE_QUEUE_CONSUMERCOUNT = "ActiveConsumerCount"; - public static final String OPERATION_CREATE_QUEUE = "createNewQueue"; - public static final String OPERATION_CREATE_BINDING = "createNewBinding"; - public static final String OPERATION_MOVE_MESSAGES = "moveMessages"; - - public static final String OPERATION_CREATEUSER = "createUser"; - public static final String OPERATION_VIEWUSERS = "viewUsers"; - public static final String OPERATION_PARAM_USERNAME = "username"; - - public static final String OPERATION_SUCCESSFUL = "Operation successful"; - public static final String OPERATION_UNSUCCESSFUL = "Operation unsuccessful"; - - public static final String ALL = "All"; - - public static final String NAVIGATION_ROOT = "Qpid Connections"; - public static final String DESCRIPTION = " Description"; - - public static final String ADMIN_MBEAN_TYPE = "UserManagement"; - public static final String QUEUE = "Queue"; - public static final String CONNECTION = "Connection"; - public static final String EXCHANGE = "Exchange"; - public static final String EXCHANGE_TYPE = "ExchangeType"; - public static final String[] EXCHANGE_TYPE_VALUES = { "direct", "fanout", "headers", "topic" }; - public static final String[] BOOLEAN_TYPE_VALUES = { "false", "true" }; - public static final String[] ATTRIBUTE_TABLE_TITLES = { "Attribute Name", "Value" }; - public static final String[] CONNECTION_PROTOCOLS = { "RMI" }; + public final static String ATTRIBUTE_QUEUE_OWNER = "owner"; + public final static String ATTRIBUTE_QUEUE_DEPTH = "QueueDepth"; + public final static String ATTRIBUTE_QUEUE_CONSUMERCOUNT = "ActiveConsumerCount"; + public final static String OPERATION_CREATE_QUEUE = "createNewQueue"; + public final static String OPERATION_CREATE_BINDING = "createNewBinding"; + public final static String OPERATION_MOVE_MESSAGES = "moveMessages"; + + public final static String OPERATION_CREATEUSER = "createUser"; + public final static String OPERATION_VIEWUSERS = "viewUsers"; + public final static String OPERATION_PARAM_USERNAME = "username"; + + public final static String OPERATION_SUCCESSFUL = "Operation successful"; + public final static String OPERATION_UNSUCCESSFUL = "Operation unsuccessful"; + + public final static String ALL = "All"; + + public final static String NAVIGATION_ROOT = "Qpid Connections"; + public final static String DESCRIPTION = " Description"; + + public final static String ADMIN_MBEAN_TYPE = "UserManagement"; + public final static String QUEUE = "Queue"; + public final static String CONNECTION ="Connection"; + public final static String EXCHANGE = "Exchange"; + public final static String EXCHANGE_TYPE = "ExchangeType"; + public final static String[] EXCHANGE_TYPE_VALUES = {"direct", "fanout", "headers", "topic"}; + public final static String[] BOOLEAN_TYPE_VALUES = {"false", "true"}; + public final static String[] ATTRIBUTE_TABLE_TITLES = {"Attribute Name", "Value"}; + public static final String[] CONNECTION_PROTOCOLS ={"RMI"}; public static final String DEFAULT_PROTOCOL = CONNECTION_PROTOCOLS[0]; - - public static final String ACTION_ADDSERVER = "New Connection"; - public static final String ACTION_RECONNECT = "Reconnect"; - public static final String ACTION_LOGIN = "Login"; - - public static final String QUEUE_SORT_BY_NAME = "Queue Name"; - public static final String QUEUE_SORT_BY_DEPTH = "Queue Depth"; - public static final String QUEUE_SORT_BY_CONSUMERCOUNT = "Consumer Count"; - public static final String QUEUE_SHOW_TEMP_QUEUES = "show temporary queues"; - - public static final String SUBSCRIBE_BUTTON = "Subscribe"; - public static final String UNSUBSCRIBE_BUTTON = "Unsubscribe"; - - public static final String CONSOLE_IMAGE = "ConsoelImage"; - public static final String CLOSED_FOLDER_IMAGE = "ClosedFolderImage"; - public static final String OPEN_FOLDER_IMAGE = "OpenFolderImage"; - public static final String MBEAN_IMAGE = "MBeanImage"; - public static final String NOTIFICATION_IMAGE = "NotificationImage"; - - public static final String FONT_BUTTON = "ButtonFont"; - public static final String FONT_BOLD = "BoldFont"; - public static final String FONT_ITALIC = "ItalicFont"; - public static final String FONT_TABLE_CELL = "TableCellFont"; - public static final String FONT_NORMAL = "Normal"; - - public static final String BUTTON_DETAILS = "Details"; - public static final String BUTTON_EDIT_ATTRIBUTE = "Edit Attribute"; - public static final String BUTTON_REFRESH = "Refresh"; - public static final String BUTTON_GRAPH = "Graph"; - public static final int TIMER_INTERVAL = 5000; - public static final String BUTTON_EXECUTE = "Execute"; - public static final String BUTTON_CLEAR = "Clear"; - public static final String BUTTON_CONNECT = "Connect"; - public static final String BUTTON_CANCEL = "Cancel"; - public static final String BUTTON_UPDATE = "Update"; - - public static final int OPERATION_IMPACT_INFO = 0; - public static final int OPERATION_IMPACT_ACTION = 1; - public static final int OPERATION_IMPACT_ACTIONINFO = 2; - public static final int OPERATION_IMPACT_UNKNOWN = 3; - - public static final String ERROR_SERVER_CONNECTION = "Server could not be connected"; - public static final String INFO_PROTOCOL = "Please select the protocol"; - public static final String INFO_HOST_ADDRESS = "Please enter the host address"; - public static final String INFO_HOST_PORT = "Please enter the port number"; - public static final String INFO_USERNAME = "Please enter the " + USERNAME; - public static final String INFO_PASSWORD = "Please enter the " + PASSWORD; - - public static final String MECH_CRAMMD5 = "CRAM-MD5"; - public static final String MECH_PLAIN = "PLAIN"; - public static final String SASL_CRAMMD5 = "SASL/CRAM-MD5"; - public static final String SASL_PLAIN = "SASL/PLAIN"; + + public final static String ACTION_ADDSERVER = "New Connection"; + public final static String ACTION_RECONNECT = "Reconnect"; + public final static String ACTION_LOGIN = "Login"; + + public final static String QUEUE_SORT_BY_NAME = "Queue Name"; + public final static String QUEUE_SORT_BY_DEPTH = "Queue Depth"; + public final static String QUEUE_SORT_BY_CONSUMERCOUNT = "Consumer Count"; + public final static String QUEUE_SHOW_TEMP_QUEUES= "show temporary queues"; + + public final static String SUBSCRIBE_BUTTON = "Subscribe"; + public final static String UNSUBSCRIBE_BUTTON = "Unsubscribe"; + + public final static String CONSOLE_IMAGE = "ConsoelImage"; + public final static String CLOSED_FOLDER_IMAGE = "ClosedFolderImage"; + public final static String OPEN_FOLDER_IMAGE = "OpenFolderImage"; + public final static String MBEAN_IMAGE = "MBeanImage"; + public final static String NOTIFICATION_IMAGE = "NotificationImage"; + + public final static String FONT_BUTTON = "ButtonFont"; + public final static String FONT_BOLD = "BoldFont"; + public final static String FONT_ITALIC = "ItalicFont"; + public final static String FONT_TABLE_CELL = "TableCellFont"; + public final static String FONT_NORMAL = "Normal"; + + public final static String BUTTON_DETAILS = "Details"; + public final static String BUTTON_EDIT_ATTRIBUTE = "Edit Attribute"; + public final static String BUTTON_REFRESH = "Refresh"; + public final static String BUTTON_GRAPH = "Graph"; + public final static int TIMER_INTERVAL = 5000; + public final static String BUTTON_EXECUTE = "Execute"; + public final static String BUTTON_CLEAR = "Clear"; + public final static String BUTTON_CONNECT = "Connect"; + public final static String BUTTON_CANCEL = "Cancel"; + public final static String BUTTON_UPDATE = "Update"; + + + public final static int OPERATION_IMPACT_INFO = 0; + public final static int OPERATION_IMPACT_ACTION = 1; + public final static int OPERATION_IMPACT_ACTIONINFO = 2; + public final static int OPERATION_IMPACT_UNKNOWN = 3; + + public final static String ERROR_SERVER_CONNECTION = "Server could not be connected"; + public final static String INFO_PROTOCOL = "Please select the protocol"; + public final static String INFO_HOST_ADDRESS = "Please enter the host address"; + public final static String INFO_HOST_PORT = "Please enter the port number"; + public final static String INFO_USERNAME = "Please enter the " + USERNAME; + public final static String INFO_PASSWORD = "Please enter the " + PASSWORD; + + public final static String MECH_CRAMMD5 = "CRAM-MD5"; + public final static String MECH_PLAIN = "PLAIN"; + public final static String SASL_CRAMMD5 = "SASL/CRAM-MD5"; + public final static String SASL_PLAIN = "SASL/PLAIN"; } |