1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
;
15 import java
.text
.SimpleDateFormat
;
16 import java
.util
.List
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimestamp
;
21 * Base class for custom trace definitions.
23 * @author Patrick Tassé
26 public abstract class CustomTraceDefinition
{
29 public static final int ACTION_SET
= 0;
31 /** "append" action */
32 public static final int ACTION_APPEND
= 1;
34 /** "append with separator" action */
35 public static final int ACTION_APPEND_WITH_SEPARATOR
= 2;
38 public static final String TAG_TIMESTAMP
= Messages
.CustomTraceDefinition_timestampTag
;
41 public static final String TAG_MESSAGE
= Messages
.CustomTraceDefinition_messageTag
;
44 public static final String TAG_OTHER
= Messages
.CustomTraceDefinition_otherTag
;
46 /** Name of this trace definition */
47 public String definitionName
;
49 /** List of output columns */
50 public List
<OutputColumn
> outputs
;
52 /** Timestamp format */
53 public String timeStampOutputFormat
;
56 * Definition of an output column
58 public static class OutputColumn
{
60 /** Name of this column */
64 * Default constructor (empty)
66 public OutputColumn() {}
71 * @param name Name of this output column
73 public OutputColumn(String name
) {
78 public String
toString() {
84 * Format a timestamp in this trace's current time stamp format.
87 * The timestamp to format
88 * @return The same timestamp as a formatted string
90 public String
formatTimeStamp(TmfTimestamp timestamp
) {
91 SimpleDateFormat simpleDateFormat
= new SimpleDateFormat(timeStampOutputFormat
);
92 return simpleDateFormat
.format(timestamp
.getValue());
96 * Save this custom trace in the default path.
98 public abstract void save();
101 * Save this custom trace in the supplied path.
104 * The path to save to
106 public abstract void save(String path
);