diff options
author | slewis | 2009-04-15 05:46:35 +0000 |
---|---|---|
committer | slewis | 2009-04-15 05:46:35 +0000 |
commit | e2eb5f90b2403b3c0abb6e355f5856b832e9db2d (patch) | |
tree | d005cadf4a9c9a08ad06f42554c45dc34931df13 | |
parent | 40a8ab79f946608069d6aa435a63878d6e868a98 (diff) | |
download | org.eclipse.ecf-e2eb5f90b2403b3c0abb6e355f5856b832e9db2d.tar.gz org.eclipse.ecf-e2eb5f90b2403b3c0abb6e355f5856b832e9db2d.tar.xz org.eclipse.ecf-e2eb5f90b2403b3c0abb6e355f5856b832e9db2d.zip |
Added IServiceClient, IServiceClientManager and IServiceHost API.
4 files changed, 173 insertions, 3 deletions
diff --git a/server-side/bundles/org.eclipse.ecf.server/META-INF/MANIFEST.MF b/server-side/bundles/org.eclipse.ecf.server/META-INF/MANIFEST.MF index e2765a180..560e36f81 100644 --- a/server-side/bundles/org.eclipse.ecf.server/META-INF/MANIFEST.MF +++ b/server-side/bundles/org.eclipse.ecf.server/META-INF/MANIFEST.MF @@ -2,13 +2,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %plugin.name Bundle-SymbolicName: org.eclipse.ecf.server -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.ecf.internal.server.Activator Bundle-Vendor: %plugin.provider Bundle-Localization: plugin Eclipse-LazyStart: true -Import-Package: org.osgi.framework;version="1.3.0" -Export-Package: org.eclipse.ecf.internal.server;x-internal:=true +Import-Package: org.eclipse.ecf.core;version="3.0.0", + org.eclipse.ecf.core.security, + org.eclipse.ecf.core.util, + org.eclipse.ecf.remoteservice, + org.osgi.framework;version="1.3.0" +Export-Package: org.eclipse.ecf.internal.server;x-internal:=true, + org.eclipse.ecf.server Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1, J2SE-1.4 Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.5.0" diff --git a/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClient.java b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClient.java new file mode 100644 index 000000000..aed37fa56 --- /dev/null +++ b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClient.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2009 EclipseSource 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: Scott Lewis and Jeff McAffer - initial API and + * implementation + *******************************************************************************/ +package org.eclipse.ecf.server; + +import java.util.Dictionary; +import org.eclipse.ecf.core.ContainerConnectException; +import org.eclipse.ecf.core.security.IConnectContext; +import org.eclipse.ecf.remoteservice.IRemoteServiceContainer; +import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * Service Client + * @since 2.0 + */ +public interface IServiceClient { + + /** + * Get the client's ID in String form. + * @return String unique id for this client. + */ + public String getId(); + + /** + * Connect to the given targetLocation + * @param targetLocation + * @throws ContainerConnectException + */ + public void connect(String targetLocation, IConnectContext connectContext) throws ContainerConnectException; + + /** + * @return <code>true</code> if client is connected, <code>false</code> otherwise. + */ + public boolean isConnected(); + + /** + * Register service client. Registers this service client in the service registry + * with the given BundleContext. + * @param context the BundleContext to register with. Must not be <code>null</code>. + * @param properties to associate with IServiceClient registration. May be <code>null</code>. + * @return ServiceRegistration registration for the IServiceClient service. Will not be <code>null</code>. + */ + public ServiceRegistration registerServiceClient(BundleContext context, Dictionary properties); + + /** + * Register a remote service with this service client. This allows remote services to be registered/exposed + * for remote usage. + * @param clazzes the interface class names of the remote services expose. + * @param service the actual service implementation. + * @param remoteServiceProperties and remote service properties to be exposed to clients of the remote service. + * @return IRemoteServiceRegistration the remote service registration for the registered remote service. + * Will not be <code>null</code>. + */ + public IRemoteServiceRegistration registerRemoteService(String[] clazzes, Object service, Dictionary remoteServiceProperties); + + /** + * Get the remote service container for this service client. + * @return IRemoteServiceContainer will not be <code>null</code>. + */ + public IRemoteServiceContainer getRemoteServiceContainer(); + + /** + * Stop this service client. This will disconnect the underlying container for this client. + */ + public void stop(); + +} diff --git a/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClientManager.java b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClientManager.java new file mode 100644 index 000000000..5d7b22cf1 --- /dev/null +++ b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceClientManager.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009 EclipseSource 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: Scott Lewis and Jeff McAffer - initial API and + * implementation + *******************************************************************************/ +package org.eclipse.ecf.server; + +/** + * Service Client Manager + * @since 2.0 + */ +public interface IServiceClientManager { + + /** + * Get an IServiceClient by it's String id. + * @param id the String id to use to lookup the IServiceClient. If <code>null</code>, then <code>null</code> + * will be returned. + * @return IServiceClient corresponding to given id. If not found then <code>null</code> will be returned. + */ + public IServiceClient lookupClient(String id); +} diff --git a/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceHost.java b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceHost.java new file mode 100644 index 000000000..915df2478 --- /dev/null +++ b/server-side/bundles/org.eclipse.ecf.server/src/org/eclipse/ecf/server/IServiceHost.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2009 EclipseSource 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: Scott Lewis and Jeff McAffer - initial API and + * implementation + *******************************************************************************/ +package org.eclipse.ecf.server; + +import java.util.Dictionary; +import org.eclipse.ecf.remoteservice.IRemoteServiceContainer; +import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * Service Host + * @since 2.0 + */ +public interface IServiceHost { + + /** + * Start the service host. This will make the service host active, and available on the network. + * @throws Exception if something goes wrong with initialization or starting. + */ + public void start() throws Exception; + + /** + * Register service host. Registers this service host in the service registry + * with the given BundleContext. + * @param context the BundleContext to register with. Must not be <code>null</code>. + * @param properties to associate with IServiceHost registration. May be <code>null</code>. + * @return ServiceRegistration registration for the IServiceHost service. Will not be <code>null</code>. + */ + public ServiceRegistration registerServiceHost(BundleContext context, Dictionary properties); + + /** + * Register a remote service with this service client. This allows remote services to be registered/exposed + * for remote usage. + * @param clazzes the interface class names of the remote services expose. + * @param service the actual service implementation. + * @param remoteServiceProperties and remote service properties to be exposed to clients of the remote service. + * @return IRemoteServiceRegistration the remote service registration for the registered remote service. + * Will not be <code>null</code>. + */ + public IRemoteServiceRegistration registerRemoteService(String[] clazzes, Object service, Dictionary remoteServiceProperties); + + /** + * Get the remote service container for this service client. + * @return IRemoteServiceContainer will not be <code>null</code>. + */ + public IRemoteServiceContainer getRemoteServiceContainer(); + + /** + * Stop this service host. This will stop any/all the underlying containers for this host. + */ + public void stop(); + +} |