This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Managing Versions of a Resource
Creating Versions of Resources
Resources are automatically versioned when they are added or updated. But collections are not versioned automatically due to performance considerations. However, you can create versions of collections using the API. It is recommended that collection versions are created only for making checkpoints of the sub-tree you are working on.
Use the following code to create a version of your resource/collection:
registry.createVersion("/c1/c2");
Retrieving Versions of a Given Resource
You can list all of the versions of a given resource using the code given below. The result would be an array of String
type, containing links to the different versions of the resource.
String [] versions = registry.getVersions("/c1/c2");
Restoring to an Old VersionÂ
Since the Registry comes with versioning, we can restore a resource to any of its versions. This can be done using the registry as well. In the Retrieving Versions of a Given Resource section, we discussed how to retrieve versions for a give resource. The following line of code demonstrates we can restore back an old version of the registry instance. Please note that in the process of restoration, the content, properties, comments, tags, ratings, associations and dependencies will be restored but subscriptions and permissions related to resources won't be restored.
registry.restoreVersion ("/c1/c2;version:2");
Â
See also Managing Metadata to learn how to check versions using the Management Console.