001    /******************************************************************************
002     * Copyright (C) MActor Developers. All rights reserved.                        *
003     * ---------------------------------------------------------------------------*
004     * This file is part of MActor.                                               *
005     *                                                                            *
006     * MActor is free software; you can redistribute it and/or modify             *
007     * it under the terms of the GNU General Public License as published by       *
008     * the Free Software Foundation; either version 2 of the License, or          *
009     * (at your option) any later version.                                        *
010     *                                                                            *
011     * MActor is distributed in the hope that it will be useful,                  *
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
014     * GNU General Public License for more details.                               *
015     *                                                                            *
016     * You should have received a copy of the GNU General Public License          *
017     * along with MActor; if not, write to the Free Software                      *
018     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
019     ******************************************************************************/
020    package org.mactor.framework.commandexecutors;
021    
022    import org.mactor.framework.MactorException;
023    
024    public class FactoryUtil {
025            public static final String JAVA = "java";
026            public static final String SHELL = "shell";
027            public static final String BSH = "bsh";
028            public static final String SQL = "sql";
029            public static final String SEQUENCE = "sequence";
030            public static String[] parseCommand(String command) throws MactorException {
031                    if (command == null || command.trim().length() == 0)
032                            return new String[0];
033                    String[] parsed = new String[2];
034                    int split = command.indexOf(":");
035                    if (split < 0 || split + 2 >= command.length())
036                            throw new MactorException("Unparseable command string '" + command + "'");
037                    parsed[0] = command.substring(0, split);
038                    parsed[1] = command.substring(split + 1, command.length());
039                    return parsed;
040            }
041    }