diff options
author | Eike Stepper | 2012-06-11 16:26:29 +0000 |
---|---|---|
committer | Eike Stepper | 2012-06-11 16:26:29 +0000 |
commit | 1a223a1861adbe36b9b9f8cdb4f381ffbe51d5fc (patch) | |
tree | 23db1dd694484be32eaaef067d39e1658fae6bfb /plugins | |
parent | 5b08149521f82f5e950034916216fb5b28286517 (diff) | |
download | cdo-1a223a1861adbe36b9b9f8cdb4f381ffbe51d5fc.tar.gz cdo-1a223a1861adbe36b9b9f8cdb4f381ffbe51d5fc.tar.xz cdo-1a223a1861adbe36b9b9f8cdb4f381ffbe51d5fc.zip |
[382225] Provide CDO example installers
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382225
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties | 13 | ||||
-rw-r--r-- | plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml | 56 | ||||
-rw-r--r-- | plugins/org.gastro.server/.gitignore | 2 | ||||
-rw-r--r-- | plugins/org.gastro.server/GastroServer.launch | 1 | ||||
-rw-r--r-- | plugins/org.gastro.server/README.html | 61 | ||||
-rw-r--r-- | plugins/org.gastro.server/README.txt | 37 | ||||
-rw-r--r-- | plugins/org.gastro.server/src/org/gastro/internal/server/OM.java | 208 |
7 files changed, 237 insertions, 141 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties index e4a4c81ac6..286384740a 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties @@ -28,3 +28,16 @@ ExampleModelWizard_name = CDO Model Example ExampleModelWizard_desc = Create plug-in projects for an example CDO model and the related edit support. ExampleModelProject_desc = This project contains the Company model and the implementation generated from it. ExampleEditProject_desc = This project contains the item providers generated to support viewing and editing instances of the Company model. + +ExampleGastroWizard_name = CDO Model Example +ExampleGastroWizard_desc = Create plug-in projects for an example CDO model and the related edit support. +ExampleProject_gastro.inventory_desc = This project contains the Gastro Inventory model and the implementation generated from it. +ExampleProject_gastro.inventory.edit_desc = This project contains the item providers generated to support viewing and editing instances of the Gastro Inventory model. +ExampleProject_gastro.business_desc = This project contains the Gastro Business model and the implementation generated from it. +ExampleProject_gastro.business.edit_desc = This project contains the item providers generated to support viewing and editing instances of the Gastro Business model. +ExampleProject_gastro.rcp_desc = This project contains +ExampleProject_gastro.rcp.department_desc = This project contains +ExampleProject_gastro.rcp.table_desc = This project contains +ExampleProject_gastro.server_desc = This project contains +ExampleProject_gastro.server.web_desc = This project contains +ExampleProject_gastro.testclient_desc = This project contains diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml index 2a81ae25bf..5901a91215 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml @@ -59,6 +59,16 @@ project="true"> <description>%ExampleModelWizard_desc</description> </wizard> + <wizard + canFinishEarly="true" + category="org.eclipse.ui.Examples/org.eclipse.emf.cdo.examples" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + icon="icons/full/ctool16/NewEMFExample.gif" + id="org.eclipse.emf.cdo.examples.ExampleGastroWizard" + name="%ExampleGastroWizard_name" + project="true"> + <description>%ExampleGastroWizard_desc</description> + </wizard> </extension> <extension point="org.eclipse.emf.common.ui.examples"> @@ -113,6 +123,52 @@ contentURI="examples/model.edit/" description="%ExampleEditProject_desc"/> </example> + <example + id="org.eclipse.emf.cdo.examples.ExampleGastro" + wizardID="org.eclipse.emf.cdo.examples.ExampleGastroWizard" + pageImage="icons/full/wizban/NewEMFExample.gif"> + <fileToOpen editorID="org.eclipse.ui.browser.editor" location="org.gastro.server/README.html"/> + <projectDescriptor + name="org.gastro.inventory" + contentURI="examples/gastro.inventory/" + description="%ExampleProject_gastro.inventory_desc"/> + <projectDescriptor + name="org.gastro.inventory.edit" + contentURI="examples/gastro.inventory.edit/" + description="%ExampleProject_gastro.inventory.edit_desc"/> + <projectDescriptor + name="org.gastro.business" + contentURI="examples/gastro.business/" + description="%ExampleProject_gastro.business_desc"/> + <projectDescriptor + name="org.gastro.business.edit" + contentURI="examples/gastro.business.edit/" + description="%ExampleProject_gastro.business.edit_desc"/> + <projectDescriptor + name="org.gastro.rcp" + contentURI="examples/gastro.rcp/" + description="%ExampleProject_gastro.rcp_desc"/> + <projectDescriptor + name="org.gastro.rcp.department" + contentURI="examples/gastro.rcp.department/" + description="%ExampleProject_gastro.rcp.department_desc"/> + <projectDescriptor + name="org.gastro.rcp.table" + contentURI="examples/gastro.rcp.table/" + description="%ExampleProject_gastro.rcp.table_desc"/> + <projectDescriptor + name="org.gastro.server" + contentURI="examples/gastro.server/" + description="%ExampleProject_gastro.server_desc"/> + <projectDescriptor + name="org.gastro.server.web" + contentURI="examples/gastro.server.web/" + description="%ExampleProject_gastro.server.web_desc"/> + <projectDescriptor + name="org.gastro.testclient" + contentURI="examples/gastro.testclient/" + description="%ExampleProject_gastro.testclient_desc"/> + </example> </extension> </plugin> diff --git a/plugins/org.gastro.server/.gitignore b/plugins/org.gastro.server/.gitignore new file mode 100644 index 0000000000..c7601f9498 --- /dev/null +++ b/plugins/org.gastro.server/.gitignore @@ -0,0 +1,2 @@ +/_database/ +/database/ diff --git a/plugins/org.gastro.server/GastroServer.launch b/plugins/org.gastro.server/GastroServer.launch index 8cf552c557..c887148bbf 100644 --- a/plugins/org.gastro.server/GastroServer.launch +++ b/plugins/org.gastro.server/GastroServer.launch @@ -24,6 +24,7 @@ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -console"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx1024m -Ddebug=true -Dorg.osgi.service.http.port=9090 -Dservlet.config=${workspace_loc:/org.gastro.server.web/config/gastro.properties}"/> +<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.gastro.server}"/> <stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="product" value="org.eclipse.platform.ide"/> <stringAttribute key="selectedPlugin" value="org.eclipse.equinox.registry"/> diff --git a/plugins/org.gastro.server/README.html b/plugins/org.gastro.server/README.html new file mode 100644 index 0000000000..b54341cdf0 --- /dev/null +++ b/plugins/org.gastro.server/README.html @@ -0,0 +1,61 @@ +<html> +<head> +<title>CDO Electronic Restaurant Example</title> +</head> + +<body> + +<h1>CDO Electronic Restaurant Example</h1> + +This example contains the following launch configurations:<p> + +<ol> +<li><b>Start the server process.</b> + <ul> + <li>Start the "GastroServer" launch config. It creates a Derby database at "/gastro". + <li>Watch the console output. + </ul> + +<li><b>Populate the repository.</b> + <ul> + <li>Start the "GastroTestClient1" launch config. It opens a runtime IDE with generic CDO support. + <li>Open the "CDO Sessions" view. + <li>Add a new session (green plus button). Enter "tcp://localhost" and "gastro". + <li>Open a new transaction (right-click on the session). + <li>Import the /org.gastro.testclient/inventory.xml resource into "/eDine/inventory". + <li>Commit the transaction (right-click on the transaction or just save the editor). + </ul> + +<li><b>Start the RCP application for table 1 (and optionally for table 2).</b> + <ul> + <li>Start the "GastroTable1" launch config. It opens an RCP application. + <li>Browse through the menu card and select some offerings here and there. + </ul> + +<li><b>Start the RCP application for the bar.</b> + <ul> + <li>Start the "GastroDepartment1" launch config. It opens an RCP application for the barkeeper. + <li>Watch orders coming in. + <li>Eventually click on order details to mark them SERVED and watch the order disappearing when completed. + </ul> + +<li><b>Start the RCP application for the kitchen.</b> + <ul> + <li>Start the "GastroDepartment2" launch config. It opens an RCP application for the cook. + <li>Eventually click on order details to mark them SERVED and watch the order disappearing when completed. + </ul> + +<li><b>Send an order (if the RCP applications are all started, see steps 4-6).</b> + <ul> + <li>In the table application open the second shelf pane and send the order. + <li>Watch how the relevant order details "arrive" in the bar and kitchen applications... + </ul> + +<li><b>Browse the menu card via Web.</b> + <ul> + <li>Start a web browser and point it to <a href="http://localhost:9090/gastro">http://localhost:9090/gastro</a>. + </ul> +</ol> + +</body> +</html> diff --git a/plugins/org.gastro.server/README.txt b/plugins/org.gastro.server/README.txt deleted file mode 100644 index 806fb6cdea..0000000000 --- a/plugins/org.gastro.server/README.txt +++ /dev/null @@ -1,37 +0,0 @@ -RUNNING THE GASTRO EXAMPLES -=========================== - -1) Install the example - - Checkout the "org.gastro.*" plugins via http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org.eclipse.emf.cdo/develop/setup/psf/pserver/cdo-gastro-example.psf?root=Modeling_Project&view=log - -2) Start the server process - - Start the "GastroServer" launch config. It creates a Derby database at "/gastro". - - Watch the console output. - -3) Populate the repository - - Start the "GastroTestClient1" launch config. It opens a runtime IDE with generic CDO support. - - Open the "CDO Sessions" view. - - Add a new session (green plus button). Enter "tcp://localhost" and "gastro". - - Open a new transaction (right-click on the session). - - Import the /org.gastro.testclient/inventory.xml resource into "/eDine/inventory". - - Commit the transaction (right-click on the transaction or just save the editor). - -4) Start the RCP application for table 1 (and optionally for table 2) - - Start the "GastroTable1" launch config. It opens an RCP application. - - Browse through the menu card and select some offerings here and there. - -5) Start the RCP application for the bar - - Start the "GastroDepartment1" launch config. It opens an RCP application for the barkeeper. - - Watch orders coming in. - - Eventually click on order details to mark them SERVED and watch the order disappearing when completed. - -6) Start the RCP application for the kitchen - - Start the "GastroDepartment2" launch config. It opens an RCP application for the cook. - - Eventually click on order details to mark them SERVED and watch the order disappearing when completed. - -7) Send an order (if the RCP applications are all started, see steps 4-6) - - In the table application open the second shelf pane and send the order. - - Watch how the relevant order details "arrive" in the bar and kitchen applications... - -8) Browse the menu card via Web - - Start a web browser and point it to "http://localhost:9090/gastro" diff --git a/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java b/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java index 9f9c5d6421..33e7e40b88 100644 --- a/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java +++ b/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java @@ -1,104 +1,104 @@ -/*
- * 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
- *
- * Initial Publication:
- * Eclipse Magazin - http://www.eclipse-magazin.de
- */
-package org.gastro.internal.server;
-
-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.db.CDODBUtil;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
-
-import org.eclipse.net4j.acceptor.IAcceptor;
-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.util.container.IPluginContainer;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-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;
-
-import org.h2.jdbcx.JdbcDataSource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.gastro.server"; //$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();
-
- private static IAcceptor acceptor;
-
- public static IRepository repository;
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
-
- @Override
- protected void doStart() throws Exception
- {
- OM.LOG.info("Gastro server starting");
- JdbcDataSource dataSource = new JdbcDataSource();
- dataSource.setURL("jdbc:h2:_database/gastro");
-
- IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true);
- IDBAdapter dbAdapter = new H2Adapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
- IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
-
- Map<String, String> props = new HashMap<String, String>();
- props.put(IRepository.Props.OVERRIDE_UUID, "gastro");
- props.put(IRepository.Props.SUPPORTING_AUDITS, "true");
- props.put(IRepository.Props.SUPPORTING_BRANCHES, "false");
-
- repository = CDOServerUtil.createRepository("gastro", store, props);
- CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository);
- CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANCE);
-
- acceptor = (IAcceptor)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.acceptors", "tcp", "0.0.0.0:2036");
- OM.LOG.info("Gastro server started");
- }
-
- @Override
- protected void doStop() throws Exception
- {
- OM.LOG.info("Gastro server stopping");
- LifecycleUtil.deactivate(acceptor);
- LifecycleUtil.deactivate(repository);
- OM.LOG.info("Gastro server stopped");
- }
- }
-}
+/* + * 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 + * + * Initial Publication: + * Eclipse Magazin - http://www.eclipse-magazin.de + */ +package org.gastro.internal.server; + +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.db.CDODBUtil; +import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; +import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil; + +import org.eclipse.net4j.acceptor.IAcceptor; +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.util.container.IPluginContainer; +import org.eclipse.net4j.util.lifecycle.LifecycleUtil; +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; + +import org.h2.jdbcx.JdbcDataSource; + +import java.util.HashMap; +import java.util.Map; + +/** + * The <em>Operations & Maintenance</em> class of this bundle. + * + * @author Eike Stepper + */ +public abstract class OM +{ + public static final String BUNDLE_ID = "org.gastro.server"; //$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(); + + private static IAcceptor acceptor; + + public static IRepository repository; + + /** + * @author Eike Stepper + */ + public static final class Activator extends OSGiActivator + { + public Activator() + { + super(BUNDLE); + } + + @Override + protected void doStart() throws Exception + { + OM.LOG.info("Gastro server starting"); + JdbcDataSource dataSource = new JdbcDataSource(); + dataSource.setURL("jdbc:h2:database/gastro"); + + IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true); + IDBAdapter dbAdapter = new H2Adapter(); + IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource); + IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider); + + Map<String, String> props = new HashMap<String, String>(); + props.put(IRepository.Props.OVERRIDE_UUID, "gastro"); + props.put(IRepository.Props.SUPPORTING_AUDITS, "true"); + props.put(IRepository.Props.SUPPORTING_BRANCHES, "false"); + + repository = CDOServerUtil.createRepository("gastro", store, props); + CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository); + CDONet4jServerUtil.prepareContainer(IPluginContainer.INSTANCE); + + acceptor = (IAcceptor)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.acceptors", "tcp", "0.0.0.0:2036"); + OM.LOG.info("Gastro server started"); + } + + @Override + protected void doStop() throws Exception + { + OM.LOG.info("Gastro server stopping"); + LifecycleUtil.deactivate(acceptor); + LifecycleUtil.deactivate(repository); + OM.LOG.info("Gastro server stopped"); + } + } +} |