KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > packaging > bundlehandlers > BasicBundle


1 /*
2  
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5  
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8  
9  */

10
11 package org.mmbase.applications.packaging.bundlehandlers;
12
13 import java.io.BufferedInputStream JavaDoc;
14 import java.io.BufferedOutputStream JavaDoc;
15 import java.io.File JavaDoc;
16 import java.io.FileOutputStream JavaDoc;
17 import java.io.IOException JavaDoc;
18 import java.util.ArrayList JavaDoc;
19 import java.util.HashMap JavaDoc;
20 import java.util.Iterator JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.jar.JarEntry JavaDoc;
23 import java.util.jar.JarFile JavaDoc;
24
25 import org.mmbase.applications.packaging.BundleManager;
26 import org.mmbase.applications.packaging.InstallManager;
27 import org.mmbase.applications.packaging.PackageManager;
28 import org.mmbase.applications.packaging.Person;
29 import org.mmbase.applications.packaging.UninstallManager;
30 import org.mmbase.applications.packaging.installhandlers.installStep;
31 import org.mmbase.applications.packaging.packagehandlers.PackageInterface;
32 import org.mmbase.applications.packaging.providerhandlers.ProviderInterface;
33 import org.mmbase.module.core.MMBaseContext;
34 import org.mmbase.util.logging.Logger;
35 import org.mmbase.util.logging.Logging;
36 import org.w3c.dom.NamedNodeMap JavaDoc;
37
38 /**
39  * BasicBundle, base class for bundles
40  *
41  * @author Daniel Ockeloen (MMBased)
42  */

