Skip to content

Commit

Permalink
Simplifications and additions to support remote service admin
Browse files Browse the repository at this point in the history
  • Loading branch information
scottslewis committed May 3, 2018
1 parent 4a5c6b3 commit 23d2c07
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pelix/rsa/remoteserviceadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def select_export_container(self, service_ref, exported_intfs, export_props):

export_containers = []
for export_provider in self._export_distribution_providers:
export_container = export_provider.supports_export(exported_intfs,exported_configs,service_intents,export_props)
export_container = export_provider.supports_export(exported_configs,service_intents,export_props)
if export_container:
export_containers.append(export_container)

Expand Down Expand Up @@ -776,9 +776,9 @@ def __init__(self):
super().__init__()
self._allow_exporter_reuse = True
self._auto_create = True
self._ipopo
self._ipopo = None

def _get_existing_export_container(self, exported_intfs, exported_configs, service_intents, export_props):
def _get_existing_export_container(self, exported_configs, service_intents, export_props):
# XXX todo
return None

Expand All @@ -794,21 +794,19 @@ def _match_service_intents(self,service_intents):
# XXX todo
return True

def _create_export_container(self, exported_intfs, exported_configs, service_intents, export_props):
def _create_instance(self, exported_configs, service_intents, export_props):
if self._match_exported_configs(exported_configs) and self._match_service_intents(service_intents):
# first create name for new export container
name = 'exportcontainername'
props = { 'foo':'bar' }
result = self._ipopo.instantiate(self._config_name, name, props)
result = self._ipopo.instantiate(self._config_name, rsa.create_uuid(), { })

return result

def supports_export(self, exported_intfs, exported_configs, service_intents, export_props):
def supports_export(self, exported_configs, service_intents, export_props):
export_container = None
if self._allow_exporter_reuse:
export_container = self._get_existing_export_container(exported_intfs, exported_configs, service_intents, export_props)
export_container = self._get_existing_instance(exported_configs, service_intents, export_props)
if not export_container:
export_container = self._create_export_container(exported_intfs, exported_configs, service_intents, export_props)
export_container = self._create_instance(exported_configs, service_intents, export_props)
return export_container

class ImportDistributionProvider(DistributionProvider):
Expand Down

0 comments on commit 23d2c07

Please sign in to comment.