Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorslewis2008-01-28 06:48:21 +0000
committerslewis2008-01-28 06:48:21 +0000
commit5a3c38d1f33392fcc338d91b2b89fc469eab6d65 (patch)
tree20230f58a2bb27d7b5655e7d18f2c27b55bb5fcb /doc
parent2e25e3735a6e06bba81cf9aabd96a93a8672827d (diff)
downloadorg.eclipse.ecf-5a3c38d1f33392fcc338d91b2b89fc469eab6d65.tar.gz
org.eclipse.ecf-5a3c38d1f33392fcc338d91b2b89fc469eab6d65.tar.xz
org.eclipse.ecf-5a3c38d1f33392fcc338d91b2b89fc469eab6d65.zip
Added documentation for service access handler extension point
Diffstat (limited to 'doc')
-rw-r--r--doc/bundles/org.eclipse.ecf.doc/html/reference/extension-points/org_eclipse_ecf_discovery_ui_serviceAccessHandler.html146
-rw-r--r--doc/bundles/org.eclipse.ecf.doc/schema.xml9
-rw-r--r--doc/bundles/org.eclipse.ecf.doc/topics_Extpoint.xml1
3 files changed, 155 insertions, 1 deletions
diff --git a/doc/bundles/org.eclipse.ecf.doc/html/reference/extension-points/org_eclipse_ecf_discovery_ui_serviceAccessHandler.html b/doc/bundles/org.eclipse.ecf.doc/html/reference/extension-points/org_eclipse_ecf_discovery_ui_serviceAccessHandler.html
new file mode 100644
index 000000000..9c40fe511
--- /dev/null
+++ b/doc/bundles/org.eclipse.ecf.doc/html/reference/extension-points/org_eclipse_ecf_discovery_ui_serviceAccessHandler.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>ECF Service Access Handler</title>
+<style type="text/css">@import url("../../book.css");</style>
+<style type="text/css">@import url("../../schema.css");</style>
+</HEAD>
+<BODY>
+<H1 style="text-align:center">ECF Service Access Handler</H1>
+<p></p>
+<h6 class="CaptionFigColumn SchemaHeader">Identifier: </h6>org.eclipse.ecf.discovery.ui.serviceAccessHandler<p></p>
+<h6 class="CaptionFigColumn SchemaHeader">Since: </h6>2.0.0M5
+<p></p>
+
+<h6 class="CaptionFigColumn SchemaHeader">Description: </h6>This extension point allows plugins to add menu items to the
+discovery view's context menu for accessing/invoking a remote service.<p></p>
+<h6 class="CaptionFigColumn SchemaHeader">Configuration Markup:</h6>
+<p></p>
+<p class="code SchemaDtd">&lt;!ELEMENT <a name="e.extension">extension</a> (<a href="#e.serviceAccessHandler">serviceAccessHandler</a>)+&gt;</p>
+<p class="code SchemaDtd">&lt;!ATTLIST extension</p>
+<p class="code SchemaDtdAttlist">point&nbsp;CDATA #REQUIRED<p class="code SchemaDtdAttlist">id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class="code SchemaDtdAttlist">name&nbsp;&nbsp;CDATA #IMPLIED&gt;</p>
+<p></p>
+<ul class="ConfigMarkupAttlistDesc">
+</ul>
+<br><p class="code SchemaDtd">&lt;!ELEMENT <a name="e.serviceAccessHandler">serviceAccessHandler</a> EMPTY&gt;</p>
+<p class="code SchemaDtd">&lt;!ATTLIST serviceAccessHandler</p>
+<p class="code SchemaDtdAttlist">class&nbsp;CDATA #REQUIRED&gt;</p>
+<p></p>
+<ul class="ConfigMarkupAttlistDesc">
+<li><b>class</b> - Required service access handler class. Note this class must implement the <b>org.eclipse.ecf.discovery.ui.views.IServiceAccessHandler</b> interface.</li>
+</ul>
+<br><h6 class="CaptionFigColumn SchemaHeader">Examples: </h6>Here is example usage of the serviceAccessHandler extension point. In this example, a http/http service handler is declared:
+
+<pre class="Example"><span class="code SchemaTag">
+ &lt;extension
+ point=</span><span class="code SchemaCstring">&quot;org.eclipse.ecf.discovery.ui.serviceAccessHandler&quot;</span><span class="code SchemaTag">&gt;
+ &lt;serviceAccessHandler
+ class=</span><span class="code SchemaCstring">&quot;org.eclipse.ecf.discovery.ui.HttpServiceAccessHandler&quot;</span><span class="code SchemaTag">&gt;
+ &lt;/serviceAccessHandler&gt;
+ &lt;/extension&gt;
+</span></pre>
+
+Here's is implementation of the HttpServiceAccessHandler:
+
+<pre class="Example"><span class="code SchemaTag">
+public class HttpServiceAccessHandler implements IServiceAccessHandler {
+
+ private static final String RFC2782_PATH = "path"; //$NON-NLS-1$
+ //private static final String RFC2782_USERNAME = "u"; //$NON-NLS-1$
+ //private static final String RFC2782_PASSWORD = "p"; //$NON-NLS-1$
+ static final IContributionItem[] EMPTY_CONTRIBUTION = {};
+
+ public HttpServiceAccessHandler() {
+ // nothing to do
+ }
+
+ public IContributionItem[] getContributionsForService(IServiceInfo serviceInfo) {
+ IServiceID serviceID = serviceInfo.getServiceID();
+ List serviceTypes = Arrays.asList(serviceID.getServiceTypeID().getProtocols());
+ String protocol = null;
+ if (serviceTypes.contains("http")) //$NON-NLS-1$
+ protocol = "http"; //$NON-NLS-1$
+ else if (serviceTypes.contains("https")) //$NON-NLS-1$
+ protocol = "https"; //$NON-NLS-1$
+ if (protocol == null)
+ return EMPTY_CONTRIBUTION;
+ URI location = serviceInfo.getLocation();
+ StringBuffer buf = new StringBuffer(protocol);
+ buf.append("://").append(location.getHost()); //$NON-NLS-1$
+ if (location.getPort() != -1)
+ buf.append(":").append(location.getPort()).append("/"); //$NON-NLS-1$ //$NON-NLS-2$
+ IServiceProperties svcProps = serviceInfo.getServiceProperties();
+ final String path = svcProps.getPropertyString(RFC2782_PATH);
+ if (path != null)
+ buf.append(path);
+ final String urlString = buf.toString();
+ //final String username = svcProps.getPropertyString(RFC2782_USERNAME);
+ //final String password = svcProps.getPropertyString(RFC2782_PASSWORD);
+ Action action = new Action() {
+ public void run() {
+ openBrowser(urlString);
+ }
+ };
+ action.setText(Messages.HttpServiceAccessHandler_MENU_TEXT + urlString);
+ return new IContributionItem[] {new ActionContributionItem(action)};
+ }
+
+ protected void openBrowser(String urlString) {
+ final IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
+ try {
+ support.createBrowser(null).openURL(new URL(urlString));
+ } catch (final Exception e) {
+ logError(Messages.HttpServiceAccessHandler_EXCEPTION_CREATEBROWSER, e);
+ }
+
+ }
+
+ protected void logError(String exceptionString, Throwable e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, exceptionString, e));
+
+ }
+
+}
+
+</span></pre>
+<p></p>
+
+<h6 class="CaptionFigColumn SchemaHeader">API Information: </h6>The IServiceAccessHandler interface must be implemented by the class defined in the extension:
+
+<pre class="Example"><span class="code SchemaTag">
+public interface IServiceAccessHandler {
+
+ /**
+ * Get the menu items to contribute for the given IServiceInfo. Implementers should return
+ * a non-null array of IContributionItem instances (menus or menu items). These will
+ * be added to the context menu of the service entry identified by the given service info.
+ *
+ * @param serviceInfo the IServiceInfo for the contributions. Will not be &lt;code&gt;null&lt;/code&gt;.
+ * @return IContributionItem [] any contribution to the context menu for the given service info. If &lt;code&gt;null&lt;/code&gt;,
+ * then no items will be added to the context menu.
+ */
+ public IContributionItem[] getContributionsForService(IServiceInfo serviceInfo);
+
+}
+</span></pre>
+<p></p>
+
+<h6 class="CaptionFigColumn SchemaHeader">Supplied Implementation: </h6>None.
+<p></p>
+
+<br>
+<p class="note SchemaCopyright">
+/****************************************************************************
+ * Copyright (c) 2008 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+</p>
+</BODY>
+</HTML>
diff --git a/doc/bundles/org.eclipse.ecf.doc/schema.xml b/doc/bundles/org.eclipse.ecf.doc/schema.xml
index 4c72bf7c4..229ccfef1 100644
--- a/doc/bundles/org.eclipse.ecf.doc/schema.xml
+++ b/doc/bundles/org.eclipse.ecf.doc/schema.xml
@@ -67,7 +67,14 @@
</antcall>
</target>
- <target name="schema" depends="org.eclipse.ecf,org.eclipse.ecf.identity,org.eclipse.ecf.sharedobject,org.eclipse.ecf.provider,org.eclipse.ecf.provider.filetransfer,org.eclipse.ecf.server.generic,org.eclipse.ecf.ui,org.eclipse.ecf.presence.ui,org.eclipse.ecf.presence.bot">
+ <target name="org.eclipse.ecf.discovery.ui">
+ <eclipse.convertPath property="org.eclipse.ecf.discovery.ui.manifest" resourcePath="/org.eclipse.ecf.discovery.ui/plugin.xml"/>
+ <antcall target="_plugin">
+ <param name="manifest.path" value="${org.eclipse.ecf.discovery.ui.manifest}"/>
+ </antcall>
+ </target>
+
+ <target name="schema" depends="org.eclipse.ecf,org.eclipse.ecf.identity,org.eclipse.ecf.sharedobject,org.eclipse.ecf.provider,org.eclipse.ecf.provider.filetransfer,org.eclipse.ecf.server.generic,org.eclipse.ecf.ui,org.eclipse.ecf.presence.ui,org.eclipse.ecf.presence.bot,org.eclipse.ecf.discovery.ui">
<!-- unfortunately, the task generates local filesystem references... fix them! -->
<property name="cssurl" value="${osgi.install.area}plugins/org.eclipse.platform.doc.isv_3.1.0"/>
<replace dir="${dest.path}" token="${cssurl}" value="../../../../org.eclipse.platform.doc.isv" includes="*.html"/>
diff --git a/doc/bundles/org.eclipse.ecf.doc/topics_Extpoint.xml b/doc/bundles/org.eclipse.ecf.doc/topics_Extpoint.xml
index 8493fe2fe..6f37c0d06 100644
--- a/doc/bundles/org.eclipse.ecf.doc/topics_Extpoint.xml
+++ b/doc/bundles/org.eclipse.ecf.doc/topics_Extpoint.xml
@@ -2,6 +2,7 @@
<toc label="Extension Points">
<topic label="org.eclipse.ecf.containerFactory" href="html/reference/extension-points/org_eclipse_ecf_containerFactory.html"/>
<topic label="org.eclipse.ecf.identity.namespace" href="html/reference/extension-points/org_eclipse_ecf_identity_namespace.html"/>
+<topic label="org.eclipse.ecf.discovery.ui.serviceAccessHandler" href="html/reference/extension-points/org_eclipse_ecf_discovery_ui_serviceAccessHandler.html"/>
<topic label="org.eclipse.ecf.presence.bot.chatRoomMessageHandler" href="html/reference/extension-points/org_eclipse_ecf_presence_bot_chatRoomMessageHandler.html"/>
<topic label="org.eclipse.ecf.presence.bot.chatRoomRobot" href="html/reference/extension-points/org_eclipse_ecf_presence_bot_chatRoomRobot.html"/>
<topic label="org.eclipse.ecf.presence.bot.imMessageHandler" href="html/reference/extension-points/org_eclipse_ecf_presence_bot_imMessageHandler.html"/>

Back to the top