Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CDO Objectivity Simple Example"

(Objectivity CDO Server)
(Data Generation)
Line 34: Line 34:
  
 
=== Data Generation ===
 
=== Data Generation ===
 +
To create the data in Objectivity CDO, we point to the repository being hosted by our CDO server.
 +
 +
DataGenerator.java:
 +
 +
<code>protected static final String REPOSITORY_NAME = "companyrepo";</code>
 +
 +
DataGeneratorCdoClient.java:
 +
 +
<code>IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$
 +
 +
CDOSessionConfiguration configuration = prepareConfiguration(connector);
 +
 +
configuration.setRepositoryName(REPOSITORY_NAME); //$NON-NLS-1$</code>
 +
 +
All other code to query the repository goes by the CDO standard. For more information regarding CDO go [[CDO|here]]
 +
 
=== CDO Explorer ===
 
=== CDO Explorer ===

Revision as of 00:55, 16 July 2010

This example will demonstrate using Objectivity CDO in Eclipse.

Before You Begin

Install Objectivity CDO explained in the Installation Guide

Getting the Example

  1. Download the example here
  2. Import the downloaded zip file into a project by choosing File -> Import -> Existing Project into Workspace
    1. From there you choose the zip file by Selecting "Select archive file"
    2. Import all projects in the zip file.
  3. Now you have the example to run Objectivity CDO for the first time!

Running the Example

  1. Start the Objectivity CDO Server
    1. Expand com.objy.example.company.server
    2. Right Click on CDOObjyServerCompany.launch -> Run As -> CDOObjyServerCompany
  2. Run the Ingest
    1. Expand com.objy.example.company.datagen
    2. Expand src then com.objy.example.company.datagen
    3. Right Click on DataGeneratorCdoClient -> Run As -> Java Application
  3. Looking at the Data
    1. Right Click on CDOObjyCompanyClient.launch in the project, com.objy.example.company.server
    2. Select Run As -> CDOObjyCompanyClient
    3. When the new instance of Eclipse finished loading, open the CDO Client Perspective.
    4. Open a new CDO Session with the following information:
      • Server Description: tcp://localhost:2036
      • Repository Name: companyrepo
    5. To Browse, Right click on Session companyrepo -> Select "Open View"
    6. Expand each folder to see all the data.

How Does it work?

Objectivity CDO Server

The Objectivity CDO server starts using CDOObjyServerCompany.launch. In the configuration, an argument points toward a configuration XML using the following argument: -Dnet4j.config="${resource_loc:/com.objy.example.company.server/rootfiles}". The configuration file uses the convention explained in CDO_Objectivity_Store_ConfigFile to connect to the Objectivity Database.

Data Generation

To create the data in Objectivity CDO, we point to the repository being hosted by our CDO server.

DataGenerator.java:

protected static final String REPOSITORY_NAME = "companyrepo";

DataGeneratorCdoClient.java:

IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$

CDOSessionConfiguration configuration = prepareConfiguration(connector);

configuration.setRepositoryName(REPOSITORY_NAME); //$NON-NLS-1$

All other code to query the repository goes by the CDO standard. For more information regarding CDO go here

CDO Explorer

Back to the top