Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 208728 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetManager.java (-49 / +243 lines)
Lines 1-10 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: LogSetManager.java,v 1.17 2008/01/12 11:01:44 rshetty Exp $
7
 * $Id: LogSetManager.java,v 1.16 2007/11/27 04:56:40 apnan Exp $
8
 * 
8
 * 
9
 * Contributors: 
9
 * Contributors: 
10
 * IBM - Initial API and implementation
10
 * IBM - Initial API and implementation
Lines 15-20 Link Here
15
import java.io.ByteArrayOutputStream;
15
import java.io.ByteArrayOutputStream;
16
import java.net.URL;
16
import java.net.URL;
17
import java.util.ArrayList;
17
import java.util.ArrayList;
18
import java.util.Collection;
18
import java.util.HashMap;
19
import java.util.HashMap;
19
import java.util.Iterator;
20
import java.util.Iterator;
20
import java.util.List;
21
import java.util.List;
Lines 46-80 Link Here
46
47
47
import com.ibm.icu.util.StringTokenizer;
48
import com.ibm.icu.util.StringTokenizer;
48
49
50
/**
51
 * Implementation of the ILogSetManager interface
52
 *
53
 */
49
54
50
public class LogSetManager{		
55
public class LogSetManager implements ILogSetManager{		
51
	
56
	
52
	private static LogSetManager instance;
53
	public static final String LOGSETS_KEY = "logsets";
54
	public static final String LOGSET_TAG = "logset";
55
	public static final String LOGELEMENT_TAG = "LogFileElement";
56
	public static final String DEFAULT_LOGSET = LogUIMessages._54;
57
	public static final String FILTER_TAG = "filters";
58
	public static final String EXPORT_URI="/temp.txt";
59
	public static final Map RESOURCE_OPTIONS = new HashMap();
60
	{
61
		RESOURCE_OPTIONS.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE);
62
	}
63
	private IPreferenceStore preferenceStore = MonitoringLogUIPlugin.getDefault().getPreferenceStore();
57
	private IPreferenceStore preferenceStore = MonitoringLogUIPlugin.getDefault().getPreferenceStore();
64
	private String defaultLogSet;
58
	private String defaultLogSet;
65
	private Map logSetsList = new HashMap();
59
	private Map logSetsList = new HashMap();
66
	private Map parsers = new HashMap();
60
	private Map parsers = new HashMap();
67
	private Map parserSets = new HashMap();
61
	private Map parserSets = new HashMap();
68
	private List parentParserSets = new ArrayList();
62
	private List parentParserSets = new ArrayList();
63
	protected Map overrideParsers = new HashMap();
64
	
69
	private Map logSetsClone;
65
	private Map logSetsClone;
70
	private List logElements = new ArrayList();
66
	private List logElements = new ArrayList();
71
	
67
	
72
	private LogSetManager(){
68
	public static final String defaultValue = "Default";
69
	
70
	public LogSetManager() {
71
		RESOURCE_OPTIONS.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE);
73
	}
72
	}
74
					
73
	
74
	/* (non-Javadoc)
75
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#initDefault()
76
	 */
75
	public void initDefault(){
77
	public void initDefault(){
76
78
77
		defaultLogSet = DEFAULT_LOGSET;
79
		defaultLogSet = ILogSetManager.DEFAULT_LOGSET;
78
		
80
		
79
		if(logElements != null)
81
		if(logElements != null)
80
			logElements.clear();
82
			logElements.clear();
Lines 96-101 Link Here
96
		loadParserRegistry();
98
		loadParserRegistry();
97
					
99
					
98
	}
100
	}
101
	
102
	/* (non-Javadoc)
103
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#saveLogSetFilters(java.util.List)
104
	 */
99
	public void saveLogSetFilters(List logSetFilterList) {
105
	public void saveLogSetFilters(List logSetFilterList) {
100
		FilterResourceHandler rTarget = FilterResourceHandler.instance(); //list of all existing filters
106
		FilterResourceHandler rTarget = FilterResourceHandler.instance(); //list of all existing filters
101
		Object[] targetFilterQueries = rTarget.toArray();
107
		Object[] targetFilterQueries = rTarget.toArray();
Lines 128-140 Link Here
128
		rTarget.save();
134
		rTarget.save();
129
	}
135
	}
130
	
136
	
137
	/* (non-Javadoc)
138
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#generateLogSetFilterDefEntry(java.util.List)
139
	 */
