You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ha...@apache.org on 2014/04/29 20:34:26 UTC

[14/14] git commit: Use autocrlf consistently for line endings

Use autocrlf consistently for line endings


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/3f32507f
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/3f32507f
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/3f32507f

Branch: refs/heads/trunk
Commit: 3f32507f7893bdc27b5dee985aeb5f86ebc49e04
Parents: b0bf144
Author: Hadrian Zbarcea <ha...@apache.org>
Authored: Tue Apr 29 14:18:37 2014 -0400
Committer: Hadrian Zbarcea <ha...@apache.org>
Committed: Tue Apr 29 14:18:37 2014 -0400

----------------------------------------------------------------------
 .../activemq/network/NetworkBridgeListener.java |  114 +-
 .../java/org/apache/activemq/util/LockFile.java |  292 +-
 .../activemq/console/command/CreateCommand.java |  592 +--
 .../console/command/store/tar/TarBuffer.java    |  924 ++---
 .../console/command/store/tar/TarConstants.java |  316 +-
 .../console/command/store/tar/TarEntry.java     | 1328 +++----
 .../command/store/tar/TarInputStream.java       |  804 ++--
 .../command/store/tar/TarOutputStream.java      |  712 ++--
 .../console/command/store/tar/TarUtils.java     |  412 +-
 .../store/jdbc/adapter/TransactJDBCAdapter.java |    4 +-
 .../kahadb/disk/journal/ReplicationTarget.java  |   50 +-
 .../apache/activemq/ExclusiveConsumerTest.java  |  714 ++--
 .../org/apache/activemq/bugs/AMQ4893Test.java   |  170 +-
 .../java/org/apache/activemq/bugs/Receiver.java |   42 +-
 .../activemq/store/kahadb/PBMesssagesTest.java  |  112 +-
 .../transport/failover/FailoverUriTest.java     |   96 +-
 .../DurableSubscriptionHangTestCase.java        |  270 +-
 ...kerConnectionDuplexExcludedDestinations.java |  342 +-
 .../apache/activemq/usecases/sender-duplex.xml  |  126 +-
 .../resources/spring-embedded-xbean-local.xml   |  160 +-
 .../webapp/WEB-INF/tags/jms/formatTimestamp.tag |   58 +-
 activemq-web-demo/src/main/webapp/js/amq.js     |  614 +--
 .../src/main/webapp/js/amq_dojo_adapter.js      |  168 +-
 .../src/main/webapp/js/amq_jquery_adapter.js    |  176 +-
 .../src/main/webapp/js/amq_prototype_adapter.js |  168 +-
 activemq-web-demo/src/main/webapp/js/chat.js    |  418 +-
 .../src/main/webapp/mqtt/mqttws31.js            | 3704 +++++++++---------
 assembly/src/release/bin/win64/wrapper.conf     |  288 +-
 .../examples/mqtt/websocket/js/mqttws31.js      | 3704 +++++++++---------
 .../ActiveMQExamples/ActiveMQExamples.sln       |   52 +-
 .../ActiveMQExamples/Listener/Listener.csproj   |  102 +-
 .../ActiveMQExamples/Publisher/Publisher.csproj |  102 +-
 .../QueueMonitor/QueueMonitor.java              |  702 ++--
 .../QueueMonitor/QueueMonitor.properties        |  144 +-
 .../QueueRoundTrip/QueueRoundTrip.java          |  484 +--
 .../QueuePTPSamples/RequestReply/Replier.java   |  676 ++--
 .../QueuePTPSamples/RequestReply/Requestor.java |  528 +--
 .../SelectorTalk/SelectorTalk.java              |  702 ++--
 .../QueuePTPSamples/Talk/Talk.java              |  664 ++--
 .../TransactedTalk/TransactedTalk.java          |  720 ++--
 .../TopicPubSubSamples/Chat/Chat.java           |  524 +--
 .../DurableChat/DurableChat.java                |  566 +--
 .../HierarchicalChat/HierarchicalChat.java      |  606 +--
 .../MessageMonitor/MessageMonitor.java          |  656 ++--
 .../MessageMonitor/MessageMonitor.properties    |  144 +-
 .../RequestReply/TopicReplier.java              |  636 +--
 .../RequestReply/TopicRequestor.java            |  482 +--
 .../SelectorChat/SelectorChat.java              |  592 +--
 .../TransactedChat/TransactedChat.java          |  592 +--
 .../examples/openwire/exploring-jms/build.xml   |  666 ++--
 .../exploring-jms/conf/log4j.properties         |   78 +-
 .../examples/openwire/exploring-jms/readme.txt  |   14 +-
 .../swissarmy/src/CommandLineSupport.java       |  240 +-
 .../ActiveMQExamples/ActiveMQExamples.sln       |   52 +-
 54 files changed, 13801 insertions(+), 13801 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/3f32507f/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java
