Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » CDO standalone
CDO standalone [message #110218] |
Wed, 30 January 2008 09:06  |
Eclipse User |
|
|
|
Hi Eike,
For the CDO Teneo integration, I can just work with the standalone cdo version probably, correct?
I remember that you posted some code for standalone cdo somewhere, can you repost it for me?
Thanks!
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: CDO standalone [message #110330 is a reply to message #110218] |
Wed, 30 January 2008 09:24  |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
This is a multi-part message in MIME format.
--------------060508000704090200020809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Martin Taal schrieb:
> Hi Eike,
> For the CDO Teneo integration, I can just work with the standalone cdo
> version probably, correct?
Yes, I'd choose the easiest setup: client and server in one vm, start
with a MEMStore and look at its implementation.
>
> I remember that you posted some code for standalone cdo somewhere, can
> you repost it for me?
I think you mean the one I gave Stefan. It's also in CVS:
org.eclipse.emf.cdo.tests.ImportXML
Here's the code:
|/********************************************************** *****************
* Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eike Stepper - initial API and implementation
************************************************************ **************/
*package *org.eclipse.emf.cdo.tests;
*import *org.eclipse.emf.cdo.CDOSession;
*import *org.eclipse.emf.cdo.CDOTransaction;
*import *org.eclipse.emf.cdo.server.CDOServerUtil;
*import *org.eclipse.emf.cdo.server.IRepository;
*import *org.eclipse.emf.cdo.server.IStore;
*import *org.eclipse.emf.cdo.server.StoreUtil;
*import *org.eclipse.emf.cdo.server.IRepository.Props;
*import *org.eclipse.emf.cdo.tests.model1.Category;
*import *org.eclipse.emf.cdo.tests.model1.Model1Factory;
*import *org.eclipse.emf.cdo.tests.model1.Model1Package;
*import *org.eclipse.emf.cdo.tests.model1.Product;
*import *org.eclipse.emf.cdo.util.CDOUtil;
*import *org.eclipse.net4j.Net4jUtil;
*import *org.eclipse.net4j.connector.IConnector;
*import *org.eclipse.net4j.jvm.JVMUtil;
*import *org.eclipse.net4j.util.container.ContainerUtil;
*import *org.eclipse.net4j.util.container.IManagedContainer;
*import *org.eclipse.net4j.util.om.OMPlatform;
*import *org.eclipse.emf.ecore.EObject;
*import *org.eclipse.emf.ecore.resource.Resource;
*import *java.util.HashMap;
*import *java.util.Map;
/**
* @author Eike Stepper
*/
*public class *ImportXML
{
*private static final *String REPOSITORY_NAME = "repo1";
*public static **void *main(String[] args)
{
// Turn on tracing
OMPlatform.INSTANCE.setDebugging(*true*);
// Prepare the standalone infra structure (not needed when running inside Eclipse)
IManagedContainer container = ContainerUtil.createContainer(); // Create a wiring container
Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
JVMUtil.prepareContainer(container); // Prepare the JVM transport
CDOServerUtil.prepareContainer(container); // Prepare the CDO server
CDOUtil.prepareContainer(container, *false*); // Prepare the CDO client
// Start the transport and create a repository
JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
CDOServerUtil.addRepository(container, createRepository()); // Start a CDO respository
// Establish a communications connection and open a session with the repository
IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
CDOSession session = CDOUtil.openSession(connector, REPOSITORY_NAME, *true*);// Open a CDO session
session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);// Not needed after first commit!!!
CDOTransaction transaction = session.openTransaction();// Open a CDO transaction
Resource resource = transaction.createResource("/my/big/resource");// Create a new EMF resource
// Work normally with the EMF resource
EObject inputModel = getInputModel();
resource.getContents().add(inputModel);
transaction.commit();
session.close();
connector.disconnect();
}
*private static *IRepository createRepository()
{
Map<String, String> props = *new *HashMap<String, String>();
props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "true");
props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
*return *CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
}
*private static *IStore createStore()
{
// You might want to create an IDBStore here instead if memory is an issue!
*return *StoreUtil.createMEMStore();
}
*private static *EObject getInputModel()
{
Category cat1 = Model1Factory.eINSTANCE.createCategory();
cat1.setName("CAT1");
Category cat2 = Model1Factory.eINSTANCE.createCategory();
cat2.setName("CAT2");
cat1.getCategories().add(cat2);
Product p1 = Model1Factory.eINSTANCE.createProduct();
p1.setName("P1");
cat1.getProducts().add(p1);
Product p2 = Model1Factory.eINSTANCE.createProduct();
p2.setName("P2");
cat1.getProducts().add(p2);
Product p3 = Model1Factory.eINSTANCE.createProduct();
p3.setName("P3");
cat2.getProducts().add(p3);
*return *cat1;
}
}|
It works out of the box here as a Java Application launch config.
Regards,
Eike Stepper
----
http://wiki.eclipse.org/CDO
http://wiki.eclipse.org/Net4j
--------------060508000704090200020809
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin Taal schrieb:
<blockquote cite="mid:fnq09p$28r$1@build.eclipse.org" type="cite">Hi
Eike,
<br>
For the CDO Teneo integration, I can just work with the standalone cdo
version probably, correct?
<br>
</blockquote>
Yes, I'd choose the easiest setup: client and server in one vm, start
with a MEMStore and look at its implementation.<br>
<br>
<br>
<blockquote cite="mid:fnq09p$28r$1@build.eclipse.org" type="cite"><br>
I remember that you posted some code for standalone cdo somewhere, can
you repost it for me?
<br>
</blockquote>
I think you mean the one I gave Stefan. It's also in CVS:
org.eclipse.emf.cdo.tests.ImportXML<br>
Here's the code:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#3f5fbf"> /*********************************************************** **************** </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * Copyright (c) 2004 -&a mp;nbsp;2008 Eike Stepper, German y. </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * All rights reserved. T his program and the acco mpanying materials </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * are made available und er the terms of the& nbsp;Eclipse Public License v1.0 </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * which accompanies this  ;distribution, and is available&a mp;nbsp;at </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* <a class="moz-txt-link-freetext" href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* Contributors:</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * Eike Stepp er - initial API and& ;nbsp;implementation </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> ************************************************************ **************/ </font><br>
<font color="#7f0055"><b>package </b></font><font color="#000000">org.eclipse.emf.cdo.tests;</font><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.CDOSession;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.CDOTransaction;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.CDOServerUtil;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IRepository;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IStore;</font> <br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.StoreUtil;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IRepository.Props; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Category; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Model1Factory; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Model1Package; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Product;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.util.CDOUtil;</font><br >
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.Net4jUtil;</font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.connector.IConnector;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.jvm.JVMUtil;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.container.ContainerUtil; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.container.IManagedContainer; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.om.OMPlatform;</font ><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.ecore.EObject;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.ecore.resource.Resource;</font ><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">java.util.HashMap;</font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">java.util.Map;</font><br>
<font color="#ffffff"></font><br>
<font color="#3f5fbf">/**</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@author </font><font color="#3f5fbf">Eike Stepper</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">*/</font><br>
<font color="#7f0055"><b>public class </b></font ><font
color="#000000">ImportXML</font><br>
<font color="#000000">{</font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static final </b></font><font
color="#000000">String REPOSITORY_NAME = </font><font color="#2a00ff">"repo1"</font><font
color="#000000">;</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>public static </b></font ><font
color="#7f0055"><b>void </b></font><font color="#000000">main</font><font
color="#000000">(</font><font color="#000000">String</font><font
color="#000000">[] </font><font color="#000000">args</font><font
color="#000000">)</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f">// Turn on tracing </font><br>
<font color="#ffffff"> </font ><font color="#000000">OMPlatform.INSTANCE.setDebugging</font><font
color="#000000">(</font><font color="#7f0055"><b>true</b></font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Prepare the standalone&nbs p;infra structure (not needed& ;nbsp;when running inside Eclipse ) </font><br>
<font color="#ffffff"> </font ><font color="#000000"> IManagedContainer container = Con tainerUtil.createContainer </font><font
color="#000000">()</font><font color="#000000">; </font><font
color="#3f7f5f"> // Create a wiring conta iner </font><br>
<font color="#ffffff"> </font ><font color="#000000">Net4jUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the Net4j ker nel </font><br>
<font color="#ffffff"> </font ><font color="#000000">JVMUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the JVM trans port </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOServerUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the CDO serve r </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#7f0055"><b>false</b></font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Prepare the CDO clien t </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Start the transport a nd create a repository </font><br>
<font color="#ffffff"> </font ><font color="#000000">JVMUtil.getAcceptor</font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#2a00ff">"default"</font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Start the JVM transpo rt </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOServerUtil.addRepository</font><font
color="#000000">(</font><font color="#000000">container, createRepository</font ><font
color="#000000">())</font><font color="#000000">; </font><font
color="#3f7f5f"> // Start a CDO resposito ry </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Establish a communications& ;nbsp;connection and open a&n bsp;session with the repository </font><br>
<font color="#ffffff"> </font ><font color="#000000"> IConnector connector = JVMUtil.ge tConnector </font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#2a00ff">"default"</font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Open a JVM connection </font><br>
<font color="#ffffff"> </font ><font color="#000000"> CDOSession session = CDOUtil.open Session </font><font
color="#000000">(</font><font color="#000000">connector, REPOSITORY_NAME, </font><font
color="#7f0055"><b>true</b></font><font color="#000000">)</font><font
color="#000000">;</font><font color="#3f7f5f">// Open a CDO session </font><br>
<font color="#ffffff"> </font ><font color="#000000">session.getPackageRegistry</font><font
color="#000000">()</font><font color="#000000">.putEPackage</font><font
color="#000000">(</font><font color="#000000">Model1Package.eINSTANCE</font><font
color="#000000">)</font><font color="#000000">;</font><font
color="#3f7f5f"> // Not needed after firs t commit!!! </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#000000"> CDOTransaction transaction = sess ion.openTransaction </font><font
color="#000000">()</font><font color="#000000">;</font><font
color="#3f7f5f"> // Open a CDO transactio n </font><br>
<font color="#ffffff"> </font ><font color="#000000"> Resource resource = transaction.c reateResource </font><font
color="#000000">(</font><font color="#2a00ff">"/my/big/resource"</font><font
color="#000000">)</font><font color="#000000">;</font><font
color="#3f7f5f"> // Create a new EMF& nbsp;resource </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Work normally with th e EMF resource </font><br>
<font color="#ffffff"> </font ><font color="#000000"> EObject inputModel = getInputMode l </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">resource.getContents</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">inputModel</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">transaction.commit</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">session.close</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">connector.disconnect</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">IRepository createRepository</font ><font
color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Map<String, String> props&am p;nbsp;= </font><font
color="#7f0055"><b>new </b></font><font color="#000000">HashMap<String, String> </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_SUPPORTING_REVISION_DELTAS, </font><font
color="#2a00ff">"true"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_CURRENT_LRU_CAPACITY, </font><font
color="#2a00ff">"10000"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_REVISED_LRU_CAPACITY, </font><font
color="#2a00ff">"10000"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">CDOServerUtil.createRepository</font><font
color="#000000">(</font><font color="#000000">REPOSITORY_NAME, createStore</font ><font
color="#000000">()</font><font color="#000000">, props</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">IStore createStore</font><font color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // You might want to& ;nbsp;create an IDBStore here& ;nbsp;instead if memory is&nb sp;an issue! </font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">StoreUtil.createMEMStore</font><font color="#000000">()</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">EObject getInputModel</font><font color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Category cat1 = Model1Factory.eIN STANCE.createCategory </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.setName</font><font
color="#000000">(</font><font color="#2a00ff">"CAT1"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Category cat2 = Model1Factory.eIN STANCE.createCategory </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat2.setName</font><font
color="#000000">(</font><font color="#2a00ff">"CAT2"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getCategories</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">cat2</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p1 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p1.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P1"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p1</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p2 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p2.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P2"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p2</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p3 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p3.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P3"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat2.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p3</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">cat1;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#000000">}</font></code> </td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --> <br>
It works out of the box here as a Java Application launch config.<br>
<br>
Regards,<br>
Eike Stepper<br>
----<br>
<a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/CDO">http://wiki.eclipse.org/CDO</a><br>
<a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/Net4j">http://wiki.eclipse.org/Net4j</a><br>
<br>
<br>
</body>
</html>
--------------060508000704090200020809--
|
|
|
Re: CDO standalone [message #614340 is a reply to message #110218] |
Wed, 30 January 2008 09:24  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060508000704090200020809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Martin Taal schrieb:
> Hi Eike,
> For the CDO Teneo integration, I can just work with the standalone cdo
> version probably, correct?
Yes, I'd choose the easiest setup: client and server in one vm, start
with a MEMStore and look at its implementation.
>
> I remember that you posted some code for standalone cdo somewhere, can
> you repost it for me?
I think you mean the one I gave Stefan. It's also in CVS:
org.eclipse.emf.cdo.tests.ImportXML
Here's the code:
|/********************************************************** *****************
* Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eike Stepper - initial API and implementation
************************************************************ **************/
*package *org.eclipse.emf.cdo.tests;
*import *org.eclipse.emf.cdo.CDOSession;
*import *org.eclipse.emf.cdo.CDOTransaction;
*import *org.eclipse.emf.cdo.server.CDOServerUtil;
*import *org.eclipse.emf.cdo.server.IRepository;
*import *org.eclipse.emf.cdo.server.IStore;
*import *org.eclipse.emf.cdo.server.StoreUtil;
*import *org.eclipse.emf.cdo.server.IRepository.Props;
*import *org.eclipse.emf.cdo.tests.model1.Category;
*import *org.eclipse.emf.cdo.tests.model1.Model1Factory;
*import *org.eclipse.emf.cdo.tests.model1.Model1Package;
*import *org.eclipse.emf.cdo.tests.model1.Product;
*import *org.eclipse.emf.cdo.util.CDOUtil;
*import *org.eclipse.net4j.Net4jUtil;
*import *org.eclipse.net4j.connector.IConnector;
*import *org.eclipse.net4j.jvm.JVMUtil;
*import *org.eclipse.net4j.util.container.ContainerUtil;
*import *org.eclipse.net4j.util.container.IManagedContainer;
*import *org.eclipse.net4j.util.om.OMPlatform;
*import *org.eclipse.emf.ecore.EObject;
*import *org.eclipse.emf.ecore.resource.Resource;
*import *java.util.HashMap;
*import *java.util.Map;
/**
* @author Eike Stepper
*/
*public class *ImportXML
{
*private static final *String REPOSITORY_NAME = "repo1";
*public static **void *main(String[] args)
{
// Turn on tracing
OMPlatform.INSTANCE.setDebugging(*true*);
// Prepare the standalone infra structure (not needed when running inside Eclipse)
IManagedContainer container = ContainerUtil.createContainer(); // Create a wiring container
Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
JVMUtil.prepareContainer(container); // Prepare the JVM transport
CDOServerUtil.prepareContainer(container); // Prepare the CDO server
CDOUtil.prepareContainer(container, *false*); // Prepare the CDO client
// Start the transport and create a repository
JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
CDOServerUtil.addRepository(container, createRepository()); // Start a CDO respository
// Establish a communications connection and open a session with the repository
IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
CDOSession session = CDOUtil.openSession(connector, REPOSITORY_NAME, *true*);// Open a CDO session
session.getPackageRegistry().putEPackage(Model1Package.eINST ANCE);// Not needed after first commit!!!
CDOTransaction transaction = session.openTransaction();// Open a CDO transaction
Resource resource = transaction.createResource("/my/big/resource");// Create a new EMF resource
// Work normally with the EMF resource
EObject inputModel = getInputModel();
resource.getContents().add(inputModel);
transaction.commit();
session.close();
connector.disconnect();
}
*private static *IRepository createRepository()
{
Map<String, String> props = *new *HashMap<String, String>();
props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "true");
props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
*return *CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
}
*private static *IStore createStore()
{
// You might want to create an IDBStore here instead if memory is an issue!
*return *StoreUtil.createMEMStore();
}
*private static *EObject getInputModel()
{
Category cat1 = Model1Factory.eINSTANCE.createCategory();
cat1.setName("CAT1");
Category cat2 = Model1Factory.eINSTANCE.createCategory();
cat2.setName("CAT2");
cat1.getCategories().add(cat2);
Product p1 = Model1Factory.eINSTANCE.createProduct();
p1.setName("P1");
cat1.getProducts().add(p1);
Product p2 = Model1Factory.eINSTANCE.createProduct();
p2.setName("P2");
cat1.getProducts().add(p2);
Product p3 = Model1Factory.eINSTANCE.createProduct();
p3.setName("P3");
cat2.getProducts().add(p3);
*return *cat1;
}
}|
It works out of the box here as a Java Application launch config.
Regards,
Eike Stepper
----
http://wiki.eclipse.org/CDO
http://wiki.eclipse.org/Net4j
--------------060508000704090200020809
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin Taal schrieb:
<blockquote cite="mid:fnq09p$28r$1@build.eclipse.org" type="cite">Hi
Eike,
<br>
For the CDO Teneo integration, I can just work with the standalone cdo
version probably, correct?
<br>
</blockquote>
Yes, I'd choose the easiest setup: client and server in one vm, start
with a MEMStore and look at its implementation.<br>
<br>
<br>
<blockquote cite="mid:fnq09p$28r$1@build.eclipse.org" type="cite"><br>
I remember that you posted some code for standalone cdo somewhere, can
you repost it for me?
<br>
</blockquote>
I think you mean the one I gave Stefan. It's also in CVS:
org.eclipse.emf.cdo.tests.ImportXML<br>
Here's the code:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#3f5fbf"> /*********************************************************** **************** </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * Copyright (c) 2004 -&a mp;nbsp;2008 Eike Stepper, German y. </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * All rights reserved. T his program and the acco mpanying materials </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * are made available und er the terms of the& nbsp;Eclipse Public License v1.0 </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * which accompanies this  ;distribution, and is available&a mp;nbsp;at </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* <a class="moz-txt-link-freetext" href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* Contributors:</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> * Eike Stepp er - initial API and& ;nbsp;implementation </font><br>
<font color="#ffffff"> </font><font color="#3f5fbf"> ************************************************************ **************/ </font><br>
<font color="#7f0055"><b>package </b></font><font color="#000000">org.eclipse.emf.cdo.tests;</font><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.CDOSession;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.CDOTransaction;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.CDOServerUtil;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IRepository;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IStore;</font> <br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.StoreUtil;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.server.IRepository.Props; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Category; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Model1Factory; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Model1Package; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.tests.model1.Product;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.cdo.util.CDOUtil;</font><br >
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.Net4jUtil;</font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.connector.IConnector;</font ><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.jvm.JVMUtil;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.container.ContainerUtil; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.container.IManagedContainer; </font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.net4j.util.om.OMPlatform;</font ><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.ecore.EObject;</font><br >
<font color="#7f0055"><b>import </b></font><font color="#000000">org.eclipse.emf.ecore.resource.Resource;</font ><br>
<font color="#ffffff"></font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">java.util.HashMap;</font><br>
<font color="#7f0055"><b>import </b></font><font color="#000000">java.util.Map;</font><br>
<font color="#ffffff"></font><br>
<font color="#3f5fbf">/**</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font
color="#7f9fbf">@author </font><font color="#3f5fbf">Eike Stepper</font><br>
<font color="#ffffff"> </font><font color="#3f5fbf">*/</font><br>
<font color="#7f0055"><b>public class </b></font ><font
color="#000000">ImportXML</font><br>
<font color="#000000">{</font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static final </b></font><font
color="#000000">String REPOSITORY_NAME = </font><font color="#2a00ff">"repo1"</font><font
color="#000000">;</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>public static </b></font ><font
color="#7f0055"><b>void </b></font><font color="#000000">main</font><font
color="#000000">(</font><font color="#000000">String</font><font
color="#000000">[] </font><font color="#000000">args</font><font
color="#000000">)</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f">// Turn on tracing </font><br>
<font color="#ffffff"> </font ><font color="#000000">OMPlatform.INSTANCE.setDebugging</font><font
color="#000000">(</font><font color="#7f0055"><b>true</b></font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Prepare the standalone&nbs p;infra structure (not needed& ;nbsp;when running inside Eclipse ) </font><br>
<font color="#ffffff"> </font ><font color="#000000"> IManagedContainer container = Con tainerUtil.createContainer </font><font
color="#000000">()</font><font color="#000000">; </font><font
color="#3f7f5f"> // Create a wiring conta iner </font><br>
<font color="#ffffff"> </font ><font color="#000000">Net4jUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the Net4j ker nel </font><br>
<font color="#ffffff"> </font ><font color="#000000">JVMUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the JVM trans port </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOServerUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container</font><font
color="#000000">)</font><font color="#000000">; </font><font
color="#3f7f5f"> // Prepare the CDO serve r </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOUtil.prepareContainer</font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#7f0055"><b>false</b></font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Prepare the CDO clien t </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Start the transport a nd create a repository </font><br>
<font color="#ffffff"> </font ><font color="#000000">JVMUtil.getAcceptor</font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#2a00ff">"default"</font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Start the JVM transpo rt </font><br>
<font color="#ffffff"> </font ><font color="#000000">CDOServerUtil.addRepository</font><font
color="#000000">(</font><font color="#000000">container, createRepository</font ><font
color="#000000">())</font><font color="#000000">; </font><font
color="#3f7f5f"> // Start a CDO resposito ry </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Establish a communications& ;nbsp;connection and open a&n bsp;session with the repository </font><br>
<font color="#ffffff"> </font ><font color="#000000"> IConnector connector = JVMUtil.ge tConnector </font><font
color="#000000">(</font><font color="#000000">container, </font><font
color="#2a00ff">"default"</font><font color="#000000">)</font><font
color="#000000">; </font><font color="#3f7f5f"> // Open a JVM connection </font><br>
<font color="#ffffff"> </font ><font color="#000000"> CDOSession session = CDOUtil.open Session </font><font
color="#000000">(</font><font color="#000000">connector, REPOSITORY_NAME, </font><font
color="#7f0055"><b>true</b></font><font color="#000000">)</font><font
color="#000000">;</font><font color="#3f7f5f">// Open a CDO session </font><br>
<font color="#ffffff"> </font ><font color="#000000">session.getPackageRegistry</font><font
color="#000000">()</font><font color="#000000">.putEPackage</font><font
color="#000000">(</font><font color="#000000">Model1Package.eINSTANCE</font><font
color="#000000">)</font><font color="#000000">;</font><font
color="#3f7f5f"> // Not needed after firs t commit!!! </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#000000"> CDOTransaction transaction = sess ion.openTransaction </font><font
color="#000000">()</font><font color="#000000">;</font><font
color="#3f7f5f"> // Open a CDO transactio n </font><br>
<font color="#ffffff"> </font ><font color="#000000"> Resource resource = transaction.c reateResource </font><font
color="#000000">(</font><font color="#2a00ff">"/my/big/resource"</font><font
color="#000000">)</font><font color="#000000">;</font><font
color="#3f7f5f"> // Create a new EMF& nbsp;resource </font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // Work normally with th e EMF resource </font><br>
<font color="#ffffff"> </font ><font color="#000000"> EObject inputModel = getInputMode l </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">resource.getContents</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">inputModel</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">transaction.commit</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">session.close</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">connector.disconnect</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">IRepository createRepository</font ><font
color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Map<String, String> props&am p;nbsp;= </font><font
color="#7f0055"><b>new </b></font><font color="#000000">HashMap<String, String> </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_SUPPORTING_REVISION_DELTAS, </font><font
color="#2a00ff">"true"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_CURRENT_LRU_CAPACITY, </font><font
color="#2a00ff">"10000"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">props.put</font><font
color="#000000">(</font><font color="#000000">Props.PROP_REVISED_LRU_CAPACITY, </font><font
color="#2a00ff">"10000"</font><font color="#000000">)</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">CDOServerUtil.createRepository</font><font
color="#000000">(</font><font color="#000000">REPOSITORY_NAME, createStore</font ><font
color="#000000">()</font><font color="#000000">, props</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">IStore createStore</font><font color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#3f7f5f"> // You might want to& ;nbsp;create an IDBStore here& ;nbsp;instead if memory is&nb sp;an issue! </font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">StoreUtil.createMEMStore</font><font color="#000000">()</font><font
color="#000000">;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#ffffff"></font><br>
<font color="#ffffff"> </font><font color="#7f0055"><b>private static </b> </font><font
color="#000000">EObject getInputModel</font><font color="#000000">()</font><br>
<font color="#ffffff"> </font><font color="#000000">{</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Category cat1 = Model1Factory.eIN STANCE.createCategory </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.setName</font><font
color="#000000">(</font><font color="#2a00ff">"CAT1"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Category cat2 = Model1Factory.eIN STANCE.createCategory </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat2.setName</font><font
color="#000000">(</font><font color="#2a00ff">"CAT2"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getCategories</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">cat2</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p1 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p1.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P1"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p1</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p2 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p2.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P2"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat1.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p2</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000"> Product p3 = Model1Factory.eINSTA NCE.createProduct </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">p3.setName</font><font
color="#000000">(</font><font color="#2a00ff">"P3"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#000000">cat2.getProducts</font><font
color="#000000">()</font><font color="#000000">.add</font><font
color="#000000">(</font><font color="#000000">p3</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> </font ><font color="#7f0055"><b>return </b></font><font
color="#000000">cat1;</font><br>
<font color="#ffffff"> </font><font color="#000000">}</font><br>
<font color="#000000">}</font></code> </td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --> <br>
It works out of the box here as a Java Application launch config.<br>
<br>
Regards,<br>
Eike Stepper<br>
----<br>
<a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/CDO">http://wiki.eclipse.org/CDO</a><br>
<a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/Net4j">http://wiki.eclipse.org/Net4j</a><br>
<br>
<br>
</body>
</html>
--------------060508000704090200020809--
|
|
|
Goto Forum:
Current Time: Tue Jul 22 13:58:19 EDT 2025
Powered by FUDForum. Page generated in 0.04120 seconds
|