KickJava   Java API By Example, From Geeks To Geeks.

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


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.autoupdate;
21
22 import java.io.File JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.io.InputStream JavaDoc;
25 import java.net.URL JavaDoc;
26 import java.net.URLConnection JavaDoc;
27 import java.net.UnknownHostException JavaDoc;
28 import java.text.ParseException JavaDoc;
29 import java.text.SimpleDateFormat JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.Collection JavaDoc;
32 import java.util.Date JavaDoc;
33 import java.util.Enumeration JavaDoc;
34 import java.util.HashSet JavaDoc;
35 import java.util.Iterator JavaDoc;
36 import java.util.List JavaDoc;
37 import java.util.Locale JavaDoc;
38 import java.util.jar.Attributes JavaDoc;
39 import java.util.jar.JarEntry JavaDoc;
40 import java.util.jar.JarFile JavaDoc;
41 import java.util.jar.Manifest JavaDoc;
42 import java.util.logging.Level JavaDoc;
43 import java.util.logging.Logger JavaDoc;
44 import java.util.regex.Pattern JavaDoc;
45 import java.util.zip.ZipEntry JavaDoc;
46 import java.util.zip.ZipException JavaDoc;
47 import org.netbeans.updater.UpdateTracking;
48 import org.openide.DialogDisplayer;
49 import org.openide.NotifyDescriptor;
50 import org.openide.modules.ModuleInfo;
51 import org.openide.util.Exceptions;
52 import org.openide.util.Lookup;
53 import org.openide.util.NbBundle;
54 import org.w3c.dom.Attr JavaDoc;
55 import org.w3c.dom.Document JavaDoc;
56 import org.w3c.dom.Element JavaDoc;
57 import org.w3c.dom.NamedNodeMap JavaDoc;
58 import org.w3c.dom.Node JavaDoc;
59 import org.w3c.dom.NodeList JavaDoc;
60 import org.xml.sax.InputSource JavaDoc;
61
62 /** This class represents one module update available on the web
63  *
64  * @author phrebejk
65  * @version
66  */

