Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 87053 Details for
Bug 208728
refactor GLA runtime and parsers to use generic handlers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for changes to org.eclipse.tptp.monitoring.logui
logui.feature208727.patch.txt (text/plain), 40.65 KB, created by
Dave Smith
on 2008-01-16 10:29:58 EST
(
hide
)
Description:
Patch for changes to org.eclipse.tptp.monitoring.logui
Filename:
MIME Type:
Creator:
Dave Smith
Created:
2008-01-16 10:29:58 EST
Size:
40.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.monitoring.logui >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetManager.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetManager.java,v >retrieving revision 1.17 >diff -u -r1.17 LogSetManager.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetManager.java 12 Jan 2008 11:01:44 -0000 1.17 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetManager.java 15 Jan 2008 23:01:00 -0000 >@@ -1,10 +1,10 @@ > /********************************************************************** >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 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 >- * $Id: LogSetManager.java,v 1.17 2008/01/12 11:01:44 rshetty Exp $ >+ * $Id: LogSetManager.java,v 1.16 2007/11/27 04:56:40 apnan Exp $ > * > * Contributors: > * IBM - Initial API and implementation >@@ -15,6 +15,7 @@ > import java.io.ByteArrayOutputStream; > import java.net.URL; > import java.util.ArrayList; >+import java.util.Collection; > import java.util.HashMap; > import java.util.Iterator; > import java.util.List; >@@ -46,35 +47,36 @@ > > import com.ibm.icu.util.StringTokenizer; > >+/** >+ * Implementation of the ILogSetManager interface >+ * >+ */ > >-public class LogSetManager{ >+public class LogSetManager implements ILogSetManager{ > >- private static LogSetManager instance; >- public static final String LOGSETS_KEY = "logsets"; >- public static final String LOGSET_TAG = "logset"; >- public static final String LOGELEMENT_TAG = "LogFileElement"; >- public static final String DEFAULT_LOGSET = LogUIMessages._54; >- public static final String FILTER_TAG = "filters"; >- public static final String EXPORT_URI="/temp.txt"; >- public static final Map RESOURCE_OPTIONS = new HashMap(); >- { >- RESOURCE_OPTIONS.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE); >- } > private IPreferenceStore preferenceStore = MonitoringLogUIPlugin.getDefault().getPreferenceStore(); > private String defaultLogSet; > private Map logSetsList = new HashMap(); > private Map parsers = new HashMap(); > private Map parserSets = new HashMap(); > private List parentParserSets = new ArrayList(); >+ protected Map overrideParsers = new HashMap(); >+ > private Map logSetsClone; > private List logElements = new ArrayList(); > >- private LogSetManager(){ >+ public static final String defaultValue = "Default"; >+ >+ public LogSetManager() { >+ RESOURCE_OPTIONS.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE); > } >- >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#initDefault() >+ */ > public void initDefault(){ > >- defaultLogSet = DEFAULT_LOGSET; >+ defaultLogSet = ILogSetManager.DEFAULT_LOGSET; > > if(logElements != null) > logElements.clear(); >@@ -96,6 +98,10 @@ > loadParserRegistry(); > > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#saveLogSetFilters(java.util.List) >+ */ > public void saveLogSetFilters(List logSetFilterList) { > FilterResourceHandler rTarget = FilterResourceHandler.instance(); //list of all existing filters > Object[] targetFilterQueries = rTarget.toArray(); >@@ -128,13 +134,16 @@ > rTarget.save(); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#generateLogSetFilterDefEntry(java.util.List) >+ */ > public String generateLogSetFilterDefEntry(List logSetFilterList){ > if (logSetFilterList != null && (logSetFilterList.size() > 0)) { > StringBuffer xmlString = new StringBuffer(); > xmlString.append(" <"); >- xmlString.append(FILTER_TAG); >+ xmlString.append(ILogSetManager.FILTER_TAG); > xmlString.append("> "); >- FilterResourceFileHandler rtarget = FilterResourceFileHandler.instance(URI.createFileURI(EXPORT_URI)); >+ FilterResourceFileHandler rtarget = FilterResourceFileHandler.instance(URI.createFileURI(ILogSetManager.EXPORT_URI)); > rtarget.clear(); > for (Iterator iter = logSetFilterList.iterator(); iter.hasNext();) { > FilterQueries fq = (FilterQueries)iter.next(); >@@ -151,7 +160,7 @@ > String filterStr = new String(b); > xmlString.append(filterStr); > xmlString.append(" </"); >- xmlString.append(FILTER_TAG); >+ xmlString.append(ILogSetManager.FILTER_TAG); > xmlString.append("> "); > return xmlString.toString(); > >@@ -159,23 +168,26 @@ > return ""; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#loadLogSets() >+ */ > public void loadLogSets(){ > >- String prefXML = preferenceStore.getString(LOGSETS_KEY); >+ String prefXML = preferenceStore.getString(ILogSetManager.LOGSETS_KEY); > > if(prefXML.length()==0){ >- logSetsList.put(DEFAULT_LOGSET, null); >+ logSetsList.put(ILogSetManager.DEFAULT_LOGSET, null); > //updateLogSetDescription(defaultLogSet); > return; > } >- Element prefElement = XMLUtil.loadDom(prefXML, LOGSETS_KEY); >+ Element prefElement = XMLUtil.loadDom(prefXML, ILogSetManager.LOGSETS_KEY); > if(prefElement == null){ >- logSetsList.put(DEFAULT_LOGSET, null); >+ logSetsList.put(ILogSetManager.DEFAULT_LOGSET, null); > //updateLogSetDescription(defaultLogSet); > return; > } > >- NodeList logSetsNodeList = XMLUtil.getChildrenByName(prefElement, LOGSET_TAG); >+ NodeList logSetsNodeList = XMLUtil.getChildrenByName(prefElement, ILogSetManager.LOGSET_TAG); > > for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++) > { >@@ -193,6 +205,9 @@ > > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#loadLogSet(org.w3c.dom.Element) >+ */ > public void loadLogSet(Element logSetElement){ > > if(XMLUtil.getValue(logSetElement, LogUIMessages._54).equals("1")){ >@@ -200,7 +215,7 @@ > } > List logElems = new ArrayList(); > >- NodeList logNodeList = XMLUtil.getChildrenByName(logSetElement, LOGELEMENT_TAG); >+ NodeList logNodeList = XMLUtil.getChildrenByName(logSetElement, ILogSetManager.LOGELEMENT_TAG); > Element element = null; > for(int i=0, maxi=logNodeList.getLength(); i<maxi; i++) > { >@@ -311,6 +326,9 @@ > > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#openLogSet(java.lang.String) >+ */ > public void openLogSet(String name){ > List logsList = (List)logSetsList.get(name); > logElements.clear(); >@@ -319,10 +337,16 @@ > //refresh(); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogSets() >+ */ > public Map getLogSets(){ > return logSetsList; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogSetsClone() >+ */ > public Map getLogSetsClone(){ > if(logSetsClone==null){ > logSetsClone = new HashMap(); >@@ -332,7 +356,7 @@ > return logSetsClone; > } > >- private void loadParserSetRegistry() { >+ protected void loadParserSetRegistry() { > > IConfigurationElement[] config = Platform.getExtensionRegistry() > .getConfigurationElementsFor( >@@ -389,8 +413,127 @@ > } > > } >+ >+ protected class OverrideLogParser { >+ private LogParserItem parser; >+ private String overrideId; >+ private short priority; >+ >+ public OverrideLogParser(LogParserItem parser, String overrideId, String overridePriority) { >+ this.parser = parser; >+ this.overrideId = overrideId; >+ this.priority = Short.valueOf(overridePriority).shortValue(); >+ } >+ >+ /** >+ * @return the parser >+ */ >+ public LogParserItem getParser() { >+ return parser; >+ } >+ >+ /** >+ * @return the overrideId >+ */ >+ public String getOverrideId() { >+ return overrideId; >+ } >+ >+ /** >+ * @return the priority >+ */ >+ public short getPriority() { >+ return priority; >+ } >+ } > >- private void loadParserRegistry() >+ protected void processParserOverrides() { >+ >+ // If there are override parsers then process them >+ if (overrideParsers.size() > 0) { >+ Collection oParsers = overrideParsers.values(); >+ Iterator i = oParsers.iterator(); >+ while (i.hasNext()) { >+ OverrideLogParser oParser = (OverrideLogParser)i.next(); >+ // If the log parser is being disabled then remove it from the list of parsers >+ if (oParser.getPriority() == -1) { >+ // Remove the parser from the parser set if it is in one >+ LogParserItem overridee = (LogParserItem)parsers.get(oParser.getOverrideId()); >+ if (overridee.getParentId() != null && overridee.getParentId().length() > 0) { >+ LogParserSet parentParserSet = (LogParserSet)parserSets.get(overridee.getParentId()); >+ parentParserSet.getChildren().remove(overridee); >+ } >+ >+ // Remove the parser from the list >+ parsers.remove(oParser.getOverrideId()); >+ >+ } >+ // Else override parts of the existing log parser >+ else { >+ LogParserItem overridee = (LogParserItem)parsers.get(oParser.getOverrideId()); >+ if (overridee != null) { >+ LogParserItem overrider = oParser.getParser(); >+ // Only override the description if it is not null and not blank >+ if (overrider.getDescription() != null && overrider.getDescription().length() > 0) { >+ overridee.setDescription(overrider.getDescription()); >+ } >+ if (overrider.getLabel() != null && !overrider.getLabel().equals(defaultValue)) { >+ overridee.setLabel(overrider.getLabel()); >+ } >+ if (overrider.getParentId() != null) { >+ // Need to add the parser to the new parent parserSet and remove it from the old parent >+ // parserSet if it was in a parserSet >+ String oldParentId = overridee.getParentId(); >+ String newParentId = overrider.getParentId(); >+ >+ LogParserSet parentParserSet = (LogParserSet)parserSets.get(newParentId); >+ parentParserSet.getChildren().add(overridee); >+ >+ if (oldParentId != null && oldParentId.length() > 0) { >+ parentParserSet = (LogParserSet)parserSets.get(oldParentId); >+ if (parentParserSet != null) { >+ parentParserSet.getChildren().remove(overridee); >+ } >+ } >+ >+ overridee.setParentId(overrider.getParentId()); >+ >+ } >+ if (overrider.getImageDescriptor() != null) { >+ overridee.setImageDescriptor(overrider.getImageDescriptor()); >+ } >+ if (overrider.getHelpContextId() != null) { >+ overridee.setHelpContextId(overrider.getHelpContextId()); >+ } >+ // If there are fields in the overrider then override all of the fields of the overridee >+ if (overrider.getFields().length > 0 && overrider.getFields()[0] != null) { >+ BasicParserField[] newParserFields = new BasicParserField[overrider.getFields().length]; >+ System.arraycopy(overrider.getFields(), 0, newParserFields, 0, overrider.getFields().length); >+ overridee.setFields(newParserFields); >+ } >+ >+ // If there are parser parameters or an ILogParser class in the overrider >+ // then configuration element should be set to the overrider element so they can >+ // be found when the log parser is used. >+ if (overrider.getParserParameters().size() > 0 || (overrider.getParserClass() != null && overrider.getParserClass().length() > 0 && !overrider.getParserClass().equals(defaultValue))) { >+ overridee.setConfigurationElement(overrider.getConfigurationElement()); >+ // If there are parserParameters in the overrider then override all of the parserParameters of the overridee >+ if (overrider.getParserParameters().size() > 0) { >+ overridee.setParserParameters(overrider.getParserParameters()); >+ } >+ >+ if (overrider.getParserClass() != null && overrider.getParserClass().length() > 0 && !overrider.getParserClass().equals(defaultValue)) { >+ overridee.setClass(overridee.getParserClass()); >+ } >+ } >+ } >+ } >+ >+ } >+ } >+ } >+ >+ protected void loadParserRegistry() > { > IConfigurationElement[] config = Platform.getExtensionRegistry() > .getConfigurationElementsFor("org.eclipse.hyades.logging.parsers", "logParser"); >@@ -402,20 +545,27 @@ > , elem.getAttribute("name") > , elem.getAttribute("ui_name") > , elem.getAttribute("description")); >+ > parser.setConfigurationElement(elem); > parser.setClass(elem.getAttribute("class")); > parser.setUIType(elem.getAttribute("ui_type")); > parser.setParentId(elem.getAttribute("parserSetId")); > parser.setHelpContextId(elem.getAttribute("helpContextId")); > >- LogParserSet parent = (LogParserSet) parserSets.get(parser >- .getParentId()); >- if (parent != null) { >- parent.getChildren().add(parser); >+ String overrideId = elem.getAttribute("override_id"); >+ String overridePriority = elem.getAttribute("override_priority"); >+ >+ // Only add this parser to the parent parser set list of children if it is not an overrider parser >+ if (overrideId == null || overrideId.length() == 0) { >+ LogParserSet parent = (LogParserSet) parserSets.get(parser >+ .getParentId()); >+ if (parent != null) { >+ parent.getChildren().add(parser); >+ } > } > > String iconPath = elem.getAttribute("icon"); >- if(iconPath != null && iconPath.length() > 0) >+ if(iconPath != null && iconPath.length() > 0 && !iconPath.equalsIgnoreCase(defaultValue)) > { > try { > URL url = new URL(Platform.getBundle(elem.getDeclaringExtension().getNamespace()).getEntry("/"), iconPath); >@@ -452,8 +602,10 @@ > pfield.setListener(felem.getAttribute("listener")); > parser.addEntry(pfield); > }else if(felem.getName().equals("parserParameter")){ >- ParserParameter para = new ParserParameter(felem.getAttribute("name"),felem.getAttribute("value")); >- parser.addParameter(para); >+ if (!felem.getAttribute("value").equalsIgnoreCase(defaultValue)) { >+ ParserParameter para = new ParserParameter(felem.getAttribute("name"),felem.getAttribute("value")); >+ parser.addParameter(para); >+ } > }else if(felem.getName().equals("customField")){ > ParserField pfield = new ParserField(felem.getAttribute("id") > , ""); >@@ -510,28 +662,62 @@ > } > } > } >- >- parsers.put(parser.getId(), parser); >+ >+ if (overrideId != null && overrideId.length() > 0 && overridePriority != null && overridePriority.length() > 0) { >+ >+ if (overrideParsers.containsKey(overrideId)) { >+ OverrideLogParser overrideparser = (OverrideLogParser)overrideParsers.get(overrideId); >+ short priority = overrideparser.getPriority(); >+ short newPriority = Short.valueOf(overridePriority).shortValue(); >+ >+ if (priority != -1 && (priority < newPriority || newPriority == -1)) { >+ overrideParsers.put(overrideId, new OverrideLogParser(parser, overrideId, overridePriority)); >+ } >+ } >+ else { >+ overrideParsers.put(overrideId, new OverrideLogParser(parser, overrideId, overridePriority)); >+ } >+ } >+ else { >+ parsers.put(parser.getId(), parser); >+ } > } >+ >+ processParserOverrides(); > > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogParser(java.lang.String) >+ */ > public LogParserItem getLogParser(String key){ > return (LogParserItem)parsers.get(key); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserRegistry() >+ */ > public Map getParserRegistry(){ > return parsers; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserSetRegistry() >+ */ > public Map getParserSetRegistry(){ > return parserSets; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserSets() >+ */ > public List getParserSets(){ > return parentParserSets; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#saveLogSets() >+ */ > public void saveLogSets(){ > > StringBuffer xmlString = new StringBuffer(); >@@ -541,7 +727,7 @@ > xmlString.append("?>"); > > xmlString.append(" <"); >- xmlString.append(LOGSETS_KEY); >+ xmlString.append(ILogSetManager.LOGSETS_KEY); > xmlString.append("> "); > > Set keySet = logSetsList.keySet(); >@@ -552,18 +738,21 @@ > } > > xmlString.append(" </"); >- xmlString.append(LOGSETS_KEY); >+ xmlString.append(ILogSetManager.LOGSETS_KEY); > xmlString.append(">"); > >- preferenceStore.setValue(LOGSETS_KEY, xmlString.toString()); >+ preferenceStore.setValue(ILogSetManager.LOGSETS_KEY, xmlString.toString()); > > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#generateLogSetPrefEntry(java.lang.String) >+ */ > public String generateLogSetPrefEntry(String name){ > > StringBuffer xmlString = new StringBuffer(); > xmlString.append(" <"); >- xmlString.append(LOGSET_TAG); >+ xmlString.append(ILogSetManager.LOGSET_TAG); > xmlString.append(XMLUtil.createXMLAttribute("name", name,false)); > xmlString.append(XMLUtil.createXMLAttribute(LogUIMessages._54, name.equals(defaultLogSet) ? "1":"0", false)); > xmlString.append("> "); >@@ -579,7 +768,7 @@ > } > > xmlString.append(" </"); >- xmlString.append(LOGSET_TAG); >+ xmlString.append(ILogSetManager.LOGSET_TAG); > xmlString.append("> "); > > return xmlString.toString(); >@@ -641,12 +830,18 @@ > } > > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#setDefaultLogSet(java.lang.String) >+ */ > public void setDefaultLogSet(String newValue){ > > defaultLogSet = newValue; > > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getDefaultLogSet() >+ */ > public String getDefaultLogSet(){ > if(defaultLogSet==null){ > initDefault(); >@@ -654,18 +849,17 @@ > return defaultLogSet; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogElements() >+ */ > public List getLogElements() { > return logElements; > } >- >- public static LogSetManager getInstance() { >- >- if(instance == null) >- instance = new LogSetManager(); >- return instance; >- } > > //bugzilla 206665 >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#reset() >+ */ > public void reset(){ > > if(logElements != null) >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizardPage.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizardPage.java,v >retrieving revision 1.43 >diff -u -r1.43 ImportLogWizardPage.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizardPage.java 21 Mar 2007 21:30:59 -0000 1.43 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizardPage.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -86,7 +86,7 @@ > private Label logset_desc; > private Combo logNameCombo; > private Label type_label; >- private LogSetManager lsMgr; >+ private ILogSetManager lsMgr; > private int dialog_type; > private Button selectAllBtn; > private Button clearAllBtn; >@@ -350,7 +350,7 @@ > */ > protected void loadDefaultLogSet() { > >- lsMgr = LogSetManager.getInstance(); >+ lsMgr = ILogSetManager.INSTANCE; > lsMgr.initDefault(); > lsMgr.loadLogSets(); > >@@ -1079,7 +1079,7 @@ > logNameCombo.setText(desc); > } > >- public LogSetManager getLogSetManager(){ >+ public ILogSetManager getLogSetManager(){ > return lsMgr; > } > >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ExportLogSetsUI.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/ExportLogSetsUI.java,v >retrieving revision 1.10 >diff -u -r1.10 ExportLogSetsUI.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/ExportLogSetsUI.java 24 May 2007 16:10:20 -0000 1.10 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/ExportLogSetsUI.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 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 >@@ -36,13 +36,14 @@ > import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin; > import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper; > import org.eclipse.tptp.monitoring.logui.internal.wizards.LogFileElement.Filter; >+import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager; > import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.IOverwriteQuery; > > public class ExportLogSetsUI extends ImportExportLogSetsUI { > >- protected LogSetManager lsMgr; >+ protected ILogSetManager lsMgr; > > public ExportLogSetsUI(Composite parent, int style) > { >@@ -58,7 +59,7 @@ > xmiString.append("?>"); > > xmiString.append(" <"); >- xmiString.append(LogSetManager.LOGSETS_KEY); >+ xmiString.append(ILogSetManager.LOGSETS_KEY); > xmiString.append("> "); > > Iterator keySet = getDoubleList().getTargetItems().iterator(); >@@ -71,7 +72,7 @@ > } > xmiString.append(FilterTransformationHelper.convertXmiToXml(lsMgr.generateLogSetFilterDefEntry(filterList))); > xmiString.append(" </"); >- xmiString.append(LogSetManager.LOGSETS_KEY); >+ xmiString.append(ILogSetManager.LOGSETS_KEY); > xmiString.append(">"); > > String filePath = sourceNameField.getText().trim(); >@@ -143,7 +144,7 @@ > > protected List populateFilterList() { > >- lsMgr = LogSetManager.getInstance(); >+ lsMgr = ILogSetManager.INSTANCE; > > Iterator sets = lsMgr.getLogSets().keySet().iterator(); > >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetUI.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetUI.java,v >retrieving revision 1.8 >diff -u -r1.8 LogSetUI.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetUI.java 7 Jun 2007 14:24:05 -0000 1.8 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetUI.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -210,7 +210,7 @@ > data = GridUtil.createHorizontalFill(); > > txtLogSetName.setLayoutData(data); >- txtLogSetName.setText(LogSetManager.getInstance().getDefaultLogSet()); >+ txtLogSetName.setText(ILogSetManager.INSTANCE.getDefaultLogSet()); > txtLogSetName.selectAll(); > > lblError = new Label(result, SWT.WRAP); >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogParserItem.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogParserItem.java,v >retrieving revision 1.14 >diff -u -r1.14 LogParserItem.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogParserItem.java 1 Jun 2007 19:59:28 -0000 1.14 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogParserItem.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >@@ -29,7 +29,7 @@ > private String _name = ""; > private String _uiName = "_unknown"; > private String _desc = ""; >- private ImageDescriptor _imgDesc; >+ private ImageDescriptor _imgDesc = null; > private String _class = ""; > private String _uiType = "text_field"; > private IBasicParserField[] _parserFields = new IBasicParserField[10]; >@@ -65,7 +65,23 @@ > _desc=""; > } > >- public void setImageDescriptor(ImageDescriptor imgDesc) { >+ /** >+ * Set the name of this log parser that will be shown in the UI >+ * @param name the log parser name to set >+ */ >+ public void setLabel(String name) { >+ _uiName = name; >+ } >+ >+ /** >+ * Set the log parser description >+ * @param _desc the log parser description to set >+ */ >+ public void setDescription(String _desc) { >+ this._desc = _desc; >+ } >+ >+ public void setImageDescriptor(ImageDescriptor imgDesc) { > _imgDesc = imgDesc; > } > >@@ -116,6 +132,10 @@ > return _parserFields; > } > >+ public void setFields(IBasicParserField[] parserFields) { >+ _parserFields = parserFields; >+ } >+ > public String getId() { > return _id; > } >@@ -152,6 +172,10 @@ > _config = elem; > } > >+ public IConfigurationElement getConfigurationElement() { >+ return _config; >+ } >+ > /** > * Sets the widgets of this page > * >@@ -198,6 +222,9 @@ > public ArrayList getParserParameters() { > return _parserParameters; > } >+ public void setParserParameters(ArrayList list) { >+ _parserParameters = list; >+ } > public void addParameter(ParserParameter para) { > _parserParameters.add(para); > } >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java,v >retrieving revision 1.110 >diff -u -r1.110 ImportLogWizard.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java 14 Jan 2008 17:56:54 -0000 1.110 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java 15 Jan 2008 23:01:00 -0000 >@@ -1,10 +1,10 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 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 >- * $Id: ImportLogWizard.java,v 1.110 2008/01/14 17:56:54 rshetty Exp $ >+ * $Id: ImportLogWizard.java,v 1.109 2007/12/05 03:12:26 apnan Exp $ > * > * Contributors: > * IBM - Initial API and implementation >@@ -411,7 +411,7 @@ > monitorThread.start(); > > // clear log set manager >- LogSetManager.getInstance().reset(); >+ ILogSetManager.INSTANCE.reset(); > } > > private void refreshView(final Object object, final int type){ >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogSetsUI.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogSetsUI.java,v >retrieving revision 1.9 >diff -u -r1.9 ImportLogSetsUI.java >--- src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogSetsUI.java 24 May 2007 16:10:20 -0000 1.9 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogSetsUI.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 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 >@@ -36,6 +36,7 @@ > import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin; > import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper; > import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin; >+import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager; > import org.eclipse.ui.PlatformUI; > import org.w3c.dom.Document; > import org.w3c.dom.Element; >@@ -45,13 +46,13 @@ > > public class ImportLogSetsUI extends ImportExportLogSetsUI { > >- protected LogSetManager lsMgr; >+ protected ILogSetManager lsMgr; > > public ImportLogSetsUI(Composite parent, int style) > { > super(parent, style); //$NON-NLS-1$ > >- lsMgr = LogSetManager.getInstance(); >+ lsMgr = ILogSetManager.INSTANCE; > } > > public boolean finish() { >@@ -100,7 +101,7 @@ > } > > private void populateLogSetFilterList(FilterResourceFileHandler rSource , Element elem,List filterList){ >- NodeList logNodeList = XMLUtil.getChildrenByName(elem,LogSetManager.LOGELEMENT_TAG); >+ NodeList logNodeList = XMLUtil.getChildrenByName(elem, ILogSetManager.LOGELEMENT_TAG); > Element element = null; > for (int i = 0, maxi = logNodeList.getLength(); i < maxi; i++) { > if (logNodeList.item(i) instanceof Element) { >@@ -143,7 +144,7 @@ > > for(int l1 = 0; l1 < nl.getLength(); l1++) > { >- if(nl.item(l1).getNodeName().equals(LogSetManager.FILTER_TAG)) >+ if(nl.item(l1).getNodeName().equals(ILogSetManager.FILTER_TAG)) > { > Node node = nl.item(l1); > String xmlString = FilterTransformationHelper.toString(node); >@@ -154,7 +155,7 @@ > rSource.clear(); > String fl = FilterTransformationHelper.toString(filterNode); > InputStream is = new ByteArrayInputStream(fl.getBytes()); >- rSource.load(is, LogSetManager.RESOURCE_OPTIONS); >+ rSource.load(is, ILogSetManager.RESOURCE_OPTIONS); > return rSource; > } > } >@@ -176,10 +177,10 @@ > { > try { > FileInputStream inputStream = new FileInputStream(fileName); >- Element elem = XMLUtil.loadDom(inputStream, LogSetManager.LOGSETS_KEY); >+ Element elem = XMLUtil.loadDom(inputStream, ILogSetManager.LOGSETS_KEY); > if(elem != null) > { >- NodeList logSetsNodeList = XMLUtil.getChildrenByName(elem, LogSetManager.LOGSET_TAG); >+ NodeList logSetsNodeList = XMLUtil.getChildrenByName(elem, ILogSetManager.LOGSET_TAG); > > for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++) > { >Index: src/org/eclipse/tptp/monitoring/logui/internal/util/FilterTransformationHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/src/org/eclipse/tptp/monitoring/logui/internal/util/FilterTransformationHelper.java,v >retrieving revision 1.7 >diff -u -r1.7 FilterTransformationHelper.java >--- src/org/eclipse/tptp/monitoring/logui/internal/util/FilterTransformationHelper.java 24 May 2007 16:10:19 -0000 1.7 >+++ src/org/eclipse/tptp/monitoring/logui/internal/util/FilterTransformationHelper.java 15 Jan 2008 23:01:00 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 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 >@@ -21,8 +21,7 @@ > import org.apache.xml.serialize.OutputFormat; > import org.apache.xml.serialize.XMLSerializer; > import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin; >-import org.eclipse.tptp.monitoring.logui.internal.wizards.LogSetManager; >- >+import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager; > import org.w3c.dom.Document; > import org.w3c.dom.Element; > import org.w3c.dom.NamedNodeMap; >@@ -44,7 +43,7 @@ > > Document newDocument = builder.newDocument(); > >- Element element = (Element) document.getElementsByTagName(LogSetManager.FILTER_TAG).item(0); >+ Element element = (Element) document.getElementsByTagName(ILogSetManager.FILTER_TAG).item(0); > if(element != null) > { > buildXMLDocument(element, null, newDocument); >@@ -172,7 +171,7 @@ > > Document newDocument = builder.newDocument(); > >- Element element = (Element) document.getElementsByTagName(LogSetManager.FILTER_TAG).item(0); >+ Element element = (Element) document.getElementsByTagName(ILogSetManager.FILTER_TAG).item(0); > if(element != null) > { > buildXmiDocument(element, null, newDocument); >@@ -197,7 +196,7 @@ > nodeName = "HierarchyExtensions:SimpleSearchQuery"; > } > >- if(nodeName.equals(LogSetManager.FILTER_TAG)) >+ if(nodeName.equals(ILogSetManager.FILTER_TAG)) > { > Element xmiElement = newDocument.createElement("xmi:XMI"); > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.monitoring.logui/plugin.xml,v >retrieving revision 1.14 >diff -u -r1.14 plugin.xml >--- plugin.xml 19 Mar 2007 20:00:51 -0000 1.14 >+++ plugin.xml 15 Jan 2008 23:01:00 -0000 >@@ -56,5 +56,18 @@ > id = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor" > group = "import.log" > class = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor"/> >- </extension> >+ </extension> >+ <extension >+ point="org.eclipse.tptp.platform.models.hierarchy.handler"> >+ <handler >+ application="TPTP/LTA" >+ class="org.eclipse.tptp.monitoring.logui.internal.wizards.LogSetManager" >+ function="LogSetManager" >+ id="org.eclipse.tptp.monitoring.logui.LogSetManager" >+ name="TPTP Log Set Manager" >+ priority="1" >+ type="org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager" >+ version="4.5"> >+ </handler> >+ </extension> > </plugin> >Index: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ILogSetManager.java >=================================================================== >RCS file: src/org/eclipse/tptp/monitoring/logui/internal/wizards/ILogSetManager.java >diff -N src/org/eclipse/tptp/monitoring/logui/internal/wizards/ILogSetManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/monitoring/logui/internal/wizards/ILogSetManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,156 @@ >+/********************************************************************** >+ * Copyright (c) 2008 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 >+ * $Id: LogSetManager.java,v 1.16 2007/11/27 04:56:40 apnan Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.monitoring.logui.internal.wizards; >+ >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.tptp.monitoring.logui.internal.LogUIMessages; >+import org.eclipse.tptp.platform.extensions.IApplicationManager; >+import org.w3c.dom.Element; >+ >+/** >+ * ILogSetManager interface represents a helper class for managing >+ * log resources such as sets of logs, parsers available to parse >+ * the logs, and containers for grouping the parsers >+ * >+ * @provisional since TPTP 4.5 >+ * @author smith >+ * >+ */ >+public interface ILogSetManager { >+ >+ // Handler's Application/Function >+ static final String TPTP_LTA_LOG_SET_MANAGER = "TPTP/LTA/LogSetManager"; >+ >+ //private static LogSetManager instance; >+ public static final String LOGSETS_KEY = "logsets"; >+ public static final String LOGSET_TAG = "logset"; >+ public static final String LOGELEMENT_TAG = "LogFileElement"; >+ public static final String DEFAULT_LOGSET = LogUIMessages._54; >+ public static final String FILTER_TAG = "filters"; >+ public static final String EXPORT_URI="/temp.txt"; >+ public static Map RESOURCE_OPTIONS = new HashMap(); >+ >+ ILogSetManager INSTANCE = (ILogSetManager)IApplicationManager.INSTANCE.createDefaultHandlerInstance(TPTP_LTA_LOG_SET_MANAGER); >+ >+ /** >+ * Initialize the list of log sets, parser sets and parsers >+ */ >+ public abstract void initDefault(); >+ >+ /** >+ * Persist the list of filters used in the log sets >+ * @param logSetFilterList list of filters to save >+ */ >+ public abstract void saveLogSetFilters(List logSetFilterList); >+ >+ /** >+ * Generate a string that represents the list of filter definitions >+ * @param logSetFilterList list of filters >+ * @return string that represents the list of filter definitions >+ */ >+ public abstract String generateLogSetFilterDefEntry(List logSetFilterList); >+ >+ /** >+ * Load the log sets that are persisted. >+ */ >+ public abstract void loadLogSets(); >+ >+ /** >+ * Add the log set to the log set list >+ * @param logSetElement logSet in XML representation >+ */ >+ public abstract void loadLogSet(Element logSetElement); >+ >+ /** >+ * Open the log set >+ * @param name of the log set to open >+ */ >+ public abstract void openLogSet(String name); >+ >+ /** >+ * Get the log sets that are loaded. >+ * @return map of log sets >+ */ >+ public abstract Map getLogSets(); >+ >+ /** >+ * Get a clone of the loaded log sets. >+ * @return map of log sets >+ */ >+ public abstract Map getLogSetsClone(); >+ >+ /** >+ * Get the specified log parser. >+ * @param key Id of log parser to return >+ * @return LogParserItem representing the log parser >+ */ >+ public abstract LogParserItem getLogParser(String key); >+ >+ /** >+ * Get the map of all log parsers in the extension registry >+ * >+ * @return map of log parsers found in the extension registry >+ */ >+ public abstract Map getParserRegistry(); >+ >+ /** >+ * Get the map of all log parser sets in the extension registry >+ * @return Map of log parser sets in the extension registry >+ */ >+ public abstract Map getParserSetRegistry(); >+ >+ /** >+ * Get the list of log parser sets that have child parser sets >+ * @return List of parent log parser sets >+ */ >+ public abstract List getParserSets(); >+ >+ /** >+ * Persist the set of log sets that are currently loaded. >+ */ >+ public abstract void saveLogSets(); >+ >+ /** >+ * Generate a string that represents the specified log set >+ * @param name of log set >+ * @return string representing the requested log set >+ */ >+ public abstract String generateLogSetPrefEntry(String name); >+ >+ /** >+ * Set the default log set. >+ * @param newValue name of the log set to make the default >+ */ >+ public abstract void setDefaultLogSet(String newValue); >+ >+ /** >+ * Get the name of the default log set >+ * @return name of the default log set >+ */ >+ public abstract String getDefaultLogSet(); >+ >+ /** >+ * Get the log elements in the currently open log set. >+ * @return List of log elements in the log set >+ */ >+ public abstract List getLogElements(); >+ >+ /** >+ * Clear the lists of loaded log sets, parser sets and parsers >+ */ >+ public abstract void reset(); >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208728
: 87053 |
87054
|
88693
|
88694
|
88695