KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > autoupdate > Updates


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.autoupdate;
21
22 import java.net.URL JavaDoc;
23 import java.util.Collection JavaDoc;
24 import java.util.Date JavaDoc;
25
26 import org.w3c.dom.*;
27
28 import org.openide.util.*;
29 import org.openide.modules.ModuleInfo;
30
31
32 /** Serves for building an UpdateCache from XML Document
33  * @author Petr Hrebejk
34  */

35 public abstract class Updates extends Object JavaDoc {
36
37     static final int NO_ERROR = 0;
38     static final int AUTH_ERROR = 2;
39     static final int NO_SERVER_ERROR = 3;
40     static final int NO_AVAILABLE_MODULES = 4;
41     static final int NO_NETWORK = 5;
42     static final int PARSE_ERROR = 6;
43     
44     /** All installed modules */
45     static protected ModuleInfo[] installedModules = null;
46     
47     /** Stops checking for new updates */
48     protected boolean checkCanceled;
49     
50     /** Checks for updates in separate thread. Displays progress in a dialog
51      */

52     public abstract void checkUpdates( final Wizard.Validator validator );
53
54     /** Checks for updates in separate thread. Displays progress in a dialog
55      */

56     public abstract void checkUpdates( final Wizard.Validator validator, String JavaDoc ucname );
57     
58     /** Checks for updates in separate thread. Displays progress in a dialog
59      */

60     public abstract void checkUpdates( final Wizard.Validator validator, AutoupdateType at );
61     
62     protected void checkUpdates (final Wizard.Validator validator, AutoupdateType at, boolean background) {
63         checkUpdates (validator, at);
64     }
65
66     public void cancelCheck() {
67         checkCanceled = true;
68     }
69
70     /** Gets the root of the module/module group tree
71      * @return The group in the root of the tree.
72      */

73     public abstract ModuleGroup getRootGroup();
74         
75     /** Gets the linear structure of all module updates i.e. Collection
76      */

77     public abstract Collection JavaDoc getModules();
78
79     /** Gets the state of pError the file was not parsed */
80     public abstract boolean isError();
81     
82     /** Gets the state of pError the file was not parsed */
83     public abstract int getError();
84     
85     /** Gets the server error message if there is any */
86     public abstract String JavaDoc getErrorMessage();
87
88     /** Gets array of currently installed modules */
89     public static ModuleInfo[] getInstalledModules() {
90         if ( installedModules == null )
91             installedModules = Autoupdater.Support.getModuleDescriptions();
92         return installedModules;
93     }
94     
95     static void reset() {
96         installedModules = null;
97     }
98
99     /** Gets Collection of patches installed in the system */
100     public static ModuleInfo[] getInstalledPatches() {
101         return PatchChecker.getPatches();
102     }
103
104     /** Returns the time stamp of the downloaded XML file */
105     public abstract Date JavaDoc getTimeStamp();
106
107     /** Returns notification text if specified otherwise null */
108     public abstract String JavaDoc getNotificationText();
109
110     /** Returns notification URL if specified otherwise null */
111     public abstract URL JavaDoc getNotificationURL();
112         
113 }
114
Popular Tags