43 public class BasicBundle implements BundleInterface {
44     private static Logger log = Logging.getLoggerInstance(BasicBundle.class);
45     
46     private String JavaDoc name;
47     private String JavaDoc id;
48     private String JavaDoc maintainer;
49     private String JavaDoc version;
50     private String JavaDoc date;
51     private String JavaDoc type = "unknown/unknown";
52     private String JavaDoc state = "not installed";
53     private String JavaDoc path;
54     private String JavaDoc description = "";
55     private String JavaDoc releasenotes = "";
56     private String JavaDoc installationnotes = "";
57     private String JavaDoc licensename = "";
58     private String JavaDoc licensetype = "";
59     private String JavaDoc licenseversion = "";
60     private String JavaDoc licensebody = "";
61     private ProviderInterface provider;
62
63     private HashMap JavaDoc neededpackages = new HashMap JavaDoc();
64     private ArrayList JavaDoc initiators,supporters,contacts,developers,screenshots,starturls;
65     private float progressbar = 0;
66     private float progressstep = 1;
67     private PackageInterface pkg = null;
68
69     // the install manager keeps track of what happend during a install
70
// of a package or bundle. These are called steps because they not
71
// only can provide log info but also possible fixed, feedback, stats
72
// etc etc. Each step in itself can have steps again providing for things
73
// like three style logging and feedback
74
private ArrayList JavaDoc installsteps;
75
76     private long lastupdated;
77
78     public BasicBundle() {
79     }
80
81     public BasicBundle(org.w3c.dom.Node JavaDoc n,ProviderInterface provider,String JavaDoc name,String JavaDoc type,String JavaDoc maintainer,String JavaDoc version, String JavaDoc date,String JavaDoc path) {
82         this.name = name;
83         this.version = version;
84         this.date = date;
85         this.maintainer = maintainer;
86         this.provider = provider;
87         this.type = type;
88         this.id = name+"@"+maintainer+"_"+type;
89         this.id = this.id.replace(' ','_');
90         this.id = this.id.replace('/','_');
91         this.path = path;
92
93         decodeNeededPackages(n);
94         if (n != null) {
95             addMetaInfo(n);
96         }
97     }
98
99     public String JavaDoc getId() {
100         if (id==null) return "";
101         return id;
102     }
103
104     public String JavaDoc getName() {
105         if (name == null) return"";
106         return name;
107     }
108
109     public Iterator JavaDoc getNeededPackages() {
110         return neededpackages.values().iterator();
111     }
112
113     public List JavaDoc getScreenshots() {
114         return screenshots;
115     }
116
117     public List JavaDoc getStarturls() {
118         return starturls;
119     }
120     
121     public String JavaDoc getVersion() {
122         if (version == null) return("");
123         return version;
124     }
125
126     public String JavaDoc getCreationDate() {
127         if (date == null) return "";
128         return date;
129     }
130
131     public String JavaDoc getMaintainer() {
132         if (maintainer == null) return "";
133         return maintainer;
134     }
135
136     public String JavaDoc getState() {
137         if (InstallManager.isActive()) {
138             if (this == InstallManager.getInstallingBundle()) {
139                 return "installing";
140             }
141         }
142
143         if (UninstallManager.isActive()) {
144             if (this == UninstallManager.getUnInstallingBundle()) {
145                 return "uninstalling";
146             }
147         }
148
149         if (BundleManager.isInstalledVersion(this)) {
150             return "installed";
151         }
152
153         if (BundleManager.upgradeAvailable(this)) {
154             return "upgrade available";
155         }
156
157         if (state == null) return "";
158         return state;
159     }
160
161     public String JavaDoc getType() {
162         if (type==null) return "";
163         return type;
164     }
165
166     public ProviderInterface getProvider() {
167         return provider;
168     }
169
170     public boolean setState(String JavaDoc state) {
171         this.state = state;
172         return true;
173     }
174
175
176     public boolean install() {
177         // step1
178
installStep step = getNextInstallStep();
179         step.setUserFeedBack("bundle/basic installer started");
180
181         setProgressBar(1000); // lets have 100 steps;
182
step = getNextInstallStep();
183         step.setUserFeedBack("getting the mmb bundle... ");
184     provider.setInstallStep(step);
185         JarFile JavaDoc jf = getJarFile();
186     provider.setInstallStep(null);
187         if (jf != null) {
188             step.setUserFeedBack("getting the mmb bundle...done ");
189             increaseProgressBar(100); // downloading is 25%
190

191             int pbs = 0;
192             // figure out how many packages we have for the progressbar
193
Iterator JavaDoc d = getNeededPackages();
194             while (d.hasNext()) {
195                 pbs++;
196                 d.next();
197             }
198             int pss = 800/pbs; // guess the progressbar per installed package
199

200             boolean changed = true; // signals something was installed
201
while (changed) {
202                 Iterator JavaDoc e = getNeededPackages();
203                 changed = false;
204                 while (e.hasNext()) {
205                     Object JavaDoc o=e.next();
206             /*
207                 if (o instanceof HashMap) {
208                 } else {
209                     }
210             */

211                     HashMap JavaDoc np = (HashMap JavaDoc)o;
212                     String JavaDoc tmp=(String JavaDoc)np.get("id");
213                     pkg = PackageManager.getPackage(tmp);
214                     if (pkg != null) {
215                         String JavaDoc state = pkg.getState();
216                         String JavaDoc name = pkg.getName();
217                         if (!state.equals("installed")) {
218                             step = getNextInstallStep();
219                             step.setUserFeedBack("calling package installer "+name+"..");
220                             boolean ins = pkg.install(step);
221                             if (ins) {
222                                 step.setUserFeedBack("calling package installer "+name+"...done");
223                                 increaseProgressBar(pss);
224                                 changed = true;
225                             } else {
226                                 if (pkg.getDependsFailed()) {
227                                     step.setUserFeedBack("calling package installer "+name+"...skipped");
228                                         removeInstallStep(step);
229                                 } else {
230                                     step.setUserFeedBack("calling package installer "+name+"...failed");
231                                     return false;
232                                 }
233                             }
234                         }
235                     } else {
236                         log.error("Missing package on +"+np.get("id"));
237                     }
238                 }
239             }
240
241             step = getNextInstallStep();
242             step.setUserFeedBack("updating mmbase registry ..");
243             updateRegistryInstalled();
244             increaseProgressBar(100);
245             step.setUserFeedBack("updating mmbase registry ... done");
246         } else {
247             step.setUserFeedBack("getting the mmb bundle...failed (server down or removed disk ? )");
248             step.setType(installStep.TYPE_ERROR);
249             try {
250                 Thread.sleep(2000);
251             } catch(Exception JavaDoc ee) {}
252         }
253
254         step=getNextInstallStep();
255         step.setUserFeedBack("bundle/basic installer ended");
256         return true;
257     }
258
259     public boolean uninstall() {
260         try {
261             // step1
262
installStep step = getNextInstallStep();
263             step.setUserFeedBack("bundle/basic uninstaller started");
264
265             Iterator JavaDoc e = getNeededPackages();
266                 while (e.hasNext()) {
267                     HashMap JavaDoc np = (HashMap JavaDoc)e.next();
268                     PackageInterface pkg = PackageManager.getPackage((String JavaDoc)np.get("id"));
269                     if (pkg != null) {
270                         String JavaDoc name = pkg.getName();
271                         step=getNextInstallStep();
272                         step.setUserFeedBack("calling package uninstaller "+name+"..");
273                         if (pkg.uninstall(step)) {
274                             step.setUserFeedBack("calling package uninstaller "+name+"...done");
275                         } else {
276                             step.setUserFeedBack("calling package uninstaller "+name+"...failed");
277                         }
278                     } else {
279                         log.error("Missing package on +"+np.get("id"));
280                     }
281                }
282
283                // step 3
284
step = getNextInstallStep();
285                step.setUserFeedBack("updating mmbase registry ..");
286                updateRegistryUninstalled();
287                step.setUserFeedBack("updating mmbase registry ... done");
288
289                // step 4
290
step = getNextInstallStep();
291                step.setUserFeedBack("bundle/basic installer ended");
292
293            } catch (Exception JavaDoc e) {
294                log.error("install crash on : "+this);
295                return false;
296            }
297            return true;
298     }
299
300     public installStep getNextInstallStep() {
301         // create new step
302
installStep step=new installStep();
303         if (installsteps==null) {
304             installsteps=new ArrayList JavaDoc();
305             installsteps.add(step);
306             return step;
307         } else {
308             installsteps.add(step);
309             return step;
310         }
311     }
312
313     public boolean removeInstallStep(installStep step) {
314         if (installsteps.contains(step)) {
315             installsteps.remove(step);
316             return true;
317         } else {
318             return false;
319         }
320     }
321
322     public Iterator JavaDoc getInstallSteps() {
323         if (installsteps != null) {
324                 return installsteps.iterator();
325         } else {
326                 return null;
327         }
328     }
329
330     public Iterator JavaDoc getInstallSteps(int logid) {
331         // well maybe its one of my subs ?
332
Iterator JavaDoc e = getInstallSteps();
333         while (e.hasNext()) {
334             installStep step = (installStep)e.next();
335             Object JavaDoc o = step.getInstallSteps(logid);
336             if (o != null) {
337                 return (Iterator JavaDoc)o;
338             }
339         }
340         return null;
341     }
342
343     public void clearInstallSteps() {
344         installsteps = null;
345     }
346
347     public JarFile JavaDoc getJarFile() {
348         if (provider != null) {
349             JarFile JavaDoc jf=provider.getJarFile(getPath(),getId(),getVersion());
350             return jf;
351         }
352         return null;
353     }
354
355     public JarFile JavaDoc getIncludedPackageJarFile(String JavaDoc packageid,String JavaDoc packageversion) {
356         if (provider != null) {
357             return provider.getIncludedPackageJarFile(getPath(),getId(),getVersion(),packageid,packageversion);
358         }
359         return null;
360     }
361
362     public BufferedInputStream JavaDoc getJarStream() {
363         if (provider!=null) {
364             return provider.getJarStream(getPath());
365         }
366         return null;
367     }
368
369     public String JavaDoc getPath() {
370         return path;
371     }
372
373
374     public boolean updateRegistryInstalled() {
375         return BundleManager.updateRegistryInstalled(this);
376     }
377
378     public boolean updateRegistryUninstalled() {
379         return BundleManager.updateRegistryUninstalled(this);
380     }
381
382     public void signalUpdate() {
383         lastupdated=System.currentTimeMillis();
384     }
385
386     public long lastSeen() {
387         return lastupdated;
388     }
389
390     private void decodeNeededPackages(org.w3c.dom.Node JavaDoc n) {
391         org.w3c.dom.Node JavaDoc n2 = n.getFirstChild();
392         while (n2 != null) {
393             String JavaDoc name = n2.getNodeName();
394             // this should me one way defined (remote or local)
395
if (name.equals("neededpackages")) {
396                 org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
397                 while (n3 != null) {
398                     name = n3.getNodeName();
399                     NamedNodeMap JavaDoc nm = n3.getAttributes();
400                     if (nm != null) {
401                         String JavaDoc maintainer = null;
402                         String JavaDoc type = null;
403                         String JavaDoc version = null;
404              
405                         // decode name
406
org.w3c.dom.Node JavaDoc n5 = nm.getNamedItem("name");
407                         if (n5 != null) {
408                             name = n5.getNodeValue();
409                         }
410
411                         // decode the type
412
n5 = nm.getNamedItem("type");
413                         if (n5 != null) {
414                             type = n5.getNodeValue();
415                         }
416
417                         // decode the maintainer
418
n5 = nm.getNamedItem("maintainer");
419                         if (n5 != null) {
420                              maintainer = n5.getNodeValue();
421                         }
422
423                         // decode the version
424
n5 = nm.getNamedItem("version");
425                         if (n5 != null) {
426                             version = n5.getNodeValue();
427                         }
428
429                         String JavaDoc wid = name+"@"+maintainer+"_"+type;
430                         wid = wid.replace(' ','_');
431                         wid = wid.replace('/','_');
432
433                         HashMap JavaDoc h = new HashMap JavaDoc();
434                         h.put("name",name);
435                         h.put("id",wid);
436                         h.put("type",type);
437                         h.put("maintainer",maintainer);
438                         h.put("version",version);
439                         neededpackages.put(wid,h);
440                     }
441                     n3 = n3.getNextSibling();
442                 }
443             }
444             // if in a remote file
445
if (name.equals("includedpackages")) {
446                 org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
447                 while (n3 != null) {
448                     name = n3.getNodeName();
449                     NamedNodeMap JavaDoc nm = n3.getAttributes();
450                     if (nm != null) {
451                         String JavaDoc maintainer = null;
452                         String JavaDoc type = null;
453                         String JavaDoc version = null;
454                         boolean packed = false;
455             
456                         // decode name
457
org.w3c.dom.Node JavaDoc n5 = nm.getNamedItem("name");
458                         if (n5 != null) {
459                            name = n5.getNodeValue();
460                         }
461
462                         // decode the type
463
n5 = nm.getNamedItem("type");
464                         if (n5 != null) {
465                             type = n5.getNodeValue();
466                         }
467
468                         // decode the maintainer
469
n5 = nm.getNamedItem("maintainer");
470                         if (n5 != null) {
471                             maintainer = n5.getNodeValue();
472                         }
473
474                         // decode the version
475
n5 = nm.getNamedItem("version");
476                         if (n5 != null) {
477                             version = n5.getNodeValue();
478                         }
479
480                         // decode the packed
481
n5 = nm.getNamedItem("packed");
482                         if (n5 != null) {
483                             if (n5.getNodeValue().equals("true")) packed = true;
484                         }
485
486                         String JavaDoc wid = name+"@"+maintainer+"_"+type;
487                         wid = wid.replace(' ','_');
488                         wid = wid.replace('/','_');
489
490                         HashMap JavaDoc h = new HashMap JavaDoc();
491                         h.put("name",name);
492                         h.put("id",wid);
493                         h.put("type",type);
494                         h.put("maintainer",maintainer);
495                         h.put("version",version);
496                         neededpackages.put(wid,h);
497
498                         // if its included add it to available packages
499
}
500                     n3 = n3.getNextSibling();
501                 }
502             }
503             n2 = n2.getNextSibling();
504         }
505     }
506
507    private void addMetaInfo(org.w3c.dom.Node JavaDoc n) {
508        org.w3c.dom.Node JavaDoc n2 = n.getFirstChild();
509        while (n2 != null) {
510            if (n2.getNodeName().equals("description")) {
511                org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
512                if (n3!=null) {
513                    description = n3.getNodeValue();
514                }
515            } else if (n2.getNodeName().equals("releasenotes")) {
516                org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
517                if (n3!=null) {
518                    releasenotes = n3.getNodeValue();
519                }
520            } else if (n2.getNodeName().equals("installationnotes")) {
521                org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
522                if (n3!=null) {
523                    installationnotes = n3.getNodeValue();
524                }
525            } else if (n2.getNodeName().equals("license")) {
526                org.w3c.dom.Node JavaDoc n3 = n2.getFirstChild();
527                if (n3 != null) {
528                    licensebody = n3.getNodeValue();
529                }
530                NamedNodeMap JavaDoc nm = n2.getAttributes();
531                if (nm != null) {
532                    // decode name
533
org.w3c.dom.Node JavaDoc n4 = nm.getNamedItem("name");
534                    if (n4 != null) {
535                        licensename = n4.getNodeValue();
536                    }
537                    // decode type
538
n4 = nm.getNamedItem("type");
539                    if (n4 != null) {
540                        licensetype = n4.getNodeValue();
541                    }
542                    // decode version
543
n4 = nm.getNamedItem("version");
544                    if (n4 != null) {
545                        licenseversion = n4.getNodeValue();
546                    }
547                }
548            } else if (n2.getNodeName().equals("screenshots")) {
549         screenshots = decodeRelatedScreenshots(n2);
550            } else if (n2.getNodeName().equals("starturls")) {
551         starturls = decodeRelatedStarturls(n2);
552            } else if (n2.getNodeName().equals("initiators")) {
553                initiators = decodeRelatedPeople(n2,"initiator");
554            } else if (n2.getNodeName().equals("supporters")) {
555                supporters = decodeRelatedPeople(n2,"supporter");
556            } else if (n2.getNodeName().equals("contacts")) {
557                contacts = decodeRelatedPeople(n2,"contact");
558            } else if (n2.getNodeName().equals("developers")) {
559                developers = decodeRelatedPeople(n2,"developer");
560            }
561            n2 = n2.getNextSibling();
562        }
563    }
564
565    public List JavaDoc getRelatedPeople(String JavaDoc type) {
566       if (type.equals("initiators")) return initiators;
567       if (type.equals("supporters")) return supporters;
568       if (type.equals("developers")) return developers;
569       if (type.equals("contacts")) return contacts;
570       return null;
571    }
572
573
574    private ArrayList JavaDoc decodeRelatedPeople(org.w3c.dom.Node JavaDoc n,String JavaDoc type) {
575        ArrayList JavaDoc list = new ArrayList JavaDoc();
576        org.w3c.dom.Node JavaDoc n2 = n.getFirstChild();
577        while (n2 != null) {
578            if (n2.getNodeName().equals(type)) {
579                Person p = new Person();
580                NamedNodeMap JavaDoc nm = n2.getAttributes();
581                if (nm != null) {
582                    org.w3c.dom.Node JavaDoc n3 = nm.getNamedItem("name");
583                    if (n3 != null) p.setName(n3.getNodeValue());
584                    n3 = nm.getNamedItem("company");
585                    if (n3 != null) p.setCompany(n3.getNodeValue());
586                    n3 = nm.getNamedItem("reason");
587                    if (n3 != null) p.setReason(n3.getNodeValue());
588                    n3 = nm.getNamedItem("mailto");
589                    if (n3 != null) p.setMailto(n3.getNodeValue());
590                }
591                list.add(p);
592            }
593            n2 = n2.getNextSibling();
594        }
595        return list;
596    }
597
598
599    private ArrayList JavaDoc decodeRelatedScreenshots(org.w3c.dom.Node JavaDoc n) {
600        ArrayList JavaDoc list = new ArrayList JavaDoc();
601        org.w3c.dom.Node JavaDoc n2 = n.getFirstChild();
602        while (n2 != null) {
603            if (n2.getNodeName().equals("screenshot")) {
604                NamedNodeMap JavaDoc nm = n2.getAttributes();
605            String JavaDoc ufile="";
606                if (nm != null) {
607            String JavaDoc name="";
608            String JavaDoc file="";
609            String JavaDoc description="";
610                    org.w3c.dom.Node JavaDoc n3 = nm.getNamedItem("name");
611                    if (n3 != null) name=n3.getNodeValue();
612                    n3 = nm.getNamedItem("file");
613                    if (n3 != null) file=n3.getNodeValue();
614                    n3=n2.getFirstChild();
615                    if (n3!=null) description=n3.getNodeValue();
616
617            // tricky tricky how do we handle where to find
618
// the file. if local we write to a tmp dir for now
619
// so a browser can find it. and if remote thats
620
// allready done by our remote counterpart so we aim
621
// to that.
622
if (provider!=null) {
623             String JavaDoc method=provider.getMethod();
624             if (method.equals("disk")) {
625                 String JavaDoc htmldir=MMBaseContext.getHtmlRoot() + File.separator+"mmbase"+File.separator+"packagemanager"+File.separator+"images"+File.separator;
626                 ufile=File.separator+"mmbase"+File.separator+"packagemanager"+File.separator+"images"+File.separator+getId()+File.separator+file;
627                             File JavaDoc d = new File JavaDoc(htmldir+getId());
628                             if (!d.exists()) {
629                                 d.mkdir();
630                             }
631                             d = new File JavaDoc(htmldir+getId()+File.separator+"screenshots");
632                             if (!d.exists()) {
633                                 d.mkdir();
634                             }
635                     JarFile JavaDoc jf = getJarFile();
636                 if (jf!=null) {
637                                 try {
638                                 JarEntry JavaDoc je = jf.getJarEntry(file);
639                                     BufferedInputStream JavaDoc in = new BufferedInputStream JavaDoc(jf.getInputStream(je));
640                                     BufferedOutputStream JavaDoc out = new BufferedOutputStream JavaDoc(new FileOutputStream JavaDoc(htmldir+getId()+File.separator+file));
641                                     int val;
642                                     while ((val = in.read()) != -1) {
643                                             out.write(val);
644                                     }
645                                     out.close();
646                                 } catch (IOException JavaDoc f) {
647                                     f.printStackTrace();
648                                 }
649                 }
650             } else if (method.equals("http")) {
651                 ufile=file;
652             }
653            }
654
655                    list.add(name);
656                    list.add(ufile);
657                    list.add(description);
658                }
659            }
660            n2 = n2.getNextSibling();
661        }
662        return list;
663    }
664
665
666    private ArrayList JavaDoc decodeRelatedStarturls(org.w3c.dom.Node JavaDoc n) {
667        ArrayList JavaDoc list = new ArrayList JavaDoc();
668        org.w3c.dom.Node JavaDoc n2 = n.getFirstChild();
669        while (n2 != null) {
670            if (n2.getNodeName().equals("url")) {
671                NamedNodeMap JavaDoc nm = n2.getAttributes();
672                if (nm != null) {
673            String JavaDoc name="";
674            String JavaDoc link="";
675            String JavaDoc description="";
676                    org.w3c.dom.Node JavaDoc n3 = nm.getNamedItem("name");
677                    if (n3 != null) name=n3.getNodeValue();
678                    n3 = nm.getNamedItem("link");
679                    if (n3 != null) link=n3.getNodeValue();
680                    n3=n2.getFirstChild();
681                    if (n3!=null) description=n3.getNodeValue();
682                    list.add(name);
683                    list.add(link);
684                    list.add(description);
685                }
686            }
687            n2 = n2.getNextSibling();
688        }
689        return list;
690    }
691
692
693     public String JavaDoc getDescription() {
694         return description;
695     }
696     
697     public String JavaDoc getInstallationNotes() {
698         return installationnotes;
699     }
700     
701     public String JavaDoc getReleaseNotes() {
702         return releasenotes;
703     }
704
705     public String JavaDoc getLicenseType() {
706         return licensetype;
707     }
708
709     public String JavaDoc getLicenseName() {
710         return licensename;
711     }
712
713     public String JavaDoc getLicenseVersion() {
714         return licenseversion;
715     }
716
717     public String JavaDoc getLicenseBody() {
718         return licensebody;
719     }
720
721     public void setProgressBar(int stepcount) {
722         progressbar=1;
723         progressstep=100/(float)stepcount;
724     }
725
726     public void increaseProgressBar() {
727         increaseProgressBar(1);
728     }
729
730     public void increaseProgressBar(int stepcount) {
731         progressbar += (stepcount*progressstep);
732     }
733
734    public int getProgressBarValue() {
735        return (int)progressbar;
736    }
737
738    public int getPackageProgressBarValue() {
739        if (pkg!=null) {
740            return pkg.getProgressBarValue();
741         }
742         return 0;
743    }
744 }
745
Popular Tags