public class EmbeddedRegistryService extends Object implements RegistryService
EmbeddedRegistry
. It is recommended to have only one EmbeddedRegistry instance per
application. But there can be exceptions, where it is required to maintain two or more registries
pointing to different data sources.
Applications should initialize an EmbeddedRegistry instance at the start-up using following
code.
InputStream configStream = new FileInputStream("/projects/registry.xml"); RegistryContext
registryContext = new RegistryContext(configStream); EmbeddedRegistry embeddedRegistry = new
EmbeddedRegistry(registryContext);
After initializing an EmbeddedRegistry instance it should be stored in some globally accessible
location, so that it can be used by necessary modules to create UserRegistry instances. From
this, it is possible to create UserRegistry instances using various parameter combinations
documented in getXXRegistry methods.
UserRegistry adminRegistry = embeddedRegistry.getRegistry("admin", "admin");EmbeddedRegistry
,
UserRegistry
Modifier and Type | Field and Description |
---|---|
protected RegistryContext |
registryContext
The registry context used by this registry service instance.
|
Modifier | Constructor and Description |
---|---|
protected |
EmbeddedRegistryService()
This constructor is used by the inherited InMemoryEmbeddedRegistry class as it has to be
instantiated using the default constructor.
|
|
EmbeddedRegistryService(RegistryContext context)
Instantiates the EmbeddedRegistry using the configuration given in the context and the given
UserRealm.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configure(org.wso2.carbon.user.core.service.RealmService realmService)
Method to configure the embedded registry service.
|
UserRegistry |
getConfigSystemRegistry()
Returns a registry to be used for system operations.
|
UserRegistry |
getConfigSystemRegistry(int tenantId)
Returns a registry to be used for system operations.
|
UserRegistry |
getConfigUserRegistry()
Creates a Registry instance for anonymous user from the configuration registry space.
|
UserRegistry |
getConfigUserRegistry(String userName)
Creates a Registry instance for the given user from the configuration registry space.
|
UserRegistry |
getConfigUserRegistry(String userName,
int tenantId)
Creates a Registry instance for the given user from the configuration registry space with the
tenant id.
|
UserRegistry |
getConfigUserRegistry(String userName,
String password)
Creates Registry instances for normal users from the configuration registry space.
|
UserRegistry |
getConfigUserRegistry(String userName,
String password,
int tenantId)
Creates Registry instances for normal users from the configuration registry space.
|
UserRegistry |
getGovernanceSystemRegistry()
Creates a Registry instance for the Governance space.
|
UserRegistry |
getGovernanceSystemRegistry(int tenantId)
Creates a Registry instance for the Governance space.
|
UserRegistry |
getGovernanceUserRegistry()
Creates a Registry instance for anonymous user from the Governance space.
|
UserRegistry |
getGovernanceUserRegistry(String userName)
Creates a Registry instance for anonymous user from the Governance space.
|
UserRegistry |
getGovernanceUserRegistry(String userName,
int tenantId)
Creates a Registry instance for anonymous user from the Governance space.
|
UserRegistry |
getGovernanceUserRegistry(String userName,
String password)
Creates a Registry instance for anonymous user from the Governance space.
|
UserRegistry |
getGovernanceUserRegistry(String userName,
String password,
int tenantId)
Creates a Registry instance for anonymous user from the Governance space.
|
UserRegistry |
getLocalRepository()
Returns a registry to be used for node-specific system operations.
|
UserRegistry |
getLocalRepository(int tenantId)
Returns a registry to be used for node-specific system operations.
|
UserRegistry |
getRegistry()
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName,
int tenantId)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName,
int tenantId,
String chroot)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName,
String password)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName,
String password,
int tenantId)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getRegistry(String userName,
String password,
int tenantId,
String chroot)
Creates a Registry instance for anonymous user which contains the entire registry tree
starting from '/'.
|
UserRegistry |
getSystemRegistry()
Returns a registry to be used for system operations.
|
UserRegistry |
getSystemRegistry(int tenantId)
Returns a registry to be used for system operations.
|
UserRegistry |
getSystemRegistry(int tenantId,
String chroot)
Returns a registry to be used for system operations.
|
org.wso2.carbon.user.core.UserRealm |
getUserRealm(int tenantId)
This will return a realm specific to the tenant.
|
UserRegistry |
getUserRegistry()
Creates a UserRegistry instance for anonymous user.
|
UserRegistry |
getUserRegistry(String userName)
Creates a UserRegistry instance for the given user.
|
UserRegistry |
getUserRegistry(String userName,
int tenantId)
Creates a UserRegistry instance for the given user.
|
UserRegistry |
getUserRegistry(String userName,
int tenantId,
String chroot)
Creates a UserRegistry instance for the given user.
|
UserRegistry |
getUserRegistry(String userName,
String password)
Creates UserRegistry instances for normal users.
|
UserRegistry |
getUserRegistry(String userName,
String password,
int tenantId)
Creates UserRegistry instances for normal users.
|
UserRegistry |
getUserRegistry(String userName,
String password,
int tenantId,
String chroot)
Creates UserRegistry instances for normal users.
|
protected RegistryContext registryContext
public EmbeddedRegistryService(RegistryContext context) throws RegistryException
context
- Registry Context containing the configuration.RegistryException
- if the creation of the embedded registry service fails.protected EmbeddedRegistryService()
protected void configure(org.wso2.carbon.user.core.service.RealmService realmService) throws RegistryException
realmService
- the user realm service instance.RegistryException
- if an error occurs.public UserRegistry getUserRegistry() throws RegistryException
RegistryException
public UserRegistry getSystemRegistry() throws RegistryException
RegistryException
public UserRegistry getSystemRegistry(int tenantId) throws RegistryException
tenantId
- tenant id of the user tenant.RegistryException
public UserRegistry getSystemRegistry(int tenantId, String chroot) throws RegistryException
tenantId
- tenant id of the user tenant.chroot
- to return a chrooted registryRegistryException
public UserRegistry getUserRegistry(String userName, String password) throws RegistryException
userName
- User name of the user.password
- Password of the user.RegistryException
public UserRegistry getUserRegistry(String userName, String password, int tenantId) throws RegistryException
userName
- User name of the user.password
- Password of the user.tenantId
- Tenant id of the user tenant.RegistryException
public UserRegistry getUserRegistry(String userName, String password, int tenantId, String chroot) throws RegistryException
userName
- User name of the user.password
- Password of the user.tenantId
- Tenant id of the user tenant.chroot
- to return a chrooted registryRegistryException
public UserRegistry getUserRegistry(String userName) throws RegistryException
userName
- User name of the user.RegistryException
public UserRegistry getUserRegistry(String userName, int tenantId) throws RegistryException
userName
- User name of the user.tenantId
- Tenant id of the user tenant.RegistryException
public UserRegistry getUserRegistry(String userName, int tenantId, String chroot) throws RegistryException
userName
- User name of the user.tenantId
- Tenant id of the user tenant.chroot
- to return a chrooted registryRegistryException
public org.wso2.carbon.user.core.UserRealm getUserRealm(int tenantId) throws RegistryException
RegistryService
tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName, int tenantId, String chroot) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.chroot
- to return a chrooted registry. The whole registry can be accessed by using
the chroot, '/', and a subset of the registry can be accessed by using a
chroot, '/x/y/z'. For example, the repository of the configuration local
registry can be obtained from '/_system/config/repository'.RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName, String password, int tenantId, String chroot) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.chroot
- to return a chrooted registry. The whole registry can be accessed by using
the chroot, '/', and a subset of the registry can be accessed by using a
chroot, '/x/y/z'. For example, the repository of the configuration local
registry can be obtained from '/_system/config/repository'.RegistryException
- if an error occurspublic UserRegistry getRegistry() throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName, int tenantId) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName, String password) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.RegistryException
- if an error occurspublic UserRegistry getRegistry(String userName, String password, int tenantId) throws RegistryException
RegistryService
getRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getLocalRepository() throws RegistryException
RegistryService
getLocalRepository
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getLocalRepository(int tenantId) throws RegistryException
RegistryService
getLocalRepository
in interface org.wso2.carbon.registry.api.RegistryService
tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getConfigSystemRegistry(int tenantId) throws RegistryException
RegistryService
getConfigSystemRegistry
in interface org.wso2.carbon.registry.api.RegistryService
tenantId
- the tenant id of the system. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getConfigSystemRegistry() throws RegistryException
RegistryService
getConfigSystemRegistry
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getConfigUserRegistry(String userName, int tenantId) throws RegistryException
RegistryService
getConfigUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getConfigUserRegistry(String userName, String password, int tenantId) throws RegistryException
RegistryService
getConfigUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getConfigUserRegistry() throws RegistryException
RegistryService
getConfigUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getConfigUserRegistry(String userName) throws RegistryException
RegistryService
getConfigUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.RegistryException
- if an error occurspublic UserRegistry getConfigUserRegistry(String userName, String password) throws RegistryException
RegistryService
getConfigUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.RegistryException
- if an error occurspublic UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException
RegistryService
getGovernanceSystemRegistry
in interface org.wso2.carbon.registry.api.RegistryService
tenantId
- the tenant id of the system. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getGovernanceSystemRegistry() throws RegistryException
RegistryService
getGovernanceSystemRegistry
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getGovernanceUserRegistry(String userName, int tenantId) throws RegistryException
RegistryService
getGovernanceUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getGovernanceUserRegistry(String userName, String password, int tenantId) throws RegistryException
RegistryService
getGovernanceUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.tenantId
- tenant id of the user tenant. The tenant id '0', corresponds to the super
tenant of the system, whereas identifiers greater than '0' correspond to
valid tenants.RegistryException
- if an error occurspublic UserRegistry getGovernanceUserRegistry() throws RegistryException
RegistryService
getGovernanceUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
RegistryException
- if an error occurspublic UserRegistry getGovernanceUserRegistry(String userName) throws RegistryException
RegistryService
getGovernanceUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.RegistryException
- if an error occurspublic UserRegistry getGovernanceUserRegistry(String userName, String password) throws RegistryException
RegistryService
getGovernanceUserRegistry
in interface org.wso2.carbon.registry.api.RegistryService
userName
- User name of the user.password
- Password of the user.RegistryException
- if an error occursCopyright © 2015 WSO2 Inc. All Rights Reserved.