/* * * Perforce/Java Integration Layer * Copyright (C) 2001-2002 David Freels * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package com.dafreels.vcs.command; import java.util.ArrayList; import java.util.List; /** * * @author David Freels */ public final class Command { public static final String ADD = "add"; public static final String EDIT = "edit"; public static final String DELETE = "delete"; public static final String DIFF = "diff -f"; public static final String LOCK = "lock"; public static final String UNLOCK = "unlock"; public static final String SYNC = "sync"; public static final String STATUS = "fstat"; public static final String DESCRIBE = "describe -s"; public static final String FILEHISTORY = "filelog"; public static final String SYNCPREVIEW = "sync -n"; public static final String REVERT = "revert"; //public static final String SUBMIT = "submit -i"; public static final String OPENED = "opened"; public static final String CHANGELIST_DELETE = "change -d"; public static final String CHANGELIST_NEW = "change -o"; public static final String CHANGELIST = "change"; private List m_paths = new ArrayList(); private String m_command = ""; /** Creates a new instance of Command */ public Command(String command) { this(command, null); } public Command(String command, List paths) { m_command = command.trim(); if(paths != null) m_paths = paths; } public void addPath(String path) { m_paths.add(path.trim()); } public void addPaths(List paths) { m_paths.addAll(paths); } public String toString() { StringBuffer retVal = new StringBuffer(m_command+" "); for(int i = 0; i < m_paths.size(); i++) { retVal.append(m_paths.get(i)+" "); } return retVal.toString(); } public String getPathString() { StringBuffer retVal = new StringBuffer(); for(int i = 0; i < m_paths.size(); i++) { retVal.append(m_paths.get(i)+" "); } return retVal.toString(); } public List getPaths() { return m_paths; } public int getPathCount() { return m_paths.size(); } public List getCommandArgs() { List list = m_paths; list.add(0, m_command); return list; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 4090 | David Freels |
Fixed bug where paths with spaces would not work. Also checked in new code or JBuilderX. |
||
#2 | 1873 | Mark E. Ackerman | Version 1.0 build. | ||
#1 | 1707 | David Freels | New file. |