Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-01-14 10:27:01 +0000
committerEike Stepper2012-01-14 10:27:01 +0000
commit0266166cb9ff9535c150250073ea1e57b42d2693 (patch)
treec006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.eclipse.emf.cdo.examples/src
parent7416443692cdda72d1f704ea4fc5ececcc669df7 (diff)
downloadcdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java236
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java160
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java182
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java214
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java136
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java1208
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java88
15 files changed, 1231 insertions, 1231 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java
index f621da74a6..9b21aff15b 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java
@@ -1,118 +1,118 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.examples.company.Category;
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.Product;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-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.mem.MEMStoreUtil;
-import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-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
- * @since 4.0
- */
-public class ImportXML
-{
- private static final String REPOSITORY_NAME = "repo1";
-
- public static void main(String[] args) throws CommitException
- {
- // 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
- CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
- CDONet4jUtil.prepareContainer(container); // Prepare the CDO client
- container.activate();
-
- // Start the transport and create a repository
- JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
- CDOServerUtil.addRepository(container, createRepository()); // Start a CDO repository
-
- // Establish a communications connection and open a session with the repository
- IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
- CDOSession session = openSession(connector);// Open a CDO session
-
- 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.close();
- }
-
- private static IRepository createRepository()
- {
- Map<String, String> props = new HashMap<String, String>();
- 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 MEMStoreUtil.createMEMStore();
- }
-
- private static EObject getInputModel()
- {
- Category cat1 = CompanyFactory.eINSTANCE.createCategory();
- cat1.setName("CAT1");
- Category cat2 = CompanyFactory.eINSTANCE.createCategory();
- cat2.setName("CAT2");
- cat1.getCategories().add(cat2);
- Product p1 = CompanyFactory.eINSTANCE.createProduct();
- p1.setName("P1");
- cat1.getProducts().add(p1);
- Product p2 = CompanyFactory.eINSTANCE.createProduct();
- p2.setName("P2");
- cat1.getProducts().add(p2);
- Product p3 = CompanyFactory.eINSTANCE.createProduct();
- p3.setName("P3");
- cat2.getProducts().add(p3);
- return cat1;
- }
-
- protected static CDOSession openSession(IConnector connector)
- {
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName(REPOSITORY_NAME);
- return configuration.openNet4jSession();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.Category;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.Product;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+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.mem.MEMStoreUtil;
+import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+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
+ * @since 4.0
+ */
+public class ImportXML
+{
+ private static final String REPOSITORY_NAME = "repo1";
+
+ public static void main(String[] args) throws CommitException
+ {
+ // 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
+ CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
+ CDONet4jUtil.prepareContainer(container); // Prepare the CDO client
+ container.activate();
+
+ // Start the transport and create a repository
+ JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
+ CDOServerUtil.addRepository(container, createRepository()); // Start a CDO repository
+
+ // Establish a communications connection and open a session with the repository
+ IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
+ CDOSession session = openSession(connector);// Open a CDO session
+
+ 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.close();
+ }
+
+ private static IRepository createRepository()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ 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 MEMStoreUtil.createMEMStore();
+ }
+
+ private static EObject getInputModel()
+ {
+ Category cat1 = CompanyFactory.eINSTANCE.createCategory();
+ cat1.setName("CAT1");
+ Category cat2 = CompanyFactory.eINSTANCE.createCategory();
+ cat2.setName("CAT2");
+ cat1.getCategories().add(cat2);
+ Product p1 = CompanyFactory.eINSTANCE.createProduct();
+ p1.setName("P1");
+ cat1.getProducts().add(p1);
+ Product p2 = CompanyFactory.eINSTANCE.createProduct();
+ p2.setName("P2");
+ cat1.getProducts().add(p2);
+ Product p3 = CompanyFactory.eINSTANCE.createProduct();
+ p3.setName("P3");
+ cat2.getProducts().add(p3);
+ return cat1;
+ }
+
+ protected static CDOSession openSession(IConnector connector)
+ {
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(REPOSITORY_NAME);
+ return configuration.openNet4jSession();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java
index 7d26442c5c..612ec5a4a6 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java
@@ -1,80 +1,80 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.CompanyPackage;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.PrintLogHandler;
-import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * @author Eike Stepper
- */
-public class StandaloneContainerExample
-{
- public static void main(String[] args) throws CommitException
- {
- // Enable logging and tracing
- OMPlatform.INSTANCE.setDebugging(true);
- OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
- OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
-
- // Prepare container
- IManagedContainer container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container); // Register Net4j factories
- TCPUtil.prepareContainer(container); // Register TCP factories
- CDONet4jUtil.prepareContainer(container); // Register CDO factories
- container.activate();
-
- // Create connector
- IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$
-
- // Create configuration
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName("repo1"); //$NON-NLS-1$
-
- // Open session
- CDOSession session = configuration.openNet4jSession();
- session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
-
- // Open transaction
- CDOTransaction transaction = session.openTransaction();
-
- // Get or create resource
- CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
-
- // Work with the resource and commit the transaction
- EObject object = CompanyFactory.eINSTANCE.createCompany();
- resource.getContents().add(object);
- transaction.commit();
-
- // Cleanup
- session.close();
- connector.close();
- container.deactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author Eike Stepper
+ */
+public class StandaloneContainerExample
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare container
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+ container.activate();
+
+ // Create connector
+ IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java
index e9a11634b7..e84e5a4559 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java
@@ -1,91 +1,91 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.CompanyPackage;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.tcp.ssl.SSLUtil;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.PrintLogHandler;
-import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class StandaloneContainerExampleSSL
-{
- public static void main(String[] args) throws CommitException
- {
- // Enable logging and tracing
- OMPlatform.INSTANCE.setDebugging(true);
- OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
- OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
-
- // Prepare container
- IManagedContainer container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container); // Register Net4j factories
- SSLUtil.prepareContainer(container);
- CDONet4jUtil.prepareContainer(container); // Register CDO factories
- container.activate();
-
- // Create connector
- IConnector connector = SSLUtil.getConnector(container, "localhost:2036");
-
- // Create configuration
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName("repo1"); //$NON-NLS-1$
-
- // Open session
- CDOSession session = configuration.openNet4jSession();
- session.options().setGeneratedPackageEmulationEnabled(true);
-
- session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
-
- // Open transaction
- CDOTransaction transaction = session.openTransaction();
-
- // Read whatetever is there
- TreeIterator<EObject> iter = transaction.getRootResource().getAllContents();
- while (iter.hasNext())
- {
- System.out.println("---> It's a " + iter.next().eClass().getName());
- }
-
- // Get or create resource
- CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
-
- // Work with the resource and commit the transaction
- EObject object = CompanyFactory.eINSTANCE.createCompany();
- resource.getContents().add(object);
- transaction.commit();
-
- // Cleanup
- session.close();
- connector.close();
- container.deactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.ssl.SSLUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class StandaloneContainerExampleSSL
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare container
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ SSLUtil.prepareContainer(container);
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+ container.activate();
+
+ // Create connector
+ IConnector connector = SSLUtil.getConnector(container, "localhost:2036");
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.options().setGeneratedPackageEmulationEnabled(true);
+
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Read whatetever is there
+ TreeIterator<EObject> iter = transaction.getRootResource().getAllContents();
+ while (iter.hasNext())
+ {
+ System.out.println("---> It's a " + iter.next().eClass().getName());
+ }
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java
index 1a8476648c..7b3b983a8d 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java
@@ -1,107 +1,107 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.CompanyPackage;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.FactoriesProtocolProvider;
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.buffer.IBufferProvider;
-import org.eclipse.net4j.protocol.IProtocolProvider;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.PrintLogHandler;
-import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
-
-import org.eclipse.emf.ecore.EObject;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * @author Eike Stepper
- */
-public class StandaloneManualExample
-{
- public static void main(String[] args) throws CommitException
- {
- // Enable logging and tracing
- OMPlatform.INSTANCE.setDebugging(true);
- OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
- OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
-
- // Prepare receiveExecutor
- final ThreadGroup threadGroup = new ThreadGroup("net4j"); //$NON-NLS-1$
- ExecutorService receiveExecutor = Executors.newCachedThreadPool(new ThreadFactory()
- {
- public Thread newThread(Runnable r)
- {
- Thread thread = new Thread(threadGroup, r);
- thread.setDaemon(true);
- return thread;
- }
- });
-
- // Prepare bufferProvider
- IBufferProvider bufferProvider = Net4jUtil.createBufferPool();
- LifecycleUtil.activate(bufferProvider);
-
- IProtocolProvider protocolProvider = new FactoriesProtocolProvider(
- new org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocolFactory());
-
- // Prepare selector
- org.eclipse.net4j.internal.tcp.TCPSelector selector = new org.eclipse.net4j.internal.tcp.TCPSelector();
- selector.activate();
-
- // Prepare connector
- org.eclipse.net4j.internal.tcp.TCPClientConnector connector = new org.eclipse.net4j.internal.tcp.TCPClientConnector();
- connector.getConfig().setBufferProvider(bufferProvider);
- connector.getConfig().setReceiveExecutor(receiveExecutor);
- connector.getConfig().setProtocolProvider(protocolProvider);
- connector.getConfig().setNegotiator(null);
- connector.setSelector(selector);
- connector.setHost("localhost"); //$NON-NLS-1$
- connector.setPort(2036);
- connector.activate();
-
- // Create configuration
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName("repo1"); //$NON-NLS-1$
-
- // Open session
- CDOSession session = configuration.openNet4jSession();
- session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
-
- // Open transaction
- CDOTransaction transaction = session.openTransaction();
-
- // Get or create resource
- CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
-
- // Work with the resource and commit the transaction
- EObject object = CompanyFactory.eINSTANCE.createCompany();
- resource.getContents().add(object);
- transaction.commit();
-
- // Cleanup
- session.close();
- connector.deactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.FactoriesProtocolProvider;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.buffer.IBufferProvider;
+import org.eclipse.net4j.protocol.IProtocolProvider;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class StandaloneManualExample
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare receiveExecutor
+ final ThreadGroup threadGroup = new ThreadGroup("net4j"); //$NON-NLS-1$
+ ExecutorService receiveExecutor = Executors.newCachedThreadPool(new ThreadFactory()
+ {
+ public Thread newThread(Runnable r)
+ {
+ Thread thread = new Thread(threadGroup, r);
+ thread.setDaemon(true);
+ return thread;
+ }
+ });
+
+ // Prepare bufferProvider
+ IBufferProvider bufferProvider = Net4jUtil.createBufferPool();
+ LifecycleUtil.activate(bufferProvider);
+
+ IProtocolProvider protocolProvider = new FactoriesProtocolProvider(
+ new org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocolFactory());
+
+ // Prepare selector
+ org.eclipse.net4j.internal.tcp.TCPSelector selector = new org.eclipse.net4j.internal.tcp.TCPSelector();
+ selector.activate();
+
+ // Prepare connector
+ org.eclipse.net4j.internal.tcp.TCPClientConnector connector = new org.eclipse.net4j.internal.tcp.TCPClientConnector();
+ connector.getConfig().setBufferProvider(bufferProvider);
+ connector.getConfig().setReceiveExecutor(receiveExecutor);
+ connector.getConfig().setProtocolProvider(protocolProvider);
+ connector.getConfig().setNegotiator(null);
+ connector.setSelector(selector);
+ connector.setHost("localhost"); //$NON-NLS-1$
+ connector.setPort(2036);
+ connector.activate();
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java
index 7c94f97dda..532f6232dd 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java
@@ -1,68 +1,68 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.CompanyPackage;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.PrintLogHandler;
-import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class TransactionMonitoring
-{
- public static void main(String[] args) throws CommitException
- {
- OMPlatform.INSTANCE.setDebugging(true);
- OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
- OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
-
- IManagedContainer container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container);
- TCPUtil.prepareContainer(container);
- CDONet4jUtil.prepareContainer(container);
- container.activate();
-
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(TCPUtil.getConnector(container, "localhost"));
- configuration.setRepositoryName("repo1");
-
- CDOSession session = configuration.openNet4jSession();
- session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
-
- CDOTransaction transaction = session.openTransaction();
- Resource resource = transaction.createResource("/my/big/resource");
- resource.getContents().add(CompanyFactory.eINSTANCE.createCompany());
- transaction.commit();
-
- System.out.println();
- System.out.println("FINISHED");
- System.out.println();
-
- session.close();
- container.deactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class TransactionMonitoring
+{
+ public static void main(String[] args) throws CommitException
+ {
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container);
+ TCPUtil.prepareContainer(container);
+ CDONet4jUtil.prepareContainer(container);
+ container.activate();
+
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(TCPUtil.getConnector(container, "localhost"));
+ configuration.setRepositoryName("repo1");
+
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ CDOTransaction transaction = session.openTransaction();
+ Resource resource = transaction.createResource("/my/big/resource");
+ resource.getContents().add(CompanyFactory.eINSTANCE.createCompany());
+ transaction.commit();
+
+ System.out.println();
+ System.out.println("FINISHED");
+ System.out.println();
+
+ session.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java
index eb9f02d074..dc5d4d52a3 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.net4j.CDONet4jSession;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.util.container.IPluginContainer;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public class VariousExamples
-{
- public static void openSessionAndUseTransaction() throws CommitException
- {
- ResourceSet resourceSet = new ResourceSetImpl();
- IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", "repos.foo.org:2036");
-
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName("MyRepo");
-
- CDONet4jSession session = configuration.openNet4jSession();
- CDOTransaction transaction = session.openTransaction(resourceSet);
-
- // Work with the resource set....
- transaction.commit();
- session.close();
- }
-
- public static void registerSessionWithPluginContainer() throws CommitException
- {
- CDONet4jSession session = (CDONet4jSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions",
- "cdo", "tcp://repos.foo.org:2036/MyRepo");
- CDOTransaction transaction = session.openTransaction();
- // ...
- transaction.commit();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.container.IPluginContainer;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class VariousExamples
+{
+ public static void openSessionAndUseTransaction() throws CommitException
+ {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", "repos.foo.org:2036");
+
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("MyRepo");
+
+ CDONet4jSession session = configuration.openNet4jSession();
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+
+ // Work with the resource set....
+ transaction.commit();
+ session.close();
+ }
+
+ public static void registerSessionWithPluginContainer() throws CommitException
+ {
+ CDONet4jSession session = (CDONet4jSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions",
+ "cdo", "tcp://repos.foo.org:2036/MyRepo");
+ CDOTransaction transaction = session.openTransaction();
+ // ...
+ transaction.commit();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java
index 3cacc5c365..526cf8831c 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java
@@ -1,56 +1,56 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples;
-
-import org.eclipse.emf.cdo.examples.company.Company;
-import org.eclipse.emf.cdo.examples.company.CompanyPackage;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public class Webinar20090129
-{
- private static final EPackage MODEL = CompanyPackage.eINSTANCE;
-
- public static void xmlSetup() throws IOException
- {
- ResourceSet rs = new ResourceSetImpl();
- rs.getResourceFactoryRegistry().getExtensionToFactoryMap() //
- .put("xml", new XMLResourceFactoryImpl()); //$NON-NLS-1$
- rs.getPackageRegistry().put(MODEL.getNsURI(), MODEL);
-
- URI uri = URI.createFileURI("C:/business/company.xml"); //$NON-NLS-1$
- Resource resource = rs.getResource(uri, true);
- resource.setTrackingModification(true);
-
- Company company = (Company)resource.getContents().get(0);
- executeBusinessLogic(company);
-
- if (resource.isModified())
- {
- resource.save(null);
- }
- }
-
- private static void executeBusinessLogic(Company company)
- {
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.Company;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class Webinar20090129
+{
+ private static final EPackage MODEL = CompanyPackage.eINSTANCE;
+
+ public static void xmlSetup() throws IOException
+ {
+ ResourceSet rs = new ResourceSetImpl();
+ rs.getResourceFactoryRegistry().getExtensionToFactoryMap() //
+ .put("xml", new XMLResourceFactoryImpl()); //$NON-NLS-1$
+ rs.getPackageRegistry().put(MODEL.getNsURI(), MODEL);
+
+ URI uri = URI.createFileURI("C:/business/company.xml"); //$NON-NLS-1$
+ Resource resource = rs.getResource(uri, true);
+ resource.setTrackingModification(true);
+
+ Company company = (Company)resource.getContents().get(0);
+ executeBusinessLogic(company);
+
+ if (resource.isModified())
+ {
+ resource.save(null);
+ }
+ }
+
+ private static void executeBusinessLogic(Company company)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
index b3c844049f..a92b0981f0 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java
@@ -1,604 +1,604 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.examples.server;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository.Type;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
-import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
-import org.eclipse.emf.cdo.examples.company.CompanyFactory;
-import org.eclipse.emf.cdo.examples.company.Customer;
-import org.eclipse.emf.cdo.net4j.CDONet4jSession;
-import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.net4j.CDOSessionRecoveryEvent;
-import org.eclipse.emf.cdo.server.CDOServerUtil;
-import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.IRepositorySynchronizer;
-import org.eclipse.emf.cdo.server.IStore;
-import org.eclipse.emf.cdo.server.ISynchronizableRepository;
-import org.eclipse.emf.cdo.server.db.CDODBUtil;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
-import org.eclipse.emf.cdo.server.net4j.FailoverAgent;
-import org.eclipse.emf.cdo.server.net4j.FailoverMonitor;
-import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol;
-import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
-import org.eclipse.emf.cdo.spi.server.InternalFailoverParticipant;
-import org.eclipse.emf.cdo.spi.server.InternalRepository;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.IDBConnectionProvider;
-import org.eclipse.net4j.db.h2.H2Adapter;
-import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.util.container.ContainerEventAdapter;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.PrintLogHandler;
-
-import org.h2.jdbcx.JdbcDataSource;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public abstract class FailoverExample
-{
- public static final String TRANSPORT_TYPE = "tcp";
-
- protected int port;
-
- protected String name;
-
- protected transient IManagedContainer container;
-
- protected transient IRepository repository;
-
- protected transient IAcceptor acceptor;
-
- static
- {
- // OMPlatform.INSTANCE.setDebugging(true);
- // OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
- OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
- }
-
- public FailoverExample()
- {
- container = createContainer();
- }
-
- public static IManagedContainer createContainer()
- {
- IManagedContainer container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container); // Register Net4j factories
- TCPUtil.prepareContainer(container); // Register TCP factories
- CDONet4jUtil.prepareContainer(container); // Register CDO client factories
- CDONet4jServerUtil.prepareContainer(container); // Register CDO server factories
- container.activate();
- return container;
- }
-
- public void init()
- {
- IStore store = createStore();
- Map<String, String> props = createProperties();
-
- repository = createRepository(store, props);
- CDOServerUtil.addRepository(container, repository);
-
- repository.addListener(new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof RepositoryTypeChangedEvent)
- {
- RepositoryTypeChangedEvent e = (RepositoryTypeChangedEvent)event;
- System.out.println("Type changed to " + e.getNewType());
- }
- else if (event instanceof RepositoryStateChangedEvent)
- {
- RepositoryStateChangedEvent e = (RepositoryStateChangedEvent)event;
- System.out.println("State changed to " + e.getNewState());
- }
- }
- });
-
- connect();
- }
-
- public void run() throws Exception
- {
- for (;;)
- {
- System.out.println();
- System.out.println("Enter a command:");
- showMenu();
- System.out.println();
-
- String command = new BufferedReader(new InputStreamReader(System.in)).readLine();
- if (handleCommand(command))
- {
- break;
- }
- }
- }
-
- public void done()
- {
- LifecycleUtil.deactivate(acceptor);
- LifecycleUtil.deactivate(repository);
- container.deactivate();
- }
-
- protected void showMenu()
- {
- System.out.println("0 - exit");
- System.out.println("1 - connect repository to network");
- System.out.println("2 - disconnect repository from network");
- System.out.println("3 - dump repository infos");
- }
-
- protected boolean handleCommand(String command)
- {
- if ("1".equals(command))
- {
- if (acceptor == null)
- {
- connect();
- }
- else
- {
- System.out.println("Already connected");
- }
- }
- else if ("2".equals(command))
- {
- if (acceptor != null)
- {
- disconnect();
- }
- else
- {
- System.out.println("Already disconnected");
- }
- }
- else if ("3".equals(command))
- {
- System.out.println();
- System.out.println(repository.getName() + ": " + repository.getType()
- + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : ""));
- }
- else if ("0".equals(command))
- {
- System.out.println("Exiting...");
- return true;
- }
- else
- {
- System.out.println("Unknown command");
- }
-
- return false;
- }
-
- protected void connect()
- {
- System.out.println("Connecting to network...");
- acceptor = createAcceptor();
- System.out.println("Connected");
- }
-
- protected void disconnect()
- {
- System.out.println("Disconnecting from network...");
- LifecycleUtil.deactivate(acceptor);
- acceptor = null;
- System.out.println("Disconnected");
- }
-
- protected IStore createStore()
- {
- JdbcDataSource dataSource = new JdbcDataSource();
- dataSource.setURL("jdbc:h2:_database/" + name);
-
- IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
- IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
- return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
- }
-
- protected Map<String, String> createProperties()
- {
- Map<String, String> props = new HashMap<String, String>();
- props.put(IRepository.Props.OVERRIDE_UUID, name);
- props.put(IRepository.Props.SUPPORTING_AUDITS, "true");
- props.put(IRepository.Props.SUPPORTING_BRANCHES, "true");
- return props;
- }
-
- protected abstract IRepository createRepository(IStore store, Map<String, String> props);
-
- protected IAcceptor createAcceptor()
- {
- return (IAcceptor)container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + port);
- }
-
- protected IConnector createConnector(String description)
- {
- return Net4jUtil.getConnector(container, TRANSPORT_TYPE, description);
- }
-
- protected IRepositorySynchronizer createRepositorySynchronizer(IConnector connector, String repositoryName)
- {
- CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connector, repositoryName);
-
- IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
- synchronizer.setRetryInterval(2);
- synchronizer.setRawReplication(true);
- synchronizer.setMaxRecommits(10);
- synchronizer.setRecommitInterval(2);
- return synchronizer;
- }
-
- protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final IConnector connector,
- final String repositoryName)
- {
- return new CDOSessionConfigurationFactory()
- {
- public CDONet4jSessionConfiguration createSessionConfiguration()
- {
- return FailoverExample.this.createSessionConfiguration(connector, repositoryName);
- }
- };
- }
-
- protected CDONet4jSessionConfiguration createSessionConfiguration(IConnector connector, String repositoryName)
- {
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
- configuration.setConnector(connector);
- configuration.setRepositoryName(repositoryName);
- configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP));
- return configuration;
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Unmonitored extends FailoverExample
- {
- protected boolean master;
-
- protected String peerHost;
-
- protected int peerPort;
-
- protected String peerRepository;
-
- public Unmonitored(int port, String name, boolean master, String peerHost, int peerPort, String peerRepository)
- {
- this.port = port;
- this.name = name;
- this.master = master;
- this.peerHost = peerHost;
- this.peerPort = peerPort;
- this.peerRepository = peerRepository;
- }
-
- @Override
- protected IRepository createRepository(IStore store, Map<String, String> props)
- {
- IConnector connector = createConnector(peerHost + ":" + peerPort);
- IRepositorySynchronizer synchronizer = createRepositorySynchronizer(connector, peerRepository);
- return CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer, master);
- }
-
- @Override
- protected void showMenu()
- {
- super.showMenu();
- System.out.println("4 - set repository type MASTER");
- System.out.println("5 - set repository type BACKUP");
- }
-
- @Override
- protected boolean handleCommand(String command)
- {
- if ("4".equals(command))
- {
- if (repository.getType() == Type.BACKUP)
- {
- System.out.println("Setting repository type MASTER...");
- ((InternalRepository)repository).setType(Type.MASTER);
- System.out.println("Type is " + repository.getType());
- }
- else
- {
- System.out.println("Already MASTER");
- }
- }
- else if ("5".equals(command))
- {
- if (repository.getType() == Type.MASTER)
- {
- System.out.println("Setting repository type BACKUP...");
- ((InternalRepository)repository).setType(Type.BACKUP);
- System.out.println("Type is " + repository.getType());
- }
- else
- {
- System.out.println("Already BACKUP");
- }
- }
- else
- {
- return super.handleCommand(command);
- }
-
- return false;
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class InitialMaster extends Unmonitored
- {
- public InitialMaster()
- {
- super(2036, "repo1", true, "localhost", 2037, "repo2");
- }
-
- public static void main(String[] args) throws Exception
- {
- FailoverExample example = new InitialMaster();
- example.init();
- example.run();
- example.done();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class InitialBackup extends Unmonitored
- {
- public InitialBackup()
- {
- super(2037, "repo2", false, "localhost", 2036, "repo1");
- }
-
- public static void main(String[] args) throws Exception
- {
- FailoverExample example = new InitialBackup();
- example.init();
- example.run();
- example.done();
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Monitored extends FailoverExample
- {
- public static final String REPOSITORY_GROUP = "ExampleGroup";
-
- // public static final String REPOSITORY_MONITOR_HOST = "92.231.107.180";
-
- public static final String REPOSITORY_MONITOR_HOST = "localhost";
-
- public static final int REPOSITORY_MONITOR_PORT = 2038;
-
- protected String host;
-
- public Monitored(String host, int port, String name)
- {
- this.host = host;
- this.port = port;
- this.name = name;
- }
-
- @Override
- protected IRepository createRepository(IStore store, Map<String, String> props)
- {
- ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props);
- ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
-
- FailoverAgent agent = new FailoverAgent()
- {
- @Override
- protected org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration(
- String connectorDescription, String repositoryName)
- {
- IConnector connector = createConnector(connectorDescription);
- return Monitored.this.createSessionConfiguration(connector, repositoryName);
- }
-
- @Override
- protected IManagedContainer getContainer()
- {
- return container;
- }
- };
-
- agent.setMonitorConnector(createConnector(REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT));
- agent.setConnectorDescription(host + ":" + port);
- agent.setRepository(repository);
- agent.setGroup(REPOSITORY_GROUP);
- agent.setRate(1000L);
- agent.setTimeout(4000L);
- agent.activate();
-
- return repository;
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Monitor
- {
- public static void main(String[] args) throws Exception
- {
- IManagedContainer container = createContainer();
- FailoverMonitor monitor = (FailoverMonitor)container.getElement(FailoverMonitor.PRODUCT_GROUP, "net4j",
- REPOSITORY_GROUP);
-
- monitor.addListener(new ContainerEventAdapter<AgentProtocol>()
- {
- @Override
- protected void onAdded(IContainer<AgentProtocol> monitor, AgentProtocol agent)
- {
- dump((FailoverMonitor)monitor, "Registered", agent);
- }
-
- @Override
- protected void onRemoved(IContainer<AgentProtocol> monitor, AgentProtocol agent)
- {
- dump((FailoverMonitor)monitor, "Deregistered", agent);
- }
-
- private void dump(FailoverMonitor monitor, String event, AgentProtocol agent)
- {
- System.out.println(event + " agent " + agent);
- for (AgentProtocol element : monitor.getElements())
- {
- String type = element == monitor.getMasterAgent() ? "MASTER: " : "BACKUP: ";
- System.out.println(" " + type + element);
- }
- }
- });
-
- container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + REPOSITORY_MONITOR_PORT);
- System.out.println("Monitoring...");
-
- for (;;)
- {
- Thread.sleep(100);
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Agent1 extends Monitored
- {
- public Agent1()
- {
- super("localhost", 2036, "repo1");
- }
-
- public static void main(String[] args) throws Exception
- {
- FailoverExample example = new Agent1();
- example.init();
- example.run();
- example.done();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Agent2 extends Monitored
- {
- public Agent2()
- {
- super("localhost", 2037, "repo2");
- }
-
- public static void main(String[] args) throws Exception
- {
- FailoverExample example = new Agent2();
- example.init();
- example.run();
- example.done();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Client
- {
- public static void main(String[] args) throws Exception
- {
- IManagedContainer container = createContainer();
- CDONet4jSessionConfiguration configuration = CDONet4jUtil.createFailoverSessionConfiguration(
- REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT, REPOSITORY_GROUP, container);
-
- final CDONet4jSession session = configuration.openNet4jSession();
- System.out.println("Connected");
-
- final CDOTransaction tx = session.openTransaction();
- addObject(tx);
- System.out.println("Succesfully committed an object to the original tx/session");
-
- session.addListener(new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof CDOSessionRecoveryEvent)
- {
- CDOSessionRecoveryEvent e = (CDOSessionRecoveryEvent)event;
- System.out.println("Failover " + e.getType() + ": " + e.getSource().getRepositoryInfo());
-
- if (e.getType() == CDOSessionRecoveryEvent.Type.FINISHED)
- {
- // Let's see if the TX in the failed-over session is usable:
- //
- addObject(tx);
- System.out.println("Succesfully committed an object to the failed-over tx/session");
- }
- }
- }
- });
-
- while (!session.isClosed())
- {
- Thread.sleep(100);
- }
- }
-
- private static void addObject(CDOTransaction tx)
- {
- try
- {
- Customer customer = CompanyFactory.eINSTANCE.createCustomer();
- tx.getOrCreateResource("/r1").getContents().add(customer);
- tx.commit();
- }
- catch (CommitException x)
- {
- throw new RuntimeException(x);
- }
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.examples.server;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository.Type;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
+import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.Customer;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.net4j.CDOSessionRecoveryEvent;
+import org.eclipse.emf.cdo.server.CDOServerUtil;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IRepositorySynchronizer;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.ISynchronizableRepository;
+import org.eclipse.emf.cdo.server.db.CDODBUtil;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
+import org.eclipse.emf.cdo.server.net4j.FailoverAgent;
+import org.eclipse.emf.cdo.server.net4j.FailoverMonitor;
+import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol;
+import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.server.InternalFailoverParticipant;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.acceptor.IAcceptor;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.db.h2.H2Adapter;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerEventAdapter;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+
+import org.h2.jdbcx.JdbcDataSource;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public abstract class FailoverExample
+{
+ public static final String TRANSPORT_TYPE = "tcp";
+
+ protected int port;
+
+ protected String name;
+
+ protected transient IManagedContainer container;
+
+ protected transient IRepository repository;
+
+ protected transient IAcceptor acceptor;
+
+ static
+ {
+ // OMPlatform.INSTANCE.setDebugging(true);
+ // OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ }
+
+ public FailoverExample()
+ {
+ container = createContainer();
+ }
+
+ public static IManagedContainer createContainer()
+ {
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO client factories
+ CDONet4jServerUtil.prepareContainer(container); // Register CDO server factories
+ container.activate();
+ return container;
+ }
+
+ public void init()
+ {
+ IStore store = createStore();
+ Map<String, String> props = createProperties();
+
+ repository = createRepository(store, props);
+ CDOServerUtil.addRepository(container, repository);
+
+ repository.addListener(new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof RepositoryTypeChangedEvent)
+ {
+ RepositoryTypeChangedEvent e = (RepositoryTypeChangedEvent)event;
+ System.out.println("Type changed to " + e.getNewType());
+ }
+ else if (event instanceof RepositoryStateChangedEvent)
+ {
+ RepositoryStateChangedEvent e = (RepositoryStateChangedEvent)event;
+ System.out.println("State changed to " + e.getNewState());
+ }
+ }
+ });
+
+ connect();
+ }
+
+ public void run() throws Exception
+ {
+ for (;;)
+ {
+ System.out.println();
+ System.out.println("Enter a command:");
+ showMenu();
+ System.out.println();
+
+ String command = new BufferedReader(new InputStreamReader(System.in)).readLine();
+ if (handleCommand(command))
+ {
+ break;
+ }
+ }
+ }
+
+ public void done()
+ {
+ LifecycleUtil.deactivate(acceptor);
+ LifecycleUtil.deactivate(repository);
+ container.deactivate();
+ }
+
+ protected void showMenu()
+ {
+ System.out.println("0 - exit");
+ System.out.println("1 - connect repository to network");
+ System.out.println("2 - disconnect repository from network");
+ System.out.println("3 - dump repository infos");
+ }
+
+ protected boolean handleCommand(String command)
+ {
+ if ("1".equals(command))
+ {
+ if (acceptor == null)
+ {
+ connect();
+ }
+ else
+ {
+ System.out.println("Already connected");
+ }
+ }
+ else if ("2".equals(command))
+ {
+ if (acceptor != null)
+ {
+ disconnect();
+ }
+ else
+ {
+ System.out.println("Already disconnected");
+ }
+ }
+ else if ("3".equals(command))
+ {
+ System.out.println();
+ System.out.println(repository.getName() + ": " + repository.getType()
+ + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : ""));
+ }
+ else if ("0".equals(command))
+ {
+ System.out.println("Exiting...");
+ return true;
+ }
+ else
+ {
+ System.out.println("Unknown command");
+ }
+
+ return false;
+ }
+
+ protected void connect()
+ {
+ System.out.println("Connecting to network...");
+ acceptor = createAcceptor();
+ System.out.println("Connected");
+ }
+
+ protected void disconnect()
+ {
+ System.out.println("Disconnecting from network...");
+ LifecycleUtil.deactivate(acceptor);
+ acceptor = null;
+ System.out.println("Disconnected");
+ }
+
+ protected IStore createStore()
+ {
+ JdbcDataSource dataSource = new JdbcDataSource();
+ dataSource.setURL("jdbc:h2:_database/" + name);
+
+ IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
+ IDBAdapter dbAdapter = new H2Adapter();
+ IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
+ }
+
+ protected Map<String, String> createProperties()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IRepository.Props.OVERRIDE_UUID, name);
+ props.put(IRepository.Props.SUPPORTING_AUDITS, "true");
+ props.put(IRepository.Props.SUPPORTING_BRANCHES, "true");
+ return props;
+ }
+
+ protected abstract IRepository createRepository(IStore store, Map<String, String> props);
+
+ protected IAcceptor createAcceptor()
+ {
+ return (IAcceptor)container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + port);
+ }
+
+ protected IConnector createConnector(String description)
+ {
+ return Net4jUtil.getConnector(container, TRANSPORT_TYPE, description);
+ }
+
+ protected IRepositorySynchronizer createRepositorySynchronizer(IConnector connector, String repositoryName)
+ {
+ CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connector, repositoryName);
+
+ IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
+ synchronizer.setRetryInterval(2);
+ synchronizer.setRawReplication(true);
+ synchronizer.setMaxRecommits(10);
+ synchronizer.setRecommitInterval(2);
+ return synchronizer;
+ }
+
+ protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final IConnector connector,
+ final String repositoryName)
+ {
+ return new CDOSessionConfigurationFactory()
+ {
+ public CDONet4jSessionConfiguration createSessionConfiguration()
+ {
+ return FailoverExample.this.createSessionConfiguration(connector, repositoryName);
+ }
+ };
+ }
+
+ protected CDONet4jSessionConfiguration createSessionConfiguration(IConnector connector, String repositoryName)
+ {
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(repositoryName);
+ configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP));
+ return configuration;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Unmonitored extends FailoverExample
+ {
+ protected boolean master;
+
+ protected String peerHost;
+
+ protected int peerPort;
+
+ protected String peerRepository;
+
+ public Unmonitored(int port, String name, boolean master, String peerHost, int peerPort, String peerRepository)
+ {
+ this.port = port;
+ this.name = name;
+ this.master = master;
+ this.peerHost = peerHost;
+ this.peerPort = peerPort;
+ this.peerRepository = peerRepository;
+ }
+
+ @Override
+ protected IRepository createRepository(IStore store, Map<String, String> props)
+ {
+ IConnector connector = createConnector(peerHost + ":" + peerPort);
+ IRepositorySynchronizer synchronizer = createRepositorySynchronizer(connector, peerRepository);
+ return CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer, master);
+ }
+
+ @Override
+ protected void showMenu()
+ {
+ super.showMenu();
+ System.out.println("4 - set repository type MASTER");
+ System.out.println("5 - set repository type BACKUP");
+ }
+
+ @Override
+ protected boolean handleCommand(String command)
+ {
+ if ("4".equals(command))
+ {
+ if (repository.getType() == Type.BACKUP)
+ {
+ System.out.println("Setting repository type MASTER...");
+ ((InternalRepository)repository).setType(Type.MASTER);
+ System.out.println("Type is " + repository.getType());
+ }
+ else
+ {
+ System.out.println("Already MASTER");
+ }
+ }
+ else if ("5".equals(command))
+ {
+ if (repository.getType() == Type.MASTER)
+ {
+ System.out.println("Setting repository type BACKUP...");
+ ((InternalRepository)repository).setType(Type.BACKUP);
+ System.out.println("Type is " + repository.getType());
+ }
+ else
+ {
+ System.out.println("Already BACKUP");
+ }
+ }
+ else
+ {
+ return super.handleCommand(command);
+ }
+
+ return false;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class InitialMaster extends Unmonitored
+ {
+ public InitialMaster()
+ {
+ super(2036, "repo1", true, "localhost", 2037, "repo2");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new InitialMaster();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class InitialBackup extends Unmonitored
+ {
+ public InitialBackup()
+ {
+ super(2037, "repo2", false, "localhost", 2036, "repo1");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new InitialBackup();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Monitored extends FailoverExample
+ {
+ public static final String REPOSITORY_GROUP = "ExampleGroup";
+
+ // public static final String REPOSITORY_MONITOR_HOST = "92.231.107.180";
+
+ public static final String REPOSITORY_MONITOR_HOST = "localhost";
+
+ public static final int REPOSITORY_MONITOR_PORT = 2038;
+
+ protected String host;
+
+ public Monitored(String host, int port, String name)
+ {
+ this.host = host;
+ this.port = port;
+ this.name = name;
+ }
+
+ @Override
+ protected IRepository createRepository(IStore store, Map<String, String> props)
+ {
+ ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props);
+ ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
+
+ FailoverAgent agent = new FailoverAgent()
+ {
+ @Override
+ protected org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration(
+ String connectorDescription, String repositoryName)
+ {
+ IConnector connector = createConnector(connectorDescription);
+ return Monitored.this.createSessionConfiguration(connector, repositoryName);
+ }
+
+ @Override
+ protected IManagedContainer getContainer()
+ {
+ return container;
+ }
+ };
+
+ agent.setMonitorConnector(createConnector(REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT));
+ agent.setConnectorDescription(host + ":" + port);
+ agent.setRepository(repository);
+ agent.setGroup(REPOSITORY_GROUP);
+ agent.setRate(1000L);
+ agent.setTimeout(4000L);
+ agent.activate();
+
+ return repository;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Monitor
+ {
+ public static void main(String[] args) throws Exception
+ {
+ IManagedContainer container = createContainer();
+ FailoverMonitor monitor = (FailoverMonitor)container.getElement(FailoverMonitor.PRODUCT_GROUP, "net4j",
+ REPOSITORY_GROUP);
+
+ monitor.addListener(new ContainerEventAdapter<AgentProtocol>()
+ {
+ @Override
+ protected void onAdded(IContainer<AgentProtocol> monitor, AgentProtocol agent)
+ {
+ dump((FailoverMonitor)monitor, "Registered", agent);
+ }
+
+ @Override
+ protected void onRemoved(IContainer<AgentProtocol> monitor, AgentProtocol agent)
+ {
+ dump((FailoverMonitor)monitor, "Deregistered", agent);
+ }
+
+ private void dump(FailoverMonitor monitor, String event, AgentProtocol agent)
+ {
+ System.out.println(event + " agent " + agent);
+ for (AgentProtocol element : monitor.getElements())
+ {
+ String type = element == monitor.getMasterAgent() ? "MASTER: " : "BACKUP: ";
+ System.out.println(" " + type + element);
+ }
+ }
+ });
+
+ container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + REPOSITORY_MONITOR_PORT);
+ System.out.println("Monitoring...");
+
+ for (;;)
+ {
+ Thread.sleep(100);
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Agent1 extends Monitored
+ {
+ public Agent1()
+ {
+ super("localhost", 2036, "repo1");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new Agent1();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Agent2 extends Monitored
+ {
+ public Agent2()
+ {
+ super("localhost", 2037, "repo2");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new Agent2();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Client
+ {
+ public static void main(String[] args) throws Exception
+ {
+ IManagedContainer container = createContainer();
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createFailoverSessionConfiguration(
+ REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT, REPOSITORY_GROUP, container);
+
+ final CDONet4jSession session = configuration.openNet4jSession();
+ System.out.println("Connected");
+
+ final CDOTransaction tx = session.openTransaction();
+ addObject(tx);
+ System.out.println("Succesfully committed an object to the original tx/session");
+
+ session.addListener(new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof CDOSessionRecoveryEvent)
+ {
+ CDOSessionRecoveryEvent e = (CDOSessionRecoveryEvent)event;
+ System.out.println("Failover " + e.getType() + ": " + e.getSource().getRepositoryInfo());
+
+ if (e.getType() == CDOSessionRecoveryEvent.Type.FINISHED)
+ {
+ // Let's see if the TX in the failed-over session is usable:
+ //
+ addObject(tx);
+ System.out.println("Succesfully committed an object to the failed-over tx/session");
+ }
+ }
+ }
+ });
+
+ while (!session.isClosed())
+ {
+ Thread.sleep(100);
+ }
+ }
+
+ private static void addObject(CDOTransaction tx)
+ {
+ try
+ {
+ Customer customer = CompanyFactory.eINSTANCE.createCustomer();
+ tx.getOrCreateResource("/r1").getContents().add(customer);
+ tx.commit();
+ }
+ catch (CommitException x)
+ {
+ throw new RuntimeException(x);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
index b275c340e4..a6afa863d5 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
index e7a1cc0f9a..d65cfc583d 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java
index 631babaea1..24b0b8f2d0 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java
index f192cdf973..fa61815194 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java
index 3aaea82d0e..64ec8b94a5 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java
index 66b18d29c6..5aaaaa917f 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java
index fe1cc6eddc..734f6913bf 100644
--- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java
@@ -1,44 +1,44 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * 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.internal.examples.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.examples"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.internal.examples.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.examples"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}

Back to the top