Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / packageutils / impl / DefaultPackageInfo.java @ 1266

History | View | Annotate | Download (23.1 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

    
29
package org.gvsig.tools.packageutils.impl;
30

    
31
import java.io.File;
32
import java.net.MalformedURLException;
33
import java.net.URL;
34
import java.security.InvalidParameterException;
35
import java.text.MessageFormat;
36
import java.util.ArrayList;
37
import java.util.HashMap;
38
import java.util.Iterator;
39
import java.util.List;
40
import java.util.Map;
41

    
42
import org.gvsig.installer.lib.api.Dependencies;
43
import org.gvsig.installer.lib.api.Version;
44
import org.gvsig.tools.ToolsLocator;
45
import org.gvsig.tools.exception.BaseException;
46
import org.gvsig.tools.packageutils.PackageInfo;
47
import org.gvsig.tools.packageutils.PackageManager;
48
import org.gvsig.tools.packageutils.PackageManager.ARCH;
49
import org.gvsig.tools.packageutils.PackageManager.JVM;
50
import org.gvsig.tools.packageutils.PackageManager.OS;
51
import org.gvsig.tools.packageutils.PackageManager.STATE;
52
import org.gvsig.tools.packageutils.StringWithAlias;
53
import org.gvsig.tools.task.SimpleTaskStatus;
54
import org.slf4j.Logger;
55
import org.slf4j.LoggerFactory;
56

    
57
/**
58
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
59
 */
60
public class DefaultPackageInfo implements PackageInfo {
61

    
62
    private static final Logger logger = LoggerFactory
63
        .getLogger(DefaultPackageInfo.class);
64

    
65
    private static PackageManager packageManager = null;
66
    
67
        public static interface PACKAGE_FILE_NAME_FIELDS {
68
                static final int GVSIG_VERSION = 0;
69
                static final int NAME = 1;
70
                static final int VERSION = 2;
71
                static final int BUILD = 3;
72
                static final int STATE = 4;
73
                static final int OS = 5;
74
                static final int ARCH = 6;
75
                static final int JVM = 7;
76
        }
77
        private static final String PACKAGE_NAME_FORMAT = "gvSIG-desktop-{0}-{1}-{2}-{4}-{5}-{6}-{7}.gvspkg";
78
        
79
        private static final String DEFAULT_MODEL_VERSION = "1.0.1";
80
        private static final String DEFAULT_TYPE = "unknow";
81
        
82
    private StringWithAlias code = null;
83
    private String name = null;
84
    private String description = null;
85
    private Version version = null;
86
    private boolean official;
87
    private String type = DEFAULT_TYPE;
88
    private boolean broken = false;
89

    
90
    private String state = STATE.DEVEL;
91
    private String operatingSystem = OS.ALL;
92
    private String architecture = ARCH.ALL;
93
    private String javaVM = JVM.J1_5;
94

    
95
    private String owner = "";
96
    private URL ownerURL = null;
97
    private URL sources = null;
98
    private Version applicationVersion = null;
99

    
100
    private String defaultDownloadURL = null;
101

    
102
    private String modelVersion = DEFAULT_MODEL_VERSION;
103
    private Dependencies dependencies = null;
104
    private List categories = null;
105

    
106
    private URL webURL = null;
107
    
108
    private String postInstallScript = null;
109
    
110
    private Map aditionalProperties = null;
111

    
112
    public DefaultPackageInfo() {
113
        super();
114
        PackageManager manager = ToolsLocator.getPackageManager();
115
        this.version = manager.createVersion().parse("0.0.1");
116
        this.applicationVersion = manager.createVersion().parse("0.0.1");
117
        this.dependencies = manager.createDependencies();
118
        this.categories = new ArrayList();
119
        this.aditionalProperties = new HashMap();
120
    }
121

    
122
    private PackageManager getPackageManager() {
123
        if( packageManager==null ) {
124
            packageManager = ToolsLocator.getPackageManager();
125
        }
126
        return packageManager;
127
    }
128
    
129
    public String getCode() {
130
            if( code == null ) {
131
                    return null;
132
            }
133
        return code.toString();
134
    }
135
    
136
    public StringWithAlias getAllCodes() {
137
            return this.code;
138
    }
139
    
140
    private String getAliasAsString() {
141
            if( this.code == null ) {
142
                    return "";
143
            }
144
            StringBuffer s = new StringBuffer();
145
            Iterator alias = this.code.getAlias().iterator();
146
            while( alias.hasNext() ) {
147
                    String ss = (String) alias.next();
148
                    s.append(ss);
149
                    if( alias.hasNext() ) {
150
                            s.append(", ");
151
                    }
152
            }
153
            return s.toString();
154
    }    
155
    public boolean hasThisCode(String code) {
156
            if( this.code == null ) {
157
                    if( code == null ) {
158
                            return true;
159
                    }
160
                    return false;
161
            }
162
            return this.code.equalsIgnoreCase(code);
163
    }
164
    
165
    public boolean hasThisCode(StringWithAlias code) {
166
            if( this.code == null ) {
167
                    if( code == null ) {
168
                            return true;
169
                    }
170
                    return false;
171
            }
172
            return this.code.equalsIgnoreCase(code);
173
    }
174
    
175
    public String getID() {
176
        String id =
177
            this.getCode() + "#" + this.getVersion() 
178
                + "#" + this.getOperatingSystem() + "#"
179
                + this.getArchitecture();
180
        return id;
181
    }
182

    
183
    public String getName() {
184
        return name;
185
    }
186

    
187
    public String getDescription() {
188
        return description;
189
    }
190

    
191
    public Version getVersion() {
192
        return version;
193
    }
194
    
195
    public String getState() {
196
        return state;
197
    }
198

    
199
    public boolean isOfficial() {
200
        return official;
201
    }
202

    
203
    public void setCode(String code) {
204
            if( code == null ) {
205
                    this.code = null;
206
            } else {
207
                    this.code = new DefaultStringWithAlias(code);
208
            }
209
    }
210

    
211
    public void setName(String name) {
212
        this.name = name;
213
    }
214

    
215
    public void setDescription(String description) {
216
        this.description = description;
217
    }
218

    
219
    public void setVersion(Version version) {
220
        try {
221
            this.version = (Version) version.clone();
222
        } catch (CloneNotSupportedException e) {
223
            throw new RuntimeException(e);
224
        }
225
    }
226

    
227
    public void setState(String state) {
228
            if( isEmptyString(state) ) {
229
                    this.state = STATE.DEVEL;
230
            } else {
231
                    this.state = state;
232
            }
233
    }
234

    
235
    public void setOfficial(boolean official) {
236
        this.official = official;
237
    }
238

    
239
    public String getOperatingSystem() {
240
        return operatingSystem;
241
    }
242

    
243
    public void setOperatingSystem(String operatingSystem) {
244
            if( isEmptyString(operatingSystem) ) {
245
                    this.operatingSystem = OS.ALL;
246
            } else {
247
                    this.operatingSystem = operatingSystem;
248
            }
249
    }
250

    
251
    public String getArchitecture() {
252
        return architecture;
253
    }
254

    
255
    public void setArchitecture(String architecture) {
256
            if( isEmptyString(architecture) ) {
257
                    this.architecture = ARCH.ALL;
258
            } else {
259
                    this.architecture = architecture;
260
            }
261
    }
262

    
263
    public String getJavaVM() {
264
        return javaVM;
265
    }
266

    
267
    public void setJavaVM(String javaVM) {
268
            if( isEmptyString(javaVM) ) {
269
                    this.javaVM = JVM.J1_5;
270
            } else {
271
                    this.javaVM = javaVM;
272
            }
273
    }
274

    
275
    public String getType() {
276
        return type;
277
    }
278

    
279
    public void setType(String type) {
280
            if( isEmptyString(type) ) {
281
                    this.type = DEFAULT_TYPE;
282
            } else {
283
                    this.type = type;
284
            }
285
    }
286

    
287
    public Version getApplicationVersion() {
288
        return applicationVersion;
289
    }
290

    
291
    public void setApplicationVersion(Version applicationVersion) {
292
        this.applicationVersion = applicationVersion;
293
    }
294

    
295
    public URL getDownloadURL() {
296
            if( this.defaultDownloadURL == null ) {
297
                    return null;
298
            }
299
            try {
300
            return new URL(this.defaultDownloadURL);
301
        } catch (MalformedURLException e) {
302
                return null;
303
//            throw new RuntimeException(
304
//                "Error converting to URL the package download url "+ this.defaultDownloadURL,
305
//                e);
306
        }
307
    }
308

    
309
    public String getDownloadURLAsString() {
310
        return this.defaultDownloadURL;
311
    }
312

    
313
    public void setDownloadURL(URL defaultDownloadURL) {
314
        this.defaultDownloadURL = defaultDownloadURL.toString();
315
    }
316

    
317
    public void setDownloadURL(String defaultDownloadURL) {
318
        this.defaultDownloadURL = defaultDownloadURL;
319
    }
320

    
321
    public String getModelVersion() {
322
        return modelVersion;
323
    }
324

    
325
    public void setModelVersion(String modelVersion) {
326
            if( isEmptyString(modelVersion) ) {
327
                    this.modelVersion = DEFAULT_MODEL_VERSION;
328
            } else {
329
                    this.modelVersion = modelVersion;
330
            }
331
    }
332

    
333
    public String getOwner() {
334
        return owner;
335
    }
336

    
337
    public void setOwner(String owner) {
338
        this.owner = owner;
339
    }
340

    
341
    public URL getOwnerURL() {
342
        return ownerURL;
343
    }
344

    
345
    public void setOwnerURL(URL sources) {
346
        this.ownerURL = sources;
347
    }
348

    
349
    public URL getSourcesURL() {
350
        return sources;
351
    }
352

    
353
    public void setSourcesURL(URL sources) {
354
        this.sources = sources;
355
    }
356

    
357
    public String toString() {
358
        StringBuffer buffer = new StringBuffer(super.toString()).append(" (");
359

    
360
        append(buffer, PackageInfoTags.CODE, getCode());
361
        append(buffer, PackageInfoTags.NAME, getName());
362
        append(buffer, PackageInfoTags.DESCRIPTION, getDescription());
363
        append(buffer, PackageInfoTags.APPLICATION_VERSION, getApplicationVersion());
364
        append(buffer, PackageInfoTags.VERSION, getVersion());
365
        append(buffer, PackageInfoTags.OS, getOperatingSystem());
366
        append(buffer, PackageInfoTags.ARCHITECTURE, getArchitecture());
367
        append(buffer, PackageInfoTags.JVM, getJavaVM());
368
        append(buffer, PackageInfoTags.DOWNLOAD_URL, getDownloadURL());
369
        append(buffer, PackageInfoTags.STATE, getState());
370
        append(buffer, PackageInfoTags.OFFICIAL, Boolean.valueOf(isOfficial()));
371
        append(buffer, PackageInfoTags.TYPE, getType());
372
        append(buffer, PackageInfoTags.MODEL_VERSION, getModelVersion());
373
        append(buffer, PackageInfoTags.OWNER, getOwner());
374
        append(buffer, PackageInfoTags.OWNER_URL, getOwnerURL());
375
        append(buffer, PackageInfoTags.SOURCES_URL, getSourcesURL());
376
        append(buffer, PackageInfoTags.DEPENDENCIES, getDependencies());
377
        append(buffer, PackageInfoTags.WEB_URL, getWebURL());
378
        append(buffer, PackageInfoTags.CATEGORIES, getCategories());
379
        append(buffer, PackageInfoTags.CODEALIAS, getAliasAsString());
380

    
381
        return buffer.append(')').toString();
382
    }
383

    
384
//    public String toStringCompact() {
385
//        // type code version state os arch jvm dep
386
//        return String.format(
387
//                "%1$-8.4s %2$-40s %3$-20.20s %4$-5.5s %5$-5.5s %6$-6.6s %7$-5.5s %8$s",
388
//                new Object[] {
389
//                        this.type, 
390
//                        this.code, 
391
//                        this.version, 
392
//                        this.state,
393
//                        this.operatingSystem, 
394
//                        this.architecture, 
395
//                        this.javaVM,
396
//                        this.dependencies
397
//                }
398
//                );
399
//    }
400

    
401
    public String toStringCompact() {
402
        // type code version state os arch jvm dep alias
403
            StringBuffer s = new StringBuffer();
404
            s.append(strformat(this.type,-8,-4));
405
            s.append(" ");
406
            s.append(strformat(this.code,-40,0));
407
            s.append(" ");
408
            s.append(strformat(this.version,-20,-20)); 
409
            s.append(" ");
410
            s.append(strformat(this.state,-5,-5));
411
            s.append(" ");
412
            s.append(strformat(this.operatingSystem,-5,-5)); 
413
            s.append(" ");
414
            s.append(strformat(this.architecture,-6,-6));
415
            s.append(" ");
416
            s.append(strformat(this.javaVM,-5,-5));
417
            s.append(" ");
418
            s.append(strformat(this.dependencies,-8,0));
419
            s.append(" ");
420
            s.append(strformat(this.getAliasAsString(),-8,0));
421
            return s.toString();
422
    }
423

    
424
    private static final String SPACES256 = "                                                                                                                                                                                                                                                               ";
425
    
426
    private String strformat(Object o, int min, int max) {
427
            String s;
428
            boolean alignright = true;
429
            if( o == null ) {
430
                    s = "null";
431
            } else {
432
                    s = o.toString();
433
            }
434
            if( min < 0 ) {
435
                    min = - min;
436
                    alignright = false;
437
            }
438
            if( max == 0 ) {
439
                if( s.length() < min ) {
440
                        if( alignright ) {
441
                                s = SPACES256+s;
442
                                s = s.substring(s.length()-min);
443
                        } else {
444
                                s = (s + SPACES256).substring(0, min);
445
                        }
446
                    }
447
            } else {
448
                    if( max > 225) {
449
                            max = 256;
450
                    } else if( max < 0 ) {
451
                            max = -max;
452
                        alignright = false;
453
                    }
454
                    if( alignright ) {
455
                            if( s.length() > max ) {
456
                                    s = s.substring(0, max);
457
                            }
458
                        if( s.length() < min ) {
459
                                    s = SPACES256.substring(0,min-s.length())+s;
460
                            }
461
                    } else {
462
                            if( s.length() > max ) {
463
                                    s = s.substring(0, max);
464
                            }
465
                            if( s.length() < min ) {
466
                                    s = s + SPACES256.substring(0,min-s.length());
467
                            }
468
                    }
469
            }
470
            return s;
471
    }
472
        
473
    private DefaultPackageInfo append(StringBuffer buffer, String key,
474
        Object value) {
475
        buffer.append("\n\t").append(key).append(": ")
476
            .append(value == null ? "" : value);
477
        return this;
478
    }
479

    
480
    public Object clone() throws CloneNotSupportedException {
481
        DefaultPackageInfo other = (DefaultPackageInfo) super.clone();
482
        
483
        /*
484
         * If setDependencies is called with "" then
485
         * dependencies is set to null, so we must check this:
486
         */
487
        if (this.dependencies == null) {
488
            other.dependencies = null;
489
        } else {
490
            other.dependencies = (Dependencies) this.dependencies.clone();
491
        }
492

    
493
        other.version = (Version) this.version.clone();
494
        other.applicationVersion = (Version) this.applicationVersion.clone();
495
        other.categories = new ArrayList();
496
        other.categories.addAll(this.categories);
497
        other.aditionalProperties = new HashMap(this.aditionalProperties);
498
        return other;
499
    }
500

    
501

    
502
    public boolean matchID(String string) {
503
        String id = this.getID();
504
        String[] stringParts = string.split("#");
505
        Version version; 
506
        
507
        switch (stringParts.length) {
508
        case 1: // id
509
            if (stringParts[0].equals(this.getCode())) {
510
                return true;
511
            } else {
512
                return false;
513
            }
514
        case 2: // id, version
515
            if (!stringParts[0].equals(this.getCode())) {
516
                return false;
517
            }
518
            version = new DefaultVersion();
519
            try {
520
                version.parse(stringParts[1]);
521
            } catch (InvalidParameterException ex) {
522
                return false;
523
            }
524

    
525
            if (version.equals(this.getVersion())) {
526
                return true;
527
            }
528
            return false;
529
        case 4: // id, version, os, arch
530
            if (!stringParts[0].equals(this.getCode())) {
531
                return false;
532
            }
533
            if( !"any".equalsIgnoreCase(stringParts[1]) ) {
534
                version = new DefaultVersion();
535
                try {
536
                    version.parse(stringParts[1]);
537
                } catch (InvalidParameterException ex) {
538
                    return false;
539
                }
540

    
541
                if (!version.equals(this.getVersion())) {
542
                    return false;
543
                }
544
            }
545
            if( !"any".equalsIgnoreCase(stringParts[2]) ) {
546
                if( "current".equalsIgnoreCase(stringParts[2]) ) {
547
                    if( !this.getOperatingSystem().equalsIgnoreCase(this.getPackageManager().getOperatingSystem()) ) {
548
                        return false;
549
                    }
550
                } else if( !this.getOperatingSystem().equalsIgnoreCase(stringParts[2]) ) {
551
                    return false;
552
                }
553
            }
554
            if( !"any".equalsIgnoreCase(stringParts[3]) ) {
555
                if( "current".equalsIgnoreCase(stringParts[3]) ) {
556
                    if( !this.getArchitecture().equalsIgnoreCase(this.getPackageManager().getArchitecture()) ) {
557
                        return false;
558
                    }
559
                } else if( !this.getArchitecture().equalsIgnoreCase(stringParts[3]) ) {
560
                    return false;
561
                }
562
            }
563
            return true;
564
            
565
        default:
566
            return string.equals(id);
567

    
568
        }
569

    
570
    }
571

    
572
    public Dependencies getDependencies() {
573
        return this.dependencies;
574
    }
575

    
576
    public void setDependencies(Dependencies dependencies) {
577
        this.dependencies = dependencies;
578
    }
579

    
580
    public void setDependencies(String dependencies) {
581
        if ( isEmptyString(dependencies)) {
582
            this.dependencies = null;
583
        } else {
584
            this.dependencies = new DefaultDependencies().parse(dependencies);
585
        }
586
    }
587

    
588
    public boolean equals(Object obj) {
589
        PackageInfo other;
590
        try {
591
            other = (PackageInfo) obj;
592
        } catch (Exception e) {
593
            return false;
594
        }
595
        if (!code.equalsIgnoreCase(other.getCode())) {
596
            return false;
597
        }
598
        if (!version.check("=", other.getVersion())) {
599
            return false;
600
        }
601
        if (!operatingSystem.equalsIgnoreCase(other.getOperatingSystem())) {
602
            return false;
603
        }
604
        if (!applicationVersion.equals(other.getApplicationVersion())) {
605
            return false;
606
        }
607
        if (!state.equalsIgnoreCase(other.getState())) {
608
            return false;
609
        }
610
        if (!architecture.equalsIgnoreCase(other.getArchitecture())) {
611
            return false;
612
        }
613
        if (!javaVM.equalsIgnoreCase(other.getJavaVM())) {
614
            return false;
615
        }
616
        if (!type.equalsIgnoreCase(other.getType())) {
617
            return false;
618
        }
619
        if (official != other.isOfficial()) {
620
            return false;
621
        }
622
        return true;
623
    }
624

    
625
    public URL getWebURL() {
626
        return webURL;
627
    }
628

    
629
    public void setWebURL(URL webURL) {
630
        this.webURL = webURL;
631
    }
632

    
633
    public List getCategories() {
634
        return this.categories;
635
    }
636

    
637
    public void setCategories(List categoriesList) {
638
        for (int i = 0; i < categoriesList.size(); i++) {
639
            if (!this.categories.contains(categoriesList.get(i))) {
640
                this.categories.add(categoriesList.get(i));
641
            }
642
        }
643
    }
644

    
645
    public String getCategoriesAsString() {
646
        String categoriesString = "";
647
        for (int i = 0; i < this.categories.size(); i++) {
648
            if (i + 1 < this.categories.size()) {
649
                categoriesString += this.categories.get(i) + ", ";
650
            } else {
651
                categoriesString += this.categories.get(i);
652
            }
653
        }
654
        return categoriesString;
655
    }
656

    
657
    public void addCategoriesAsString(String categoriesString) {
658
        if (categoriesString == null) {
659
            return;
660
        }
661
        categoriesString.trim();
662
        String[] cadena = categoriesString.split(",");
663

    
664
        for (int i = 0; i < cadena.length; i++) {
665
            String trimCadena = cadena[i].trim();
666
            if ((!this.categories.contains(trimCadena)) && (trimCadena != "")) {
667
                this.categories.add(trimCadena);
668
            }
669
        }
670

    
671
    }
672

    
673
    public boolean isBroken() {
674
        if (this.broken) {
675
            return true;
676
        }
677
        // if( this.isOfficial() && !this.isSigned() ) {
678
        // return true;
679
        // }
680
        return false;
681
    }
682

    
683
        private boolean isEmptyString(String s) {
684
                if( s == null ) {
685
                        return true;
686
                }
687
                return s.length()==0;
688
        }
689

    
690
        public String getPostInstallScript() {
691
                return this.postInstallScript;
692
        }
693

    
694
        public void setPostInstallScript(String script) {
695
                this.postInstallScript = script;
696
        }
697
        
698
        protected void setBroken(boolean broken) {
699
                this.broken = broken;
700
        }
701

    
702
        public void setValue(String name, Object value) {
703
                this.aditionalProperties.put(name, value);
704
        }
705

    
706
        public Object getValue(String name) {
707
                return this.aditionalProperties.get(name);
708
        }
709

    
710
        private Object[] getPackageNameFormatParameters() {
711
                Object[] parameters = new Object[8];
712
                parameters[PACKAGE_FILE_NAME_FIELDS.GVSIG_VERSION] = this.getApplicationVersion().toString();
713
                parameters[PACKAGE_FILE_NAME_FIELDS.NAME] = this.getCode();
714
                parameters[PACKAGE_FILE_NAME_FIELDS.VERSION] = this.getVersion();
715
                parameters[PACKAGE_FILE_NAME_FIELDS.BUILD] = new Integer(this.getVersion().getBuild());
716
                parameters[PACKAGE_FILE_NAME_FIELDS.STATE] = this.getState();
717
                parameters[PACKAGE_FILE_NAME_FIELDS.OS] = this.getOperatingSystem();
718
                parameters[PACKAGE_FILE_NAME_FIELDS.ARCH] = this.getArchitecture();
719
                parameters[PACKAGE_FILE_NAME_FIELDS.JVM] = this.getJavaVM();
720
                return parameters;
721
        }
722
        
723
        public String getPreferedPackageFileName() {
724
                Object[] parameters = getPackageNameFormatParameters();
725
                return MessageFormat.format(PACKAGE_NAME_FORMAT, parameters);
726
        }
727

    
728
        
729
        // 
730
        // =========================================================
731
        // 
732
        // Deprecated methods
733
        //
734
        
735
        
736
        public int getBuild() {
737
                return this.getVersion().getBuild();
738
        }
739

    
740
        public void setBuild(int build) {
741
                this.getVersion().setBuild(build);
742
        }
743

    
744
        public String getGvSIGVersion() {
745
                // return this.getApplicationVersion().toString();
746
            Version v = this.getApplicationVersion();
747
            return v.getMajor() + "." + v.getMinor() + "." + v.getRevision();
748
        }
749

    
750
        public void setGvSIGVersion(String gvSIGVersion) {
751
                this.getApplicationVersion().parse(gvSIGVersion);
752
        }
753

    
754
        public URL getDownloadURL(URL baseURL) {
755
                logger.info("Deprecated methos, ignore parameter baseURL.");
756
                return this.getOwnerURL();
757
        }
758

    
759
        public String getAntScript() {
760
                return this.getPostInstallScript(); 
761
        }
762

    
763
        public void setAntScript(String antScript) {
764
                this.setPostInstallScript(antScript);
765
        }
766

    
767
        public File downloadFile() throws BaseException {
768
                throw new UnsupportedOperationException();
769
        }
770

    
771
        public File downloadFile(SimpleTaskStatus taskStatus) throws BaseException {
772
                throw new UnsupportedOperationException();
773
        }
774

    
775
        public void addFileToCopy(File file) {
776
                throw new UnsupportedOperationException();
777
        }
778

    
779
        public File getFileToCopy(int i) {
780
                throw new UnsupportedOperationException();
781
        }
782

    
783
        public void removeFileToCopy(File file) {
784
                throw new UnsupportedOperationException();
785
        }
786

    
787
        public void clearFilesToCopy() {
788
                throw new UnsupportedOperationException();
789
        }
790

    
791
        public List getFilesToCopy() {
792
                throw new UnsupportedOperationException();
793
        }
794

    
795
        public boolean removeInstallFolder(File folder) {
796
                throw new UnsupportedOperationException();
797
        }
798

    
799
        public boolean removeFilesFolder(File folder) {
800
                throw new UnsupportedOperationException();
801
        }
802

    
803
        public boolean isSigned() {
804
                return true;
805
        }
806

    
807
        public void checkSignature(byte[] pkgdata) {
808
                // Do nothing
809
        }
810

    
811
    /* (non-Javadoc)
812
     * @see org.gvsig.installer.lib.api.PackageInfo#setVersion(java.lang.String)
813
     */
814
    public void setVersion(String version) {
815
        this.version.parse(version);
816
    }
817
}