Saturday, June 5, 2010

WSO2 Governance Registry Eclipse Tool v1.0.0-beta

WSO2 Governance Registry Eclipse Tool v1.0.0-beta has been released. This is a light weight eclipse plugin which will give you registry functionalities in a very user friendly manner. As a pre-requisite, you need latest version of a running WSO2 Governance Registry in your local machine or in any other remote instance.

Key features :
  • Add different remote registry instances
  • Add, edit, delete collections, resources
  • Add, edit, delete properties, associations, dependencies, comments, tags for a resource or collection
  • Link with editor
  • Add multiple files and folder from file system
  • Import/Export resources and collections
  • Drag/Drop resources and collections
  • Modify permission for a resource, collection
  • Refresh registry
  • View information per resource and collection (properties, dependencies, associations, tags, comments etc)
  • Check-out a collection to local project (both ways)
  • Do changes and commit back to registry, update with registry
  • Show in Registry Browser
  • View versions, restore versions
  • Double click on a resource to open the resource in the relevant editor of eclipse
  • Add, modify, delete users
  • Change role permissions of resource

You can find more details from our project home page.

Friday, June 4, 2010

Programmatically create a P2 Repo in eclipse

You can create a P2 repo programmatically with your plugin using extensible API of P2 publisher. P2 repo contains four items as plugins folder, features folder, content.xml and artifact.xml.

Here is the code:

import java.util.Collections;

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
import org.eclipse.equinox.p2.publisher.IPublisherAction;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.Publisher;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager;

public class PublisherExample implements IApplication {

public Object start(IApplicationContext context) throws Exception {
IPublisherInfo info = createPublisherInfo();
IPublisherAction[] actions = createActions();
Publisher publisher = new Publisher(info);
publisher.publish(actions, new NullProgressMonitor());
return null;


public void stop() {


public static IPublisherInfo createPublisherInfo()
throws ProvisionException, URISyntaxException {
PublisherInfo result = new PublisherInfo();

// Create the metadata repository. This will fail if a repository
// already exists here
IMetadataRepository metadataRepository = new SimpleMetadataRepositoryFactory()
.create(new URI("path to create the repo"),
"Sample Metadata Repository",

// Create the artifact repository. This will fail if a repository
// already exists here
IArtifactRepository artifactRepository = new SimpleArtifactRepositoryFactory()
.create(new URI("path to create the repo"),
"Sample Artifact Repository",

| IPublisherInfo.A_INDEX);
return result;

public static IPublisherAction[] createActions() {
IPublisherAction[] result = new IPublisherAction[2];
File[] bundleLocations = new File[1];
bundleLocations[0] = new File("location of the feature folder");
BundlesAction bundlesAction = new BundlesAction(bundleLocations);
FeaturesAction featureAction = new FeaturesAction(bundleLocations);
result[0] = bundlesAction;
result[1] = featureAction;
return result;

In here, you have to define the path you want to create the P2 repo which is called as metadataRepository. At the same time, you have to specify the source path where it contains bundles and features that you want to added to the P2 Repo.