Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [CDO] Starting server code
[CDO] Starting server code [message #616092] Mon, 07 April 2008 12:12
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Eike!

I do not succeed in setting up a CDO Server. Currently I am doing it the
programmatically way... Some time ago you provided two source files in
this newsgropu where it had been described how to set up the server.

Basically I have two plugins:
CdoServer and CdoClient.
The CdoServer uses the following code:
OMPlatform.INSTANCE.setDebugging(true);
OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOL E);

IManagedContainer container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container);
CDOServerUtil.prepareContainer(container);

// prepare store parameters
IMappingStrategy strategy = CDODBUtil
.createMappingStrategy("horizontal");

Map<String, String> mappingProps = new HashMap<String, String>();
mappingProps.put(MappingStrategy.PROP_MAPPING_PRECEDENCE, "MODEL");
mappingProps.put(MappingStrategy.PROP_TO_ONE_REFERENCE_MAPPI NG,
"LIKE_ATTRIBUTES");
mappingProps.put(MappingStrategy.PROP_TO_MANY_REFERENCE_MAPP ING,
"ONE_TABLE_PER_REFERENCE");

strategy.setProperties(mappingProps);

IDBAdapter adapter = DBUtil.getDBAdapter("derby");

// DataSource dataSource = createEmbeddedDataSource(database);
DataSource dataSource = createClientDataSource(database);
IDBConnectionProvider provider = DBUtil
.createConnectionProvider(dataSource);

// Create a DBStore
IDBStore store = CDODBUtil.createStore(strategy, adapter, provider);
strategy.setStore(store);

// Create a repository
Map<String, String> props = new HashMap<String, String>();
props.put(Props.PROP_SUPPORTING_AUDITS, "true");
props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");// true does
not work
props.put(Props.PROP_VERIFYING_REVISIONS, "false");
props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");

IRepository repository = CDOServerUtil.createRepository(repositoryName,
store, props);

CDOServerUtil.addRepository(container, repository);

The createClientDataSource looks like the following:
private DataSource createClientDataSource(String database) {

ClientDataSource ds = new ClientDataSource();
ds.setDatabaseName(database);
ds.setCreateDatabase("create");

return ds;
}

When starting no log gets printed from the CDO plug-ins! Maybe I do not
know how to enable this behaviour.

The client uses the following connection code:
IManagedContainer container = ContainerUtil.createContainer();

Net4jUtil.prepareContainer(container);
CDOUtil.prepareContainer(container, true);
IAcceptor acceptor = null;

if (kind == ConnectionKind.TCP) {

TCPUtil.prepareContainer(container);

// Start the TCP transport
acceptor = TCPUtil.getAcceptor(container, host);

// Open a TCP connection
connector = TCPUtil.getConnector(container, host);

} else if (kind == ConnectionKind.JVM) {

JVMUtil.prepareContainer(container);

// Start the JVM transport
acceptor = JVMUtil.getAcceptor(container, "default");

// Open a JVM connection
connector = JVMUtil.getConnector(container, "default");

}

CDOSession session = null;

session = CDOUtil.openSession(connector, repository, true);

Variable host and kind are correctly initialized by me.
So when I start the server and the client wants to connect (either JVM or
TCP) the client hangs.
The problem is because the client gets no answer from the server in the
method call OpenSessionRequest.confirming().

So I guess the server is not initialized correctly because he does not
"react".
But the database is sucessfully created by CDO.

What am I doing wrong?!?

Best regards,
Matthias
Previous Topic:EMF Compare Diff Tree customization
Next Topic:[CDO] Starting server code
Goto Forum:
  


Current Time: Sat Jun 19 23:00:38 GMT 2021

Powered by FUDForum. Page generated in 0.01961 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top