Update.java 3.9 KB
Newer Older
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision: $
 * $Date: $
 *
6
 * Copyright (C) 2005-2008 Jive Software. All rights reserved.
7
 *
8 9 10 11 12 13 14 15 16 17 18
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
19 20
 */

21
package org.jivesoftware.openfire.update;
Gaston Dombiak's avatar
Gaston Dombiak committed
22 23 24

/**
 * An Update represents a component that needs to be updated. By component we can refer
25
 * to the Openfire server itself or to any of the installed plugins.
Gaston Dombiak's avatar
Gaston Dombiak committed
26 27 28 29 30 31 32
 *
 * @author Gaston Dombiak
 */
public class Update {

    /**
     * Name of the component that is outdated. The name could be of the server
33
     * (i.e. "Openfire") or of installed plugins.
Gaston Dombiak's avatar
Gaston Dombiak committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
     */
    private String componentName;
    /**
     * Latest version of the component that was found.
     */
    private String latestVersion;
    /**
     * URL from where the latest version of the component can be downloaded.
     */
    private String url;
    /**
     * Changelog URL of the latest version of the component.
     */
    private String changelog;

    /**
     * Flag that indicates if the plugin was downloaded. This flag only makes sense for
51
     * plugins since we currently do not support download new openfire releases.
Gaston Dombiak's avatar
Gaston Dombiak committed
52 53 54 55 56 57 58 59 60 61 62 63
     */
    private boolean downloaded;

    public Update(String componentName, String latestVersion, String changelog, String url) {
        this.componentName = componentName;
        this.latestVersion = latestVersion;
        this.changelog = changelog;
        this.url = url;
    }

    /**
     * Returns the name of the component that is outdated. When the server is the
64
     * outdated component then a "Openfire" will be returned. Otherwise, the name of
Gaston Dombiak's avatar
Gaston Dombiak committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
     * the outdated plugin is returned.
     *
     * @return the name of the component that is outdated.
     */
    public String getComponentName() {
        return componentName;
    }

    /**
     * Returns the latest version of the component that was found.
     *
     * @return the latest version of the component that was found.
     */
    public String getLatestVersion() {
        return latestVersion;
    }

    /**
     * Returns the URL to the change log of the latest version of the component.
     *
     * @return the URL to the change log of the latest version of the component.
     */
    public String getChangelog() {
        return changelog;
    }

    /**
     * Returns the URL from where the latest version of the component can be downloaded.
     *
     * @return the URL from where the latest version of the component can be downloaded.
     */
    public String getURL() {
        return url;
    }

    /**
     * Returns true if the plugin was downloaded. Once a plugin has been downloaded
     * it may take a couple of seconds to be installed. This flag only makes sense for
103
     * plugins since we currently do not support download new openfire releases.
Gaston Dombiak's avatar
Gaston Dombiak committed
104 105 106 107 108 109 110 111 112 113
     *
     * @return true if the plugin was downloaded.
     */
    public boolean isDownloaded() {
        return downloaded;
    }

    /**
     * Sets if the plugin was downloaded. Once a plugin has been downloaded
     * it may take a couple of seconds to be installed. This flag only makes sense for
114
     * plugins since we currently do not support download new openfire releases.
Gaston Dombiak's avatar
Gaston Dombiak committed
115 116 117 118 119 120
     *
     * @param downloaded true if the plugin was downloaded.
     */
    public void setDownloaded(boolean downloaded) {
        this.downloaded = downloaded;
    }
121 122 123 124 125 126 127 128

    /**
     * Returns the hashCode for this update object.
     * @return hashCode
     */
    public int getHashCode(){
        return hashCode();
    }
Gaston Dombiak's avatar
Gaston Dombiak committed
129
}