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.
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.
Contents
Before You Begin
Install Objectivity CDO explained in the Installation Guide
Getting the Example
- Download the example here
- Import the downloaded zip file into a project by choosing File -> Import -> Existing Project into Workspace
- From there you choose the zip file by Selecting "Select archive file"
- Import all projects in the zip file.
- Now you have the example to run Objectivity CDO for the first time!
Running the Example
- Start the Objectivity CDO Server
- Expand com.objy.example.company.server
- Right Click on CDOObjyServerCompany.launch -> Run As -> CDOObjyServerCompany
- Run the Ingest
- Expand com.objy.example.company.datagen
- Expand src then com.objy.example.company.datagen
- Right Click on DataGeneratorCdoClient -> Run As -> Java Application
- Looking at the Data
- Right Click on CDOObjyCompanyClient.launch in the project, com.objy.example.company.server
- Select Run As -> CDOObjyCompanyClient
- When the new instance of Eclipse finished loading, open the CDO Client Perspective.
- Open a new CDO Session with the following information:
- Server Description: tcp://localhost:2036
- Repository Name: companyrepo
- To Browse, Right click on Session companyrepo -> Select "Open View"
- 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