简单的“检查更新” java中的库

发布于 2024-11-06 03:00:51 字数 254 浏览 0 评论 0原文

我正在使用 Eclipse RCP,但是,主要是因为我完全控制了 UI(删除了所有贡献,从头开始进行首选项等),我只是无法接受所包含的更新管理器的复杂性和需求(另外,我不使用插件功能,并且应用程序插件必须被提取 - 尽管我可以解决最后一个问题)。

无论如何,在第一种方法中,我只想检查是否有可用的较新版本的应用程序。

合乎逻辑的方法是检查服务器上的文件(xml?)。

有没有好的库和示例?

谢谢。

I'm using Eclipse RCP, but, mainly because i have total control of the UI (removed all contributions, made Preferences from scratch, etc) i just cannot accept the complexity and demand of the included UPDATE MANAGER (also, i use PLUGINS not features, and the app Plugin must be EXTRACTED - though i could get arround this last issue).

Anyway, on a first approach i just want to check IF there is a newer version of the app available.

The logical way would be to check against a file (xml?) on a server.

Is there a good library and example out there?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦中的蝴蝶 2024-11-13 03:00:51

Eclipse 现在支持 p2,这是一个比旧更新管理器更加灵活的系统。它可用于安装新软件并检查现有软件的更新。

您可以在没有 UI 的情况下包含 p2 的自我更新部分,尽管此处描述了包含“帮助”>“安装新更新”的完整过程 http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application

如果您使用某个功能,则 Eclipse 中的所有更新都会更容易管理,但该功能是您可以将您的 RCP 应用程序插件标记为扩展为目录而不是 jar(它会自动执行此操作)。

向任何应用程序添加自我更新并非易事。您是一次性更新所有罐子,还是只更新选定的罐子?同时更新哪些 jar 才有意义?使用基于 OSGi 的 eclipse,如何确保更新使系统处于工作状态? p2 的构建是为了帮助管理这些用例。请参阅http://wiki.eclipse.org/P2

编辑:

简单的自我- 可以使用 p2 API 添加更新,而不包含任何 UI 代码:

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。

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 on existing software.

You can include the self-updating portion of p2 with no UI, although the full process that includes the 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 manager if you use a feature, but the feature is where you can mark your RCP app plugin to be expanded to a directory instead of as a jar (it'll do it automatically).

Adding self-updating to any app is non-trivial. Do you update all jars at once, or only select ones? Which jars does it make sense to update at the same time? With eclipse based on OSGi, how do you make sure that your update leaves your system in a working state? p2 was built to help manage these usecases. See http://wiki.eclipse.org/P2

Edit:

Simple self-updating can be added using the p2 API without including any of the UI code:

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);
    }
}

This needs a little work (maybe the product has to include the update site), but that's the basic API.

剩余の解释 2024-11-13 03:00:51

使用 Java Web Start 启动应用程序。自动更新是JWS的主要功能之一。

Use Java Web Start to launch the app. Auto-update is one of the main features of JWS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文