1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 12:35:22 +02:00

[220041][api][breaking] Get rid of IHostProcessFilter#getStates()

This commit is contained in:
Martin Oberhuber 2008-02-22 21:51:19 +00:00
parent 0abf88fa1b
commit bee7836a48
2 changed files with 87 additions and 60 deletions

View file

@ -13,6 +13,7 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [219975] Fix implementations of clone() * Martin Oberhuber (Wind River) - [219975] Fix implementations of clone()
* Martin Oberhuber (Wind River) - [220041][api][breaking] Get rid of IHostProcessFilter#getStates()
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.services.clientserver.processes; package org.eclipse.rse.services.clientserver.processes;
@ -37,7 +38,7 @@ import org.eclipse.rse.services.clientserver.NamePatternMatcher;
* *
* To get the actual filter string back from objects of this class, just call {@link #toString()}. * To get the actual filter string back from objects of this class, just call {@link #toString()}.
* <p> * <p>
* Clients may use or subclass this class. When subclassing, clients need to * Clients may instantiate or subclass this class. When subclassing, clients need to
* ensure that the subclass is always capable of performing a deep clone * ensure that the subclass is always capable of performing a deep clone
* operation with the {@link #clone()} method, so if they add fields of * operation with the {@link #clone()} method, so if they add fields of
* complex type, these need to be dealt with by overriding {@link #clone()}. * complex type, these need to be dealt with by overriding {@link #clone()}.
@ -214,21 +215,18 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
} }
} }
public HashMap getStates() /*
{ * (non-Javadoc)
return states; * @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getName()
}
/**
* Return the process name part of this filter string.
*/ */
public String getName() public String getName()
{ {
return name; return name;
} }
/** /*
* Return the username part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getUsername()
*/ */
public String getUsername() public String getUsername()
{ {
@ -239,49 +237,54 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
else return username; else return username;
} }
/** /*
* Return the process group id (gid) part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getGid()
*/ */
public String getGid() public String getGid()
{ {
return gid; return gid;
} }
/** /*
* Return the process parent id (ppid) part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getPpid()
*/ */
public String getPpid() public String getPpid()
{ {
return ppid; return ppid;
} }
/** /*
* Return the process id (pid) part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getPid()
*/ */
public String getPid() public String getPid()
{ {
return pid; return pid;
} }
/** /*
* Returns true when all process states are selected. The individal state * (non-Javadoc)
* queries will return false in this case. * @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getAnyStatus()
*/ */
public boolean getAnyStatus() public boolean getAnyStatus()
{ {
return anystatus; return anystatus;
} }
/** /*
* Returns the minimum VM size for processes allowed by this filter * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getMinVM()
*/ */
public String getMinVM() public String getMinVM()
{ {
return "" + minVM; //$NON-NLS-1$ return "" + minVM; //$NON-NLS-1$
} }
/** /*
* Returns the maximum VM size for processes allowed by this filter * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getMaxVM()
*/ */
public String getMaxVM() public String getMaxVM()
{ {
@ -289,52 +292,54 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
} }
/** /*
* Set the name part of this filter string. This can be simple or * (non-Javadoc)
* generic, where generic is a name containing one or two asterisks * @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setName(java.lang.String)
* anywhere in the name.
*/ */
public void setName(String obj) public void setName(String obj)
{ {
name = obj; name = obj;
} }
/** /*
* Set the user id (uid) part of this filter string. This can be simple or * (non-Javadoc)
* generic, where generic is a uid containing one or two asterisks anywhere * @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setUsername(java.lang.String)
* in the name.
*/ */
public void setUsername(String obj) public void setUsername(String obj)
{ {
username = obj; username = obj;
} }
/** /*
* Set the process group id (gid) part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setGid(java.lang.String)
*/ */
public void setGid(String obj) public void setGid(String obj)
{ {
gid = obj; gid = obj;
} }
/** /*
* Set the process parent id part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setPpid(java.lang.String)
*/ */
public void setPpid(String obj) public void setPpid(String obj)
{ {
ppid = obj; ppid = obj;
} }
/** /*
* Set the process id part of this filter string. * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setPid(java.lang.String)
*/ */
public void setPid(String obj) public void setPid(String obj)
{ {
pid = obj; pid = obj;
} }
/** /*
* Select all/any process states * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setAnyStatus()
*/ */
public void setAnyStatus() public void setAnyStatus()
{ {
@ -342,8 +347,9 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
initStates(); initStates();
} }
/** /*
* Sets the minimum VM size for processes allowed by this filter * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setMinVM(java.lang.String)
*/ */
public void setMinVM(String strMinVM) public void setMinVM(String strMinVM)
{ {
@ -357,8 +363,9 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
} }
} }
/** /*
* Sets the maximum VM size for processes allowed by this filter * (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setMaxVM(java.lang.String)
*/ */
public void setMaxVM(String strMaxVM) public void setMaxVM(String strMaxVM)
{ {
@ -398,14 +405,9 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
return s; return s;
} }
/** /*
* Returns whether this filter allows a process with the status line * (non-Javadoc)
* <code>status</code> to pass through. The status line contains some of the contents of * @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#allows(java.lang.String)
* the <i>status</i> file contained in the processes numbered directory in
* the /proc filesystem. For example, the status line of process 12345 is
* the contents of the file <i>/proc/12345/stat</i>.
* The status line must be structured as follows:
* "pid|name|status|tgid|ppid|tracerpid|uid|username|gid|vmSize|vmRSS"
*/ */
public boolean allows(String status) public boolean allows(String status)
{ {
@ -447,6 +449,10 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
return true; return true;
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#getSpecificState(java.lang.String)
*/
public boolean getSpecificState(String stateCode) public boolean getSpecificState(String stateCode)
{ {
if (anystatus) return true; if (anystatus) return true;
@ -455,6 +461,10 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
return state.booleanValue(); return state.booleanValue();
} }
/*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#setSpecificState(java.lang.String)
*/
public void setSpecificState(String stateCode) public void setSpecificState(String stateCode)
{ {
anystatus = false; anystatus = false;
@ -462,11 +472,15 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable
states.put(stateCode, new Boolean(true)); states.put(stateCode, new Boolean(true));
} }
public boolean satisfiesState(String state) /*
* (non-Javadoc)
* @see org.eclipse.rse.services.clientserver.processes.IHostProcessFilter#satisfiesState(java.lang.String)
*/
public boolean satisfiesState(String stateString)
{ {
if (!anystatus) if (!anystatus)
{ {
String[] allStates = state.split(","); //$NON-NLS-1$ String[] allStates = stateString.split(","); //$NON-NLS-1$
if (allStates == null) return false; if (allStates == null) return false;
if (allStates.length == 0) return false; if (allStates.length == 0) return false;
boolean satisfied = false; boolean satisfied = false;

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -11,17 +11,14 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * Martin Oberhuber (Wind River) - [220041][api][breaking] Get rid of IHostProcessFilter#getStates()
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.clientserver.processes; package org.eclipse.rse.services.clientserver.processes;
import java.util.HashMap;
public interface IHostProcessFilter public interface IHostProcessFilter
{ {
public HashMap getStates();
/** /**
* Return the process name part of this filter string. * Return the process name part of this filter string.
*/ */
@ -48,7 +45,7 @@ public interface IHostProcessFilter
public String getPid(); public String getPid();
/** /**
* Returns true when all process states are selected. The individal state * Returns true when all process states are selected. The individual state
* queries will return false in this case. * queries will return false in this case.
*/ */
public boolean getAnyStatus(); public boolean getAnyStatus();
@ -118,9 +115,25 @@ public interface IHostProcessFilter
*/ */
public boolean allows(String status); public boolean allows(String status);
/**
* Check whether this filter requires that the given state is set.
* @param stateCode state code to check. One of the String constants
* in {@link ISystemProcessRemoteConstants#ALL_STATES_STR}.
*/
public boolean getSpecificState(String stateCode); public boolean getSpecificState(String stateCode);
/**
* Change this filter such that it requires the given state to be set.
* @param stateCode state code to check. One of the String constants
* in {@link ISystemProcessRemoteConstants#ALL_STATES_STR}.
*/
public void setSpecificState(String stateCode); public void setSpecificState(String stateCode);
public boolean satisfiesState(String state); /**
* Check whether a given process state String matches this filter.
* @param stateString A state String, holding a list of state constants
* from {@link ISystemProcessRemoteConstants#ALL_STATES_STR},
* separated by comma (",").
*/
public boolean satisfiesState(String stateString);
} }