index c30a999..a08064c 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeListener.java
@@ -1,57 +1,57 @@
-/**
- * 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
- *
- * 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.activemq.network;
-
-import org.apache.activemq.command.Message;
-
-/**
- * called when a bridge fails
- * 
- * 
- */
-public interface NetworkBridgeListener {
-
-    /**
-     * called when the transport fails
-     */
-    void bridgeFailed();
-
-    /**
-     * called after the bridge is started.
-     */
-    void onStart(NetworkBridge bridge);
-
-    /**
-     * called before the bridge is stopped.
-     */
-    void onStop(NetworkBridge bridge);
-
-    /**
-     * Called when message forwarded over the network
-     * @param bridge
-     * @param message
-     */
-    void onOutboundMessage (NetworkBridge bridge,Message message);
-
-    /**
-     * Called for when a message arrives over the network
-     * @param bridge
-     * @param message
-     */
-    void onInboundMessage (NetworkBridge bridge,Message message);
-
-}
+/**
+ * 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
+ *
+ * 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.activemq.network;
+
+import org.apache.activemq.command.Message;
+
+/**
+ * called when a bridge fails
+ * 
+ * 
+ */
+public interface NetworkBridgeListener {
+
+    /**
+     * called when the transport fails
+     */
+    void bridgeFailed();
+
+    /**
+     * called after the bridge is started.
+     */
+    void onStart(NetworkBridge bridge);
+
+    /**
+     * called before the bridge is stopped.
+     */
+    void onStop(NetworkBridge bridge);
+
+    /**
+     * Called when message forwarded over the network
+     * @param bridge
+     * @param message
+     */
+    void onOutboundMessage (NetworkBridge bridge,Message message);
+
+    /**
+     * Called for when a message arrives over the network
+     * @param bridge
+     * @param message
+     */
+    void onInboundMessage (NetworkBridge bridge,Message message);
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/3f32507f/activemq-broker/src/main/java/org/apache/activemq/util/LockFile.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/util/LockFile.java b/activemq-broker/src/main/java/org/apache/activemq/util/LockFile.java
index 8fe512a..7fc4648 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/util/LockFile.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/util/LockFile.java
@@ -1,146 +1,146 @@
-/**
- * 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
- *
- * 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.activemq.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileLock;
-import java.nio.channels.OverlappingFileLockException;
-import java.util.Date;
-
-/**
- * Used to lock a File.
- *
- * @author chirino
- */
-public class LockFile {
-
-    private static final boolean DISABLE_FILE_LOCK = Boolean.getBoolean("java.nio.channels.FileLock.broken");
-    final private File file;
-
-    private FileLock lock;
-    private RandomAccessFile readFile;
-    private int lockCounter;
-    private final boolean deleteOnUnlock;
-
-    public LockFile(File file, boolean deleteOnUnlock) {
-        this.file = file;
-        this.deleteOnUnlock = deleteOnUnlock;
-    }
-
-    /**
-     * @throws IOException
-     */
-    synchronized public void lock() throws IOException {
-        if (DISABLE_FILE_LOCK) {
-            return;
-        }
-
-        if (lockCounter > 0) {
-            return;
-        }
-
-        IOHelper.mkdirs(file.getParentFile());
-        synchronized (LockFile.class) {
-            if (System.getProperty(getVmLockKey()) != null) {
-                throw new IOException("File '" + file + "' could not be locked as lock is already held for this jvm.");
-            }
-            System.setProperty(getVmLockKey(), new Date().toString());
-        }
-        try {
-            if (lock == null) {
-                readFile = new RandomAccessFile(file, "rw");
-                IOException reason = null;
-                try {
-                    lock = readFile.getChannel().tryLock(0, Math.max(1, readFile.getChannel().size()), false);
-                } catch (OverlappingFileLockException e) {
-                    reason = IOExceptionSupport.create("File '" + file + "' could not be locked.", e);
-                } catch (IOException ioe) {
-                    reason = ioe;
-                }
-                if (lock != null) {
-                    lockCounter++;
-                    System.setProperty(getVmLockKey(), new Date().toString());
-                } else {
-                    // new read file for next attempt
-                    closeReadFile();
-                    if (reason != null) {
-                        throw reason;
-                    }
-                    throw new IOException("File '" + file + "' could not be locked.");
-                }
-
-            }
-        } finally {
-            synchronized (LockFile.class) {
-                if (lock == null) {
-                    System.getProperties().remove(getVmLockKey());
-                }
-            }
-        }
-    }
-
-    /**
-     */
-    public void unlock() {
-        if (DISABLE_FILE_LOCK) {
-            return;
-        }
-
-        lockCounter--;
-        if (lockCounter != 0) {
-            return;
-        }
-
-        // release the lock..
-        if (lock != null) {
-            try {
-                lock.release();
-                System.getProperties().remove(getVmLockKey());
-            } catch (Throwable ignore) {
-            }
-            lock = null;
-        }
-        closeReadFile();
-
-        if (deleteOnUnlock) {
-            file.delete();
-        }
-    }
-
-    private String getVmLockKey() throws IOException {
-        return getClass().getName() + ".lock." + file.getCanonicalPath();
-    }
-
-    private void closeReadFile() {
-        // close the file.
-        if (readFile != null) {
-            try {
-                readFile.close();
-            } catch (Throwable ignore) {
-            }
-            readFile = null;
-        }
-
-    }
-
-    public boolean keepAlive() {
-        return lock != null && lock.isValid() && file.exists();
-    }
-
-}
+/**
+ * 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
+ *
+ * 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.activemq.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileLock;
+import java.nio.channels.OverlappingFileLockException;
+import java.util.Date;
+
+/**
+ * Used to lock a File.
+ *
+ * @author chirino
+ */
+public class LockFile {
+
+    private static final boolean DISABLE_FILE_LOCK = Boolean.getBoolean("java.nio.channels.FileLock.broken");
+    final private File file;
+
+    private FileLock lock;
+    private RandomAccessFile readFile;
+    private int lockCounter;
+    private final boolean deleteOnUnlock;
+
+    public LockFile(File file, boolean deleteOnUnlock) {
+        this.file = file;
+        this.deleteOnUnlock = deleteOnUnlock;
+    }
+
+    /**
+     * @throws IOException
+     */
+    synchronized public void lock() throws IOException {
+        if (DISABLE_FILE_LOCK) {
+            return;
+        }
+
+        if (lockCounter > 0) {
+            return;
+        }
+
+        IOHelper.mkdirs(file.getParentFile());
+        synchronized (LockFile.class) {
+            if (System.getProperty(getVmLockKey()) != null) {
+                throw new IOException("File '" + file + "' could not be locked as lock is already held for this jvm.");
+            }
+            System.setProperty(getVmLockKey(), new Date().toString());
+        }
+        try {
+            if (lock == null) {
+                readFile = new RandomAccessFile(file, "rw");
+                IOException reason = null;
+                try {
+                    lock = readFile.getChannel().tryLock(0, Math.max(1, readFile.getChannel().size()), false);
+                } catch (OverlappingFileLockException e) {
+                    reason = IOExceptionSupport.create("File '" + file + "' could not be locked.", e);
+                } catch (IOException ioe) {
+                    reason = ioe;
+                }
+                if (lock != null) {
+                    lockCounter++;
+                    System.setProperty(getVmLockKey(), new Date().toString());
+                } else {
+                    // new read file for next attempt
+                    closeReadFile();
+                    if (reason != null) {
+                        throw reason;
+                    }
+                    throw new IOException("File '" + file + "' could not be locked.");
+                }
+
+            }
+        } finally {
+            synchronized (LockFile.class) {
+                if (lock == null) {
+                    System.getProperties().remove(getVmLockKey());
+                }
+            }
+        }
+    }
+
+    /**
+     */
+    public void unlock() {
+        if (DISABLE_FILE_LOCK) {
+            return;
+        }
+
+        lockCounter--;
+        if (lockCounter != 0) {
+            return;
+        }
+
+        // release the lock..
+        if (lock != null) {
+            try {
+                lock.release();
+                System.getProperties().remove(getVmLockKey());
+            } catch (Throwable ignore) {
+            }
+            lock = null;
+        }
+        closeReadFile();
+
+        if (deleteOnUnlock) {
+            file.delete();
+        }
+    }
+
+    private String getVmLockKey() throws IOException {
+        return getClass().getName() + ".lock." + file.getCanonicalPath();
+    }
+
+    private void closeReadFile() {
+        // close the file.
+        if (readFile != null) {
+            try {
+                readFile.close();
+            } catch (Throwable ignore) {
+            }
+            readFile = null;
+        }
+
+    }
+
+    public boolean keepAlive() {
+        return lock != null && lock.isValid() && file.exists();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/3f32507f/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
----------------------------------------------------------------------
diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java b/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
index c2e6a09..ae87837 100644
--- a/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
+++ b/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
@@ -1,296 +1,296 @@
-/*
- * 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
- *
- * 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.activemq.console.command;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.util.List;
-
-public class CreateCommand extends AbstractCommand {
-
-    protected final String[] helpFile = new String[] {
-        "Task Usage: Main create path/to/brokerA [create-options]",
-        "Description:  Creates a runnable broker instance in the specified path.",
-        "",
-        "List Options:",
-        "    --amqconf <file path>   Path to ActiveMQ conf file that will be used in the broker instance. Default is: conf/activemq.xml",
-        "    --version               Display the version information.",
-        "    -h,-?,--help            Display the create broker help information.",
-        ""
-    };
-
-    protected final String DEFAULT_TARGET_ACTIVEMQ_CONF = "conf/activemq.xml"; // default activemq conf to create in the new broker instance
-    protected final String DEFAULT_BROKERNAME_XPATH = "/beans/broker/@brokerName"; // default broker name xpath to change the broker name
-
-    protected final String[] BASE_SUB_DIRS = { "bin", "conf" }; // default sub directories that will be created
-    protected final String BROKER_NAME_REGEX = "[$][{]brokerName[}]"; // use to replace broker name property holders
-
-    protected String amqConf = "conf/activemq.xml"; // default conf if no conf is specified via --amqconf
-
-    // default files to create 
-    protected String[][] fileWriteMap = {
-        { "winActivemq", "bin/${brokerName}.bat" },
-        { "unixActivemq", "bin/${brokerName}" }
-    };
-
-
-    protected String brokerName;
-    protected File amqHome;
-    protected File targetAmqBase;
-
-    @Override
-    public String getName() {
-        return "create";
-    }
-
-    @Override
-    public String getOneLineDescription() {
-        return "Creates a runnable broker instance in the specified path.";
-    }
-
-    protected void runTask(List<String> tokens) throws Exception {
-        context.print("Running create broker task...");
-        amqHome = new File(System.getProperty("activemq.home"));
-        for (String token : tokens) {
-
-            targetAmqBase = new File(token);
-            brokerName = targetAmqBase.getName();
-            
-
-            if (targetAmqBase.exists()) {
-                BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
-                String resp;
-                while (true) {
-                    context.print("Target directory (" + targetAmqBase.getCanonicalPath() + ") already exists. Overwrite (y/n): ");
-                    resp = console.readLine();
-                    if (resp.equalsIgnoreCase("y") || resp.equalsIgnoreCase("yes")) {
-                        break;
-                    } else if (resp.equalsIgnoreCase("n") || resp.equalsIgnoreCase("no")) {
-                        return;
-                    }
-                }
-            }
-
-            context.print("Creating directory: " + targetAmqBase.getCanonicalPath());
-            targetAmqBase.mkdirs();
-            createSubDirs(targetAmqBase, BASE_SUB_DIRS);
-            writeFileMapping(targetAmqBase, fileWriteMap);
-            copyActivemqConf(amqHome, targetAmqBase, amqConf);
-            copyConfDirectory(new File(amqHome, "conf"), new File(targetAmqBase, "conf"));
-        }
-    }
-
-    /**
-     * Handle the --amqconf options.
-     *
-     * @param token  - option token to handle
-     * @param tokens - succeeding command arguments
-     * @throws Exception
-     */
-    protected void handleOption(String token, List<String> tokens) throws Exception {
-        if (token.startsWith("--amqconf")) {
-            // If no amqconf specified, or next token is a new option
-            if (tokens.isEmpty() || tokens.get(0).startsWith("-")) {
-                context.printException(new IllegalArgumentException("Attributes to amqconf not specified"));
-                return;
-            }
-
-            amqConf = tokens.remove(0);
-        } else {
-            // Let super class handle unknown option
-            super.handleOption(token, tokens);
-        }
-    }
-
-    protected void createSubDirs(File target, String[] subDirs) throws IOException {
-        File subDirFile;
-        for (String subDir : BASE_SUB_DIRS) {
-            subDirFile = new File(target, subDir);
-            context.print("Creating directory: " + subDirFile.getCanonicalPath());
-            subDirFile.mkdirs();
-        }
-    }
-
-    protected void writeFileMapping(File targetBase, String[][] fileWriteMapping) throws IOException {
-        for (String[] fileWrite : fileWriteMapping) {
-            File dest = new File(targetBase, resolveParam(BROKER_NAME_REGEX, brokerName, fileWrite[1]));
-            context.print("Creating new file: " + dest.getCanonicalPath());
-            writeFile(fileWrite[0], dest);
-        }
-    }
-
-    protected void copyActivemqConf(File srcBase, File targetBase, String activemqConf) throws IOException, ParserConfigurationException, SAXException, TransformerException, XPathExpressionException {
-        File src = new File(srcBase, activemqConf);
-
-        if (!src.exists()) {
-            throw new FileNotFoundException("File: " + src.getCanonicalPath() + " not found.");
-        }
-
-        File dest = new File(targetBase, DEFAULT_TARGET_ACTIVEMQ_CONF);
-        context.print("Copying from: " + src.getCanonicalPath() + "\n          to: " + dest.getCanonicalPath());
-
-        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        Element docElem = builder.parse(src).getDocumentElement();
-
-        XPath xpath = XPathFactory.newInstance().newXPath();
-        Attr brokerNameAttr = (Attr) xpath.evaluate(DEFAULT_BROKERNAME_XPATH, docElem, XPathConstants.NODE);
-        brokerNameAttr.setValue(brokerName);
-
-        writeToFile(new DOMSource(docElem), dest);
-    }
-
-    protected void printHelp() {
-        context.printHelp(helpFile);
-    }
-
-    // write the default files to create (i.e. script files)
-    private void writeFile(String typeName, File dest) throws IOException {
-        String data;
-        if (typeName.equals("winActivemq")) {
-            data = winActivemqData;
-            data = resolveParam("[$][{]activemq.home[}]", amqHome.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
-            data = resolveParam("[$][{]activemq.base[}]", targetAmqBase.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
-        } else if (typeName.equals("unixActivemq")) {
-            data = getUnixActivemqData();
-            data = resolveParam("[$][{]activemq.home[}]", amqHome.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
-            data = resolveParam("[$][{]activemq.base[}]", targetAmqBase.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
-        } else {
-            throw new IllegalStateException("Unknown file type: " + typeName);
-        }
-
-        ByteBuffer buf = ByteBuffer.allocate(data.length());
-        buf.put(data.getBytes());
-        buf.flip();
-
-        FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
-        destinationChannel.write(buf);
-        destinationChannel.close();
-
-        // Set file permissions available for Java 6.0 only
-        dest.setExecutable(true);
-        dest.setReadable(true);
-        dest.setWritable(true);
-    }
-
-    // utlity method to write an xml source to file
-    private void writeToFile(Source src, File file) throws TransformerException {
-        TransformerFactory tFactory = TransformerFactory.newInstance();
-        Transformer fileTransformer = tFactory.newTransformer();
-
-        Result res = new StreamResult(file);
-        fileTransformer.transform(src, res);
-    }
-
-    // utility method to copy one file to another
-    private void copyFile(File from, File dest) throws IOException {
-        if (!from.exists()) {
-            return;
-        }
-        FileChannel sourceChannel = new FileInputStream(from).getChannel();
-        FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
-        sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
-        sourceChannel.close();
-        destinationChannel.close();
-    }
-
-    private void copyConfDirectory(File from, File dest) throws IOException {
-        if (from.isDirectory()) {
-            String files[] = from.list();
-
-            for (String file : files) {
-                File srcFile = new File(from, file);
-                if (srcFile.isFile() && !srcFile.getName().equals("activemq.xml")) {
-                    File destFile = new File(dest, file);
-                    context.print("Copying from: " + srcFile.getCanonicalPath() + "\n          to: " + destFile.getCanonicalPath());
-                    copyFile(srcFile, destFile);
-                }
-            }
-        } else {
-            throw new IOException(from + " is not a directory");
-        }
-    }
-
-    // replace a property place holder (paramName) with the paramValue
-    private String resolveParam(String paramName, String paramValue, String target) {
-        return target.replaceAll(paramName, paramValue);
-    }
-
-    // Embedded windows script data
-    private static final String winActivemqData =
-        "@echo off\n"
-            + "set ACTIVEMQ_HOME=\"${activemq.home}\"\n"
-            + "set ACTIVEMQ_BASE=\"${activemq.base}\"\n"
-            + "\n"
-            + "set PARAM=%1\n"
-            + ":getParam\n"
-            + "shift\n"
-            + "if \"%1\"==\"\" goto end\n"
-            + "set PARAM=%PARAM% %1\n"
-            + "goto getParam\n"
-            + ":end\n"
-            + "\n"
-            + "%ACTIVEMQ_HOME%/bin/activemq %PARAM%";
-
-
-   private String getUnixActivemqData() {
-       StringBuffer res = new StringBuffer();
-       res.append("## Figure out the ACTIVEMQ_BASE from the directory this script was run from\n");
-       res.append("PRG=\"$0\"\n");
-       res.append("progname=`basename \"$0\"`\n");
-       res.append("saveddir=`pwd`\n");
-       res.append("# need this for relative symlinks\n");
-       res.append("dirname_prg=`dirname \"$PRG\"`\n");
-       res.append("cd \"$dirname_prg\"\n");
-       res.append("while [ -h \"$PRG\" ] ; do\n");
-       res.append("  ls=`ls -ld \"$PRG\"`\n");
-       res.append("  link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n");
-       res.append("  if expr \"$link\" : '.*/.*' > /dev/null; then\n");
-       res.append("    PRG=\"$link\"\n");
-       res.append("  else\n");
-       res.append("    PRG=`dirname \"$PRG\"`\"/$link\"\n");
-       res.append("  fi\n");
-       res.append("done\n");
-       res.append("ACTIVEMQ_BASE=`dirname \"$PRG\"`/..\n");
-       res.append("cd \"$saveddir\"\n\n");
-       res.append("ACTIVEMQ_BASE=`cd \"$ACTIVEMQ_BASE\" && pwd`\n\n");
-       res.append("## Enable remote debugging\n");
-       res.append("#export ACTIVEMQ_DEBUG_OPTS=\"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005\"\n\n");
-       res.append("## Add system properties for this instance here (if needed), e.g\n");
-       res.append("#export ACTIVEMQ_OPTS_MEMORY=\"-Xms256M -Xmx1G\"\n");
-       res.append("#export ACTIVEMQ_OPTS=\"$ACTIVEMQ_OPTS_MEMORY -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties\"\n\n");
-       res.append("export ACTIVEMQ_HOME=${activemq.home}\n");
-       res.append("export ACTIVEMQ_BASE=$ACTIVEMQ_BASE\n\n");
-       res.append("${ACTIVEMQ_HOME}/bin/activemq \"$@\"");
-       return res.toString();
-   }
-
-}
+/*
+ * 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
+ *
+ * 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.activemq.console.command;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.List;
+
+public class CreateCommand extends AbstractCommand {
+
+    protected final String[] helpFile = new String[] {
+        "Task Usage: Main create path/to/brokerA [create-options]",
+        "Description:  Creates a runnable broker instance in the specified path.",
+        "",
+        "List Options:",
+        "    --amqconf <file path>   Path to ActiveMQ conf file that will be used in the broker instance. Default is: conf/activemq.xml",
+        "    --version               Display the version information.",
+        "    -h,-?,--help            Display the create broker help information.",
+        ""
+    };
+
+    protected final String DEFAULT_TARGET_ACTIVEMQ_CONF = "conf/activemq.xml"; // default activemq conf to create in the new broker instance
+    protected final String DEFAULT_BROKERNAME_XPATH = "/beans/broker/@brokerName"; // default broker name xpath to change the broker name
+
+    protected final String[] BASE_SUB_DIRS = { "bin", "conf" }; // default sub directories that will be created
+    protected final String BROKER_NAME_REGEX = "[$][{]brokerName[}]"; // use to replace broker name property holders
+
+    protected String amqConf = "conf/activemq.xml"; // default conf if no conf is specified via --amqconf
+
+    // default files to create 
+    protected String[][] fileWriteMap = {
+        { "winActivemq", "bin/${brokerName}.bat" },
+        { "unixActivemq", "bin/${brokerName}" }
+    };
+
+
+    protected String brokerName;
+    protected File amqHome;
+    protected File targetAmqBase;
+
+    @Override
+    public String getName() {
+        return "create";
+    }
+
+    @Override
+    public String getOneLineDescription() {
+        return "Creates a runnable broker instance in the specified path.";
+    }
+
+    protected void runTask(List<String> tokens) throws Exception {
+        context.print("Running create broker task...");
+        amqHome = new File(System.getProperty("activemq.home"));
+        for (String token : tokens) {
+
+            targetAmqBase = new File(token);
+            brokerName = targetAmqBase.getName();
+            
+
+            if (targetAmqBase.exists()) {
+                BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
+                String resp;
+                while (true) {
+                    context.print("Target directory (" + targetAmqBase.getCanonicalPath() + ") already exists. Overwrite (y/n): ");
+                    resp = console.readLine();
+                    if (resp.equalsIgnoreCase("y") || resp.equalsIgnoreCase("yes")) {
+                        break;
+                    } else if (resp.equalsIgnoreCase("n") || resp.equalsIgnoreCase("no")) {
+                        return;
+                    }
+                }
+            }
+
+            context.print("Creating directory: " + targetAmqBase.getCanonicalPath());
+            targetAmqBase.mkdirs();
+            createSubDirs(targetAmqBase, BASE_SUB_DIRS);
+            writeFileMapping(targetAmqBase, fileWriteMap);
+            copyActivemqConf(amqHome, targetAmqBase, amqConf);
+            copyConfDirectory(new File(amqHome, "conf"), new File(targetAmqBase, "conf"));
+        }
+    }
+
+    /**
+     * Handle the --amqconf options.
+     *
+     * @param token  - option token to handle
+     * @param tokens - succeeding command arguments
+     * @throws Exception
+     */
+    protected void handleOption(String token, List<String> tokens) throws Exception {
+        if (token.startsWith("--amqconf")) {
+            // If no amqconf specified, or next token is a new option
+            if (tokens.isEmpty() || tokens.get(0).startsWith("-")) {
+                context.printException(new IllegalArgumentException("Attributes to amqconf not specified"));
+                return;
+            }
+
+            amqConf = tokens.remove(0);
+        } else {
+            // Let super class handle unknown option
+            super.handleOption(token, tokens);
+        }
+    }
+
+    protected void createSubDirs(File target, String[] subDirs) throws IOException {
+        File subDirFile;
+        for (String subDir : BASE_SUB_DIRS) {
+            subDirFile = new File(target, subDir);
+            context.print("Creating directory: " + subDirFile.getCanonicalPath());
+            subDirFile.mkdirs();
+        }
+    }
+
+    protected void writeFileMapping(File targetBase, String[][] fileWriteMapping) throws IOException {
+        for (String[] fileWrite : fileWriteMapping) {
+            File dest = new File(targetBase, resolveParam(BROKER_NAME_REGEX, brokerName, fileWrite[1]));
+            context.print("Creating new file: " + dest.getCanonicalPath());
+            writeFile(fileWrite[0], dest);
+        }
+    }
+
+    protected void copyActivemqConf(File srcBase, File targetBase, String activemqConf) throws IOException, ParserConfigurationException, SAXException, TransformerException, XPathExpressionException {
+        File src = new File(srcBase, activemqConf);
+
+        if (!src.exists()) {
+            throw new FileNotFoundException("File: " + src.getCanonicalPath() + " not found.");
+        }
+
+        File dest = new File(targetBase, DEFAULT_TARGET_ACTIVEMQ_CONF);
+        context.print("Copying from: " + src.getCanonicalPath() + "\n          to: " + dest.getCanonicalPath());
+
+        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        Element docElem = builder.parse(src).getDocumentElement();
+
+        XPath xpath = XPathFactory.newInstance().newXPath();
+        Attr brokerNameAttr = (Attr) xpath.evaluate(DEFAULT_BROKERNAME_XPATH, docElem, XPathConstants.NODE);
+        brokerNameAttr.setValue(brokerName);
+
+        writeToFile(new DOMSource(docElem), dest);
+    }
+
+    protected void printHelp() {
+        context.printHelp(helpFile);
+    }
+
+    // write the default files to create (i.e. script files)
+    private void writeFile(String typeName, File dest) throws IOException {
+        String data;
+        if (typeName.equals("winActivemq")) {
+            data = winActivemqData;
+            data = resolveParam("[$][{]activemq.home[}]", amqHome.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
+            data = resolveParam("[$][{]activemq.base[}]", targetAmqBase.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
+        } else if (typeName.equals("unixActivemq")) {
+            data = getUnixActivemqData();
+            data = resolveParam("[$][{]activemq.home[}]", amqHome.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
+            data = resolveParam("[$][{]activemq.base[}]", targetAmqBase.getCanonicalPath().replaceAll("[\\\\]", "/"), data);
+        } else {
+            throw new IllegalStateException("Unknown file type: " + typeName);
+        }
+
+        ByteBuffer buf = ByteBuffer.allocate(data.length());
+        buf.put(data.getBytes());
+        buf.flip();
+
+        FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
+        destinationChannel.write(buf);
+        destinationChannel.close();
+
+        // Set file permissions available for Java 6.0 only
+        dest.setExecutable(true);
+        dest.setReadable(true);
+        dest.setWritable(true);
+    }
+
+    // utlity method to write an xml source to file
+    private void writeToFile(Source src, File file) throws TransformerException {
+        TransformerFactory tFactory = TransformerFactory.newInstance();
+        Transformer fileTransformer = tFactory.newTransformer();
+
+        Result res = new StreamResult(file);
+        fileTransformer.transform(src, res);
+    }
+
+    // utility method to copy one file to another
+    private void copyFile(File from, File dest) throws IOException {
+        if (!from.exists()) {
+            return;
+        }
+        FileChannel sourceChannel = new FileInputStream(from).getChannel();
+        FileChannel destinationChannel = new FileOutputStream(dest).getChannel();
+        sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
+        sourceChannel.close();
+        destinationChannel.close();
+    }
+
+    private void copyConfDirectory(File from, File dest) throws IOException {
+        if (from.isDirectory()) {
+            String files[] = from.list();
+
+            for (String file : files) {
+                File srcFile = new File(from, file);
+                if (srcFile.isFile() && !srcFile.getName().equals("activemq.xml")) {
+                    File destFile = new File(dest, file);
+                    context.print("Copying from: " + srcFile.getCanonicalPath() + "\n          to: " + destFile.getCanonicalPath());
+                    copyFile(srcFile, destFile);
+                }
+            }
+        } else {
+            throw new IOException(from + " is not a directory");
+        }
+    }
+
+    // replace a property place holder (paramName) with the paramValue
+    private String resolveParam(String paramName, String paramValue, String target) {
+        return target.replaceAll(paramName, paramValue);
+    }
+
+    // Embedded windows script data
+    private static final String winActivemqData =
+        "@echo off\n"
+            + "set ACTIVEMQ_HOME=\"${activemq.home}\"\n"
+            + "set ACTIVEMQ_BASE=\"${activemq.base}\"\n"
+            + "\n"
+            + "set PARAM=%1\n"
+            + ":getParam\n"
+            + "shift\n"
+            + "if \"%1\"==\"\" goto end\n"
+            + "set PARAM=%PARAM% %1\n"
+            + "goto getParam\n"
+            + ":end\n"
+            + "\n"
+            + "%ACTIVEMQ_HOME%/bin/activemq %PARAM%";
+
+
+   private String getUnixActivemqData() {
+       StringBuffer res = new StringBuffer();
+       res.append("## Figure out the ACTIVEMQ_BASE from the directory this script was run from\n");
+       res.append("PRG=\"$0\"\n");
+       res.append("progname=`basename \"$0\"`\n");
+       res.append("saveddir=`pwd`\n");
+       res.append("# need this for relative symlinks\n");
+       res.append("dirname_prg=`dirname \"$PRG\"`\n");
+       res.append("cd \"$dirname_prg\"\n");
+       res.append("while [ -h \"$PRG\" ] ; do\n");
+       res.append("  ls=`ls -ld \"$PRG\"`\n");
+       res.append("  link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n");
+       res.append("  if expr \"$link\" : '.*/.*' > /dev/null; then\n");
+       res.append("    PRG=\"$link\"\n");
+       res.append("  else\n");
+       res.append("    PRG=`dirname \"$PRG\"`\"/$link\"\n");
+       res.append("  fi\n");
+       res.append("done\n");
+       res.append("ACTIVEMQ_BASE=`dirname \"$PRG\"`/..\n");
+       res.append("cd \"$saveddir\"\n\n");
+       res.append("ACTIVEMQ_BASE=`cd \"$ACTIVEMQ_BASE\" && pwd`\n\n");
+       res.append("## Enable remote debugging\n");
+       res.append("#export ACTIVEMQ_DEBUG_OPTS=\"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005\"\n\n");
+       res.append("## Add system properties for this instance here (if needed), e.g\n");
+       res.append("#export ACTIVEMQ_OPTS_MEMORY=\"-Xms256M -Xmx1G\"\n");
+       res.append("#export ACTIVEMQ_OPTS=\"$ACTIVEMQ_OPTS_MEMORY -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties\"\n\n");
+       res.append("export ACTIVEMQ_HOME=${activemq.home}\n");
+       res.append("export ACTIVEMQ_BASE=$ACTIVEMQ_BASE\n\n");
+       res.append("${ACTIVEMQ_HOME}/bin/activemq \"$@\"");
+       return res.toString();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/3f32507f/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java
----------------------------------------------------------------------
diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java b/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java
index 6bde68f..46f9110 100644
--- a/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java
+++ b/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java
@@ -1,462 +1,462 @@
-/*
- *  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
- *
- *  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.
- *
- */
-
-/*
- * This package is based on the work done by Timothy Gerard Endres
- * (time@ice.com) to whom the Ant project is very grateful for his great code.
- */
-
-package org.apache.activemq.console.command.store.tar;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * The TarBuffer class implements the tar archive concept
- * of a buffered input stream. This concept goes back to the
- * days of blocked tape drives and special io devices. In the
- * Java universe, the only real function that this class
- * performs is to ensure that files have the correct "block"
- * size, or other tars will complain.
- * <p>
- * You should never have a need to access this class directly.
- * TarBuffers are created by Tar IO Streams.
- *
- */
-
-public class TarBuffer {
-
-    /** Default record size */
-    public static final int DEFAULT_RCDSIZE = (512);
-
-    /** Default block size */
-    public static final int DEFAULT_BLKSIZE = (DEFAULT_RCDSIZE * 20);
-
-    private InputStream     inStream;
-    private OutputStream    outStream;
-    private byte[]          blockBuffer;
-    private int             currBlkIdx;
-    private int             currRecIdx;
-    private int             blockSize;
-    private int             recordSize;
-    private int             recsPerBlock;
-    private boolean         debug;
-
-    /**
-     * Constructor for a TarBuffer on an input stream.
-     * @param inStream the input stream to use
-     */
-    public TarBuffer(InputStream inStream) {
-        this(inStream, TarBuffer.DEFAULT_BLKSIZE);
-    }
-
-    /**
-     * Constructor for a TarBuffer on an input stream.
-     * @param inStream the input stream to use
-     * @param blockSize the block size to use
-     */
-    public TarBuffer(InputStream inStream, int blockSize) {
-        this(inStream, blockSize, TarBuffer.DEFAULT_RCDSIZE);
-    }
-
-    /**
-     * Constructor for a TarBuffer on an input stream.
-     * @param inStream the input stream to use
-     * @param blockSize the block size to use
-     * @param recordSize the record size to use
-     */
-    public TarBuffer(InputStream inStream, int blockSize, int recordSize) {
-        this.inStream = inStream;
-        this.outStream = null;
-
-        this.initialize(blockSize, recordSize);
-    }
-
-    /**
-     * Constructor for a TarBuffer on an output stream.
-     * @param outStream the output stream to use
-     */
-    public TarBuffer(OutputStream outStream) {
-        this(outStream, TarBuffer.DEFAULT_BLKSIZE);
-    }
-
-    /**
-     * Constructor for a TarBuffer on an output stream.
-     * @param outStream the output stream to use
-     * @param blockSize the block size to use
-     */
-    public TarBuffer(OutputStream outStream, int blockSize) {
-        this(outStream, blockSize, TarBuffer.DEFAULT_RCDSIZE);
-    }
-
-    /**
-     * Constructor for a TarBuffer on an output stream.
-     * @param outStream the output stream to use
-     * @param blockSize the block size to use
-     * @param recordSize the record size to use
-     */
-    public TarBuffer(OutputStream outStream, int blockSize, int recordSize) {
-        this.inStream = null;
-        this.outStream = outStream;
-
-        this.initialize(blockSize, recordSize);
-    }
-
-    /**
-     * Initialization common to all constructors.
-     */
-    private void initialize(int blockSize, int recordSize) {
-        this.debug = false;
-        this.blockSize = blockSize;
-        this.recordSize = recordSize;
-        this.recsPerBlock = (this.blockSize / this.recordSize);
-        this.blockBuffer = new byte[this.blockSize];
-
-        if (this.inStream != null) {
-            this.currBlkIdx = -1;
-            this.currRecIdx = this.recsPerBlock;
-        } else {
-            this.currBlkIdx = 0;
-            this.currRecIdx = 0;
-        }
-    }
-
-    /**
-     * Get the TAR Buffer's block size. Blocks consist of multiple records.
-     * @return the block size
-     */
-    public int getBlockSize() {
-        return this.blockSize;
-    }
-
-    /**
-     * Get the TAR Buffer's record size.
-     * @return the record size
-     */
-    public int getRecordSize() {
-        return this.recordSize;
-    }
-
-    /**
-     * Set the debugging flag for the buffer.
-     *
-     * @param debug If true, print debugging output.
-     */
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    /**
-     * Determine if an archive record indicate End of Archive. End of
-     * archive is indicated by a record that consists entirely of null bytes.
-     *
-     * @param record The record data to check.
-     * @return true if the record data is an End of Archive
-     */
-    public boolean isEOFRecord(byte[] record) {
-        for (int i = 0, sz = getRecordSize(); i < sz; ++i) {
-            if (record[i] != 0) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Skip over a record on the input stream.
-     * @throws IOException on error
-     */
-    public void skipRecord() throws IOException {
-        if (debug) {
-            System.err.println("SkipRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
-        if (inStream == null) {
-            throw new IOException("reading (via skip) from an output buffer");
-        }
-
-        if (currRecIdx >= recsPerBlock) {
-            if (!readBlock()) {
-                return;    // UNDONE
-            }
-        }
-
-        currRecIdx++;
-    }
-
-    /**
-     * Read a record from the input stream and return the data.
-     *
-     * @return The record data.
-     * @throws IOException on error
-     */
-    public byte[] readRecord() throws IOException {
-        if (debug) {
-            System.err.println("ReadRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
-        if (inStream == null) {
-            throw new IOException("reading from an output buffer");
-        }
-
-        if (currRecIdx >= recsPerBlock) {
-            if (!readBlock()) {
-                return null;
-            }
-        }
-
-        byte[] result = new byte[recordSize];
-
-        System.arraycopy(blockBuffer,
-                         (currRecIdx * recordSize), result, 0,
-                         recordSize);
-
-        currRecIdx++;
-
-        return result;
-    }
-
-    /**
-     * @return false if End-Of-File, else true
-     */
-    private boolean readBlock() throws IOException {
-        if (debug) {
-            System.err.println("ReadBlock: blkIdx = " + currBlkIdx);
-        }
-
-        if (inStream == null) {
-            throw new IOException("reading from an output buffer");
-        }
-
-        currRecIdx = 0;
-
-        int offset = 0;
-        int bytesNeeded = blockSize;
-
-        while (bytesNeeded > 0) {
-            long numBytes = inStream.read(blockBuffer, offset,
-                                               bytesNeeded);
-
-            //
-            // NOTE
-            // We have fit EOF, and the block is not full!
-            //
-            // This is a broken archive. It does not follow the standard
-            // blocking algorithm. However, because we are generous, and
-            // it requires little effort, we will simply ignore the error
-            // and continue as if the entire block were read. This does
-            // not appear to break anything upstream. We used to return
-            // false in this case.
-            //
-            // Thanks to 'Yohann.Roussel@alcatel.fr' for this fix.
-            //
-            if (numBytes == -1) {
-                if (offset == 0) {
-                    // Ensure that we do not read gigabytes of zeros
-                    // for a corrupt tar file.
-                    // See http://issues.apache.org/bugzilla/show_bug.cgi?id=39924
-                    return false;
-                }
-                // However, just leaving the unread portion of the buffer dirty does
-                // cause problems in some cases.  This problem is described in
-                // http://issues.apache.org/bugzilla/show_bug.cgi?id=29877
-                //
-                // The solution is to fill the unused portion of the buffer with zeros.
-
-                Arrays.fill(blockBuffer, offset, offset + bytesNeeded, (byte) 0);
-
-                break;
-            }
-
-            offset += numBytes;
-            bytesNeeded -= numBytes;
-
-            if (numBytes != blockSize) {
-                if (debug) {
-                    System.err.println("ReadBlock: INCOMPLETE READ "
-                                       + numBytes + " of " + blockSize
-                                       + " bytes read.");
-                }
-            }
-        }
-
-        currBlkIdx++;
-
-        return true;
-    }
-
-    /**
-     * Get the current block number, zero based.
-     *
-     * @return The current zero based block number.
-     */
-    public int getCurrentBlockNum() {
-        return currBlkIdx;
-    }
-
-    /**
-     * Get the current record number, within the current block, zero based.
-     * Thus, current offset = (currentBlockNum * recsPerBlk) + currentRecNum.
-     *
-     * @return The current zero based record number.
-     */
-    public int getCurrentRecordNum() {
-        return currRecIdx - 1;
-    }
-
-    /**
-     * Write an archive record to the archive.
-     *
-     * @param record The record data to write to the archive.
-     * @throws IOException on error
-     */
-    public void writeRecord(byte[] record) throws IOException {
-        if (debug) {
-            System.err.println("WriteRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
-        if (outStream == null) {
-            throw new IOException("writing to an input buffer");
-        }
-
-        if (record.length != recordSize) {
-            throw new IOException("record to write has length '"
-                                  + record.length
-                                  + "' which is not the record size of '"
-                                  + recordSize + "'");
-        }
-
-        if (currRecIdx >= recsPerBlock) {
-            writeBlock();
-        }
-
-        System.arraycopy(record, 0, blockBuffer,
-                         (currRecIdx * recordSize),
-                         recordSize);
-
-        currRecIdx++;
-    }
-
-    /**
-     * Write an archive record to the archive, where the record may be
-     * inside of a larger array buffer. The buffer must be "offset plus
-     * record size" long.
-     *
-     * @param buf The buffer containing the record data to write.
-     * @param offset The offset of the record data within buf.
-     * @throws IOException on error
-     */
-    public void writeRecord(byte[] buf, int offset) throws IOException {
-        if (debug) {
-            System.err.println("WriteRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
-        if (outStream == null) {
-            throw new IOException("writing to an input buffer");
-        }
-
-        if ((offset + recordSize) > buf.length) {
-            throw new IOException("record has length '" + buf.length
-                                  + "' with offset '" + offset
-                                  + "' which is less than the record size of '"
-                                  + recordSize + "'");
-        }
-
-        if (currRecIdx >= recsPerBlock) {
-            writeBlock();
-        }
-
-        System.arraycopy(buf, offset, blockBuffer,
-                         (currRecIdx * recordSize),
-                         recordSize);
-
-        currRecIdx++;
-    }
-
-    /**
-     * Write a TarBuffer block to the archive.
-     */
-    private void writeBlock() throws IOException {
-        if (debug) {
-            System.err.println("WriteBlock: blkIdx = " + currBlkIdx);
-        }
-
-        if (outStream == null) {
-            throw new IOException("writing to an input buffer");
-        }
-
-        outStream.write(blockBuffer, 0, blockSize);
-        outStream.flush();
-
-        currRecIdx = 0;
-        currBlkIdx++;
-        Arrays.fill(blockBuffer, (byte) 0);
-    }
-
-    /**
-     * Flush the current data block if it has any data in it.
-     */
-    void flushBlock() throws IOException {
-        if (debug) {
-            System.err.println("TarBuffer.flushBlock() called.");
-        }
-
-        if (outStream == null) {
-            throw new IOException("writing to an input buffer");
-        }
-
-        if (currRecIdx > 0) {
-            writeBlock();
-        }
-    }
-
-    /**
-     * Close the TarBuffer. If this is an output buffer, also flush the
-     * current block before closing.
-     * @throws IOException on error
-     */
-    public void close() throws IOException {
-        if (debug) {
-            System.err.println("TarBuffer.closeBuffer().");
-        }
-
-        if (outStream != null) {
-            flushBlock();
-
-            if (outStream != System.out
-                    && outStream != System.err) {
-                outStream.close();
-
-                outStream = null;
-            }
-        } else if (inStream != null) {
-            if (inStream != System.in) {
-                inStream.close();
-
-                inStream = null;
-            }
-        }
-    }
-}
+/*
+ *  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
+ *
+ *  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.
+ *
+ */
+
+/*
+ * This package is based on the work done by Timothy Gerard Endres
+ * (time@ice.com) to whom the Ant project is very grateful for his great code.
+ */
+
+package org.apache.activemq.console.command.store.tar;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * The TarBuffer class implements the tar archive concept
+ * of a buffered input stream. This concept goes back to the
+ * days of blocked tape drives and special io devices. In the
+ * Java universe, the only real function that this class
+ * performs is to ensure that files have the correct "block"
+ * size, or other tars will complain.
+ * <p>
+ * You should never have a need to access this class directly.
+ * TarBuffers are created by Tar IO Streams.
+ *
+ */
+
+public class TarBuffer {
+
+    /** Default record size */
+    public static final int DEFAULT_RCDSIZE = (512);
+
+    /** Default block size */
+    public static final int DEFAULT_BLKSIZE = (DEFAULT_RCDSIZE * 20);
+
+    private InputStream     inStream;
+    private OutputStream    outStream;
+    private byte[]          blockBuffer;
+    private int             currBlkIdx;
+    private int             currRecIdx;
+    private int             blockSize;
+    private int             recordSize;
+    private int             recsPerBlock;
+    private boolean         debug;
+
+    /**
+     * Constructor for a TarBuffer on an input stream.
+     * @param inStream the input stream to use
+     */
+    public TarBuffer(InputStream inStream) {
+        this(inStream, TarBuffer.DEFAULT_BLKSIZE);
+    }
+
+    /**
+     * Constructor for a TarBuffer on an input stream.
+     * @param inStream the input stream to use
+     * @param blockSize the block size to use
+     */
+    public TarBuffer(InputStream inStream, int blockSize) {
+        this(inStream, blockSize, TarBuffer.DEFAULT_RCDSIZE);
+    }
+
+    /**
+     * Constructor for a TarBuffer on an input stream.
+     * @param inStream the input stream to use
+     * @param blockSize the block size to use
+     * @param recordSize the record size to use
+     */
+    public TarBuffer(InputStream inStream, int blockSize, int recordSize) {
+        this.inStream = inStream;
+        this.outStream = null;
+
+        this.initialize(blockSize, recordSize);
+    }
+
+    /**
+     * Constructor for a TarBuffer on an output stream.
+     * @param outStream the output stream to use
+     */
+    public TarBuffer(OutputStream outStream) {
+        this(outStream, TarBuffer.DEFAULT_BLKSIZE);
+    }
+
+    /**
+     * Constructor for a TarBuffer on an output stream.
+     * @param outStream the output stream to use
+     * @param blockSize the block size to use
+     */
+    public TarBuffer(OutputStream outStream, int blockSize) {
+        this(outStream, blockSize, TarBuffer.DEFAULT_RCDSIZE);
+    }
+
+    /**
+     * Constructor for a TarBuffer on an output stream.
+     * @param outStream the output stream to use
+     * @param blockSize the block size to use
+     * @param recordSize the record size to use
+     */
+    public TarBuffer(OutputStream outStream, int blockSize, int recordSize) {
+        this.inStream = null;
+        this.outStream = outStream;
+
+        this.initialize(blockSize, recordSize);
+    }
+
+    /**
+     * Initialization common to all constructors.
+     */
+    private void initialize(int blockSize, int recordSize) {
+        this.debug = false;
+        this.blockSize = blockSize;
+        this.recordSize = recordSize;
+        this.recsPerBlock = (this.blockSize / this.recordSize);
+        this.blockBuffer = new byte[this.blockSize];
+
+        if (this.inStream != null) {
+            this.currBlkIdx = -1;
+            this.currRecIdx = this.recsPerBlock;
+        } else {
+            this.currBlkIdx = 0;
+            this.currRecIdx = 0;
+        }
+    }
+
+    /**
+     * Get the TAR Buffer's block size. Blocks consist of multiple records.
+     * @return the block size
+     */
+    public int getBlockSize() {
+        return this.blockSize;
+    }
+
+    /**
+     * Get the TAR Buffer's record size.
+     * @return the record size
+     */
+    public int getRecordSize() {
+        return this.recordSize;
+    }
+
+    /**
+     * Set the debugging flag for the buffer.
+     *
+     * @param debug If true, print debugging output.
+     */
+    public void setDebug(boolean debug) {
+        this.debug = debug;
+    }
+
+    /**
+     * Determine if an archive record indicate End of Archive. End of
+     * archive is indicated by a record that consists entirely of null bytes.
+     *
+     * @param record The record data to check.
+     * @return true if the record data is an End of Archive
+     */
+    public boolean isEOFRecord(byte[] record) {
+        for (int i = 0, sz = getRecordSize(); i < sz; ++i) {
+            if (record[i] != 0) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Skip over a record on the input stream.
+     * @throws IOException on error
+     */
+    public void skipRecord() throws IOException {
+        if (debug) {
+            System.err.println("SkipRecord: recIdx = " + currRecIdx
+                               + " blkIdx = " + currBlkIdx);
+        }
+
+        if (inStream == null) {
+            throw new IOException("reading (via skip) from an output buffer");
+        }
+
+        if (currRecIdx >= recsPerBlock) {
+            if (!readBlock()) {
+                return;    // UNDONE
+            }
+        }
+
+        currRecIdx++;
+    }
+
+    /**
+     * Read a record from the input stream and return the data.
+     *
+     * @return The record data.
+     * @throws IOException on error
+     */
+    public byte[] readRecord() throws IOException {
+        if (debug) {
+            System.err.println("ReadRecord: recIdx = " + currRecIdx
+                               + " blkIdx = " + currBlkIdx);
+        }
+
+        if (inStream == null) {
+            throw new IOException("reading from an output buffer");
+        }
+
+        if (currRecIdx >= recsPerBlock) {
+            if (!readBlock()) {
+                return null;
+            }
+        }
+
+        byte[] result = new byte[recordSize];
+
+        System.arraycopy(blockBuffer,
+                         (currRecIdx * recordSize), result, 0,
+                         recordSize);
+
+        currRecIdx++;
+
+        return result;
+    }
+
+    /**
+     * @return false if End-Of-File, else true
+     */
+    private boolean readBlock() throws IOException {
+        if (debug) {
+            System.err.println("ReadBlock: blkIdx = " + currBlkIdx);
+        }
+
+        if (inStream == null) {
+            throw new IOException("reading from an output buffer");
+        }
+
+        currRecIdx = 0;
+
+        int offset = 0;
+        int bytesNeeded = blockSize;
+
+        while (bytesNeeded > 0) {
+            long numBytes = inStream.read(blockBuffer, offset,
+                                               bytesNeeded);
+
+            //
+            // NOTE
+            // We have fit EOF, and the block is not full!
+            //
+            // This is a broken archive. It does not follow the standard
+            // blocking algorithm. However, because we are generous, and
+            // it requires little effort, we will simply ignore the error
+            // and continue as if the entire block were read. This does
+            // not appear to break anything upstream. We used to return
+            // false in this case.
+            //
+            // Thanks to 'Yohann.Roussel@alcatel.fr' for this fix.
+            //
+            if (numBytes == -1) {
+                if (offset == 0) {
+                    // Ensure that we do not read gigabytes of zeros
+                    // for a corrupt tar file.
+                    // See http://issues.apache.org/bugzilla/show_bug.cgi?id=39924
+                    return false;
+                }
+                // However, just leaving the unread portion of the buffer dirty does
+                // cause problems in some cases.  This problem is described in
+                // http://issues.apache.org/bugzilla/show_bug.cgi?id=29877
+                //
+                // The solution is to fill the unused portion of the buffer with zeros.
+
+                Arrays.fill(blockBuffer, offset, offset + bytesNeeded, (byte) 0);
+
+                break;
+            }
+
+            offset += numBytes;
+            bytesNeeded -= numBytes;
+
+            if (numBytes != blockSize) {
+                if (debug) {
+                    System.err.println("ReadBlock: INCOMPLETE READ "
+                                       + numBytes + " of " + blockSize
+                                       + " bytes read.");
+                }
+            }
+        }
+
+        currBlkIdx++;
+
+        return true;
+    }
+
+    /**
+     * Get the current block number, zero based.
+     *
+     * @return The current zero based block number.
+     */
+    public int getCurrentBlockNum() {
+        return currBlkIdx;
+    }
+
+    /**
+     * Get the current record number, within the current block, zero based.
+     * Thus, current offset = (currentBlockNum * recsPerBlk) + currentRecNum.
+     *
+     * @return The current zero based record number.
+     */
+    public int getCurrentRecordNum() {
+        return currRecIdx - 1;
+    }
+
+    /**
+     * Write an archive record to the archive.
+     *
+     * @param record The record data to write to the archive.
+     * @throws IOException on error
+     */
+    public void writeRecord(byte[] record) throws IOException {
+        if (debug) {
+            System.err.println("WriteRecord: recIdx = " + currRecIdx
+                               + " blkIdx = " + currBlkIdx);
+        }
+
+        if (outStream == null) {
+            throw new IOException("writing to an input buffer");
+        }
+
+        if (record.length != recordSize) {
+            throw new IOException("record to write has length '"
+                                  + record.length
+                                  + "' which is not the record size of '"
+                                  + recordSize + "'");
+        }
+
+        if (currRecIdx >= recsPerBlock) {
+            writeBlock();
+        }
+
+        System.arraycopy(record, 0, blockBuffer,
+                         (currRecIdx * recordSize),
+                         recordSize);
+
+        currRecIdx++;
+    }
+
+    /**
+     * Write an archive record to the archive, where the record may be
+     * inside of a larger array buffer. The buffer must be "offset plus
+     * record size" long.
+     *
+     * @param buf The buffer containing the record data to write.
+     * @param offset The offset of the record data within buf.
+     * @throws IOException on error
+     */
+    public void writeRecord(byte[] buf, int offset) throws IOException {
+        if (debug) {
+            System.err.println("WriteRecord: recIdx = " + currRecIdx
+                               + " blkIdx = " + currBlkIdx);
+        }
+
+        if (outStream == null) {
+            throw new IOException("writing to an input buffer");
+        }
+
+        if ((offset + recordSize) > buf.length) {
+            throw new IOException("record has length '" + buf.length
+                                  + "' with offset '" + offset
+                                  + "' which is less than the record size of '"
+                                  + recordSize + "'");
+        }
+
+        if (currRecIdx >= recsPerBlock) {
+            writeBlock();
+        }
+
+        System.arraycopy(buf, offset, blockBuffer,
+                         (currRecIdx * recordSize),
+                         recordSize);
+
+        currRecIdx++;
+    }
+
+    /**
+     * Write a TarBuffer block to the archive.
+     */
+    private void writeBlock() throws IOException {
+        if (debug) {
+            System.err.println("WriteBlock: blkIdx = " + currBlkIdx);
+        }
+
+        if (outStream == null) {
+            throw new IOException("writing to an input buffer");
+        }
+
+        outStream.write(blockBuffer, 0, blockSize);
+        outStream.flush();
+
+        currRecIdx = 0;
+        currBlkIdx++;
+        Arrays.fill(blockBuffer, (byte) 0);
+    }
+
+    /**
+     * Flush the current data block if it has any data in it.
+     */
+    void flushBlock() throws IOException {
+        if (debug) {
+            System.err.println("TarBuffer.flushBlock() called.");
+        }
+
+        if (outStream == null) {
+            throw new IOException("writing to an input buffer");
+        }
+
+        if (currRecIdx > 0) {
+            writeBlock();
+        }
+    }
+
+    /**
+     * Close the TarBuffer. If this is an output buffer, also flush the
+     * current block before closing.
+     * @throws IOException on error
+     */
+    public void close() throws IOException {
+        if (debug) {
+            System.err.println("TarBuffer.closeBuffer().");
+        }
+
+        if (outStream != null) {
+            flushBlock();
+
+            if (outStream != System.out
+                    && outStream != System.err) {
+                outStream.close();
+
+                outStream = null;
+            }
+        } else if (inStream != null) {
+            if (inStream != System.in) {
+                inStream.close();
+
+                inStream = null;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/3f32507f/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarConstants.java
----------------------------------------------------------------------
diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarConstants.java b/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarConstants.java
index 940dc46..6088e82 100644
--- a/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarConstants.java
+++ b/activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarConstants.java
@@ -1,158 +1,158 @@
-/*
- *  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
- *
- *  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.
- *
- */
-
-/*
- * This package is based on the work done by Timothy Gerard Endres
- * (time@ice.com) to whom the Ant project is very grateful for his great code.
- */
-
-package org.apache.activemq.console.command.store.tar;
-
-/**
- * This interface contains all the definitions used in the package.
- *
- */
-// CheckStyle:InterfaceIsTypeCheck OFF (bc)
-public interface TarConstants {
-
-    /**
-     * The length of the name field in a header buffer.
-     */
-    int    NAMELEN = 100;
-
-    /**
-     * The length of the mode field in a header buffer.
-     */
-    int    MODELEN = 8;
-
-    /**
-     * The length of the user id field in a header buffer.
-     */
-    int    UIDLEN = 8;
-
-    /**
-     * The length of the group id field in a header buffer.
-     */
-    int    GIDLEN = 8;
-
-    /**
-     * The length of the checksum field in a header buffer.
-     */
-    int    CHKSUMLEN = 8;
-
-    /**
-     * The length of the size field in a header buffer.
-     */
-    int    SIZELEN = 12;
-
-    /**
-     * The maximum size of a file in a tar archive (That's 11 sevens, octal).
-     */
-    long   MAXSIZE = 077777777777L;
-
-    /**
-     * The length of the magic field in a header buffer.
-     */
-    int    MAGICLEN = 8;
-
-    /**
-     * The length of the modification time field in a header buffer.
-     */
-    int    MODTIMELEN = 12;
-
-    /**
-     * The length of the user name field in a header buffer.
-     */
-    int    UNAMELEN = 32;
-
-    /**
-     * The length of the group name field in a header buffer.
-     */
-    int    GNAMELEN = 32;
-
-    /**
-     * The length of the devices field in a header buffer.
-     */
-    int    DEVLEN = 8;
-
-    /**
-     * LF_ constants represent the "link flag" of an entry, or more commonly,
-     * the "entry type". This is the "old way" of indicating a normal file.
-     */
-    byte   LF_OLDNORM = 0;
-
-    /**
-     * Normal file type.
-     */
-    byte   LF_NORMAL = (byte) '0';
-
-    /**
-     * Link file type.
-     */
-    byte   LF_LINK = (byte) '1';
-
-    /**
-     * Symbolic link file type.
-     */
-    byte   LF_SYMLINK = (byte) '2';
-
-    /**
-     * Character device file type.
-     */
-    byte   LF_CHR = (byte) '3';
-
-    /**
-     * Block device file type.
-     */
-    byte   LF_BLK = (byte) '4';
-
-    /**
-     * Directory file type.
-     */
-    byte   LF_DIR = (byte) '5';
-
-    /**
-     * FIFO (pipe) file type.
-     */
-    byte   LF_FIFO = (byte) '6';
-
-    /**
-     * Contiguous file type.
-     */
-    byte   LF_CONTIG = (byte) '7';
-
-    /**
-     * The magic tag representing a POSIX tar archive.
-     */
-    String TMAGIC = "ustar";
-
-    /**
-     * The magic tag representing a GNU tar archive.
-     */
-    String GNU_TMAGIC = "ustar  ";
-
-    /**
-     * The namr of the GNU tar entry which contains a long name.
-     */
-    String GNU_LONGLINK = "././@LongLink";
-
-    /**
-     * Identifies the *next* file on the tape as having a long name.
-     */
-    byte LF_GNUTYPE_LONGNAME = (byte) 'L';
-}
+/*
+ *  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
+ *
+ *  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.
+ *
+ */
+
+/*
+ * This package is based on the work done by Timothy Gerard Endres
+ * (time@ice.com) to whom the Ant project is very grateful for his great code.
+ */
+
+package org.apache.activemq.console.command.store.tar;
+
+/**
+ * This interface contains all the definitions used in the package.
+ *
+ */
+// CheckStyle:InterfaceIsTypeCheck OFF (bc)
+public interface TarConstants {
+
+    /**
+     * The length of the name field in a header buffer.
+     */
+    int    NAMELEN = 100;
+
+    /**
+     * The length of the mode field in a header buffer.
+     */
+    int    MODELEN = 8;
+
+    /**
+     * The length of the user id field in a header buffer.
+     */
+    int    UIDLEN = 8;
+
+    /**
+     * The length of the group id field in a header buffer.
+     */
+    int    GIDLEN = 8;
+
+    /**
+     * The length of the checksum field in a header buffer.
+     */
+    int    CHKSUMLEN = 8;
+
+    /**
+     * The length of the size field in a header buffer.
+     */
+    int    SIZELEN = 12;
+
+    /**
+     * The maximum size of a file in a tar archive (That's 11 sevens, octal).
+     */
+    long   MAXSIZE = 077777777777L;
+
+    /**
+     * The length of the magic field in a header buffer.
+     */
+    int    MAGICLEN = 8;
+
+    /**
+     * The length of the modification time field in a header buffer.
+     */
+    int    MODTIMELEN = 12;
+
+    /**
+     * The length of the user name field in a header buffer.
+     */
+    int    UNAMELEN = 32;
+
+    /**
+     * The length of the group name field in a header buffer.
+     */
+    int    GNAMELEN = 32;
+
+    /**
+     * The length of the devices field in a header buffer.
+     */
+    int    DEVLEN = 8;
+
+    /**
+     * LF_ constants represent the "link flag" of an entry, or more commonly,
+     * the "entry type". This is the "old way" of indicating a normal file.
+     */
+    byte   LF_OLDNORM = 0;
+
+    /**
+     * Normal file type.
+     */
+    byte   LF_NORMAL = (byte) '0';
+
+    /**
+     * Link file type.
+     */
+    byte   LF_LINK = (byte) '1';
+
+    /**
+     * Symbolic link file type.
+     */
+    byte   LF_SYMLINK = (byte) '2';
+
+    /**
+     * Character device file type.
+     */
+    byte   LF_CHR = (byte) '3';
+
+    /**
+     * Block device file type.
+     */
+    byte   LF_BLK = (byte) '4';
+
+    /**
+     * Directory file type.
+     */
+    byte   LF_DIR = (byte) '5';
+
+    /**
+     * FIFO (pipe) file type.
+     */
+    byte   LF_FIFO = (byte) '6';
+
+    /**
+     * Contiguous file type.
+     */
+    byte   LF_CONTIG = (byte) '7';
+
+    /**
+     * The magic tag representing a POSIX tar archive.
+     */
+    String TMAGIC = "ustar";
+
+    /**
+     * The magic tag representing a GNU tar archive.
+     */
+    String GNU_TMAGIC = "ustar  ";
+
+    /**
+     * The namr of the GNU tar entry which contains a long name.
+     */
+    String GNU_LONGLINK = "././@LongLink";
+
+    /**
+     * Identifies the *next* file on the tape as having a long name.
+     */
+    byte LF_GNUTYPE_LONGNAME = (byte) 'L';
+}