Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To add a resource to the registry instance, create a Resource object and then pass the created resource object to the registry instance's  put method:

  1. Create a collection called "/c1/c2."in the org.wso2.carbon.registry.core.CollectionImpl class.

    Code Block
    Collection collection = registry.newCollection();
  2. Call the put method.

    Code Block
    registry.put("/c1/c2", collection);

If you call the get methodthe get method, then you will be able to access that created resource. You can also use the set method the set method to set the value of the resource in the org.wso2.carbon.registry.core.Registry class. For example:

Code Block
//set property
registry.setProperty("propertyName", "value")

//get property
registry.getProperty("propertyName");

To add a resource with content, create a Resource object and in the org.wso2.carbon.registry.core.Resource class and then set content.

Code Block
Resource r1 = registry.newResource();
String str = "My File Content";
r1.setContent(str.getBytes());
registry.put("/c1/c2/r1", r1);

...