Unable to Initialise WSO2 governance registry? - wso2

I am trying to customize the index.jsp for wso2 governance registry. I am trying to get the list of all the services that were being added into the registry. And also I want to add functionality like searching for the services in the index.jsp. I am trying to intialize the Registry object ? I am wondering how to get the Registry object. Can any one suggest me how to do that ? so that once I can get the Registry object, I will use Resource object to search in the Registry.
Resource governanceFolder = registry.get("/_system/governance");
But how to get that registry object ?
I tried Registry registry = initialize(); which did not work. Can any one help me ?

What is the GREG version you are using ? In the case if you are using latest GREG (4.5.3) services are also considered as Configurable governance artifacts, Therefor you can follow http://ajithvblogs.blogspot.com/2013/02/how-to-invoke-custom-artifacts-using.html to get list of services.
In case if you are using an old version of GREG you may have to use the corresponding Admin Service to list services.

You can find [1] to initialize the registry object.
Registry governanceRegistry = GovernanceUtils.getGovernanceUserRegistry(registry, userName);
ServiceManager serviceManager = new ServiceManager(governanceRegistry);
Service[] services = serviceManager.getAllServices();
Find more details on Governance Registry documentation.

Related

Accessing WSO2 BPS and ESB registry from code

I am trying to access the registry of WSO2 BPS and WSO2 ESB from Java in order to automatically fill the registry based on the data I provide.
I have already found a number of resources about the required Java code and dependencies, this being the most helpful one: [WSO2 Governance Registry]Using WSRegistryServiceClient. However, the approach described in these resources depends on the WSRegistryService service. This service is included in Governance Registry by default, but not in the other WSO2 products. I have verified that my code works for the Governance Registry. For any other WSO2 product on my machine, I get this error:
The service cannot be found for the endpoint reference (EPR) https://localhost:9445/services/WSRegistryService
I found an old thread suggesting that it should be possible to install the WSRegistryService on other WSO2 products as well, but I have not been able to find out how to do so. I can't seem to find it within the features I can install from the web console of the products. I have also tried manually copying the relevant jar from the plugins directory of Governance Registry into the plugins directory of other products, but that doesn't seem to be sufficient.
Note that my application for filling the registry will not be running on the carbon server whose registry I want to access, so using CarbonContext.getThreadLocalCarbonContext() (an approach I found in some other articles) is not an option.
I think your referring to how to install features to WSO2 products,
Please find this documentation.

WSO2 class mediator for accessing Governance Registry Resource

In a cluster configuration made up of 2 WSO2 ESB 4.8.1, i need to develop a machanism by which the two ESB can access a shared Map Object writing and reading it.
In particular i was thinking about developing a custom class mediator deployed on both the esb which can access a Map Object stored inside a WSO2 Governance Registry.
I have already integrate an instance of the WSO2 Governance Registry with the 2 ESB.
Now i need to know:
1) is there a client code sample by wich i can find, access a resource on the governance registry and update it?
2) in which section of the registry can i store the Map object?
Thanks
I have given the answer for your questions in WSO2 Governance API from WSO2 ESB Mediator. But personally I think best way to achieve this writing a new cache manager using underlying wso2 caching implementation.
Here is a sample code.
import javax.cache.Cache;
import javax.cache.CacheBuilder;
import javax.cache.CacheManager;
import javax.cache.Caching;
....
....
CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("CustomCacheManager");
CacheBuilder<String, Object> cacheBuilder = cacheManager.createCacheBuilder("MapCache");
Cache<String, Object> cache = cacheBuilder.build();
cache.put("key", "value");
Here is how values retrieve in remote node.
CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("CustomCacheManager");
Cache remoteCache = cacheManager.getCache("MapCache");
String value = (String) cache.get("key");
Hope you will be able to find the best solution for your problem.

Error occurring while Listing wsdl from wso2 governance

I have added wso2 governance registry on wso2 BPS 3 as a feature from http://dist.wso2.org/p2/carbon/releases/turing/
and restarted.
When tried to add wsdl from file it giving error:
org.wso2.carbon.governance.api.exception.GovernanceException: Attribute Search Service not Found.
I am trying to use BPS, GREG as a single component to reduce servers in my project. After GREG added as a feature it adding ".wsdl" file at "_/system/governance" and it is not forming endpoints,services as GREG normally do.
Is there any way to get out of this problem.
Thank's in advance....
The reason for this is missing some of the features which needed in ordered to work governance features. I think best option is using Governance Registry separately and mount the registry of it to BPS. By doing this you can add services from Governance Registry and use them in BPS. You can follow this document for more information on registry mounting.

Access programmatically WSO2 BAM registry

I know I can access the WSO2 Governance Registry programmatically using the API. Is it also possible to access and upload/modify information on another (non GREG) servers'registry and how?
Is the approach the same? Is it possible to upload hive scripts for example on BAM programically?
Accessing embedded registry from a 'non GREG' WSO2 product using the registry API, is described here [1] in WSO2 Application Server documentation page.
[1] http://docs.wso2.org/display/AS520/Basic+Registry+API+Knowledge
Thanks,
Isuruwan

wso2 product Registry menu (config, governance, local)

Is there any authoritative documentation available for data found under the Registry UI menu (for example as found in WSO2 ESB admin screens)?
I have seen snippets of information about this registry, for example:
The configuration registry contains product specific configuration
that can be shared across multiple instances of the same product (a
cluster of ESB nodes for example).
Source: link
To start with, I have a few questions:
What is the difference between this registry and the WSO2 Governance Registry?
What are the typical use cases for a WSO2 esb admin user for interacting with this Registry?
What are the typical use cases for a WSO2 esb developer for interacting with this Registry?
Is there a description of all the meta data stored in this registry?
In All WSO2 products there is an internal registry which is used to store resources. WSo2 Governance Registry uses the same core features + some more feature that gives complete Governance scenario. If you need you can mount to an external WSo2 Governance Registry without using the internal registry you referred.You can find more details here.