Package org.eclipse.equinox.p2.core
Interface IProvisioningAgent
public interface IProvisioningAgent
A provisioning agent is comprised of a modular, extensible set of related services.
Each agent instance has its own separate instances of these services that are
not shared with other agents. There is at most one instance of a given service
tracked by an agent at any given time, which ensures all services that make
up an agent instance share common service instances with each other.
Services are registered with an agent either directly, via the registerService(String, Object)
method, or indirectly by registering an IAgentServiceFactory
in the OSGi
service registry.
- Since:
- 2.0
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
Service property identifying whether an agent is the default agent.static final String
Service name constant for the agent service.static final String
When running in "shared mode", this allows to retrieve from the IProvisioningAgent the agent representing what is in the shared location aka the basestatic final String
When running in "shared mode", this allows to retrieve from the IProvisioningAgent identified bySHARED_BASE_AGENT
the current agent -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
getBooleanProperty
(String key) Returns an agent bound property as a boolean, the default implementation delegates togetBooleanProperty(String, boolean)
withfalse
as the default.default boolean
getBooleanProperty
(String key, boolean defaultValue) Returns an agent bound property as a boolean, the default implementation delegates togetProperty(String)
with the given default as a String and parses the result as byBoolean.parseBoolean(String)
.default String
getProperty
(String key) Returns an agent bound property, the default implementation delegates to the bundle properties if running and to the system properties otherwise.default String
getProperty
(String key, String defaultValue) Returns an agent bound property, the default implementation delegates to the bundle properties if running and to the system properties otherwise.default <T> T
getService
(Class<T> key) Returns the service with the given service name, ornull
if no such service is available in this agent.getService
(String serviceName) Returns the service with the given service name, ornull
if no such service is available in this agent.void
registerService
(String serviceName, Object service) Registers a service with this provisioning agent.void
stop()
Stops the provisioning agent.void
unregisterService
(String serviceName, Object service) Unregisters a service that has previously been registered with this agent viaregisterService(String, Object)
.
-
Field Details
-
SERVICE_NAME
Service name constant for the agent service. Note that an agent obtained directly as a service typically represents the agent of the currently running system. To obtain an agent for a different system theIProvisioningAgentProvider
service must be used. -
INSTALLER_AGENT
- See Also:
-
INSTALLER_PROFILEID
- See Also:
-
SHARED_BASE_AGENT
When running in "shared mode", this allows to retrieve from the IProvisioningAgent the agent representing what is in the shared location aka the base- Since:
- 2.3
- See Also:
-
SHARED_CURRENT_AGENT
When running in "shared mode", this allows to retrieve from the IProvisioningAgent identified bySHARED_BASE_AGENT
the current agent- Since:
- 2.3
- See Also:
-
SERVICE_CURRENT
Service property identifying whether an agent is the default agent.This property may be used by clients wishing to obtain or track the provisioning agent for the currently running system. When the value of this property is
"true"
then the corresponding service is the agent for the currently running system. If the property is undefined or has any other value, then the service is not the agent for the currently running system.- See Also:
-
-
Method Details
-
getService
Returns the service with the given service name, ornull
if no such service is available in this agent.- Throws:
IllegalStateException
- if this agent has been stopped
-
getService
Returns the service with the given service name, ornull
if no such service is available in this agent.- Throws:
IllegalStateException
- if this agent has been stoppedClassCastException
- if the agent cannot be cast to the provided class- Since:
- 2.6
-
registerService
Registers a service with this provisioning agent.- Parameters:
serviceName
- The name of the service to registerservice
- The service implementation- Throws:
IllegalStateException
- if this agent has been stopped
-
stop
void stop()Stops the provisioning agent. This causes services provided by this agent to be cleaned up and discarded. No services provided by the agent should be referenced after the agent has been stopped, and subsequent attempts to obtain services after the agent has stopped will fail.An agent should only be stopped by the client who first created the agent by invoking
IProvisioningAgentProvider.createAgent(java.net.URI)
. -
unregisterService
Unregisters a service that has previously been registered with this agent viaregisterService(String, Object)
. This method has no effect if no such service is registered with this agent.- Parameters:
serviceName
- The name of the service to unregisterservice
- The service implementation to unregister.
-
getProperty
Returns an agent bound property, the default implementation delegates to the bundle properties if running and to the system properties otherwise.- Since:
- 2.11
-
getProperty
Returns an agent bound property, the default implementation delegates to the bundle properties if running and to the system properties otherwise.- Since:
- 2.11
-
getBooleanProperty
Returns an agent bound property as a boolean, the default implementation delegates togetBooleanProperty(String, boolean)
withfalse
as the default.- Since:
- 2.12
-
getBooleanProperty
Returns an agent bound property as a boolean, the default implementation delegates togetProperty(String)
with the given default as a String and parses the result as byBoolean.parseBoolean(String)
.- Since:
- 2.12
-