blob: a629f9194f7d6642a2a0c556e9aa935c24d0b7b0 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. 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 available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.ptp.core.elements.attributes;
import org.eclipse.ptp.core.attributes.EnumeratedAttributeDefinition;
import org.eclipse.ptp.core.attributes.IAttributeDefinition;
import org.eclipse.ptp.core.attributes.IntegerAttributeDefinition;
import org.eclipse.ptp.core.attributes.StringAttributeDefinition;
/**
* Process attributes
*/
public class ProcessAttributes {
public enum State {
STARTING,
RUNNING,
EXITED,
EXITED_SIGNALLED,
SUSPENDED,
ERROR,
UNKNOWN
};
private static final String STATE_ATTR_ID = "processState";
private static final String PID_ATTR_ID = "processPID";
private static final String EXIT_CODE_ATTR_ID = "processExitCode";
private static final String SIGNAL_NAME_ATTR_ID = "processSignalName";
private static final String INDEX_ATTR_ID = "processIndex";
private static final String STDOUT_ATTR_ID = "processStdout";
private static final String STDERR_ATTR_ID = "processStderr";
private static final String NODEID_ATTR_ID = "processNodeId";
private final static EnumeratedAttributeDefinition<State> stateAttrDef =
new EnumeratedAttributeDefinition<State>(STATE_ATTR_ID, "State",
"Execution state of a process", true, State.STARTING);
private final static IntegerAttributeDefinition pidAttrDef =
new IntegerAttributeDefinition(PID_ATTR_ID, "PID",
"Operating system process ID", true, 0);
private final static IntegerAttributeDefinition exitCodeAttrDef =
new IntegerAttributeDefinition(EXIT_CODE_ATTR_ID, "Exit Code",
"Operating system exit code", true, 0);
private final static IntegerAttributeDefinition indexAttrDef =
new IntegerAttributeDefinition(INDEX_ATTR_ID, "Index",
"Zero-based index of process (e.g. MPI rank)", true, 0);
private final static StringAttributeDefinition signalNameAttrDef =
new StringAttributeDefinition(SIGNAL_NAME_ATTR_ID, "Exit Signal",
"Name of signal that caused process termination", true, "");
private final static StringAttributeDefinition stdoutAttrDef =
new StringAttributeDefinition(STDOUT_ATTR_ID, "Process Stdout",
"Standard output from process", false, "");
private final static StringAttributeDefinition stderrAttrDef =
new StringAttributeDefinition(STDERR_ATTR_ID, "Process Stderr",
"Standard error from process", false, "");
private final static StringAttributeDefinition nodeIdAttrDef =
new StringAttributeDefinition(NODEID_ATTR_ID, "Process Node ID",
"Node that this process is running on", true, "");
public static EnumeratedAttributeDefinition<State> getStateAttributeDefinition() {
return stateAttrDef;
}
public static IntegerAttributeDefinition getPIDAttributeDefinition() {
return pidAttrDef;
}
public static IntegerAttributeDefinition getExitCodeAttributeDefinition() {
return exitCodeAttrDef;
}
public static IntegerAttributeDefinition getIndexAttributeDefinition() {
return indexAttrDef;
}
public static StringAttributeDefinition getSignalNameAttributeDefinition() {
return signalNameAttrDef;
}
public static StringAttributeDefinition getStdoutAttributeDefinition() {
return stdoutAttrDef;
}
public static StringAttributeDefinition getStderrAttributeDefinition() {
return stderrAttrDef;
}
public static StringAttributeDefinition getNodeIdAttributeDefinition() {
return nodeIdAttrDef;
}
public static IAttributeDefinition<?,?,?>[] getDefaultAttributeDefinitions() {
return new IAttributeDefinition[]{
stateAttrDef,
pidAttrDef,
exitCodeAttrDef,
indexAttrDef,
signalNameAttrDef,
stdoutAttrDef,
stderrAttrDef,
nodeIdAttrDef
};
}
}