Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

ProfileVersion

Thomas Diesler edited this page May 23, 2014 · 3 revisions

Working with Profile Versions

A Profile Version is an identifiable set of Fabric8 Profiles.

  • It is uniquely identified in the cluster by a Version

Clients can obtain instances of profile versions from the ProfileManager.

Managing Profile Versions

The ProfileManager is the central entry point for working with profile versions. It containers operations to

  • Add, remove profile versions
  • Find profile versions by given identifiers
  • Associate a profile version with a set of given Profiles

ProfileVersion instances returned by the ProfileManager are shallow immutable objects. They represent the state of physical profile version at a moment in time.

LinkedProfileVersion gives access to the complete hierarchy of all Profiles associated with a given ProfileVersion.

Creating a Profile Version

To create a profile version, a client would use a ProfileVersionBuilder and pass the so built ProfileVersion to the ProfileManager like this

// Building the profile version
Version version = Version.parseVersion("1.1");
ProfileVersionBuilder builder = ProfileVersionBuilder.Factory.create();
ProfileVersion profileVersion = builder.addIdentity(version).getProfileVersion();

// Adding the profile version
ProfileManager manager = ProfileManagerLocator.getProfileManager();
manager.addProfileVersion(profileVersion);

Initially, there are no Profiles associated with a newly created profile version.

Removing a Profile Version

// Removing a profile version
ProfileManager manager = ProfileManagerLocator.getProfileManager();
manager.removeProfileVersion(version);

A profile version that is associated with an active container cannot be removed.

Concurrency and Locking Strategy

  • Read access to Profile Version and Profile can happen concurrently.
  • Each Profile Version supports the notion of a read-write lock.
  • Access to a Profile is protected by the lock of the associated Profile Version

Obtaining an exclusive lock on a Profile Version is necessary when consistent access to Profile content is required over a number of calls. For example management clients may provide a deep view of profile content that is associated with a set of containers. While aggregating the data the Profile Version and associated Profile content must be guaranteed to not change.