131
	public String generateLogSetFilterDefEntry(List logSetFilterList){
140
	public String generateLogSetFilterDefEntry(List logSetFilterList){
132
		if (logSetFilterList != null && (logSetFilterList.size() > 0)) {
141
		if (logSetFilterList != null && (logSetFilterList.size() > 0)) {
133
			StringBuffer xmlString = new StringBuffer();
142
			StringBuffer xmlString = new StringBuffer();
134
			xmlString.append(" <");
143
			xmlString.append(" <");
135
			xmlString.append(FILTER_TAG);
144
			xmlString.append(ILogSetManager.FILTER_TAG);
136
			xmlString.append("> ");
145
			xmlString.append("> ");
137
			FilterResourceFileHandler rtarget = FilterResourceFileHandler.instance(URI.createFileURI(EXPORT_URI));
146
			FilterResourceFileHandler rtarget = FilterResourceFileHandler.instance(URI.createFileURI(ILogSetManager.EXPORT_URI));
138
			rtarget.clear();
147
			rtarget.clear();
139
			for (Iterator iter = logSetFilterList.iterator(); iter.hasNext();) {
148
			for (Iterator iter = logSetFilterList.iterator(); iter.hasNext();) {
140
				FilterQueries fq = (FilterQueries)iter.next();
149
				FilterQueries fq = (FilterQueries)iter.next();
Lines 151-157 Link Here
151
			String filterStr = new String(b);
160
			String filterStr = new String(b);
152
			xmlString.append(filterStr);
161
			xmlString.append(filterStr);
153
			xmlString.append(" </");
162
			xmlString.append(" </");
154
			xmlString.append(FILTER_TAG);
163
			xmlString.append(ILogSetManager.FILTER_TAG);
155
			xmlString.append("> ");
164
			xmlString.append("> ");
156
			return xmlString.toString();
165
			return xmlString.toString();
157
166
Lines 159-181 Link Here
159
		return "";
168
		return "";
160
	}
169
	}
161
170
171
	/* (non-Javadoc)
172
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#loadLogSets()
173
	 */
162
	public void loadLogSets(){
174
	public void loadLogSets(){
163
		
175
		
164
		String prefXML = preferenceStore.getString(LOGSETS_KEY);
176
		String prefXML = preferenceStore.getString(ILogSetManager.LOGSETS_KEY);
165
		
177
		
166
		if(prefXML.length()==0){
178
		if(prefXML.length()==0){
167
			logSetsList.put(DEFAULT_LOGSET, null);
179
			logSetsList.put(ILogSetManager.DEFAULT_LOGSET, null);
168
			//updateLogSetDescription(defaultLogSet);
180
			//updateLogSetDescription(defaultLogSet);
169
			return;
181
			return;
170
		}
182
		}
171
		Element prefElement = XMLUtil.loadDom(prefXML, LOGSETS_KEY);
183
		Element prefElement = XMLUtil.loadDom(prefXML, ILogSetManager.LOGSETS_KEY);
172
		if(prefElement == null){
184
		if(prefElement == null){
173
			logSetsList.put(DEFAULT_LOGSET, null);
185
			logSetsList.put(ILogSetManager.DEFAULT_LOGSET, null);
174
			//updateLogSetDescription(defaultLogSet);
186
			//updateLogSetDescription(defaultLogSet);
175
			return;
187
			return;
176
		}
188
		}
177
					
189
					
178
		NodeList logSetsNodeList = XMLUtil.getChildrenByName(prefElement, LOGSET_TAG);
190
		NodeList logSetsNodeList = XMLUtil.getChildrenByName(prefElement, ILogSetManager.LOGSET_TAG);
179
191
180
		for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++)
192
		for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++)
181
		{
193
		{
Lines 193-198 Link Here
193
		
205
		
194
	}
206
	}
195
	
207
	
208
	/* (non-Javadoc)
209
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#loadLogSet(org.w3c.dom.Element)
210
	 */
196
	public void loadLogSet(Element logSetElement){
211
	public void loadLogSet(Element logSetElement){
197
		
212
		
198
		if(XMLUtil.getValue(logSetElement, LogUIMessages._54).equals("1")){
213
		if(XMLUtil.getValue(logSetElement, LogUIMessages._54).equals("1")){
Lines 200-206 Link Here
200
		}
215
		}
201
		List logElems = new ArrayList();
216
		List logElems = new ArrayList();
202
					
217
					
203
		NodeList logNodeList = XMLUtil.getChildrenByName(logSetElement, LOGELEMENT_TAG);
218
		NodeList logNodeList = XMLUtil.getChildrenByName(logSetElement, ILogSetManager.LOGELEMENT_TAG);
204
		Element element = null;
219
		Element element = null;
205
		for(int i=0, maxi=logNodeList.getLength(); i<maxi; i++)
220
		for(int i=0, maxi=logNodeList.getLength(); i<maxi; i++)
206
		{			
221
		{			
Lines 311-316 Link Here
311
				
326
				
312
	}
327
	}
313
	
328
	
329
	/* (non-Javadoc)
330
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#openLogSet(java.lang.String)
331
	 */
314
	public void openLogSet(String name){
332
	public void openLogSet(String name){
315
		List logsList = (List)logSetsList.get(name);
333
		List logsList = (List)logSetsList.get(name);
316
		logElements.clear();
334
		logElements.clear();
Lines 319-328 Link Here
319
		//refresh();
337
		//refresh();
320
	}
338
	}
321
	
339
	
340
	/* (non-Javadoc)
341
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogSets()
342
	 */
322
	public Map getLogSets(){
343
	public Map getLogSets(){
323
		return logSetsList;
344
		return logSetsList;
324
	}
345
	}
325
	
346
	
347
	/* (non-Javadoc)
348
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogSetsClone()
349
	 */
326
	public Map getLogSetsClone(){
350
	public Map getLogSetsClone(){
327
		if(logSetsClone==null){
351
		if(logSetsClone==null){
328
			logSetsClone = new HashMap();
352
			logSetsClone = new HashMap();
Lines 332-338 Link Here
332
		return logSetsClone;
356
		return logSetsClone;
333
	}
357
	}
334
	
358
	
335
	private void loadParserSetRegistry() {
359
	protected void loadParserSetRegistry() {
336
360
337
		IConfigurationElement[] config = Platform.getExtensionRegistry()
361
		IConfigurationElement[] config = Platform.getExtensionRegistry()
338
				.getConfigurationElementsFor(
362
				.getConfigurationElementsFor(
Lines 389-396 Link Here
389
		}
413
		}
390
414
391
	}
415
	}
416
417
	protected class OverrideLogParser {
418
		private LogParserItem parser;
419
		private String overrideId;
420
		private short priority;
421
		
422
		public OverrideLogParser(LogParserItem parser, String overrideId, String overridePriority) {
423
			this.parser = parser;
424
			this.overrideId = overrideId;
425
			this.priority = Short.valueOf(overridePriority).shortValue();
426
		}
427
428
		/**
429
		 * @return the parser
430
		 */
431
		public LogParserItem getParser() {
432
			return parser;
433
		}
434
435
		/**
436
		 * @return the overrideId
437
		 */
438
		public String getOverrideId() {
439
			return overrideId;
440
		}
441
442
		/**
443
		 * @return the priority
444
		 */
445
		public short getPriority() {
446
			return priority;
447
		}
448
	}
392
	
449
	
393
	private void loadParserRegistry()
450
	protected void processParserOverrides() {
451
		
452
		// If there are override parsers then process them
453
		if (overrideParsers.size() > 0) {
454
			Collection oParsers = overrideParsers.values();
455
			Iterator i = oParsers.iterator();
456
			while (i.hasNext()) {
457
				OverrideLogParser oParser = (OverrideLogParser)i.next();
458
				// If the log parser is being disabled then remove it from the list of parsers
459
				if (oParser.getPriority() == -1) {
460
					// Remove the parser from the parser set if it is in one
461
					LogParserItem overridee = (LogParserItem)parsers.get(oParser.getOverrideId());
462
					if (overridee.getParentId() != null && overridee.getParentId().length() > 0) {
463
						LogParserSet parentParserSet = (LogParserSet)parserSets.get(overridee.getParentId());
464
						parentParserSet.getChildren().remove(overridee);
465
					}
466
467
					// Remove the parser from the list
468
					parsers.remove(oParser.getOverrideId());
469
					
470
				}
471
				// Else override parts of the existing log parser
472
				else {
473
					LogParserItem overridee = (LogParserItem)parsers.get(oParser.getOverrideId());
474
					if (overridee != null) {
475
						LogParserItem overrider = oParser.getParser();
476
						// Only override the description if it is not null and not blank
477
						if (overrider.getDescription() != null && overrider.getDescription().length() > 0) {
478
							overridee.setDescription(overrider.getDescription());
479
						}
480
						if (overrider.getLabel() != null && !overrider.getLabel().equals(defaultValue)) {
481
							overridee.setLabel(overrider.getLabel());
482
						}
483
						if (overrider.getParentId() != null) {
484
							// Need to add the parser to the new parent parserSet and remove it from the old parent 
485
							// parserSet if it was in a parserSet
486
							String oldParentId = overridee.getParentId();
487
							String newParentId = overrider.getParentId();
488
							
489
							LogParserSet parentParserSet = (LogParserSet)parserSets.get(newParentId);
490
							parentParserSet.getChildren().add(overridee);
491
							
492
							if (oldParentId != null && oldParentId.length() > 0) {
493
								parentParserSet = (LogParserSet)parserSets.get(oldParentId);
494
								if (parentParserSet != null) {
495
									parentParserSet.getChildren().remove(overridee);
496
								}
497
							}
498
							
499
							overridee.setParentId(overrider.getParentId());
500
							
501
						}
502
						if (overrider.getImageDescriptor() != null) {
503
							overridee.setImageDescriptor(overrider.getImageDescriptor());
504
						}
505
						if (overrider.getHelpContextId() != null) {
506
							overridee.setHelpContextId(overrider.getHelpContextId());
507
						}
508
						// If there are fields in the overrider then override all of the fields of the overridee
509
						if (overrider.getFields().length > 0 && overrider.getFields()[0] != null) {
510
				    		BasicParserField[] newParserFields = new BasicParserField[overrider.getFields().length];
511
				    		System.arraycopy(overrider.getFields(), 0, newParserFields, 0, overrider.getFields().length);
512
				    		overridee.setFields(newParserFields);
513
						}
514
						
515
						// If there are parser parameters or an ILogParser class in the overrider 
516
						// then configuration element should be set to the overrider element so they can
517
						// be found when the log parser is used.
518
						if (overrider.getParserParameters().size() > 0 || (overrider.getParserClass() != null && overrider.getParserClass().length() > 0 && !overrider.getParserClass().equals(defaultValue))) {
519
							overridee.setConfigurationElement(overrider.getConfigurationElement());
520
							// If there are parserParameters in the overrider then override all of the parserParameters of the overridee
521
							if (overrider.getParserParameters().size() > 0) {
522
								overridee.setParserParameters(overrider.getParserParameters());
523
							}
524
							
525
							if (overrider.getParserClass() != null && overrider.getParserClass().length() > 0  && !overrider.getParserClass().equals(defaultValue)) {
526
								overridee.setClass(overridee.getParserClass());
527
							}
528
						}
529
					}
530
				}
531
					
532
			}
533
		}
534
	}
535
	
536
	protected void loadParserRegistry()
394
	{
537
	{
395
        IConfigurationElement[] config = Platform.getExtensionRegistry()
538
        IConfigurationElement[] config = Platform.getExtensionRegistry()
396
	       .getConfigurationElementsFor("org.eclipse.hyades.logging.parsers", "logParser");			
539
	       .getConfigurationElementsFor("org.eclipse.hyades.logging.parsers", "logParser");			
Lines 402-421 Link Here
402
											 , elem.getAttribute("name")
545
											 , elem.getAttribute("name")
403
											 , elem.getAttribute("ui_name")
546
											 , elem.getAttribute("ui_name")
404
											 , elem.getAttribute("description"));
547
											 , elem.getAttribute("description"));
548
			
405
			parser.setConfigurationElement(elem);
549
			parser.setConfigurationElement(elem);
406
			parser.setClass(elem.getAttribute("class"));								 
550
			parser.setClass(elem.getAttribute("class"));								 
407
			parser.setUIType(elem.getAttribute("ui_type"));
551
			parser.setUIType(elem.getAttribute("ui_type"));
408
			parser.setParentId(elem.getAttribute("parserSetId"));
552
			parser.setParentId(elem.getAttribute("parserSetId"));
409
			parser.setHelpContextId(elem.getAttribute("helpContextId"));
553
			parser.setHelpContextId(elem.getAttribute("helpContextId"));
410
554
411
			LogParserSet parent = (LogParserSet) parserSets.get(parser
555
			String overrideId = elem.getAttribute("override_id");
412
					.getParentId());
556
			String overridePriority = elem.getAttribute("override_priority");
413
			if (parent != null) {
557
			
414
				parent.getChildren().add(parser);
558
			// Only add this parser to the parent parser set list of children if it is not an overrider parser 
559
			if (overrideId == null || overrideId.length() == 0) {
560
				LogParserSet parent = (LogParserSet) parserSets.get(parser
561
						.getParentId());
562
				if (parent != null) {
563
					parent.getChildren().add(parser);
564
				}
415
			}
565
			}
416
				
566
				
417
			String iconPath = elem.getAttribute("icon");
567
			String iconPath = elem.getAttribute("icon");
418
			if(iconPath != null && iconPath.length() > 0)
568
			if(iconPath != null && iconPath.length() > 0 && !iconPath.equalsIgnoreCase(defaultValue))
419
			{
569
			{
420
				try {
570
				try {
421
					URL url = new URL(Platform.getBundle(elem.getDeclaringExtension().getNamespace()).getEntry("/"), iconPath);
571
					URL url = new URL(Platform.getBundle(elem.getDeclaringExtension().getNamespace()).getEntry("/"), iconPath);
Lines 452-459 Link Here
452
				   pfield.setListener(felem.getAttribute("listener"));					   
602
				   pfield.setListener(felem.getAttribute("listener"));					   
453
				   parser.addEntry(pfield);
603
				   parser.addEntry(pfield);
454
			   }else if(felem.getName().equals("parserParameter")){
604
			   }else if(felem.getName().equals("parserParameter")){
455
				   ParserParameter para = new ParserParameter(felem.getAttribute("name"),felem.getAttribute("value"));
605
				   if (!felem.getAttribute("value").equalsIgnoreCase(defaultValue)) {
456
				   parser.addParameter(para);					   
606
					   ParserParameter para = new ParserParameter(felem.getAttribute("name"),felem.getAttribute("value"));
607
					   parser.addParameter(para);
608
				   }
457
			   }else if(felem.getName().equals("customField")){					
609
			   }else if(felem.getName().equals("customField")){					
458
					ParserField pfield = new ParserField(felem.getAttribute("id")
610
					ParserField pfield = new ParserField(felem.getAttribute("id")
459
							, "");
611
							, "");
Lines 510-537 Link Here
510
					}
662
					}
511
			   }
663
			   }
512
			}
664
			}
513
		
665
			
514
			parsers.put(parser.getId(), parser);
666
			if (overrideId != null && overrideId.length() > 0 && overridePriority != null && overridePriority.length() > 0) {
667
				
668
				if (overrideParsers.containsKey(overrideId)) {
669
					OverrideLogParser overrideparser = (OverrideLogParser)overrideParsers.get(overrideId);
670
					short priority = overrideparser.getPriority();
671
					short newPriority = Short.valueOf(overridePriority).shortValue();
672
					
673
					if (priority != -1 && (priority < newPriority || newPriority == -1)) {
674
						overrideParsers.put(overrideId, new OverrideLogParser(parser, overrideId, overridePriority));
675
					}
676
				}
677
				else {
678
					overrideParsers.put(overrideId, new OverrideLogParser(parser, overrideId, overridePriority));
679
				}	
680
			}
681
			else {
682
				parsers.put(parser.getId(), parser);
683
			}
515
		}
684
		}
685
		
686
		processParserOverrides();
516
				
687
				
517
	}
688
	}
518
	
689
	
690
	/* (non-Javadoc)
691
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogParser(java.lang.String)
692
	 */
519
	public LogParserItem getLogParser(String key){
693
	public LogParserItem getLogParser(String key){
520
		return (LogParserItem)parsers.get(key);
694
		return (LogParserItem)parsers.get(key);
521
	}
695
	}
522
	
696
	
697
	/* (non-Javadoc)
698
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserRegistry()
699
	 */
523
	public Map getParserRegistry(){
700
	public Map getParserRegistry(){
524
		return parsers;
701
		return parsers;
525
	}
702
	}
526
	
703
	
704
	/* (non-Javadoc)
705
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserSetRegistry()
706
	 */
527
	public Map getParserSetRegistry(){
707
	public Map getParserSetRegistry(){
528
		return parserSets;
708
		return parserSets;
529
	}
709
	}
530
	
710
	
711
	/* (non-Javadoc)
712
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getParserSets()
713
	 */
531
	public List getParserSets(){
714
	public List getParserSets(){
532
		return parentParserSets;
715
		return parentParserSets;
533
	}
716
	}
534
	
717
	
718
	/* (non-Javadoc)
719
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#saveLogSets()
720
	 */
535
	public void saveLogSets(){
721
	public void saveLogSets(){
536
		
722
		
537
		StringBuffer xmlString = new StringBuffer();
723
		StringBuffer xmlString = new StringBuffer();
Lines 541-547 Link Here
541
		xmlString.append("?>");
727
		xmlString.append("?>");
542
		
728
		
543
		xmlString.append(" <");
729
		xmlString.append(" <");
544
		xmlString.append(LOGSETS_KEY);
730
		xmlString.append(ILogSetManager.LOGSETS_KEY);
545
		xmlString.append("> ");			
731
		xmlString.append("> ");			
546
		
732
		
547
		Set keySet = logSetsList.keySet();
733
		Set keySet = logSetsList.keySet();
Lines 552-569 Link Here
552
		}			
738
		}			
553
		
739
		
554
		xmlString.append(" </");				
740
		xmlString.append(" </");				
555
		xmlString.append(LOGSETS_KEY);
741
		xmlString.append(ILogSetManager.LOGSETS_KEY);
556
		xmlString.append(">");
742
		xmlString.append(">");
557
		
743
		
558
		preferenceStore.setValue(LOGSETS_KEY, xmlString.toString());			
744
		preferenceStore.setValue(ILogSetManager.LOGSETS_KEY, xmlString.toString());			
559
745
560
	}
746
	}
