summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java')
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
new file mode 100644
index 0000000000..184d3a12bf
--- /dev/null
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.dosgi.discovery;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.discovery.ServicePublication;
+
+/**
+ * Publication of an SCA endpoint
+ */
+public class EndpointPublication implements ServicePublication {
+ private Endpoint endpoint;
+ private ServiceReference reference;
+
+ /**
+ * Create a publication for the endpoint
+ * @param reference The OSGi service reference for the given endpoint. The SCA endpoint
+ * is pointing to a local service in the OSGi service registry
+ */
+ public EndpointPublication(ServiceReference reference, Endpoint endpoint) {
+ super();
+ this.reference = reference;
+ this.endpoint = endpoint;
+ }
+
+ public ServiceReference getReference() {
+ return reference;
+ }
+
+ public Dictionary<String, Object> getProperties() {
+ Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Map<String, Object> serviceProps = EndpointDescription.getServiceProperties(endpoint);
+ props.put(SERVICE_PROPERTIES, serviceProps);
+ // TODO: Populate the properties from the Endpoint object
+ String name = EndpointDescription.getInterfaceName(endpoint);
+ props.put(ENDPOINT_INTERFACE_NAME, Collections.singleton(name));
+ return props;
+ }
+
+}