001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.activemq.console.command; 018 019import org.apache.activemq.console.CommandContext; 020import org.apache.activemq.console.command.store.StoreExporter; 021import org.apache.activemq.console.command.store.amq.CommandLineSupport; 022 023import java.util.Arrays; 024import java.util.List; 025 026/** 027 * @author <a href="http://hiramchirino.com">Hiram Chirino</a> 028 */ 029public class StoreExportCommand implements Command { 030 031 private CommandContext context; 032 033 @Override 034 public void setCommandContext(CommandContext context) { 035 this.context = context; 036 } 037 038 @Override 039 public String getName() { 040 return "export"; 041 } 042 043 @Override 044 public String getOneLineDescription() { 045 return "Exports a stopped brokers data files to an archive file"; 046 } 047 048 @Override 049 public void execute(List<String> tokens) throws Exception { 050 StoreExporter exporter = new StoreExporter(); 051 String[] remaining = CommandLineSupport.setOptions(exporter, tokens.toArray(new String[tokens.size()])); 052 if (remaining.length > 0) { 053 throw new Exception("Unexpected arguments: " + Arrays.asList(remaining)); 054 } 055 exporter.execute(); 056 } 057}