561
		
747
		
748
	/* (non-Javadoc)
749
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#generateLogSetPrefEntry(java.lang.String)
750
	 */
562
	public String generateLogSetPrefEntry(String name){
751
	public String generateLogSetPrefEntry(String name){
563
		
752
		
564
		StringBuffer xmlString = new StringBuffer();
753
		StringBuffer xmlString = new StringBuffer();
565
		xmlString.append(" <");
754
		xmlString.append(" <");
566
		xmlString.append(LOGSET_TAG);
755
		xmlString.append(ILogSetManager.LOGSET_TAG);
567
		xmlString.append(XMLUtil.createXMLAttribute("name", name,false));
756
		xmlString.append(XMLUtil.createXMLAttribute("name", name,false));
568
		xmlString.append(XMLUtil.createXMLAttribute(LogUIMessages._54, name.equals(defaultLogSet) ? "1":"0", false));
757
		xmlString.append(XMLUtil.createXMLAttribute(LogUIMessages._54, name.equals(defaultLogSet) ? "1":"0", false));
569
		xmlString.append("> ");
758
		xmlString.append("> ");
Lines 579-585 Link Here
579
		}			
768
		}			
580
769
581
		xmlString.append(" </");				
770
		xmlString.append(" </");				
582
		xmlString.append(LOGSET_TAG);
