// Path: gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
// public class Arguments
// {
//     public static Object[] shift(final Object[] args) {
//         return shift(args, 1);
//     }
// 
//     public static Object[] shift(final Object[] args, int pos) {
//         assert args != null;
//         assert args.length >= pos;
// 
//         String[] _args = new String[args.length - pos];
//         System.arraycopy(args, pos, _args, 0, _args.length);
//         return _args;
//     }
// 
//     public static String asString(final Object[] args) {
//         assert args != null;
// 
//         StringBuffer buff = new StringBuffer();
// 
//         for (int i=0; i<args.length; i++ ) {
//             buff.append(args[i]);
//             if (i + 1 < args.length) {
//                 buff.append(", ");
//             }
//         }
// 
//         return buff.toString();
//     }
// 
//     public static String[] toStringArray(final Object[] args) {
//         assert args != null;
// 
//         String[] strings = new String[args.length];
// 
//         for (int i=0; i<args.length; i++ ) {
//             strings[i] = String.valueOf(args[i]);
//         }
// 
//         return strings;
//     }
// }


import java.util.Properties;
import org.apache.geronimo.gshell.util.Arguments;
import org.apache.commons.lang.NullArgumentException;
/*
 * 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.geronimo.gshell.command;



/**
 * Container for the very basic information about a command.
 *
 * @version $Rev$ $Date$
 */
public class CommandDefinition
{
    private final String name;

    private final String classname;

    private final String[] aliases;

    private final boolean enabled;

    private final String category;

    public CommandDefinition(final Properties props) throws InvalidDefinitionException {
        if (props == null) {
            throw new NullArgumentException("props");
        }

        this.name = props.getProperty("name");
        if (name == null) {
            throw new MissingPropertyException("name", props);
        }

        this.classname = props.getProperty("class");
        if (classname == null) {
            throw new MissingPropertyException("class", props);
        }

        this.aliases = loadAliasesFrom(props);

        this.enabled = Boolean.getBoolean(props.getProperty("enable"));

        this.category = props.getProperty("category");
        if (category == null) {
            throw new MissingPropertyException("category", props);
        }
    }

    public String toString() {
        return getName() + "=" + getClassName() +
// Path: gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
// public class Arguments
// {
//     public static Object[] shift(final Object[] args) {
//         return shift(args, 1);
//     }
// 
//     public static Object[] shift(final Object[] args, int pos) {
//         assert args != null;
//         assert args.length >= pos;
// 
//         String[] _args = new String[args.length - pos];
//         System.arraycopy(args, pos, _args, 0, _args.length);
//         return _args;
//     }
// 
//     public static String asString(final Object[] args) {
//         assert args != null;
// 
//         StringBuffer buff = new StringBuffer();
// 
//         for (int i=0; i<args.length; i++ ) {
//             buff.append(args[i]);
//             if (i + 1 < args.length) {
//                 buff.append(", ");
//             }
//         }
// 
//         return buff.toString();
//     }
// 
//     public static String[] toStringArray(final Object[] args) {
//         assert args != null;
// 
//         String[] strings = new String[args.length];
// 
//         for (int i=0; i<args.length; i++ ) {
//             strings[i] = String.valueOf(args[i]);
//         }
// 
//         return strings;
//     }
// }


// Path: gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDefinition.java
import java.util.Properties;
import org.apache.geronimo.gshell.util.Arguments;
import org.apache.commons.lang.NullArgumentException;

/*
 * 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.geronimo.gshell.command;



/**
 * Container for the very basic information about a command.
 *
 * @version $Rev$ $Date$
 */
public class CommandDefinition
{
    private final String name;

    private final String classname;

    private final String[] aliases;

    private final boolean enabled;

    private final String category;

    public CommandDefinition(final Properties props) throws InvalidDefinitionException {
        if (props == null) {
            throw new NullArgumentException("props");
        }

        this.name = props.getProperty("name");
        if (name == null) {
            throw new MissingPropertyException("name", props);
        }

        this.classname = props.getProperty("class");
        if (classname == null) {
            throw new MissingPropertyException("class", props);
        }

        this.aliases = loadAliasesFrom(props);

        this.enabled = Boolean.getBoolean(props.getProperty("enable"));

        this.category = props.getProperty("category");
        if (category == null) {
            throw new MissingPropertyException("category", props);
        }
    }

    public String toString() {
        return getName() + "=" + getClassName() +
                "{ aliases=" + Arguments.asString(getAliases()) +