Simple "check for updates" library in java

I use Eclipse RCP, but mainly because I have full control over the user interface (all contributions are removed, settings are made from scratch, etc.), I just can not agree with the complexity and requirement of the included UPDATE MANAGER (also , I use PLUGINS not features, and the Plugin application should be EXTRACTED - although I could get arround this latest release).

In any case, in the first approach, I just want to check if a newer version of the application exists.

The logical way would be to check the file (xml?) On the server.

Is there a good library and example?

Thank.

+5
source share
2 answers

Eclipse now supports p2, a much more flexible system over the old update manager. It can be used to install new software and check for updates to existing software.

You can enable the p2 self-update part without an interface, although the complete process, which includes Help> Install new updates, is described here http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application

All updates in eclipse are easier to manage if you use this function, but in this function you can mark the RCP application plugin for extension to the directory, and not as a jar (it will do it automatically).

. ? ? eclipse OSGi, , ? p2 , . . http://wiki.eclipse.org/P2

Edit:

API p2 - :

public class SelfUpdateOperation {
    public static void update() {
        BundleContext context = FrameworkUtil.getBundle(
                SelfUpdateOperation.class).getBundleContext();
        ServiceReference<?> reference = context
                .getServiceReference(IProvisioningAgent.SERVICE_NAME);
        if (reference == null)
            return;
        Object obj = context.getService(reference);
        IProvisioningAgent agent = (IProvisioningAgent) obj;
        ProvisioningSession session = new ProvisioningSession(agent);
        UpdateOperation update = new UpdateOperation(session);
        IStatus result = update.resolveModal(new NullProgressMonitor());
        if (result.isOK()) {
            update.getProvisioningJob(new NullProgressMonitor()).schedule();
        } else {
            // can't update for some reason
        }
        context.ungetService(reference);
    }
}

(, ), API.

+3
+1

All Articles