771
		xmlString.append(ILogSetManager.LOGSET_TAG);
583
		xmlString.append("> ");
772
		xmlString.append("> ");
584
773
585
		return xmlString.toString();
774
		return xmlString.toString();
Lines 641-652 Link Here
641
	}
830
	}
642
	
831
	
643
	
832
	
833
	/* (non-Javadoc)
834
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#setDefaultLogSet(java.lang.String)
835
	 */
644
	public void setDefaultLogSet(String newValue){
836
	public void setDefaultLogSet(String newValue){
645
		
837
		
646
		defaultLogSet = newValue;
838
		defaultLogSet = newValue;
647
				
839
				
648
	}
840
	}
649
	
841
	
842
	/* (non-Javadoc)
843
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getDefaultLogSet()
844
	 */
650
	public String getDefaultLogSet(){
845
	public String getDefaultLogSet(){
651
		if(defaultLogSet==null){
846
		if(defaultLogSet==null){
652
			initDefault();
847
			initDefault();
Lines 654-671 Link Here
654
		return defaultLogSet;
849
		return defaultLogSet;
655
	}
850
	}
656
851
852
	/* (non-Javadoc)
853
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#getLogElements()
854
	 */
657
	public List getLogElements() {
855
	public List getLogElements() {
658
		return logElements;
856
		return logElements;
659
	}
857
	}
660
661
	public static LogSetManager getInstance() {
662
		
663
		if(instance == null)
664
			instance = new LogSetManager();
665
		return instance;
666
	}
667
	
858
	
668
	//bugzilla 206665
859
	//bugzilla 206665
860
	/* (non-Javadoc)
861
	 * @see org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager#reset()
862
	 */
669
	public void reset(){
863
	public void reset(){
670
864
671
		if(logElements != null)
865
		if(logElements != null)
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizardPage.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 86-92 Link Here
86
	private Label logset_desc;
86
	private Label logset_desc;
87
	private Combo logNameCombo;
87
	private Combo logNameCombo;
88
	private Label type_label;
88
	private Label type_label;
89
	private LogSetManager lsMgr;
89
	private ILogSetManager lsMgr;
90
	private int dialog_type;
90
	private int dialog_type;
91
	private Button selectAllBtn;
91
	private Button selectAllBtn;
92
	private Button clearAllBtn;
92
	private Button clearAllBtn;
Lines 350-356 Link Here
350
	 */
350
	 */
351
	protected void loadDefaultLogSet() {
351
	protected void loadDefaultLogSet() {
352
352
353
		lsMgr = LogSetManager.getInstance();
353
		lsMgr = ILogSetManager.INSTANCE;
354
		lsMgr.initDefault();		
354
		lsMgr.initDefault();		
355
		lsMgr.loadLogSets();
355
		lsMgr.loadLogSets();
356
				
356
				
Lines 1079-1085 Link Here
1079
		logNameCombo.setText(desc);
1079
		logNameCombo.setText(desc);
1080
	}
1080
	}
1081
	
1081
	
1082
	public LogSetManager getLogSetManager(){
1082
	public ILogSetManager getLogSetManager(){
1083
		return lsMgr;
1083
		return lsMgr;
1084
	}
1084
	}
1085
1085
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ExportLogSetsUI.java (-5 / +6 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 36-48 Link Here
36
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
36
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
37
import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper;
37
import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper;
38
import org.eclipse.tptp.monitoring.logui.internal.wizards.LogFileElement.Filter;
38
import org.eclipse.tptp.monitoring.logui.internal.wizards.LogFileElement.Filter;
39
import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager;
39
import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin;
40
import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin;
40
import org.eclipse.ui.PlatformUI;
41
import org.eclipse.ui.PlatformUI;
41
import org.eclipse.ui.dialogs.IOverwriteQuery;
42
import org.eclipse.ui.dialogs.IOverwriteQuery;
42
43
43
public class ExportLogSetsUI extends ImportExportLogSetsUI {
44
public class ExportLogSetsUI extends ImportExportLogSetsUI {
44
45
45
	protected LogSetManager lsMgr;
46
	protected ILogSetManager lsMgr;
46
	
47
	
47
	public ExportLogSetsUI(Composite parent, int style)
48
	public ExportLogSetsUI(Composite parent, int style)
48
	{
49
	{
Lines 58-64 Link Here
58
		xmiString.append("?>");
59
		xmiString.append("?>");
59
60
60
		xmiString.append(" <");
61
		xmiString.append(" <");
61
		xmiString.append(LogSetManager.LOGSETS_KEY);
62
		xmiString.append(ILogSetManager.LOGSETS_KEY);
62
		xmiString.append("> ");			
63
		xmiString.append("> ");			
63
		
64
		
64
		Iterator keySet = getDoubleList().getTargetItems().iterator();
65
		Iterator keySet = getDoubleList().getTargetItems().iterator();
Lines 71-77 Link Here
71
		}			
72
		}			
72
		xmiString.append(FilterTransformationHelper.convertXmiToXml(lsMgr.generateLogSetFilterDefEntry(filterList)));
73
		xmiString.append(FilterTransformationHelper.convertXmiToXml(lsMgr.generateLogSetFilterDefEntry(filterList)));
73
		xmiString.append(" </");				
74
		xmiString.append(" </");				
74
		xmiString.append(LogSetManager.LOGSETS_KEY);
75
		xmiString.append(ILogSetManager.LOGSETS_KEY);
75
		xmiString.append(">");
76
		xmiString.append(">");
76
77
77
		String filePath = sourceNameField.getText().trim();
78
		String filePath = sourceNameField.getText().trim();
Lines 143-149 Link Here
143
144
144
	protected List populateFilterList() {
145
	protected List populateFilterList() {
145
		
146
		
146
		lsMgr = LogSetManager.getInstance();
147
		lsMgr = ILogSetManager.INSTANCE;
147
		
148
		
148
		Iterator sets = lsMgr.getLogSets().keySet().iterator();
149
		Iterator sets = lsMgr.getLogSets().keySet().iterator();
149
		
150
		
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogSetUI.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 210-216 Link Here
210
		data = GridUtil.createHorizontalFill();
210
		data = GridUtil.createHorizontalFill();
211
	
211
	
212
		txtLogSetName.setLayoutData(data);
212
		txtLogSetName.setLayoutData(data);
213
		txtLogSetName.setText(LogSetManager.getInstance().getDefaultLogSet());	
213
		txtLogSetName.setText(ILogSetManager.INSTANCE.getDefaultLogSet());	
214
		txtLogSetName.selectAll();
214
		txtLogSetName.selectAll();
215
		
215
		
216
		lblError = new Label(result, SWT.WRAP);
216
		lblError = new Label(result, SWT.WRAP);
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/LogParserItem.java (-3 / +30 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 29-35 Link Here
29
    private String _name = "";
29
    private String _name = "";
30
    private String _uiName = "_unknown";
30
    private String _uiName = "_unknown";
31
    private String _desc = "";
31
    private String _desc = "";
32
    private ImageDescriptor _imgDesc;
32
    private ImageDescriptor _imgDesc = null;
33
    private String _class = "";
33
    private String _class = "";
34
    private String _uiType = "text_field";    
34
    private String _uiType = "text_field";    
35
    private IBasicParserField[] _parserFields = new IBasicParserField[10];
35
    private IBasicParserField[] _parserFields = new IBasicParserField[10];
Lines 65-71 Link Here
65
        	_desc="";
65
        	_desc="";
66
    }
66
    }
67
67
68
    public void setImageDescriptor(ImageDescriptor imgDesc) {
68
    /**
69
     * Set the name of this log parser that will be shown in the UI
70
	 * @param name the log parser name to set
71
	 */
72
	public void setLabel(String name) {
73
		_uiName = name;
74
	}
75
76
	/**
77
	 * Set the log parser description
78
	 * @param _desc the log parser description to set
79
	 */
80
	public void setDescription(String _desc) {
81
		this._desc = _desc;
82
	}
83
84
	public void setImageDescriptor(ImageDescriptor imgDesc) {
69
        _imgDesc = imgDesc;
85
        _imgDesc = imgDesc;
70
    }
86
    }
71
87
Lines 116-121 Link Here
116
        return _parserFields;
132
        return _parserFields;
117
    }
133
    }
118
134
135
    public void setFields(IBasicParserField[] parserFields) {
136
        _parserFields = parserFields;
137
    }
138
    
119
    public String getId() {
139
    public String getId() {
120
        return _id;
140
        return _id;
121
    }
141
    }
Lines 152-157 Link Here
152
        _config = elem;
172
        _config = elem;
153
    }
173
    }
154
    
174
    
175
    public IConfigurationElement getConfigurationElement() {
176
        return _config;
177
    }
178
    
155
	/**
179
	/**
156
	 * Sets the widgets of this page
180
	 * Sets the widgets of this page
157
	 * 
181
	 * 
Lines 198-203 Link Here
198
	public ArrayList getParserParameters() {
222
	public ArrayList getParserParameters() {
199
		return _parserParameters;
223
		return _parserParameters;
200
	}
224
	}
225
	public void setParserParameters(ArrayList list) {
226
		_parserParameters = list;
227
	}
201
	public void addParameter(ParserParameter para) {
228
	public void addParameter(ParserParameter para) {
202
		_parserParameters.add(para);
229
		_parserParameters.add(para);
203
	 }
230
	 }
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogWizard.java (-3 / +3 lines)
Lines 1-10 Link Here
1
 /**********************************************************************
1
 /**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: ImportLogWizard.java,v 1.110 2008/01/14 17:56:54 rshetty Exp $
7
 * $Id: ImportLogWizard.java,v 1.109 2007/12/05 03:12:26 apnan Exp $
8
 *
8
 *
9
 * Contributors:
9
 * Contributors:
10
 * IBM - Initial API and implementation
10
 * IBM - Initial API and implementation
Lines 411-417 Link Here
411
			monitorThread.start();
411
			monitorThread.start();
412
		
412
		
413
		// clear log set manager
413
		// clear log set manager
414
		LogSetManager.getInstance().reset();
414
		ILogSetManager.INSTANCE.reset();
415
    }
415
    }
416
416
417
	private void refreshView(final Object object, final int type){
417
	private void refreshView(final Object object, final int type){
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ImportLogSetsUI.java (-8 / +9 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 36-41 Link Here
36
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
36
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
37
import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper;
37
import org.eclipse.tptp.monitoring.logui.internal.util.FilterTransformationHelper;
38
import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin;
38
import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin;
39
import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager;
39
import org.eclipse.ui.PlatformUI;
40
import org.eclipse.ui.PlatformUI;
40
import org.w3c.dom.Document;
41
import org.w3c.dom.Document;
41
import org.w3c.dom.Element;
42
import org.w3c.dom.Element;
Lines 45-57 Link Here
45
46
46
public class ImportLogSetsUI extends ImportExportLogSetsUI {
47
public class ImportLogSetsUI extends ImportExportLogSetsUI {
47
	
48
	
48
	protected LogSetManager lsMgr;
49
	protected ILogSetManager lsMgr;
49
50
50
	public ImportLogSetsUI(Composite parent, int style)
51
	public ImportLogSetsUI(Composite parent, int style)
51
	{
52
	{
52
		super(parent, style); //$NON-NLS-1$
53
		super(parent, style); //$NON-NLS-1$
53
		
54
		
54
		lsMgr = LogSetManager.getInstance();
55
		lsMgr = ILogSetManager.INSTANCE;
55
	}
56
	}
56
	
57
	
57
	public boolean finish() {
58
	public boolean finish() {
Lines 100-106 Link Here
100
	}
101
	}
101
102
102
	private void populateLogSetFilterList(FilterResourceFileHandler rSource , Element elem,List filterList){
103
	private void populateLogSetFilterList(FilterResourceFileHandler rSource , Element elem,List filterList){
103
		NodeList logNodeList = XMLUtil.getChildrenByName(elem,LogSetManager.LOGELEMENT_TAG);
104
		NodeList logNodeList = XMLUtil.getChildrenByName(elem, ILogSetManager.LOGELEMENT_TAG);
104
		Element element = null;
105
		Element element = null;
105
		for (int i = 0, maxi = logNodeList.getLength(); i < maxi; i++) {
106
		for (int i = 0, maxi = logNodeList.getLength(); i < maxi; i++) {
106
			if (logNodeList.item(i) instanceof Element) {
107
			if (logNodeList.item(i) instanceof Element) {
Lines 143-149 Link Here
143
144
144
			    for(int l1 = 0; l1 < nl.getLength(); l1++)
145
			    for(int l1 = 0; l1 < nl.getLength(); l1++)
145
			    {
146
			    {
146
			    	if(nl.item(l1).getNodeName().equals(LogSetManager.FILTER_TAG))
147
			    	if(nl.item(l1).getNodeName().equals(ILogSetManager.FILTER_TAG))
147
			    	{
148
			    	{
148
			    		Node node = nl.item(l1);
149
			    		Node node = nl.item(l1);
149
					    String xmlString = FilterTransformationHelper.toString(node);
150
					    String xmlString = FilterTransformationHelper.toString(node);
Lines 154-160 Link Here
154
			    		rSource.clear();
155
			    		rSource.clear();
155
			    		String fl = FilterTransformationHelper.toString(filterNode);
156
			    		String fl = FilterTransformationHelper.toString(filterNode);
156
			    		InputStream is = new ByteArrayInputStream(fl.getBytes());
157
			    		InputStream is = new ByteArrayInputStream(fl.getBytes());
157
						rSource.load(is, LogSetManager.RESOURCE_OPTIONS);
158
						rSource.load(is, ILogSetManager.RESOURCE_OPTIONS);
158
						return rSource;
159
						return rSource;
159
			    	}
160
			    	}
160
			    }
161
			    }
Lines 176-185 Link Here
176
		{
177
		{
177
			try {
178
			try {
178
		    FileInputStream inputStream = new FileInputStream(fileName);
179
		    FileInputStream inputStream = new FileInputStream(fileName);
179
		    Element elem = XMLUtil.loadDom(inputStream, LogSetManager.LOGSETS_KEY);
180
		    Element elem = XMLUtil.loadDom(inputStream, ILogSetManager.LOGSETS_KEY);
180
		    if(elem != null)
181
		    if(elem != null)
181
		    {
182
		    {
182
				NodeList logSetsNodeList = XMLUtil.getChildrenByName(elem, LogSetManager.LOGSET_TAG);
183
				NodeList logSetsNodeList = XMLUtil.getChildrenByName(elem, ILogSetManager.LOGSET_TAG);
183
184
184
				for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++)
185
				for(int i=0, maxi=logSetsNodeList.getLength(); i<maxi; i++)
185
				{
186
				{
(-)src/org/eclipse/tptp/monitoring/logui/internal/util/FilterTransformationHelper.java (-6 / +5 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 21-28 Link Here
21
import org.apache.xml.serialize.OutputFormat;
21
import org.apache.xml.serialize.OutputFormat;
22
import org.apache.xml.serialize.XMLSerializer;
22
import org.apache.xml.serialize.XMLSerializer;
23
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
23
import org.eclipse.tptp.monitoring.logui.internal.MonitoringLogUIPlugin;
24
import org.eclipse.tptp.monitoring.logui.internal.wizards.LogSetManager;
24
import org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager;
25
26
import org.w3c.dom.Document;
25
import org.w3c.dom.Document;
27
import org.w3c.dom.Element;
26
import org.w3c.dom.Element;
28
import org.w3c.dom.NamedNodeMap;
27
import org.w3c.dom.NamedNodeMap;
Lines 44-50 Link Here
44
			
43
			
45
			Document newDocument = builder.newDocument();
44
			Document newDocument = builder.newDocument();
46
				
45
				
47
			Element element = (Element) document.getElementsByTagName(LogSetManager.FILTER_TAG).item(0);
46
			Element element = (Element) document.getElementsByTagName(ILogSetManager.FILTER_TAG).item(0);
48
			if(element != null)
47
			if(element != null)
49
			{
48
			{
50
				buildXMLDocument(element, null, newDocument);
49
				buildXMLDocument(element, null, newDocument);
Lines 172-178 Link Here
172
			
171
			
173
			Document newDocument = builder.newDocument();
172
			Document newDocument = builder.newDocument();
174
				
173
				
175
			Element element = (Element) document.getElementsByTagName(LogSetManager.FILTER_TAG).item(0);
174
			Element element = (Element) document.getElementsByTagName(ILogSetManager.FILTER_TAG).item(0);
176
			if(element != null)
175
			if(element != null)
177
			{
176
			{
178
				buildXmiDocument(element, null, newDocument);
177
				buildXmiDocument(element, null, newDocument);
Lines 197-203 Link Here
197
			nodeName = "HierarchyExtensions:SimpleSearchQuery";
196
			nodeName = "HierarchyExtensions:SimpleSearchQuery";
198
		}
197
		}
199
		
198
		
200
		if(nodeName.equals(LogSetManager.FILTER_TAG))
199
		if(nodeName.equals(ILogSetManager.FILTER_TAG))
201
		{
200
		{
202
			Element xmiElement = newDocument.createElement("xmi:XMI");
201
			Element xmiElement = newDocument.createElement("xmi:XMI");
203
			
202
			
(-)plugin.xml (-1 / +14 lines)
Lines 56-60 Link Here
56
			id = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor"
56
			id = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor"
57
			group = "import.log"
57
			group = "import.log"
58
			class = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor"/>
58
			class = "org.eclipse.tptp.monitoring.logui.internal.actions.ImportLogNavigatorActionContributor"/>
59
	</extension>   
59
	</extension>
60
 <extension
61
       point="org.eclipse.tptp.platform.models.hierarchy.handler">
62
    <handler
63
          application="TPTP/LTA"
64
          class="org.eclipse.tptp.monitoring.logui.internal.wizards.LogSetManager"
65
          function="LogSetManager"
66
          id="org.eclipse.tptp.monitoring.logui.LogSetManager"
67
          name="TPTP Log Set Manager"
68
          priority="1"
69
          type="org.eclipse.tptp.monitoring.logui.internal.wizards.ILogSetManager"
70
          version="4.5">
71
    </handler>
72
 </extension>   
60
</plugin>
73
</plugin>
(-)src/org/eclipse/tptp/monitoring/logui/internal/wizards/ILogSetManager.java (+156 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: LogSetManager.java,v 1.16 2007/11/27 04:56:40 apnan Exp $
8
 * 
9
 * Contributors: 
10
 * IBM - Initial API and implementation
11
 **********************************************************************/
12
13
package org.eclipse.tptp.monitoring.logui.internal.wizards;
14
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18
19
import org.eclipse.tptp.monitoring.logui.internal.LogUIMessages;
20
import org.eclipse.tptp.platform.extensions.IApplicationManager;
21
import org.w3c.dom.Element;
22
23
/**
24
 * ILogSetManager interface represents a helper class for managing
25
 * log resources such as sets of logs, parsers available to parse
26
 * the logs, and containers for grouping the parsers
27
 * 
28
 * @provisional since TPTP 4.5
29
 * @author smith
30
 *
31
 */
32
public interface ILogSetManager {
33
34
	// Handler's Application/Function
35
	static final String TPTP_LTA_LOG_SET_MANAGER = "TPTP/LTA/LogSetManager";
36
	
37
	//private static LogSetManager instance;
38
	public static final String LOGSETS_KEY = "logsets";
39
	public static final String LOGSET_TAG = "logset";
40
	public static final String LOGELEMENT_TAG = "LogFileElement";
41
	public static final String DEFAULT_LOGSET = LogUIMessages._54;
42
	public static final String FILTER_TAG = "filters";
43
	public static final String EXPORT_URI="/temp.txt";
44
	public static Map RESOURCE_OPTIONS = new HashMap();
45
46
	ILogSetManager INSTANCE = (ILogSetManager)IApplicationManager.INSTANCE.createDefaultHandlerInstance(TPTP_LTA_LOG_SET_MANAGER);
47
48
	/**
49
	 * Initialize the list of log sets, parser sets and parsers
50
	 */
51
	public abstract void initDefault();
52
	
53
	/**
54
	 * Persist the list of filters used in the log sets
55
	 * @param logSetFilterList list of filters to save
56
	 */
57
	public abstract void saveLogSetFilters(List logSetFilterList);
58
59
	/**
60
	 * Generate a string that represents the list of filter definitions
61
	 * @param logSetFilterList list of filters
62
	 * @return string that represents the list of filter definitions
63
	 */
64
	public abstract String generateLogSetFilterDefEntry(List logSetFilterList);
65
	
66
	/**
67
	 * Load the log sets that are persisted.
68
	 */
69
	public abstract void loadLogSets();
70
	
71
	/**
72
	 * Add the log set to the log set list
73
	 * @param logSetElement logSet in XML representation
74
	 */
75
	public abstract void loadLogSet(Element logSetElement);
76
77
	/**
78
	 * Open the log set
79
	 * @param name of the log set to open
80
	 */
81
	public abstract void openLogSet(String name);
82
83
	/**
84
	 * Get the log sets that are loaded.
85
	 * @return map of log sets
86
	 */
87
	public abstract Map getLogSets();
88
	
89
	/**
90
	 * Get a clone of the loaded log sets.
91
	 * @return map of log sets
92
	 */
93
	public abstract Map getLogSetsClone();
94
95
	/**
96
	 * Get the specified log parser.
97
	 * @param key Id of log parser to return
98
	 * @return LogParserItem representing the log parser
99
	 */
100
	public abstract LogParserItem getLogParser(String key);
101
102
	/**
103
	 * Get the map of all log parsers in the extension registry
104
	 * 
105
	 * @return map of log parsers found in the extension registry 
106
	 */
107
	public abstract Map getParserRegistry();
108
109
	/**
110
	 * Get the map of all log parser sets in the extension registry
111
	 * @return Map of log parser sets in the extension registry
112
	 */
113
	public abstract Map getParserSetRegistry();
114
115
	/**
116
	 * Get the list of log parser sets that have child parser sets
117
	 * @return List of parent log parser sets
118
	 */
119
	public abstract List getParserSets();
120
121
	/**
122
	 * Persist the set of log sets that are currently loaded.
123
	 */
124
	public abstract void saveLogSets();
125
126
	/**
127
	 * Generate a string that represents the specified log set
128
	 * @param name of log set
129
	 * @return string representing the requested log set
130
	 */
131
	public abstract String generateLogSetPrefEntry(String name);
132
	
133
	/**
134
	 * Set the default log set.
135
	 * @param newValue name of the log set to make the default
136
	 */
137
	public abstract void setDefaultLogSet(String newValue);
138
	
139
	/**
140
	 * Get the name of the default log set
141
	 * @return name of the default log set
142
	 */
143
	public abstract String getDefaultLogSet();
144
	
145
	/**
146
	 * Get the log elements in the currently open log set.
147
	 * @return List of log elements in the log set
148
	 */
149
	public abstract List getLogElements();
150
151
	/**
152
	 * Clear the lists of loaded log sets, parser sets and parsers
153
	 */
154
	public abstract void reset();
155
	
156
}

Return to bug 208728