[Registry-dev] Embedded registry initialization

Chathura C. Ekanayake chathura at wso2.com
Tue Apr 22 08:12:58 PDT 2008


Now all the authorizations of the registry are performed by the 
components responsible for actual operations. So the SecureRegistry is 
no longer required. Now all the operations are authorized and the 
registry cannot be directly accessed through the JDBCRegistry. If an 
application doesn't want to care about managing users, it can access the 
registry as the system user. Creating registries for users is simplified 
by the EmbeddedRegistry.

Below are the steps for creating the EmbeddedRegistry and then obtaining 
user registries from it.

EmbeddedRegistry embeddedRegistry = new EmbeddedRegistry(datasource);

// get the system registry
Registry systemRegistry = embeddedRegistry.getSystemRegistry();

// get an anonymous user registry
Registry systemRegistry = embeddedRegistry.getRegistry();

// get the user registry for the user "username"
Registry userRegistry1 = embeddedRegistry.getUserRegistry("username", 
"password");

In the above sample, the user realm for the registry is automatically 
created from the same data source, where registry database is located. 
If it is necessary to use a different realm, below constructor can be used.

EmbeddedRegistry embeddedRegistry = new EmbeddedRegistry(datasource, realm);

Below constructor can be used to create registry from an in-memory database.

EmbeddedRegistry embeddedRegistry = new InMemoryEmbeddedRegistry();

Thanks,
Chathura







More information about the Registry-dev mailing list