Skip to content

Commit

Permalink
Merge ada7a52 into 4602389
Browse files Browse the repository at this point in the history
  • Loading branch information
scottslewis committed Apr 26, 2018
2 parents 4602389 + ada7a52 commit a0cb914
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pelix/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
This property is constant during the life of a framework instance.
"""

OSGI_FRAMEWORK_UUID = "org.osgi.framework.uuid"
"""
OSGi standard framework uuid property name. Set in framework init to the value
of FRAMEWORK_UID
"""

# ------------------------------------------------------------------------------

SCOPE_SINGLETON = "singleton"
Expand Down
7 changes: 4 additions & 3 deletions pelix/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
pass

# Pelix beans and constants
from pelix.constants import ACTIVATOR, ACTIVATOR_LEGACY, FRAMEWORK_UID, \
from pelix.constants import ACTIVATOR, ACTIVATOR_LEGACY, FRAMEWORK_UID, OSGI_FRAMEWORK_UUID, \
BundleException, FrameworkException
from pelix.internals.events import BundleEvent, ServiceEvent
from pelix.internals.registry import EventDispatcher, ServiceRegistry, \
Expand Down Expand Up @@ -625,13 +625,14 @@ def __init__(self, properties=None):
# Use a copy of the properties, to avoid external changes
self.__properties = properties.copy()

# Generate a framework instance UUID, if needed
# Generate and set a framework instance UUID, if needed
framework_uid = self.__properties.get(FRAMEWORK_UID)
if not framework_uid:
framework_uid = str(uuid.uuid4())

# Normalize the UID: it must be a string
self.__properties[FRAMEWORK_UID] = str(framework_uid)
# Also normalize the OSGI_FRAMEWORK_UID: it must be a string
self.__properties[OSGI_FRAMEWORK_UUID] = str(framework_uid)

# Properties lock
self.__properties_lock = threading.Lock()
Expand Down

0 comments on commit a0cb914

Please sign in to comment.