Revision 641

View differences:

org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrariesInitializer.java
353 353
        }
354 354

  
355 355
        private void addRequiredLibrary(Required req) {
356
            if (req.getLibrary() != null && req.getType() != null) {
356
            if (req.getLibrary() != null) {
357 357
                String name = req.getLibrary().getName();
358 358
                addRequiredLibrary(name, req.getType());
359 359
            }
360 360
        }
361 361

  
362 362
        private void addRequiredLibrary(String libraryName, String libraryType) {
363
            if (Library.TYPE.SERVICE.equals(libraryType)) {
363
            String type = getLibraryType(libraryName, libraryType);
364
            if (Library.TYPE.SERVICE.equals(type)) {
364 365
                Set libSet =
365
                    (Set) organizedLibs.get(libraryName + "-" + libraryType);
366
                    (Set) organizedLibs.get(libraryName + "-" + type);
366 367
                if (libSet != null) {
367 368
                    for (Iterator iterator = libSet.iterator(); iterator
368 369
                        .hasNext();) {
......
372 373
            } else {
373 374
                Library lib =
374 375
                    (Library) organizedLibs
375
                        .get(libraryName + "-" + libraryType);
376
                        .get(libraryName + "-" + type);
376 377
                if (lib != null) {
377 378
                    this.add(lib);
378 379
                }
379 380
            }
380 381
        }
382

  
383
        private String getLibraryType(String libraryName, String libraryType) {
384
            if (libraryType != null) {
385
                return libraryType;
386
            }
387
            if (organizedLibs.get(libraryName + "-" + Library.TYPE.SERVICE) != null) {
388
                return Library.TYPE.SERVICE;
389
            } else
390
                if (organizedLibs.get(libraryName + "-" + Library.TYPE.IMPL) != null) {
391
                    return Library.TYPE.IMPL;
392
                } else {
393
                    return Library.TYPE.API;
394
                }
395

  
396
        }
381 397
    }
382 398
}
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/library/AbstractLibrary.java
75 75
        public String getType() {
76 76
            return this.type;
77 77
        }
78
        
79
        public String toString() {
80
            return this.library.toString() + ":"
81
                + (this.type == null ? "UNDEFINED" : this.type.toUpperCase());
82
        }
78 83
    }
79 84

  
80 85
    /**
......
165 170
     *            the required library
166 171
     */
167 172
    public synchronized final void require(Class library) {
168
        doRequire(library, Library.TYPE.IMPL);
173
        doRequire(library, null);
169 174
    }
170 175

  
171 176
    private void doRequire(Class library, String type) {

Also available in: Unified diff