diff options
author | Eike Stepper | 2012-01-10 14:52:23 +0000 |
---|---|---|
committer | Eike Stepper | 2012-01-10 14:52:23 +0000 |
commit | 0e4d5df279b8c92255af38579cdc15a545766a21 (patch) | |
tree | cf094bfa94317154c470987581c3ba8677792f34 | |
parent | b7cb58538e6371d97fecb399d5d35f514dca4351 (diff) | |
download | cdo-0e4d5df279b8c92255af38579cdc15a545766a21.tar.gz cdo-0e4d5df279b8c92255af38579cdc15a545766a21.tar.xz cdo-0e4d5df279b8c92255af38579cdc15a545766a21.zip |
[367905] [CDO] Allow Adapters to be notified during loading
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367905
14 files changed, 381 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.doc/build.xml b/plugins/org.eclipse.emf.cdo.doc/build.xml index 7447d450ca..973fa58e87 100644 --- a/plugins/org.eclipse.emf.cdo.doc/build.xml +++ b/plugins/org.eclipse.emf.cdo.doc/build.xml @@ -53,6 +53,8 @@ classpathref="javadoc.classpath" /> <target name="build.java"> + <echo message="Building JavaDoc for org.eclipse.emf.cdo.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${javadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -290,6 +292,8 @@ </target> <target name="build.schema" unless="schema.skip"> + <echo message="Building SchemaDoc for org.eclipse.emf.cdo.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${schemadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -316,6 +320,8 @@ </target> <target name="build.article" unless="article.skip"> + <echo message="Building Articles for org.eclipse.emf.cdo.doc" /> + <tstamp> <format property="start.time" pattern="y-M-D-H-m-s-S" /> </tstamp> diff --git a/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html index 79a914ee5e..fe3b567dcb 100644 --- a/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html +++ b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html @@ -23,7 +23,7 @@ function windowTitle() <table border="0"> <tr> <td width="100%"><h1>Understanding the Architecture of a Client Application</h1></td> - <td align="right" valign="middle" nowrap><a href="index.html" title="Backward to Developing Client Applications"><img src="../../../images/backward.png" border="0"></a> <a href="../server/index.html" title="Forward to Dealing with Servers"><img src="../../../images/forward.png" border="0"></a></td> + <td align="right" valign="middle" nowrap><a href="index.html" title="Backward to Developing Client Applications"><img src="../../../images/backward.png" border="0"></a> <a href="ViewProviders.html" title="Forward to View Providers"><img src="../../../images/forward.png" border="0"></a></td> </tr> </table> <p class="author">Author: Eike Stepper</p> @@ -60,7 +60,7 @@ function windowTitle() <p align="right"> -<a href="index.html" title="Backward to Developing Client Applications"><img src="../../../images/backward.png" border="0"></a> <a href="../server/index.html" title="Forward to Dealing with Servers"><img src="../../../images/forward.png" border="0"></a></p> +<a href="index.html" title="Backward to Developing Client Applications"><img src="../../../images/backward.png" border="0"></a> <a href="ViewProviders.html" title="Forward to View Providers"><img src="../../../images/forward.png" border="0"></a></p> <HR> <i>Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.</i> </BODY> diff --git a/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/ViewProviders.html b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/ViewProviders.html new file mode 100644 index 0000000000..d1d2cf3a59 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/ViewProviders.html @@ -0,0 +1,190 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<HTML> + +<HEAD> +<TITLE>View Providers (CDO Model Repository Documentation)</TITLE> + +<LINK REL="STYLESHEET" HREF="../../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> + +<SCRIPT type="text/javascript"> +function windowTitle() +{ + if (location.href.indexOf('is-external=true') == -1) { + parent.document.title="View Providers (CDO Model Repository Documentation)"; + } +} +</SCRIPT> +<NOSCRIPT></NOSCRIPT> +</HEAD> + +<BODY BGCOLOR="white" onload="windowTitle();"> +<!-- <div class="help_breadcrumbs"><a href="../../Overview.html" title="CDO Model Repository Documentation">CDO Model Repository Documentation</a> > <a href="../index.html" title="Category in CDO Model Repository Documentation">Programmer's Guide</a> > <a href="index.html" title="Category in CDO Model Repository Documentation">Developing Client Applications</a></div> --> + +<table border="0"> + <tr> + <td width="100%"><h1>View Providers</h1></td> + <td align="right" valign="middle" nowrap><a href="Architecture.html" title="Backward to Understanding the Architecture of a Client Application"><img src="../../../images/backward.png" border="0"></a> <a href="../server/index.html" title="Forward to Dealing with Servers"><img src="../../../images/forward.png" border="0"></a></td> + </tr> +</table> +<p class="author">Author: Victor Roldan Betancort</p> +<p> + A <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProvider.html" title="Interface in org.eclipse.emf.cdo.view"><code>view provider</code></a> allows clients to inject custom logic into the <a href="../../../javadoc/org/eclipse/emf/cdo/eresource/CDOResourceFactory.html" title="Interface in org.eclipse.emf.cdo.eresource"><code>resource factory</code></a> mechansim, capable of handling the whole <a href="../../../javadoc/org/eclipse/emf/cdo/session/CDOSession.html" title="Interface in org.eclipse.emf.cdo.session"><code>session</code></a> and <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOView.html" title="Interface in org.eclipse.emf.cdo.view"><code>view</code></a> + instantiation process. This permits to obtain <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/ecore/resource/Resource.html" title="Interface in org.eclipse.emf.ecore.resource"><code>resources</code></a> through the <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/ecore/resource/ResourceSet.html" title="Interface in org.eclipse.emf.ecore.resource"><code>resource set</code></a> + API transparently, without any prior CDO client API code. The view provider automatically kicks in the middle of the + <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/ecore/resource/ResourceSet.html" title="Interface in org.eclipse.emf.ecore.resource"><code>ResourceSet.getResource()</code></a> call, forgetting + about the whole openning session / openning transaction process, which happens behind the scenes. + <p> + This is quite useful when integrating CDO with EMF-based frameworks and tools that are not prepared for a CDO + scenario themselves. + <p> + <b>Table of Contents</b> <p> +<table border="0"> +<tr><td>1 </td><td colspan="3"><a href="ViewProviders.html#ProviderImplementation" title="Chapter in CDO Model Repository Documentation">Implementing a View Provider</a></td></tr> +<tr><td>2 </td><td colspan="3"><a href="ViewProviders.html#ContributeProviderProgrammatically" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Programmatically</a></td></tr> +<tr><td>3 </td><td colspan="3"><a href="ViewProviders.html#ContributeProviderUsingExtensionPoint" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Using Extension Points</a></td></tr> +</table> +</p> + + +<h2><a name="ProviderImplementation"></a>1 Implementing a View Provider</h2> +<p> + Clients should implement the <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProvider.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProvider</code></a> interface, or sub class the <a href="../../../javadoc/org/eclipse/emf/cdo/view/AbstractCDOViewProvider.html" title="Class in org.eclipse.emf.cdo.view"><code>AbstractCDOViewProvider</code></a> + class, which provides common functionality. + <p> + The example below shows a simple implementation that opens a <b>new</b> <a href="../../../javadoc/org/eclipse/emf/cdo/session/CDOSession.html" title="Interface in org.eclipse.emf.cdo.session"><code>session</code></a> to a local + server and a <b>new</b> <a href="../../../javadoc/org/eclipse/emf/cdo/transaction/CDOTransaction.html" title="Interface in org.eclipse.emf.cdo.transaction"><code>transaction</code></a> on that session. + <p> + + +<div class="snippet" style="margin-left:24px;" align="left"> + <a name="snippet_example"></a> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="../../../images/editor-top-left-java.png"></td> + <td style="background-image:url(../../../images/editor-top1.png); background-repeat:repeat-x;" width="1px"><font face="Segoe UI,Arial" size="-1">ExampleViewProvider.java</font></td> + <td width="1px"><img src="../../../images/editor-close.png"></td> + <td style="background-image:url(../../../images/editor-top2.png); background-repeat:repeat-x;"> </td> + <td><img src="../../../images/editor-top-right.png"></td> + </tr> + <tr> + <td style="background-image:url(../../../images/editor-left.png); background-repeat:repeat-y;"> </td> + <td colspan="3" align="left" valign="top" nowrap> + <div style="margin:10px 0px 10px 0px;"> + <code> + <a name="callout_example_1_code" href="#callout_example_1" alt="The example provider catches all URIs with shape "cdo.local:"." title="The example provider catches all URIs with shape "cdo.local:"."><img src="../../../images/callout-1.png" width="16" height="16" border="0" align="top"></a> <font color="#7f0055"><b>new </b></font>AbstractCDOViewProvider(<font color="#2a00ff">"cdo\\.local:.*"</font>, <font color="#990000">100</font>)<br/>
+ {<br/>
+ <font color="#7f0055"><b>private </b></font>IManagedContainer container;<br/>
+ <br/>
+ <a name="callout_example_2_code" href="#callout_example_2" alt="Register the provider with CDOViewProviderRegistry." title="Register the provider with CDOViewProviderRegistry."><img src="../../../images/callout-2.png" width="16" height="16" border="0" align="top"></a> <font color="#7f0055"><b>public </b></font>CDOView getView(URI uri, ResourceSet resourceSet)<br/>
+ {<br/>
+ <font color="#7f0055"><b>if </b></font>(container == <font color="#7f0055"><b>null</b></font>)<br/>
+ {<br/>
+ container = <font color="#7f0055"><b>new </b></font>ManagedContainer();<br/>
+ Net4jUtil.prepareContainer(container);<br/>
+ TCPUtil.prepareContainer(container);<br/>
+ container.activate();<br/>
+ }<br/>
+ <br/>
+ <font color="#7f0055"><b>int </b></font>startIndex = uri.toString().indexOf(<font color="#990000">':'</font>);<br/>
+ String repoName = uri.toString().substring(startIndex);<br/>
+ <br/>
+ IConnector connector = (IConnector)container.getElement(<font color="#2a00ff">"org.eclipse.net4j.connectors"</font>, <font color="#2a00ff">"tcp"</font>, <font color="#2a00ff">"localhost"</font>);<br/>
+ <br/>
+ CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration();<br/>
+ config.setConnector(connector);<br/>
+ config.setRepositoryName(repoName);<br/>
+ <br/>
+ CDOSession session = config.openNet4jSession();<br/>
+ <font color="#7f0055"><b>return </b></font>session.openTransaction();<br/>
+ }<br/>
+ }; + </code> + </div> + </td> + <td style="background-image:url(../../../images/editor-right.png); background-repeat:repeat-y;"> </td> + </tr> + <tr> + <td><img src="../../../images/editor-bottom-left.png"></td> + <td style="background-image:url(../../../images/editor-bottom.png); background-repeat:repeat-x;" colspan="3"> </td> + <td><img src="../../../images/editor-bottom-right.png"></td> + </tr> + </table> +</div> +<p> +<div style="margin-left:24px;"><a name="callout_example_1" href="#callout_example_1_code" alt="Jump to snippet..." title="Jump to snippet..."><img src="../../../images/callout-1.png" width="16" height="16" border="0" align="top"></a> The example provider catches all URIs with shape "cdo.local:<repoName>". + +</div> +<div style="margin-left:24px;"><a name="callout_example_2" href="#callout_example_2_code" alt="Jump to snippet..." title="Jump to snippet..."><img src="../../../images/callout-2.png" width="16" height="16" border="0" align="top"></a> Register the provider with <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProviderRegistry.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProviderRegistry</code></a>. + +</div> +<p> + + +<h2><a name="ContributeProviderProgrammatically"></a>2 Contributing View Providers Programmatically</h2> +<p> + A client's view provider implementation can be contributed programmatically to the <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProviderRegistry.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProviderRegistry</code></a>, + as the following example suggests: + <p> + + +<div class="snippet" style="margin-left:24px;" align="left"> + <a name="snippet_snippet2"></a> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="../../../images/editor-top-left-java.png"></td> + <td style="background-image:url(../../../images/editor-top1.png); background-repeat:repeat-x;" width="1px"><font face="Segoe UI,Arial" size="-1">ProviderContribution.java</font></td> + <td width="1px"><img src="../../../images/editor-close.png"></td> + <td style="background-image:url(../../../images/editor-top2.png); background-repeat:repeat-x;"> </td> + <td><img src="../../../images/editor-top-right.png"></td> + </tr> + <tr> + <td style="background-image:url(../../../images/editor-left.png); background-repeat:repeat-y;"> </td> + <td colspan="3" align="left" valign="top" nowrap> + <div style="margin:10px 0px 10px 0px;"> + <code> + <font color="#3f7f5f">// Instantiate your view provider</font><br/>
+ CDOViewProvider viewProvider = <a name="callout_snippet2_1_code" href="#callout_snippet2_1" alt="Get the target CDOViewProvider implementation." title="Get the target CDOViewProvider implementation."><img src="../../../images/callout-1.png" width="16" height="16" border="0" align="top"></a> org.eclipse.emf.internal.cdo.view.PluginContainerViewProvider.INSTANCE;<br/>
+ <br/>
+ <font color="#3f7f5f">// Add the instance to the registry</font><br/>
+ <a name="callout_snippet2_2_code" href="#callout_snippet2_2" alt="Add the provider instance to CDOViewProviderRegistry." title="Add the provider instance to CDOViewProviderRegistry."><img src="../../../images/callout-2.png" width="16" height="16" border="0" align="top"></a> CDOViewProviderRegistry.INSTANCE.addViewProvider(viewProvider); + </code> + </div> + </td> + <td style="background-image:url(../../../images/editor-right.png); background-repeat:repeat-y;"> </td> + </tr> + <tr> + <td><img src="../../../images/editor-bottom-left.png"></td> + <td style="background-image:url(../../../images/editor-bottom.png); background-repeat:repeat-x;" colspan="3"> </td> + <td><img src="../../../images/editor-bottom-right.png"></td> + </tr> + </table> +</div> +<p> +<div style="margin-left:24px;"><a name="callout_snippet2_1" href="#callout_snippet2_1_code" alt="Jump to snippet..." title="Jump to snippet..."><img src="../../../images/callout-1.png" width="16" height="16" border="0" align="top"></a> Get the target <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProvider.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProvider</code></a> implementation. + +</div> +<div style="margin-left:24px;"><a name="callout_snippet2_2" href="#callout_snippet2_2_code" alt="Jump to snippet..." title="Jump to snippet..."><img src="../../../images/callout-2.png" width="16" height="16" border="0" align="top"></a> Add the provider instance to <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProviderRegistry.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProviderRegistry</code></a>. + +</div> +<p> + + +<h2><a name="ContributeProviderUsingExtensionPoint"></a>3 Contributing View Providers Using Extension Points</h2> +<p> + A specific <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProvider.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProvider</code></a> implementation can also be contributed using the + <code>org.eclipse.emf.cdo.viewProviders</code> extension point. Clients specify: + <p> + <ul> + <li>A mandatory <b><code>class</code></b> implementing the <a href="../../../javadoc/org/eclipse/emf/cdo/view/CDOViewProvider.html" title="Interface in org.eclipse.emf.cdo.view"><code>CDOViewProvider</code></a> interface. + <li>A mandatory <b>regular expression</b> string indicating the shape of <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/common/util/URI.html" title="Class in org.eclipse.emf.common.util"><code>URIs</code></a> that should match with the contributed provider. + <li>An optional <b><code>priority</code></b> integer value, to indicate preference over other implementations + matching the same regular expression. A higher value indicates a higher priority, <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Integer.html" title="Class in java.lang"><code>Integer#MAX_VALUE</code></a> being + the maximum priority value and <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Integer.html" title="Class in java.lang"><code>Integer#MIN_VALUE</code></a> the minimum. + </ul> + +<p align="right"> +<a href="Architecture.html" title="Backward to Understanding the Architecture of a Client Application"><img src="../../../images/backward.png" border="0"></a> <a href="../server/index.html" title="Forward to Dealing with Servers"><img src="../../../images/forward.png" border="0"></a></p> +<HR> +<i>Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.</i> +</BODY> +</HTML> diff --git a/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/index.html b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/index.html index 79b4b9eaa6..d58f54b6d6 100644 --- a/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/index.html +++ b/plugins/org.eclipse.emf.cdo.doc/html/programmers/client/index.html @@ -36,6 +36,10 @@ function windowTitle() <tr><td></td><td>5 </td><td colspan="3"><a href="Architecture.html#Models" title="Chapter in CDO Model Repository Documentation">Models</a></td></tr> <tr><td></td><td>6 </td><td colspan="3"><a href="Architecture.html#Protocol" title="Chapter in CDO Model Repository Documentation">Protocol</a></td></tr> <tr><td></td><td>7 </td><td colspan="3"><a href="Architecture.html#Transport" title="Chapter in CDO Model Repository Documentation">Transport</a></td></tr> +<tr><td><img src="../../../images/article.gif"> </td><td colspan="4"><a href="ViewProviders.html" title="Article in CDO Model Repository Documentation">View Providers</a></td></tr> +<tr><td></td><td>1 </td><td colspan="3"><a href="ViewProviders.html#ProviderImplementation" title="Chapter in CDO Model Repository Documentation">Implementing a View Provider</a></td></tr> +<tr><td></td><td>2 </td><td colspan="3"><a href="ViewProviders.html#ContributeProviderProgrammatically" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Programmatically</a></td></tr> +<tr><td></td><td>3 </td><td colspan="3"><a href="ViewProviders.html#ContributeProviderUsingExtensionPoint" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Using Extension Points</a></td></tr> </table> </p> diff --git a/plugins/org.eclipse.emf.cdo.doc/html/programmers/index.html b/plugins/org.eclipse.emf.cdo.doc/html/programmers/index.html index 1f8ff46fcc..8e7885d9e6 100644 --- a/plugins/org.eclipse.emf.cdo.doc/html/programmers/index.html +++ b/plugins/org.eclipse.emf.cdo.doc/html/programmers/index.html @@ -37,6 +37,10 @@ function windowTitle() <tr><td></td><td></td><td>5 </td><td colspan="3"><a href="client/Architecture.html#Models" title="Chapter in CDO Model Repository Documentation">Models</a></td></tr> <tr><td></td><td></td><td>6 </td><td colspan="3"><a href="client/Architecture.html#Protocol" title="Chapter in CDO Model Repository Documentation">Protocol</a></td></tr> <tr><td></td><td></td><td>7 </td><td colspan="3"><a href="client/Architecture.html#Transport" title="Chapter in CDO Model Repository Documentation">Transport</a></td></tr> +<tr><td></td><td><img src="../../images/article.gif"> </td><td colspan="4"><a href="client/ViewProviders.html" title="Article in CDO Model Repository Documentation">View Providers</a></td></tr> +<tr><td></td><td></td><td>1 </td><td colspan="3"><a href="client/ViewProviders.html#ProviderImplementation" title="Chapter in CDO Model Repository Documentation">Implementing a View Provider</a></td></tr> +<tr><td></td><td></td><td>2 </td><td colspan="3"><a href="client/ViewProviders.html#ContributeProviderProgrammatically" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Programmatically</a></td></tr> +<tr><td></td><td></td><td>3 </td><td colspan="3"><a href="client/ViewProviders.html#ContributeProviderUsingExtensionPoint" title="Chapter in CDO Model Repository Documentation">Contributing View Providers Using Extension Points</a></td></tr> <tr><td><img src="../../images/category.gif"> </td><td colspan="5"><a href="server/index.html" title="Category in CDO Model Repository Documentation">Dealing with Servers</a></td></tr> <tr><td></td><td><img src="../../images/article.gif"> </td><td colspan="4"><a href="server/Architecture.html" title="Article in CDO Model Repository Documentation">Understanding the Architecture of a Repository</a></td></tr> <tr><td></td><td></td><td>1 </td><td colspan="3"><a href="server/Architecture.html#OSGi" title="Chapter in CDO Model Repository Documentation">OSGi</a></td></tr> diff --git a/plugins/org.eclipse.emf.cdo.doc/html/programmers/server/index.html b/plugins/org.eclipse.emf.cdo.doc/html/programmers/server/index.html index 3a2d402c2f..a0ceed2b34 100644 --- a/plugins/org.eclipse.emf.cdo.doc/html/programmers/server/index.html +++ b/plugins/org.eclipse.emf.cdo.doc/html/programmers/server/index.html @@ -23,7 +23,7 @@ function windowTitle() <table border="0"> <tr> <td width="100%"><h1>Dealing with Servers</h1></td> - <td align="right" valign="middle" nowrap><a href="../client/Architecture.html" title="Backward to Understanding the Architecture of a Client Application"><img src="../../../images/backward.png" border="0"></a> <a href="Architecture.html" title="Forward to Understanding the Architecture of a Repository"><img src="../../../images/forward.png" border="0"></a></td> + <td align="right" valign="middle" nowrap><a href="../client/ViewProviders.html" title="Backward to View Providers"><img src="../../../images/backward.png" border="0"></a> <a href="Architecture.html" title="Forward to Understanding the Architecture of a Repository"><img src="../../../images/forward.png" border="0"></a></td> </tr> </table> <p> @@ -41,7 +41,7 @@ function windowTitle() <p align="right"> -<a href="../client/Architecture.html" title="Backward to Understanding the Architecture of a Client Application"><img src="../../../images/backward.png" border="0"></a> <a href="Architecture.html" title="Forward to Understanding the Architecture of a Repository"><img src="../../../images/forward.png" border="0"></a></p> +<a href="../client/ViewProviders.html" title="Backward to View Providers"><img src="../../../images/backward.png" border="0"></a> <a href="Architecture.html" title="Forward to Understanding the Architecture of a Repository"><img src="../../../images/forward.png" border="0"></a></p> <HR> <i>Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.</i> </BODY> diff --git a/plugins/org.eclipse.emf.cdo.doc/src/org/eclipse/emf/cdo/doc/programmers/client/ViewProviders.java b/plugins/org.eclipse.emf.cdo.doc/src/org/eclipse/emf/cdo/doc/programmers/client/ViewProviders.java new file mode 100644 index 0000000000..80b6712592 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.doc/src/org/eclipse/emf/cdo/doc/programmers/client/ViewProviders.java @@ -0,0 +1,146 @@ +/*
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.doc.programmers.client;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFactory;
+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.view.AbstractCDOViewProvider;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewProvider;
+import org.eclipse.emf.cdo.view.CDOViewProviderRegistry;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.ManagedContainer;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * View Providers
+ * <p>
+ * A {@link CDOViewProvider view provider} allows clients to inject custom logic into the {@link CDOResourceFactory
+ * resource factory} mechansim, capable of handling the whole {@link CDOSession session} and {@link CDOView view}
+ * instantiation process. This permits to obtain {@link Resource resources} through the {@link ResourceSet resource set}
+ * API transparently, without any prior CDO client API code. The view provider automatically kicks in the middle of the
+ * {@link ResourceSet#getResource(org.eclipse.emf.common.util.URI, boolean) ResourceSet.getResource()} call, forgetting
+ * about the whole openning session / openning transaction process, which happens behind the scenes.
+ * <p>
+ * This is quite useful when integrating CDO with EMF-based frameworks and tools that are not prepared for a CDO
+ * scenario themselves.
+ * <p>
+ * <b>Table of Contents</b> {@toc}
+ *
+ * @author Victor Roldan Betancort
+ */
+public class ViewProviders
+{
+ /**
+ * Implementing a View Provider
+ * <p>
+ * Clients should implement the {@link CDOViewProvider} interface, or sub class the {@link AbstractCDOViewProvider}
+ * class, which provides common functionality.
+ * <p>
+ * The example below shows a simple implementation that opens a <b>new</b> {@link CDOSession session} to a local
+ * server and a <b>new</b> {@link CDOTransaction transaction} on that session.
+ * <p>
+ * {@link #example() ExampleViewProvider.java}
+ */
+ public class ProviderImplementation
+ {
+ /**
+ * @snippet
+ * @callout The example provider catches all URIs with shape "cdo.local:<repoName>".
+ * @callout Register the provider with {@link CDOViewProviderRegistry}.
+ */
+ public void example()
+ {
+ /* callout */new AbstractCDOViewProvider("cdo\\.local:.*", 100)
+ {
+ private IManagedContainer container;
+
+ /* callout */public CDOView getView(URI uri, ResourceSet resourceSet)
+ {
+ if (container == null)
+ {
+ container = new ManagedContainer();
+ Net4jUtil.prepareContainer(container);
+ TCPUtil.prepareContainer(container);
+ container.activate();
+ }
+
+ int startIndex = uri.toString().indexOf(':');
+ String repoName = uri.toString().substring(startIndex);
+
+ IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", "localhost");
+
+ CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration();
+ config.setConnector(connector);
+ config.setRepositoryName(repoName);
+
+ CDOSession session = config.openNet4jSession();
+ return session.openTransaction();
+ }
+ };
+ }
+ }
+
+ /**
+ * Contributing View Providers Programmatically
+ * <p>
+ * A client's view provider implementation can be contributed programmatically to the {@link CDOViewProviderRegistry},
+ * as the following example suggests:
+ * <p>
+ * {@link #snippet2() ProviderContribution.java}
+ */
+ public class ContributeProviderProgrammatically
+ {
+ /**
+ * @snippet
+ * @callout Get the target {@link CDOViewProvider} implementation.
+ * @callout Add the provider instance to {@link CDOViewProviderRegistry}.
+ */
+ @SuppressWarnings("restriction")
+ public void snippet2()
+ {
+ // Instantiate your view provider
+ CDOViewProvider viewProvider = /* callout */org.eclipse.emf.internal.cdo.view.PluginContainerViewProvider.INSTANCE;
+
+ // Add the instance to the registry
+ /* callout */CDOViewProviderRegistry.INSTANCE.addViewProvider(viewProvider);
+ }
+ }
+
+ /**
+ * Contributing View Providers Using Extension Points
+ * <p>
+ * A specific {@link CDOViewProvider} implementation can also be contributed using the
+ * <code>org.eclipse.emf.cdo.viewProviders</code> extension point. Clients specify:
+ * <p>
+ * <ul>
+ * <li>A mandatory <b><code>class</code></b> implementing the {@link CDOViewProvider} interface.
+ * <li>A mandatory <b>regular expression</b> string indicating the shape of {@link org.eclipse.emf.common.util.URI
+ * URIs} that should match with the contributed provider.
+ * <li>An optional <b><code>priority</code></b> integer value, to indicate preference over other implementations
+ * matching the same regular expression. A higher value indicates a higher priority, {@link Integer#MAX_VALUE} being
+ * the maximum priority value and {@link Integer#MIN_VALUE} the minimum.
+ * </ul>
+ */
+ public class ContributeProviderUsingExtensionPoint
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.doc/toc.html b/plugins/org.eclipse.emf.cdo.doc/toc.html index 3f47c7a56c..ab69ba6204 100644 --- a/plugins/org.eclipse.emf.cdo.doc/toc.html +++ b/plugins/org.eclipse.emf.cdo.doc/toc.html @@ -6,6 +6,7 @@ <div class="te"><span><a href="javascript:toggle('org_eclipse_emf_cdo_doc_3')"><img src="plus.gif" id="img_org_eclipse_emf_cdo_doc_3"></a><img src="category.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/index.html" target="content">Developing Client Applications</a></span></div> <div id="org_eclipse_emf_cdo_doc_3" style="display:none; margin-left:20px;"> <div class="te"><span><img src="empty.gif"><img src="article.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html" target="content">Understanding the Architecture of a Client Application</a></span></div> + <div class="te"><span><img src="empty.gif"><img src="article.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/ViewProviders.html" target="content">View Providers</a></span></div> </div> <div class="te"><span><a href="javascript:toggle('org_eclipse_emf_cdo_doc_4')"><img src="plus.gif" id="img_org_eclipse_emf_cdo_doc_4"></a><img src="category.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/server/index.html" target="content">Dealing with Servers</a></span></div> <div id="org_eclipse_emf_cdo_doc_4" style="display:none; margin-left:20px;"> diff --git a/plugins/org.eclipse.emf.cdo.doc/toc.xml b/plugins/org.eclipse.emf.cdo.doc/toc.xml index f79b94d134..e385b9308b 100644 --- a/plugins/org.eclipse.emf.cdo.doc/toc.xml +++ b/plugins/org.eclipse.emf.cdo.doc/toc.xml @@ -6,6 +6,7 @@ <topic label="Programmer's Guide" href="html/programmers/index.html"> <topic label="Developing Client Applications" href="html/programmers/client/index.html"> <topic label="Understanding the Architecture of a Client Application" href="html/programmers/client/Architecture.html" /> + <topic label="View Providers" href="html/programmers/client/ViewProviders.html" /> </topic> <topic label="Dealing with Servers" href="html/programmers/server/index.html"> <topic label="Understanding the Architecture of a Repository" href="html/programmers/server/Architecture.html" /> diff --git a/plugins/org.eclipse.emf.cdo.releng.help/build.xml b/plugins/org.eclipse.emf.cdo.releng.help/build.xml index 6209f7e168..f43624d3b7 100644 --- a/plugins/org.eclipse.emf.cdo.releng.help/build.xml +++ b/plugins/org.eclipse.emf.cdo.releng.help/build.xml @@ -54,6 +54,8 @@ classpathref="javadoc.classpath" /> <target name="build.java"> + <echo message="Building JavaDoc for org.eclipse.emf.cdo.releng.help" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${javadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -188,6 +190,8 @@ </target> <target name="build.schema" unless="schema.skip"> + <echo message="Building SchemaDoc for org.eclipse.emf.cdo.releng.help" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${schemadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -210,6 +214,8 @@ </target> <target name="build.article" unless="article.skip"> + <echo message="Building Articles for org.eclipse.emf.cdo.releng.help" /> + <tstamp> <format property="start.time" pattern="y-M-D-H-m-s-S" /> </tstamp> diff --git a/plugins/org.eclipse.emf.cdo.releng/help/toc.html b/plugins/org.eclipse.emf.cdo.releng/help/toc.html index 8f02de5c9d..30dd7317d1 100644 --- a/plugins/org.eclipse.emf.cdo.releng/help/toc.html +++ b/plugins/org.eclipse.emf.cdo.releng/help/toc.html @@ -105,6 +105,7 @@ <div class="te"><span><a href="javascript:toggle('org_eclipse_emf_cdo_doc_3')"><img src="plus.gif" id="img_org_eclipse_emf_cdo_doc_3"></a><img src="category.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/index.html" target="content">Developing Client Applications</a></span></div> <div id="org_eclipse_emf_cdo_doc_3" style="display:none; margin-left:20px;"> <div class="te"><span><img src="empty.gif"><img src="article.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/Architecture.html" target="content">Understanding the Architecture of a Client Application</a></span></div> + <div class="te"><span><img src="empty.gif"><img src="article.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/client/ViewProviders.html" target="content">View Providers</a></span></div> </div> <div class="te"><span><a href="javascript:toggle('org_eclipse_emf_cdo_doc_4')"><img src="plus.gif" id="img_org_eclipse_emf_cdo_doc_4"></a><img src="category.gif"><a href="org.eclipse.emf.cdo.doc/html/programmers/server/index.html" target="content">Dealing with Servers</a></span></div> <div id="org_eclipse_emf_cdo_doc_4" style="display:none; margin-left:20px;"> diff --git a/plugins/org.eclipse.net4j.db.doc/build.xml b/plugins/org.eclipse.net4j.db.doc/build.xml index b3fdd75a9c..e6e715cdf9 100644 --- a/plugins/org.eclipse.net4j.db.doc/build.xml +++ b/plugins/org.eclipse.net4j.db.doc/build.xml @@ -53,6 +53,8 @@ classpathref="javadoc.classpath" /> <target name="build.java"> + <echo message="Building JavaDoc for org.eclipse.net4j.db.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${javadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -198,6 +200,8 @@ </target> <target name="build.schema" unless="schema.skip"> + <echo message="Building SchemaDoc for org.eclipse.net4j.db.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${schemadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -221,6 +225,8 @@ </target> <target name="build.article" unless="article.skip"> + <echo message="Building Articles for org.eclipse.net4j.db.doc" /> + <tstamp> <format property="start.time" pattern="y-M-D-H-m-s-S" /> </tstamp> diff --git a/plugins/org.eclipse.net4j.doc/build.xml b/plugins/org.eclipse.net4j.doc/build.xml index a31cb1ac2b..fb926f482f 100644 --- a/plugins/org.eclipse.net4j.doc/build.xml +++ b/plugins/org.eclipse.net4j.doc/build.xml @@ -54,6 +54,8 @@ classpathref="javadoc.classpath" /> <target name="build.java"> + <echo message="Building JavaDoc for org.eclipse.net4j.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${javadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -227,6 +229,8 @@ </target> <target name="build.schema" unless="schema.skip"> + <echo message="Building SchemaDoc for org.eclipse.net4j.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${schemadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -249,6 +253,8 @@ </target> <target name="build.article" unless="article.skip"> + <echo message="Building Articles for org.eclipse.net4j.doc" /> + <tstamp> <format property="start.time" pattern="y-M-D-H-m-s-S" /> </tstamp> diff --git a/plugins/org.eclipse.net4j.util.doc/build.xml b/plugins/org.eclipse.net4j.util.doc/build.xml index 7634cb74b2..920d5fd007 100644 --- a/plugins/org.eclipse.net4j.util.doc/build.xml +++ b/plugins/org.eclipse.net4j.util.doc/build.xml @@ -53,6 +53,8 @@ classpathref="javadoc.classpath" /> <target name="build.java"> + <echo message="Building JavaDoc for org.eclipse.net4j.util.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${javadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -235,6 +237,8 @@ </target> <target name="build.schema" unless="schema.skip"> + <echo message="Building SchemaDoc for org.eclipse.net4j.util.doc" /> + <delete includeemptydirs="true" failonerror="false"> <fileset dir="${schemadoc.destdir}" defaultexcludes="true"> <include name="**/*" /> @@ -258,6 +262,8 @@ </target> <target name="build.article" unless="article.skip"> + <echo message="Building Articles for org.eclipse.net4j.util.doc" /> + <tstamp> <format property="start.time" pattern="y-M-D-H-m-s-S" /> </tstamp> |