Building Blocks > Understanding Namespaces, Access Modifiers, and Their Customization Impact
Understanding Namespaces, Access Modifiers, and Their Customization Impact
Namespaces and access modifiers in ThingWorx are used to set the scope within which the building block entities and their characteristics (properties, services, configuration tables) can be used. This functionality determines which entities and characteristics are protected from external use and which can be used for further customization or development, including extension, referencing, and reuse.
For more information on these features, including which entities support access modifiers, see Namespaces and Access Modifiers in the ThingWorx Platform Help Center.
The following sections explain how these features impact building block customization.
Namespaces on Building Block Projects
The project for each building block has its Namespace value set to ptc.sca.<building_block_name>. Namespaces are hierarchical, using a dot-separated nomenclature to display the hierarchy.
For example, the Namespace on the PTC.Status project is ptc.sca.status, and the Namespace on the PTC.ModelManagementImpl project is ptc.sca.modelmanagementimpl. The ptc.sca namespace is a parent to any ptc.sca.<building_block_name> namespaces, such as ptc.sca.status and ptc.sca.modelmanagementimpl.
Scope
The scope for entities and characteristics within a building block project is the namespace or namespaces in which they are available to be used. For entities, the scope is set using the Scope property on their General Information page. For characteristics, this is set using their Access Modifier field. The following list describes the scope values that can be set:
NONE (or an empty value)—The entity or characteristic is available outside of the namespace that is defined for its parent project. This is considered to be a public scope.
RESTRICTED—The entity or characteristic can be accessed only within the scope of the designated namespace.
If a parent namespace is designated, then the entity or characteristic can be accessed within the parent namespace and all child namespaces of the parent namespace. For example, if ptc.sca is designated as the restricted namespace, then the entity or characteristic can be accessed within the ptc.sca namespace and child namespaces such as ptc.sca.status and ptc.sca.mfgmodel.
If a child namespace is designated, then the entity or characteristic can be accessed within that child namespace, but cannot be accessed within the parent namespace. For example, if ptc.sca.status is designated as the restricted namespace, then the entity or characteristic can be accessed within the ptc.sca.status namespace, but cannot be accessed within the parent ptc.sca namespace.
PRIVATE—The entity or characteristic is only accessible within the scope of the current project.
INTERNAL—The characteristic is accessible only within the entity that it is on. This scope can be applied only to characteristics.
An entity can have some characteristics that are public (NONE) and some characteristics that are protected (RESTRICTED, PRIVATE, or INTERNAL). Protected entities and characteristics are considered to have a non-public scope.
What Does This Mean for Customizations?
Only entities and characteristics with a public scope (NONE) should be used in customizations. This ensures that customizations do not interfere with upgrading the building blocks to a new release.
Starting with the 9.5.0 release, all entities and characteristics that are newly added to the building blocks have the appropriate access modifiers applied.
Entities and characteristics that were present in the building blocks prior to 9.5.0 will have access modifiers added in a future release. Any existing entities and characteristics that should have a non-public scope have the NON-PUBLIC designation added at the start of their descriptions.
* 
When creating and updating customizations, do not use entities or characteristics that have the NON-PUBLIC designation in their descriptions.
If you have existing customizations, review them after upgrading to 9.5.0 to discover if they use any NON-PUBLIC entities or characteristics. Update your customizations so that these entities or characteristics are not used, as they will become unavailable in a future release when the access modifiers are applied.
The following entities and their characteristics in the PTC-provided building blocks always have a public scope:
Manager Thing Shapes
Manager Thing Templates, which implement a manager Thing Shape
Entry Point Thing Shapes
Model Logic Thing Shapes
Other entities and characteristics within the building blocks can be non-public, depending on their use. For example, services created directly on a manager Thing Template are non-public. Data Shapes used only in non-public APIs can be public or non-public.
Was this helpful?