« - »

That was easy!

16 September 2008

That was a little scary … it was almost as if I knew what I was doing!

I wanted to try out the Example application that comes shipped with TPTP, so after restarting Ganymede once the TPTP installation was complete, I selected File > New > Example… > Logging > EMF Common Base Event v1.0.1 Sample and then BAM — up came the example project in the workspace and then up popped an internal help screen that basically laid out exactly what needed to be done in order to run the example code:

Working with the EMF Common Base Event v1.0.1 sample
This sample demonstrates creating and configuring Common Base Events. Users experience creating and configuring a Common Base Event using the Common Base Event XML file template Event Factory and logs the newly created Common Base Event to the console.

The contents of the sample include the Java source code, dependencies and configuration file necessary to create and configure a Common Base Event.

If you have not already done so, create the example by File > New > Example… >Logging > EMF Common Base Event v1.0.1 Sample.

  • JRE 1.4.0 or above is required to compile and execute this sample.
  • The ‘HyadesEMFCommonBaseEventv101Sample.event.xml.file’ environment variable is set to the sample’s configuration template’s (HyadesEMFCommonBaseEventv101Sample.event.xml) absolute path and name. For example, <workspace>/HyadesEMFCommonBaseEventv101Sample/config/HyadesEMFCommonBaseEventv101Sample.event.xml, where <workspace> is the absolute path to the workbench’s workspace.

To run this sample, follow these steps:

  1. If the workbench’s default JRE is not 1.4.0 or above, modify the newly created Java project to compile and execute using JRE 1.4.0 or above. To add the JRE 1.4.0 to the Java Build Path:
    1. Right-click on HyadesEMFCommonBaseEventv101Project and select Properties.
    2. Select Java Build Path from the list in the left pane.
    3. Under the Libraries tab, select JRE_LIB and click the Remove button.
    4. Click the Add Library button.
    5. In the Add Library dialog, select the JRE System Library from the list and click Next.
    6. Select the Alternate JRE option, and click Installed JREs to add a JRE. The preferences dialog for Installed Java Runtime Environments opens.
    7. Click Add.
    8. On the Add JRE dialog, specify the name and home directory of the JRE 1.4.0. Click OK.
    9. Click OK.
    10. Click Finish.
    11. Click OK in the properties dialog.
  2. Confirm that all compilation errors have been fixed.
  3. From the Java perspective, right-click on the project, and select Run As > Run… to run the sample class.
  4. In the Run configuration dialog, double-click on Java application. A new configuration is created.
  5. Under the Main tab, the project name is pre-filled. Click Search to find the Main class that should be run.
  6. In the Choose Main Type dialog, double-click on the HyadesEMFCommonBaseEventv101Sample listed. The Main class field now has the value HyadesEMFCommonBaseEventv101Sample.
  7. Click Run to run the sample.

I followed the directions, and before you knew it, the following came out on the Eclipse console:

<CommonBaseEvent creationTime="2008-09-17T02:31:18.781Z"
             globalInstanceId="A1DD8460B5808AD0D130E56565656330"
             localInstanceId="Sample_Event"
             msg="Hyades EMF Common Base Event v101 Sample log message"
             severity="60" version="1.0.1">
	<extendedDataElements name="Sample ExtendedDataElement name" type="string">
		<values>Sample ExtendedDataElement value</values>
	</extendedDataElements>
	<sourceComponentId component="HyadesEMFCommonBaseEventv101Sample"
             componentIdType="Application" location="192.168.0.71" locationType="IPV4"
             subComponent="Component" threadId="main" componentType="Eclipse_Hyades"/>
	<situation categoryName="ReportSituation">
		<situationType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:type="ReportSituation" reasoningScope="INTERNAL" reportCategory="LOG"/>
	</situation>
</CommonBaseEvent>

HyadesEMFCommonBaseEventv101Sample successfully ended!

It worked. Just like that. Done.

Very cool. Now I can dig into the code and see how it all works …


http://blog.restafarian.org/2008/09/that-was-easy/

Comments are closed.

Sorry, the comment form is closed at this time.