Bug 80018 - (Plat) CBEnative: need a factory for creating events.
Summary: (Plat) CBEnative: need a factory for creating events.
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Hyades (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Slauenwhite CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 80013
  Show dependency tree
 
Reported: 2004-12-02 10:27 EST by Paul Slauenwhite CLA
Modified: 2012-02-15 13:48 EST (History)
2 users (show)

See Also:


Attachments
Partial implementation of EventFactory (14.93 KB, text/plain)
2005-03-10 14:20 EST, Michael Hao CLA
no flags Details
Partial implementation of TemplateContentHandler (38.67 KB, text/plain)
2005-03-10 14:20 EST, Michael Hao CLA
no flags Details
Fix (29.64 KB, application/x-zip-compressed)
2005-03-24 16:11 EST, Paul Slauenwhite CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2004-12-02 10:27:57 EST
Native Common Base Event implementation does not provide a factory for creating 
events.

When users instrument native Common Base Events for logging/tracing, the number 
of lines to create each record is typically
around 20 - 30.  This will be unacceptable to achieve widespread adoption of 
the native Common Base Events in applications for
logging/tracing.  One approach to reduce the number of lines to create a native 
Common Base Event is to provide an implementation of a factory pattern for 
users to create Common Base Events for logging/tracing. 

For example, the factory could be populated with a template event that is 
common for all events within a certain context (e.g. application, component, 
etc.) and when components create Common Base Events for logging/tracing, they 
are returned a pre-populated event which they set the dynamic data (e.g. 
severity, message, etc.).

For a reference implementation of a Common Base Event factory pattern, see the 
Java Common Base Event implementation (e.g. org.eclipse.hyades.logging.core).
Comment 1 Paul Slauenwhite CLA 2005-02-07 12:17:31 EST
Assignment: Mike Hao
Comment 2 Michael Hao CLA 2005-03-10 14:20:02 EST
Created attachment 18664 [details]
Partial implementation of EventFactory
Comment 3 Michael Hao CLA 2005-03-10 14:20:49 EST
Created attachment 18665 [details]
Partial implementation of TemplateContentHandler
Comment 4 Ruth Lee CLA 2005-03-15 18:17:12 EST
Now that we have a "3.3" Version in bugzilla, updating bugzillas targeted to 3.3
or a 3.3 iteration so that their Version matches their Target. "future",
"unspecified", "4.0", and "4.1" Versions will not be updated.
Comment 5 Paul Slauenwhite CLA 2005-03-16 22:25:00 EST
Sizing: 2 PW
Comment 6 Paul Slauenwhite CLA 2005-03-24 16:11:57 EST
Created attachment 19173 [details]
Fix

Here is the summary to the fix of this defect:

1. File CommonBaseEvent.h
	-- added EventFactory declarations
	-- added TemplateContentHandler declarations
	-- two new fields and four functions added to CommonBaseEvent "class": 

		-- hcbe_TemplateContentHandler *_templateContentHandler
		-- int _isComplete   
		-- hcbe_CommonBaseEventSetContentHandlerFP setContentHandler;
		-- hcbe_CommonBaseEventGetContentHandlerFP getContentHandler;
		-- hcbe_CommonBaseEventIsCompleteFP isComplete;
		-- hcbe_CommonBaseEventCompleteFP complete;

2. File CommonBaseEvent.c: 
	Following functions added:
		-- void commonBaseEvent_setContentHandler(hcbe_CommonBaseEvent*
commonBaseEvent, hcbe_TemplateContentHandler* templateContentHandler)
		-- hcbe_TemplateContentHandler*
commonBaseEvent_getContentHandler(hcbe_CommonBaseEvent* commonBaseEvent)
		-- int commonBaseEvent_isComplete(hcbe_CommonBaseEvent*
commonBaseEvent)
		-- void commonBaseEvent_complete(hcbe_CommonBaseEvent*
commonBaseEvent)

3. EventFormatter.c
	-- removed code related to CBE V1.0
	-- changes made to the function
hcbe_commonBaseEventFromCanonicalXMLString(char* xmlString)

		In this function, we had some code like:

			masterIndex = strstr(xmlString, "<contextDataElements
");

		By doing this way, if no ContextDataElement presents in the
template CBE XML file, then the masterIndex will be NULL, so we lost the track
of the masterIndex. 
		Therefore, we will not be able to retrieve the <any> values
when the processing going down to the end of the XML file. This problem was
fixed in this way:
			
			if(strstr(xmlString, "<contextDataElements ") != NULL){

				masterIndex = strstr(xmlString,
"<contextDataElements ");
				......

4. New files
	EventFactory.c
	TemplateContentHandler.c
Comment 7 Paul Slauenwhite CLA 2005-04-28 15:56:43 EDT
The following files checked-in to Hyades 3.3 (HEAD) and TPTP 4.0 (HEAD) on 
April 28, 2005:

-CommonBaseEvent.c
-CommonBaseEvent.h
-EventFactory.c
-EventFormatter.c
-TemplateContentHandler.c
-cImpl.def
-cImpl.dsp
Comment 8 Paul Slauenwhite CLA 2005-05-02 10:43:47 EDT
Verified in Hyades 3.3 (HEAD) build (20050502_0704) on May 2, 2005.
Comment 9 Paul Slauenwhite CLA 2005-05-02 10:43:55 EDT
Closing.