Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2015-08-19 22:44:57 +0000
committerslewis2015-08-19 22:44:57 +0000
commit6697574371461fa8cd34063231fae144be5b11b4 (patch)
tree4d0c3d9ce501dad6a3d81c7a64e7ea3c731a0d14 /framework
parent59c0ea3dd70455894bf87122364bfb54c1a5ce79 (diff)
downloadorg.eclipse.ecf-6697574371461fa8cd34063231fae144be5b11b4.tar.gz
org.eclipse.ecf-6697574371461fa8cd34063231fae144be5b11b4.tar.xz
org.eclipse.ecf-6697574371461fa8cd34063231fae144be5b11b4.zip
Improved design of remote service provider API
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java75
1 files changed, 73 insertions, 2 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java
index a5008d90e..7683b35b9 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java
@@ -1,8 +1,10 @@
package org.eclipse.ecf.remoteservice.provider;
import java.util.Dictionary;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
/**
* Basic implementation of IRemoteServiceDistributionProvider. Intended to be subclassed by distribution
@@ -10,9 +12,78 @@ import org.eclipse.ecf.core.identity.Namespace;
*
* @since 8.7
*/
-public abstract class RemoteServiceDistributionProvider implements IRemoteServiceDistributionProvider {
+public class RemoteServiceDistributionProvider implements IRemoteServiceDistributionProvider {
- public abstract ContainerTypeDescription createContainerTypeDescription();
+ private String name;
+ private IContainerInstantiator instantiator;
+ private String description;
+ private boolean server;
+ private boolean hidden;
+
+ protected RemoteServiceDistributionProvider(String name, IContainerInstantiator instantiator) {
+ setName(name).setInstantiator(instantiator);
+ }
+
+ protected String getName() {
+ return this.name;
+ }
+
+ protected RemoteServiceDistributionProvider setName(String name) {
+ Assert.isNotNull(name);
+ this.name = name;
+ return this;
+ }
+
+ protected IContainerInstantiator getInstantiator() {
+ return instantiator;
+ }
+
+ protected RemoteServiceDistributionProvider setInstantiator(IContainerInstantiator instantiator) {
+ Assert.isNotNull(instantiator);
+ this.instantiator = instantiator;
+ return this;
+ }
+
+ protected String getDescription() {
+ return this.description;
+ }
+
+ protected RemoteServiceDistributionProvider setDescription(String desc) {
+ this.description = desc;
+ return this;
+ }
+
+ protected boolean isServer() {
+ return this.server;
+ }
+
+ protected RemoteServiceDistributionProvider setServer(boolean server) {
+ this.server = server;
+ return this;
+ }
+
+ protected boolean isHidden() {
+ return this.hidden;
+ }
+
+ protected RemoteServiceDistributionProvider setHidden(boolean hidden) {
+ this.hidden = hidden;
+ return this;
+ }
+
+ public void validateComplete() throws NullPointerException {
+ String ctdName = getName();
+ if (ctdName == null)
+ throw new NullPointerException("Container type description name cannot be null"); //$NON-NLS-1$
+ IContainerInstantiator ctdInstantiator = getInstantiator();
+ if (ctdInstantiator == null)
+ throw new NullPointerException("Container type description instantiator cannot be null"); //$NON-NLS-1$
+ }
+
+ public ContainerTypeDescription createContainerTypeDescription() {
+ validateComplete();
+ return new ContainerTypeDescription(getName(), getInstantiator(), getDescription(), isServer(), isHidden());
+ }
public Dictionary<String, ?> getContainerTypeDescriptionProperties() {
return null;

Back to the top