67 class ModuleUpdate extends Object JavaDoc
68     implements org.openide.nodes.Node.Cookie {
69     
70     // Constants
71
private static final String JavaDoc ATTR_HOMEPAGE = "homepage"; // NOI18N
72
private static final String JavaDoc ATTR_DISTRIBUTION = "distribution"; // NOI18N
73
private static final String JavaDoc ATTR_CODENAMEBASE = "codenamebase"; // NOI18N
74
private static final String JavaDoc ATTR_DOWNLOAD_SIZE = "downloadsize"; // NOI18N
75
private static final String JavaDoc ATTR_UNPACKED_SIZE = "unpacksize"; // NOI18N
76
private static final String JavaDoc ATTR_LICENSE = "license"; // NOI18N
77
private static final String JavaDoc ATTR_LICENSE_MISSPELLED = "licence"; // NOI18N
78
private static final String JavaDoc ATTR_PURCHASED = "purchased"; // NOI18N
79
private static final String JavaDoc ATTR_NEEDSRESTART = "needsrestart"; // NOI18N
80

81     private static final String JavaDoc ATTR_AUTHOR = "moduleauthor"; // NOI18N
82
private static final String JavaDoc ATTR_RELEASE_DATE = "releasedate"; // NOI18N
83
private static final String JavaDoc ATTR_IS_GLOBAL = "global"; // NOI18N
84
private static final String JavaDoc ATTR_TARGET_CLUSTER = "targetcluster"; // NOI18N
85

86     static final SimpleDateFormat JavaDoc DATE_FORMAT = new SimpleDateFormat JavaDoc ("yyyy/MM/dd"); // NOI18N
87

88     private static final String JavaDoc ELEMENT_DESCRIPTION = "description"; // NOI18N
89
private static final String JavaDoc ELEMENT_NOTIFICATION = "module_notification"; // NOI18N
90
private static final String JavaDoc ELEMENT_EXTERNAL = "external_package"; // NOI18N
91
static final String JavaDoc ELEMENT_L10N = "l10n"; // NOI18N
92

93     private static final String JavaDoc ATTR_EXT_NAME = "name"; // NOI18N
94
private static final String JavaDoc ATTR_EXT_TARGET = "target_name"; // NOI18N
95
private static final String JavaDoc ATTR_EXT_URL = "start_url"; // NOI18N
96
private static final String JavaDoc ATTR_EXT_DESC = "description"; // NOI18N
97

98     // special directories in NB files layout
99
static final String JavaDoc NBM_LIB = "lib"; // NOI18N
100
static final String JavaDoc NBM_CORE = "core"; // NOI18N
101

102     private static final Logger JavaDoc LOG = Logger.getLogger ("org.netbeans.modules.autoupdate.ModuleUpdate"); // NOI18N
103

104     /** The base url of XML Document used to create URL from relative paths */
105     private URL JavaDoc xmlURL;
106     /** Node in the DOM the ModuleUpdate comes from */
107     private Node JavaDoc node;
108     /** Holds the document of the XML */
109     private Element JavaDoc documentElement;
110
111     /** Used for downloaded files */
112     private File JavaDoc nbmFile;
113
114
115     /** Holds value of property distribution. */
116     private URL JavaDoc distribution = null;
117     /** Holds value of property homepage. */
118     private URL JavaDoc homepage = null;
119     /** Holds value of property infoCodenamebase. */
120     private String JavaDoc infoCodenamebase = null;
121     /** Holds value of property downloadSize. */
122     private long downloadSize = -1;
123     /** Holds value of property unpackedSize. */
124     private long unpackedSize = -1;
125     /** Holds value of property downlaodOK. */
126     private boolean downloadOK = false;
127     /** Holds value of property description. */
128     private String JavaDoc description = null;
129     /** Holds value of property licence */
130     private String JavaDoc licenceID = null;
131     /** Holds value text of the licence */
132     private String JavaDoc licenceText = null;
133     /** Holds value of property selected */
134     private boolean selected = false;
135     /** Holds value of property secutiry */
136     private int security = SignVerifier.NOT_CHECKED;
137     /** Holds value of property certificates */
138     private Collection JavaDoc certs = null;
139     /** Holds value of property installApproved */
140     private boolean installApproved = false;
141
142     // Associations
143
private ModuleInfo localModule = null;
144
145     private ModuleInfo remoteModule = null;
146     
147     /** Holds value of property purchased. */
148     private boolean purchased = false;
149     
150     /** Holds value of property notification. */
151     private String JavaDoc notification = null;
152     
153     /** Holds value of property notification. */
154     private String JavaDoc moduleAuthor = null;
155     
156     /** Holds value of property notification. */
157     private Date JavaDoc releaseDate = null;
158     
159     /** Was notification accepted? */
160     private boolean notificationAccepted = false;
161
162     private String JavaDoc distributionFilename = null;
163     
164     /** Holds value of property external. */
165     private List JavaDoc externals;
166     
167     /** Holds value of property depending. */
168     private boolean depending;
169     
170     /** Holds value of property toInstallDir. */
171     private boolean toInstallDir;
172     
173     /** Holds value of property downloadStarted. */
174     private boolean downloadStarted;
175     
176     /** Holds value of property safeToInstall. */
177     private boolean safeToInstall;
178     
179     /** Holds value of property isGlobal. */
180     private Boolean JavaDoc isGlobal;
181     
182     /** Holds value of property targetCluster. */
183     private String JavaDoc targetCluster;
184     
185     /** Holds value of property jarList. */
186     private List JavaDoc jarList = new ArrayList JavaDoc();
187
188     /** Directory for global installation. */
189     private File JavaDoc target;
190     
191     //private Updates linearStructure;
192

193     // CONSTRUCTORS -------------------------------------------------------------
194

195     /** Creates new ModuleUpdate */
196     ModuleUpdate( URL JavaDoc xmlURL, Node JavaDoc node, Element JavaDoc documentElement ) {
197         this.xmlURL = xmlURL;
198         this.node = node;
199         this.documentElement = documentElement;
200     }
201
202     /** Creates new ModuleUpdate for downloaded .nbm file */
203     ModuleUpdate( File JavaDoc nbmFile, Node JavaDoc node, Element JavaDoc documentElement ) {
204         this.nbmFile = nbmFile;
205         this.node = node;
206         this.documentElement = documentElement;
207     }
208
209     static ModuleUpdate getModuleUpdate( URL JavaDoc xmlURL, Node JavaDoc node, Element JavaDoc documentElement, AutoupdateType at ) {
210         ModuleUpdate mod;
211         NodeList JavaDoc nodeList = ((Element JavaDoc)node).getElementsByTagName( ELEMENT_L10N ); // NOI18N
212
if ( nodeList != null && nodeList.getLength() > 0 )
213             mod = new L10NUpdate( xmlURL, node, documentElement );
214         else
215             mod = new ModuleUpdate( xmlURL, node, documentElement );
216         
217         if ( mod.readModuleUpdate( at ) )
218             return mod;
219         else
220             return null;
221     }
222     
223     static private String JavaDoc getMessage (String JavaDoc key, String JavaDoc p1) {
224         return NbBundle.getMessage (ModuleUpdate.class, key, p1);
225     }
226     
227     static ModuleUpdate getModuleUpdate( File JavaDoc nbmFile ) {
228         ModuleUpdate mod;
229         Document JavaDoc document = null;
230         Node JavaDoc node;
231         Element JavaDoc documentElement;
232         
233         // Try to parse the info file
234
JarFile JavaDoc jf = null;
235         try {
236             jf = new JarFile JavaDoc(nbmFile);
237             ZipEntry JavaDoc info = getLocalizedInfo( jf ); // NOI18N
238
if ( info == null ) {
239                 DialogDisplayer.getDefault().notify(
240                     new NotifyDescriptor.Message(
241                         NbBundle.getMessage( ModuleUpdate.class, "MSG_NoInfoXml",
242                             nbmFile.getName()
243                         ),
244                         NotifyDescriptor.ERROR_MESSAGE
245                     )
246                 );
247                 return null;
248             }
249             InputStream JavaDoc is = jf.getInputStream( info );
250             
251             InputSource JavaDoc xmlInputSource = new InputSource JavaDoc( is );
252             document = org.openide.xml.XMLUtil.parse( xmlInputSource, false, false,
253                             new ErrorCatcher(), org.netbeans.updater.XMLUtil.createAUResolver() );
254             
255             documentElement = document.getDocumentElement();
256             node = documentElement;
257         } catch ( org.xml.sax.SAXException JavaDoc e ) {
258             Exceptions.attachMessage(e, "Bad info : " + nbmFile.getName());
259             Exceptions.attachLocalizedMessage(e, getMessage("ERR_Bad_Info",
260                                                           nbmFile.getName()));
261             LOG.log(Level.WARNING, null, e);
262             return null;
263         } catch ( ZipException JavaDoc ze ) {
264             Exceptions.attachMessage(ze, "Corrupted nbm file : " +
265                                                nbmFile.getName());
266             Exceptions.attachLocalizedMessage(ze, getMessage("ERR_Corrupted_Zip",
267                                                           nbmFile.getName()));
268             LOG.log(Level.WARNING, null, ze);
269             return null;
270         } catch (UnknownHostException JavaDoc e) {
271             String JavaDoc message = "Cannot access required resource (see the message log for more details). " // NOI18N
272
+ "Module " + nbmFile.getName() + " will be ommited in the install list."; // NOI18N
273
Exceptions.attachMessage(e, message);
274             Exceptions.attachLocalizedMessage(e, getMessage("ERR_Unavailability_Resource",
275                                                           nbmFile.getName()));
276             LOG.log(Level.WARNING, null, e);
277             return null;
278         } catch ( IOException JavaDoc e ) {
279             Exceptions.attachMessage(e, "Missing info : " +
280                                                nbmFile.getName());
281             Exceptions.attachLocalizedMessage(e, getMessage("ERR_Missing_Info",
282                                                           nbmFile.getName()));
283             LOG.log(Level.WARNING, null, e);
284             return null;
285         } finally {
286             try {
287                 if ( jf != null )
288                     jf.close();
289             } catch ( IOException JavaDoc ie ) {
290             }
291         }
292         
293         NodeList JavaDoc nodeList = ((Element JavaDoc)node).getElementsByTagName( ELEMENT_L10N ); // NOI18N
294
if ( nodeList != null && nodeList.getLength() > 0 )
295             mod = new L10NUpdate( nbmFile, node, documentElement );
296         else
297             mod = new ModuleUpdate( nbmFile, node, documentElement );
298         
299         if ( mod.createFromDistribution() )
300             return mod;
301         else
302             return null;
303     }
304     
305     // METHODS ------------------------------------------------------------------
306

307     /** Reads the module update from DOM and if the module is already loaded
308      * finds the description
309      * @return True if the read-operation was O.K.
310      */

311     boolean readModuleUpdate(AutoupdateType at) {
312
313         // Read module update information
314

315         try {
316             String JavaDoc textURL = getAttribute( ATTR_HOMEPAGE );
317             if ( textURL != null )
318                 homepage = new URL JavaDoc( xmlURL, textURL );
319         }
320         catch ( java.net.MalformedURLException JavaDoc e ) {
321             LOG.log(Level.WARNING, null, e);
322             // let homepage set to null
323
}
324
325
326         
327         setInfoCodenamebase( getAttribute( ATTR_CODENAMEBASE ) );
328
329         try {
330             setDownloadSize( Long.parseLong( getAttribute( ATTR_DOWNLOAD_SIZE ) ) );
331         }
332         catch ( NumberFormatException JavaDoc e ) {
333             // Let the value set to -1
334
}
335
336         try {
337             setUnpackedSize( Long.parseLong( getAttribute( ATTR_UNPACKED_SIZE ) ) );
338         }
339         catch ( NumberFormatException JavaDoc e ) {
340             // Let the value set to -1
341
}
342
343         setDescription( getTextOfElement( ELEMENT_DESCRIPTION ) );
344         
345         setNotification( getTextOfElement( ELEMENT_NOTIFICATION ) );
346         
347         List JavaDoc ext = externalFromXML( );
348         if ( ext != null )
349             externals = ext;
350
351         try {
352             String JavaDoc textURL = getAttribute( ATTR_DISTRIBUTION );
353             if ( textURL != null ) {
354                 String JavaDoc sURL = xmlURL.toString();
355                 int qmark = sURL.indexOf('?');
356                 if ((qmark > -1) && (qmark < sURL.lastIndexOf('/')))
357                     // hack, when properties includes slash
358
distribution = new URL JavaDoc ( new URL JavaDoc(sURL.substring(0, qmark)), textURL );
359                 else
360                     distribution = new URL JavaDoc ( xmlURL, textURL );
361                 if ( at instanceof XMLAutoupdateType )
362                     distribution = ((XMLAutoupdateType)at).modifyURL (distribution);
363             }
364         }
365         catch ( java.net.MalformedURLException JavaDoc e ) {
366             LOG.log(Level.WARNING, null, e);
367             // let distibution URL set to null
368
}
369
370         purchased = Boolean.valueOf( getAttribute( ATTR_PURCHASED ) ).booleanValue();
371
372         processNeedsRestart();
373         processIsGlobal ();
374         processTargetCluster ();
375         
376         readReleaseDate ();
377         readModuleAuthor ();
378         
379         try {
380             remoteModule = readRemoteInfo();
381         }
382         catch ( IllegalArgumentException JavaDoc e ) {
383             LOG.log(Level.WARNING, null, e);
384         }
385
386         // Read the licence from the XML
387
licenceID = getAttribute( ATTR_LICENSE );
388     if (licenceID == null) licenceID = getAttribute( ATTR_LICENSE_MISSPELLED );
389         licenceText = licenseFromXML( licenceID, documentElement );
390
391         // Try to find installed module
392
localModule = readLocalInfo();
393
394         return remoteModule != null;
395     }
396
397     ModuleInfo readRemoteInfo() throws IllegalArgumentException JavaDoc {
398         // Read the manifest from XML file and create
399
// the module description
400
Manifest JavaDoc mf = manifestFromXML( );
401
402         // See above.
403
if (description == null || description.equals ("")) { // NOI18N
404
String JavaDoc longDesc = mf.getMainAttributes ().getValue ("OpenIDE-Module-Long-Description"); // NOI18N
405
if (longDesc != null) {
406                 description = longDesc;
407             }
408         }
409
410         return new DummyModuleInfo( mf.getMainAttributes() );
411     }
412     
413     ModuleInfo readLocalInfo() {
414         ModuleInfo localinfo = null;
415         
416         ModuleInfo[] installedModules = Updates.getInstalledModules();
417         ModuleInfo[] installedPatches = Updates.getInstalledPatches();
418
419         if ( remoteModule != null ) {
420
421             // Try if the module describes the Core IDE
422
if ( remoteModule.getCodeName().equals( IdeDescription.getName() ) ) {
423                 localinfo = IdeDescription.getIdeDescription();
424             }
425
426             // Try other modules
427
for ( int i = 0; localModule == null && i < installedModules.length; i++ ) {
428                 if ( installedModules[i].getCodeNameBase().equals( remoteModule.getCodeNameBase() ) ) {
429                     localinfo = installedModules[i];
430                     break;
431                 }
432             }
433
434             // Try wether the module is a installed patch
435
for ( int i = 0; localModule == null && i < installedPatches.length; i++ ) {
436                 if ( installedPatches[i].getCodeNameBase().equals( remoteModule.getCodeNameBase() ) ) {
437                     localinfo = installedPatches[i];
438                     break;
439                 }
440             }
441         }
442         return localinfo;
443     }
444     
445     private static ZipEntry JavaDoc getLocalizedInfo(JarFile JavaDoc jf) {
446         String JavaDoc locale = Locale.getDefault().getLanguage();
447         ZipEntry JavaDoc info = jf.getEntry("Info/locale/info_" + locale + ".xml"); // NOI18N
448
if ( info == null ) {
449             info = jf.getEntry("Info/info.xml"); // NOI18N
450
}
451         return info;
452     }
453
454     /** Creates module from downloaded .nbm file */
455     private boolean createFromDistribution() {
456
457         Document JavaDoc document = null;
458         
459         // Try to parse the info file
460
JarFile JavaDoc jf = null;
461         try {
462             jf = new JarFile JavaDoc(nbmFile);
463             ZipEntry JavaDoc info = getLocalizedInfo( jf ); // NOI18N
464
if ( info == null ) {
465                 DialogDisplayer.getDefault().notify(
466                     new NotifyDescriptor.Message(
467                         NbBundle.getMessage( ModuleUpdate.class, "MSG_NoInfoXml",
468                             nbmFile.getName()
469                         ),
470                         NotifyDescriptor.ERROR_MESSAGE
471                     )
472                 );
473                 return false;
474             }
475             InputStream JavaDoc is = jf.getInputStream( info );
476             
477             InputSource JavaDoc xmlInputSource = new InputSource JavaDoc( is );
478             document = org.openide.xml.XMLUtil.parse( xmlInputSource, false, false,
479                             new ErrorCatcher(), org.netbeans.updater.XMLUtil.createAUResolver() );
480             
481             documentElement = document.getDocumentElement();
482             node = documentElement;
483         }
484         catch ( org.xml.sax.SAXException JavaDoc e ) {
485             Exceptions.attachMessage(e, "Bad info : " + nbmFile.getName()); // NOI18N
486
LOG.log(Level.WARNING, null, e);
487             return false;
488         }
489         catch ( IOException JavaDoc e ) {
490             Exceptions.attachMessage(e, "Missing info : " + nbmFile.getName()); // NOI18N
491
LOG.log(Level.WARNING, null, e);
492             return false;
493         }
494         finally {
495             try {
496                 if ( jf != null )
497                     jf.close();
498             } catch ( IOException JavaDoc ie ) {
499             }
500         }
501
502         // Read module update information
503

504         try {
505             String JavaDoc textURL = getAttribute( ATTR_HOMEPAGE );
506             if ( textURL != null && textURL.length () > 0 ) {
507                 homepage = new URL JavaDoc( textURL );
508             }
509         }
510         catch ( java.net.MalformedURLException JavaDoc e ) {
511             LOG.log(Level.WARNING, null, e);
512             // let homepage set to null
513
}
514
515         setInfoCodenamebase( getAttribute( ATTR_CODENAMEBASE ) );
516
517         setDownloadSize( nbmFile.length() );
518
519
520         /*
521         try {
522           setDownloadSize( Long.parseLong( getAttribute( ATTR_DOWNLOAD_SIZE ) ) );
523     }
524         catch ( NumberFormatException e ) {
525           // Let the value set to -1
526     }
527
528         try {
529           setUnpackedSize( Long.parseLong( getAttribute( ATTR_UNPACKED_SIZE ) ) );
530     }
531         catch ( NumberFormatException e ) {
532           // Let the value set to -1
533     }
534         */

535
536         setDescription( getTextOfElement( ELEMENT_DESCRIPTION ) );
537         
538         setNotification( getTextOfElement( ELEMENT_NOTIFICATION ) );
539         
540         List JavaDoc ext = externalFromXML( );
541         if ( ext != null )
542             externals = ext;
543
544         purchased = Boolean.valueOf( getAttribute( ATTR_PURCHASED ) ).booleanValue();
545         
546         processNeedsRestart();
547         processIsGlobal ();
548         processTargetCluster ();
549         
550         readReleaseDate ();
551         readModuleAuthor ();
552         
553         try {
554             remoteModule = readRemoteInfo();
555         }
556         catch ( IllegalArgumentException JavaDoc e ) {
557             LOG.log(Level.WARNING, null, e);
558         }
559         
560         // Read the licence from the XML
561
licenceID = getAttribute( ATTR_LICENSE );
562     if (licenceID == null) licenceID = getAttribute( ATTR_LICENSE_MISSPELLED );
563         licenceText = licenseFromXML( licenceID, documentElement );
564
565
566         // Try to find installed module
567
localModule = readLocalInfo();
568         
569         return remoteModule != null;
570
571     }
572
573     /** Finds the module in the Colloection of installed modules */
574     void resolveInstalledModule( Collection JavaDoc installedModules ) {
575
576     }
577     
578     private void readReleaseDate () {
579         String JavaDoc attr = getAttribute (ATTR_RELEASE_DATE);
580         
581         if (attr != null) {
582             try {
583                 setReleaseDate (DATE_FORMAT.parse (attr));
584             } catch (ParseException JavaDoc pe) {
585                 // notify in log
586
LOG.log(Level.WARNING, null, pe);
587             }
588         }
589     }
590     
591     private void readModuleAuthor () {
592         setModuleAuthor (getAttribute (ATTR_AUTHOR));
593     }
594
595     private void processNeedsRestart() {
596         String JavaDoc attr = getAttribute( ATTR_NEEDSRESTART );
597         if ( attr != null && Boolean.FALSE.toString().equals( attr.toLowerCase() ) )
598             setSafeToInstall( true );
599     }
600     
601     private void processIsGlobal () {
602         String JavaDoc attr = getAttribute( ATTR_IS_GLOBAL );
603         if (attr != null) {
604             if (Boolean.TRUE.toString ().equals (attr.toLowerCase ())) {
605                 isGlobal = Boolean.TRUE;
606             } else if (Boolean.FALSE.toString ().equals (attr.toLowerCase ())) {
607                 isGlobal = Boolean.FALSE;
608             }
609         }
610     }
611     
612     private void processTargetCluster () {
613         String JavaDoc attr = getAttribute (ATTR_TARGET_CLUSTER);
614         if (attr != null) {
615             Pattern JavaDoc p = Pattern.compile (attr);
616             Iterator JavaDoc en = UpdateTracking.clusters (false).iterator ();
617             while (en.hasNext ()) {
618                 File JavaDoc f = (File JavaDoc) en.next ();
619                 if (p.matcher (f.getName ()).matches ()) {
620                     targetCluster = f.getName ();
621                     return;
622                 }
623             }
624             
625             for (
626                 Iterator JavaDoc it = Lookup.getDefault().lookupAll(AutoupdateClusterCreator.class).iterator();
627                 it.hasNext() && targetCluster == null;
628             ) {
629                 AutoupdateClusterCreator creator = (AutoupdateClusterCreator)it.next();
630                 File JavaDoc f = creator.findCluster(attr);
631                 if (f != null) {
632                     targetCluster = f.getName();
633                     return;
634                 }
635             }
636             
637         }
638     }
639     
640     // GETTERS AND SETTERS ------------------------------------------------------
641

642     /** Getter for property codeNameBase.
643      *@return Value of property codeNameBase.
644      */

645     String JavaDoc getCodeNameBase() {
646         return remoteModule.getCodeNameBase();
647     }
648
649     /** Getter for property name.
650      *@return Value of property name.
651      */

652     String JavaDoc getName() {
653         return remoteModule.getDisplayName();
654     }
655
656     /** Getter for property distribution.
657      *@return Value of property distribution.
658      */

659     URL JavaDoc getDistribution() {
660         return distribution;
661     }
662
663     void setRemoteDistributionFilename(URLConnection JavaDoc distrConnection) {
664         if ( distributionFilename == null ) {
665             String JavaDoc s = distrConnection.getURL().getFile();
666             int i = s.indexOf('?');
667             if ( i > 0 )
668                 s = s.substring(0,i);
669             i = s.lastIndexOf('/');
670             if ( (i > 0) && (i < s.length()-1) )
671                 s = s.substring(i+1);
672             distributionFilename = s;
673         }
674     }
675     
676     /** Lazy getter for property distributionFilename.
677      *@return Name of the distribution file.
678      */

679     String JavaDoc getDistributionFilename() {
680         if ( distributionFilename == null ) {
681             if ( nbmFile != null ) {
682                 distributionFilename = nbmFile.getName();
683             }
684             else {
685                 try {
686                     URLConnection JavaDoc distrConnection = getDistribution().openConnection();
687                     setRemoteDistributionFilename(distrConnection);
688                 } catch (IOException JavaDoc e) {
689                     distributionFilename = new File JavaDoc( getDistribution().getFile() ).getName();
690                 }
691             }
692         }
693         return distributionFilename;
694     }
695
696     /** Getter for property licenceID.
697      *@return Value of property licenceID.
698      */

699     String JavaDoc getLicenceID() {
700         return licenceID;
701     }
702
703     /** Getter for property infoCodenamebase.
704      *@return Value of property infoCodenamebase.
705      */

706     public String JavaDoc getInfoCodenamebase() {
707         return infoCodenamebase;
708     }
709
710     /** Setter for property infoCodenamebase.
711      *@param InfoCodenamebase New value of property infoCodenamebase.
712      */

713     void setInfoCodenamebase(String JavaDoc infoCodenamebase) {
714         this.infoCodenamebase = infoCodenamebase;
715     }
716
717     /** Getter for property downloadSize.
718      *@return Value of property downloadSize.
719      */

720     long getDownloadSize() {
721         return downloadSize;
722     }
723
724     /** Setter for property downloadSize.
725      *@param downloadSize New value of property downloadSize.
726      */

727     void setDownloadSize(long downloadSize) {
728         this.downloadSize = downloadSize;
729     }
730
731     /** Getter for property unpackedSize.
732      *@return Value of property unpackedSize.
733      */

734     long getUnpackedSize() {
735         return unpackedSize;
736     }
737
738     /** Setter for property unpackedSize.
739      *@param unpackedSize New value of property unpackedSize.
740      */

741     void setUnpackedSize(long unpackedSize) {
742         this.unpackedSize = unpackedSize;
743     }
744
745     /** Getter for property description.
746      *@return Value of property description.
747      */

748     String JavaDoc getDescription() {
749         return description;
750     }
751
752     /** Setter for property description.
753      *@param description New value of property description.
754      */

755     void setDescription(String JavaDoc description) {
756         this.description = description;
757     }
758
759     /** Getter for property module author.
760      *@return Value of property moduleAuthor.
761      */

762     String JavaDoc getModuleAuthor () {
763         return moduleAuthor;
764     }
765
766     /** Setter for property moduleAuthor.
767      *@param notification New value of property moduleAuthor.
768      */

769     void setModuleAuthor (String JavaDoc author) {
770         moduleAuthor = author;
771     }
772     
773     /** Getter for property releaseDate.
774      *@return Value of property releaseDate.
775      */

776     Date JavaDoc getReleaseDate () {
777         return releaseDate;
778     }
779
780     /** Setter for property releaseDate.
781      *@param notification New value of property releaseDate.
782      */

783     void setReleaseDate (Date JavaDoc date) {
784         releaseDate = date;
785     }
786     
787     /** Getter for property notification.
788      *@return Value of property notification.
789      */

790     String JavaDoc getNotification() {
791         return notification;
792     }
793
794     /** Setter for property notification.
795      *@param notification New value of property notification.
796      */

797     void setNotification(String JavaDoc notification) {
798         this.notification = notification;
799     }
800     
801     /** Getter for property notificationAccepted.
802      *@return Value of property notificationAccepted.
803      */

804     boolean getNotificationAccepted() {
805         return notificationAccepted;
806     }
807     
808     /** Setter for property notificationAccepted.
809      *@param notificationAccepted New value of property notificationAccepted.
810      */

811     void setNotificationAccepted(boolean notificationAccepted) {
812         this.notificationAccepted = notificationAccepted;
813     }
814     
815     /** Getter for property selected.
816      *@return Value of property selected.
817      */

818     boolean isSelected() {
819         return selected;
820     }
821
822     /** Setter for property selected.
823      *@param description New value of property selected.
824      */

825     void setSelected( boolean selected ) {
826         this.selected = selected;
827     }
828
829
830     /** Getter for property new.
831      *@return True if such module is not installed in netbeans
832      */

833     boolean isNew() {
834         return localModule == null;
835     }
836     
837     /** Getter for property purchased.
838      *@return True if such module is not installed in netbeans
839      */

840     boolean isPurchased() {
841         return purchased;
842     }
843
844     /** Getter for property homePage.
845      *@return Value of property homePage.
846      */

847     URL JavaDoc getHomePage() {
848         return homepage;
849     }
850
851     /** Getter for property licenceText.
852      *@return Value of property licenceText.
853      */

854     String JavaDoc getLicenceText() {
855         return licenceText;
856     }
857
858     /** Getter for property remoteModule.
859      *@return Value of property remoteModule.
860      */

861     ModuleInfo getRemoteModule() {
862         return remoteModule;
863     }
864     
865     /** Getter for property localModule.
866      *@return Value of property localModule.
867      */

868     ModuleInfo getLocalModule() {
869         return localModule;
870     }
871     
872     Node JavaDoc getNode() {
873         return node;
874     }
875
876     /** Tests if there is an update available */
877     boolean isUpdateAvailable() {
878         if ( getLocalModule() == null )
879             return true;
880
881         if ( getRemoteModule().getCodeNameRelease() > getLocalModule().getCodeNameRelease() ) {
882             return true;
883         }
884
885         if (getLocalModule().getSpecificationVersion() == null) {
886             return true;
887         }
888         if (getRemoteModule().getSpecificationVersion() == null) {
889             return false;
890         }
891         if (getLocalModule().getSpecificationVersion().compareTo(getRemoteModule().getSpecificationVersion()) < 0) {
892             return true;
893         }
894
895         return false;
896
897     }
898
899     /** Returns true if file wasn't checked still.
900      */

901     boolean isNotChecked() {
902         return security == SignVerifier.NOT_CHECKED;
903     }
904     
905     /** Getter for property downloadOK.
906      *@return Value of property downloadOK.
907      */

908     boolean isDownloadOK() {
909         return downloadOK;
910     }
911
912     /** Setter for property downloadOK
913      *@param downloadOK New value of property downloadOK.
914      */

915     void setDownloadOK( boolean downloadOK ) {
916         this.downloadOK = downloadOK;
917     }
918
919
920     /** Getter for property security.
921      *@return Value of property security.
922      */

923     int getSecurity() {
924         return security;
925     }
926
927     /** Setter for property security
928      *@param downloadOK New value of property security.
929      */

930     void setSecurity( int security ) {
931         this.security = security;
932     }
933
934     /** Getter for property certificates.
935      *@return Value of property certificates.
936      */

937     Collection JavaDoc getCerts() {
938         return certs;
939     }
940
941     /** Setter for property certificates
942      *@param downloadOK New value of property certificates.
943      */

944     void setCerts( Collection JavaDoc certs ) {
945         this.certs = certs;
946     }
947
948
949     /** Getter for property nbmFile.
950      *@return The manually downloaded nbm file.
951      */

952     File JavaDoc getDistributionFile() {
953         return nbmFile;
954     }
955
956     /** Getter for property installApproved.
957      *@return Value of property installApproved.
958      */

959     boolean isInstallApproved() {
960         return installApproved;
961     }
962
963     /** Setter for property installApproved.
964      *@param description New value of property installApproved.
965      */

966     void setInstallApproved( boolean installApproved ) {
967         this.installApproved = installApproved;
968     }
969
970     // UTILITY METHODS ----------------------------------------------------------
971

972     /** Utility method gets the atribute of node
973      *@param attribute Name of the desired attribute
974      */

975     private String JavaDoc getAttribute(String JavaDoc attribute) {
976         Node JavaDoc attr = node.getAttributes().getNamedItem( attribute );
977         return attr == null ? null : attr.getNodeValue();
978     }
979
980     /** Utility method gets text of subelement. Used for getting
981      * description text.
982      *@param name Name of the desired subelement
983      */

984     private String JavaDoc getTextOfElement( String JavaDoc name ) {
985
986         if ( node.getNodeType() != Node.ELEMENT_NODE ||
987                 !( node instanceof Element JavaDoc ) ) {
988             return null;
989         }
990
991         NodeList JavaDoc nodeList = ((Element JavaDoc)node).getElementsByTagName( name );
992         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
993
994         for( int i = 0; i < nodeList.getLength(); i++ ) {
995
996             if ( nodeList.item( i ).getNodeType() != Node.ELEMENT_NODE ||
997                     !( nodeList.item( i ) instanceof Element JavaDoc ) ) {
998                 break;
999             }
1000
1001            // ((Element)nodeList.item( i )).normalize();
1002
NodeList JavaDoc innerList = nodeList.item( i ).getChildNodes();
1003
1004            for( int j = 0; j < innerList.getLength(); j++ ) {
1005        short type = innerList.item( j ).getNodeType();
1006                if ( type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE ) {
1007                    sb.append( innerList.item( j ).getNodeValue() );
1008                }
1009            }
1010        }
1011        return sb.toString();
1012    }
1013
1014    /** Utility methods finds the external_package tag, reads all it's attributes and
1015     * creates the manifest */

1016    private List JavaDoc externalFromXML() {
1017        if ( node.getNodeType() != Node.ELEMENT_NODE ||
1018                !( node instanceof Element JavaDoc ) ) {
1019            return null;
1020        }
1021        List JavaDoc ext_list = null;
1022
1023        NodeList JavaDoc nodeList = ((Element JavaDoc)node).getElementsByTagName( ELEMENT_EXTERNAL ); // NOI18N
1024

1025        for( int i = 0; i < nodeList.getLength(); i++ ) {
1026            
1027            if ( i==0 )
1028                ext_list = new ArrayList JavaDoc();
1029
1030            if ( nodeList.item( i ).getNodeType() != Node.ELEMENT_NODE ||
1031                    !( nodeList.item( i ) instanceof Element JavaDoc ) ) {
1032                break;
1033            }
1034
1035            // ((Element)nodeList.item( i )).normalize();
1036
NamedNodeMap JavaDoc attrList = nodeList.item( i ).getAttributes();
1037            External ext = new External();
1038            
1039            for( int j = 0; j < attrList.getLength(); j++ ) {
1040                Attr JavaDoc attr = (Attr JavaDoc) attrList.item( j );
1041                if ( attr.getName().equals( ATTR_EXT_NAME ))
1042                    ext.setName( attr.getValue() );
1043                else if ( attr.getName().equals( ATTR_EXT_TARGET ))
1044                    ext.setTarget_name( attr.getValue() );
1045                else if ( attr.getName().equals( ATTR_EXT_URL ))
1046                    ext.setStart_url( attr.getValue() );
1047                else if ( attr.getName().equals( ATTR_EXT_DESC ))
1048                    ext.setDescription( attr.getValue() );
1049            }
1050
1051            ext_list.add( ext );
1052        }
1053        return ext_list;
1054    }
1055    
1056    /** Utility methods finds the manifest tag, reads all it's attributes and
1057     * creates the manifest */

1058    private Manifest JavaDoc manifestFromXML() {
1059        if ( node.getNodeType() != Node.ELEMENT_NODE ||
1060                !( node instanceof Element JavaDoc ) ) {
1061            return null;
1062        }
1063
1064        NodeList JavaDoc nodeList = ((Element JavaDoc)node).getElementsByTagName( "manifest" ); // NOI18N
1065

1066        for( int i = 0; i < nodeList.getLength(); i++ ) {
1067
1068            if ( nodeList.item( i ).getNodeType() != Node.ELEMENT_NODE ||
1069                    !( nodeList.item( i ) instanceof Element JavaDoc ) ) {
1070                break;
1071            }
1072
1073            // ((Element)nodeList.item( i )).normalize();
1074
NamedNodeMap JavaDoc attrList = nodeList.item( i ).getAttributes();
1075            Manifest JavaDoc mf = new Manifest JavaDoc();
1076            Attributes JavaDoc mfAttrs = mf.getMainAttributes();
1077
1078
1079            for( int j = 0; j < attrList.getLength(); j++ ) {
1080                Attr JavaDoc attr = (Attr JavaDoc) attrList.item( j );
1081                mfAttrs.put( new Attributes.Name JavaDoc( attr.getName() ), attr.getValue() );
1082            }
1083
1084            return mf;
1085        }
1086        return null;
1087    }
1088
1089    /** Gets the licence from XML file
1090    */

1091    private String JavaDoc licenseFromXML( String JavaDoc name, Element JavaDoc docElement ) {
1092        NodeList JavaDoc nodeList = docElement.getElementsByTagName( "license" ); // NOI18N
1093

1094        for( int i = 0; i < nodeList.getLength(); i++ ) {
1095
1096            Node JavaDoc nameAttr = nodeList.item(i).getAttributes().getNamedItem( "name" ); // NOI18N
1097

1098            if ( nameAttr == null )
1099                continue;
1100
1101            if ( nameAttr.getNodeValue().equals( name ) ) { // licence found
1102
StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
1103
1104                // ((Element)nodeList.item( i )).normalize();
1105
NodeList JavaDoc innerList = nodeList.item( i ).getChildNodes();
1106
1107                for( int j = 0; j < innerList.getLength(); j++ ) {
1108            short type = innerList.item( j ).getNodeType();
1109                    if ( type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE ) {
1110                        sb.append( innerList.item( j ).getNodeValue() );
1111                    }
1112                }
1113                return sb.toString();
1114            }
1115        }
1116
1117        // licence not found
1118
if (name != null) {
1119           Logger.getAnonymousLogger().log(Level.WARNING,
1120                                          "[AutoUpdate] warning: no license found with name " +
1121                                          name);
1122        }
1123        return null;
1124    }
1125
1126    /** Getter for property external.
1127     * @return Value of property external.
1128     */

1129    List JavaDoc getExternals() {
1130        return externals;
1131    }
1132    
1133    /** Returns true if update must be installed into install dir.
1134     * @return true if must be install globaly.
1135     */

1136    public boolean isForcedGlobal () {
1137        return depending || ! isAbleToInstallToUserDir ();
1138    }
1139    
1140    /** Sets the update is depending on install dir. Must be installed into shared dir.
1141     * @param depending New value of property depending.
1142     */

1143    public void setDepending(boolean depending) {
1144        this.depending = depending;
1145    }
1146    
1147    /** Getter for property toInstallDir.
1148     * @return Value of property toInstallDir.
1149     */

1150    public boolean isToInstallDir() {
1151        if (isForcedGlobal ()) {
1152            return true;
1153        } else {
1154            
1155            // the global attribute is stronger then toInstallDir
1156
if (isGlobal () != null) {
1157                return isGlobal ().booleanValue ();
1158            } else {
1159                return this.toInstallDir;
1160            }
1161            
1162        }
1163    }
1164    
1165    /** Setter for property toInstallDir.
1166     * @param toInstallDir New value of property toInstallDir.
1167     */

1168    public void setToInstallDir(boolean toInstallDir) throws IllegalArgumentException JavaDoc {
1169        if (isGlobal () != null && toInstallDir != isGlobal ().booleanValue ()) {
1170            throw new IllegalArgumentException JavaDoc ("Cannot setToInstallDir (" + toInstallDir + ") when isGlobal is set to " + isGlobal ()); // NOI18N
1171
} else if (isForcedGlobal () && ! toInstallDir) {
1172            throw new IllegalArgumentException JavaDoc ("Cannot setToInstallDir (" + toInstallDir + ") when isForderGlobal is " + isForcedGlobal ()); // NOI18N
1173
}
1174        
1175        this.toInstallDir = toInstallDir;
1176    }
1177    
1178    /** Getter for property downloadStarted.
1179     * @return Value of property downloadStarted.
1180     */

1181    public boolean isDownloadStarted() {
1182        return this.downloadStarted;
1183    }
1184    
1185    /** Setter for property downloadStarted.
1186     * @param downloadStarted New value of property downloadStarted.
1187     */

1188    public void setDownloadStarted(boolean downloadStarted) {
1189        this.downloadStarted = downloadStarted;
1190    }
1191    
1192    /** Getter for property safeToInstall.
1193     * @return Value of property safeToInstall.
1194     */

1195    boolean isSafeToInstall() {
1196        return safeToInstall && isNew() && !isForcedGlobal () ;
1197    }
1198    
1199    /** Setter for property safeToInstall.
1200     * @param safeToInstall New value of property safeToInstall.
1201     */

1202    void setSafeToInstall(boolean safeToInstall) {
1203        this.safeToInstall = safeToInstall;
1204    }
1205    
1206    /** Getter for attribute isGlobal read from NBM/Info.xml.
1207     * @return Value of property isGlobal or null if not set.
1208     */

1209    Boolean JavaDoc isGlobal () {
1210        return isGlobal;
1211    }
1212
1213    /** Getter for attribute targetCluster read from NBM/Info.xml.
1214     * @return Value of property targetCluster or null if not set or the cluster doesn't exist.
1215     */

1216    String JavaDoc getTargetCluster () {
1217        return targetCluster;
1218    }
1219    
1220    /** Getter for property jarList.
1221     * @return Value of property jarList.
1222     */

1223    List JavaDoc getJarList() {
1224        return this.jarList;
1225    }
1226    
1227    /** Setter for property jarList.
1228     * @param jarList New value of property jarList.
1229     */

1230    void setJarList(List JavaDoc jarList) {
1231        this.jarList = jarList;
1232    }
1233    
1234    void addToJarList(String JavaDoc jarName) {
1235        jarList.add( jarName );
1236    }
1237    
1238    /** Searches the shared installations (each cluster in sequence)
1239     * directories and chooses the one that this module should be installed
1240     * into.
1241     * <P>
1242     * This is done according to the rules described at
1243     * http://openide.netbeans.org/proposals/arch/installation.html#influence-on-autoupdate
1244     *
1245     * @return the directory we want to install at or <code>null</code> if the
1246     * module cannot be installed into shared location
1247     */

1248    final File JavaDoc findInstallDirectory () {
1249        if (target == null) {
1250
1251            File JavaDoc firstInstallable = null;
1252            File JavaDoc declaredTarget = null;
1253            File JavaDoc updateTarget = null;
1254
1255            java.util.Iterator JavaDoc en = org.netbeans.updater.UpdateTracking.clusters (false).iterator ();
1256            while (en.hasNext ()) {
1257                File JavaDoc f = (File JavaDoc)en.next ();
1258                
1259                // a fallback cluster should be used though non-existing or empty
1260
if (firstInstallable == null) {
1261
1262                    // but if update_tracking exists then take care of .noautoupdate file
1263
if (! f.isDirectory () || UpdateTracking.getTracking (f, false) != null) {
1264                        firstInstallable = f;
1265                    }
1266
1267                }
1268
1269                if (f.getName ().equals (getTargetCluster ())) {
1270                    declaredTarget = f;
1271                }
1272
1273                UpdateTracking ut = org.netbeans.updater.UpdateTracking.getTracking (f, false);
1274                if (ut != null && ut.isModuleInstalled (this.getInfoCodenamebase ())) {
1275                    // if module is installed here, let's stop the
1276
// search and treat this as the install dir
1277
assert declaredTarget == null || f.equals (declaredTarget) : "Update's target cluster must be placed into as same cluster as original module.";
1278                    updateTarget = f;
1279                    break;
1280                }
1281            }
1282            if (updateTarget != null) {
1283                target = updateTarget;
1284            } else {
1285                if (declaredTarget != null) {
1286                    target = declaredTarget;
1287                }
1288                if (getTargetCluster() != null) {
1289                    for (
1290                        Iterator JavaDoc it = Lookup.getDefault().lookupAll(AutoupdateClusterCreator.class).iterator();
1291                        it.hasNext() && target == null;
1292                    ) {
1293                        AutoupdateClusterCreator creator = (AutoupdateClusterCreator)it.next();
1294                        target = creator.findCluster(getTargetCluster());
1295                    }
1296                }
1297                if (target == null) {
1298                    target = firstInstallable;
1299                }
1300                if (target != null && ! target.exists ()) {
1301                    new File JavaDoc (target, UpdateTracking.TRACKING_FILE_NAME).mkdirs ();
1302                }
1303            }
1304        }
1305
1306        return target;
1307    }
1308    
1309    /** Returns true if a module can be installed into user directory.
1310     * We cannot install into user dir if our files would clash with some
1311     * files already installed in some global cluster.
1312     */

1313    final boolean isAbleToInstallToUserDir () {
1314        HashSet JavaDoc files = new HashSet JavaDoc ();
1315        if (nbmFile == null) {
1316            files.addAll (jarList);
1317        } else {
1318            try {
1319                JarFile JavaDoc f = new JarFile JavaDoc (nbmFile);
1320                Enumeration JavaDoc en = f.entries ();
1321                while (en.hasMoreElements ()) {
1322                    JarEntry JavaDoc e = (JarEntry JavaDoc)en.nextElement ();
1323                    String JavaDoc s = e.getName ();
1324                    if (s.startsWith ("netbeans/")) {
1325                        s = s.substring (9);
1326                    }
1327                    files.add (s);
1328                }
1329            } catch (IOException JavaDoc ex) {
1330                assert false : "IOException caught: " + ex.getMessage ();
1331                return false;
1332            }
1333        }
1334        
1335        Iterator JavaDoc en = org.netbeans.updater.UpdateTracking.clusters (false).iterator ();
1336        while (en.hasNext ()) {
1337            File JavaDoc f = (File JavaDoc)en.next ();
1338            
1339            Iterator JavaDoc it = files.iterator ();
1340            while (it.hasNext ()) {
1341                String JavaDoc entry = (String JavaDoc)it.next ();
1342                if (entry.startsWith(NBM_CORE + "/") || entry.startsWith(NBM_LIB + "/")) {
1343                    File JavaDoc my = new File JavaDoc (f, entry);
1344                    if (! my.isDirectory () && my.exists ()) {
1345                        return false;
1346                    }
1347                }
1348            }
1349        }
1350        return true;
1351    }
1352    
1353    /* This innerclass represents licence cache
1354    */

1355    /*
1356    private static class LicenceCache extends Object {
1357      
1358      private HashMap map;
1359      
1360      
1361      LicenceCache() {
1362        map = new HashMap();
1363      }
1364      
1365      String getLicence ( URL url ) {
1366        Set keys = map.keySet();
1367        Iterator it = keys.iterator();
1368        while( it.hasNext() ) {
1369          URL keyUrl = (URL)it.next();
1370          if ( keyUrl.equals( url ) ) {
1371            return (String)map.get( keyUrl );
1372          }
1373        }
1374        
1375        return null;
1376      }
1377      
1378      void addLicence ( URL url, String text ) {
1379        map.put( url, text );
1380      }
1381}
1382    */

1383    static class ErrorCatcher implements org.xml.sax.ErrorHandler JavaDoc {
1384        private void message (String JavaDoc level, org.xml.sax.SAXParseException JavaDoc e) {
1385        }
1386
1387        public void error (org.xml.sax.SAXParseException JavaDoc e) {
1388        }
1389
1390        public void warning (org.xml.sax.SAXParseException JavaDoc e) {
1391            LOG.log(Level.WARNING, null, e);
1392        }
1393
1394        public void fatalError (org.xml.sax.SAXParseException JavaDoc e) {
1395        }
1396    } //end of inner class ErrorPrinter
1397

1398    class External extends Object JavaDoc {
1399        
1400        /** Holds value of property name. */
1401        private String JavaDoc name;
1402        
1403        /** Holds value of property target_name. */
1404        private String JavaDoc target_name;
1405        
1406        /** Holds value of property start_url. */
1407        private String JavaDoc start_url;
1408        
1409        /** Holds value of property description. */
1410        private String JavaDoc description;
1411        
1412        /** Getter for property name.
1413         * @return Value of property name.
1414         */

1415        public String JavaDoc getName() {
1416            return name;
1417        }
1418        
1419        /** Setter for property name.
1420         * @param name New value of property name.
1421         */

1422        public void setName(String JavaDoc name) {
1423            this.name = name;
1424        }
1425        
1426        /** Getter for property target_name.
1427         * @return Value of property target_name.
1428         */

1429        public String JavaDoc getTarget_name() {
1430            return target_name;
1431        }
1432        
1433        /** Setter for property target_name.
1434         * @param target_name New value of property target_name.
1435         */

1436        public void setTarget_name(String JavaDoc target_name) {
1437            this.target_name = target_name;
1438        }
1439        
1440        /** Getter for property start_url.
1441         * @return Value of property start_url.
1442         */

1443        public String JavaDoc getStart_url() {
1444            return start_url;
1445        }
1446        
1447        /** Setter for property start_url.
1448         * @param start_url New value of property start_url.
1449         */

1450        public void setStart_url(String JavaDoc start_url) {
1451            this.start_url = start_url;
1452        }
1453        
1454        /** Getter for property description.
1455         * @return Value of property description.
1456         */

1457        public String JavaDoc getDescription() {
1458            return description;
1459        }
1460        
1461        /** Setter for property description.
1462         * @param description New value of property description.
1463         */

1464        public void setDescription(String JavaDoc description) {
1465            this.description = description;
1466        }
1467        
1468    }
1469}
1470
Popular Tags