1 package org
.argeo
.slc
.osgiboot
;
3 import java
.io
.BufferedReader
;
5 import java
.io
.IOException
;
6 import java
.io
.InputStream
;
7 import java
.io
.InputStreamReader
;
9 import java
.util
.ArrayList
;
10 import java
.util
.HashMap
;
11 import java
.util
.Iterator
;
12 import java
.util
.List
;
14 import java
.util
.StringTokenizer
;
16 import org
.argeo
.slc
.osgiboot
.internal
.springutil
.AntPathMatcher
;
17 import org
.argeo
.slc
.osgiboot
.internal
.springutil
.PathMatcher
;
18 import org
.argeo
.slc
.osgiboot
.internal
.springutil
.SystemPropertyUtils
;
19 import org
.osgi
.framework
.Bundle
;
20 import org
.osgi
.framework
.BundleContext
;
21 import org
.osgi
.framework
.BundleException
;
22 import org
.osgi
.framework
.Constants
;
23 import org
.osgi
.framework
.ServiceReference
;
24 import org
.osgi
.service
.packageadmin
.PackageAdmin
;
26 public class OsgiBoot
{
27 public final static String SYMBOLIC_NAME_OSGI_BOOT
= "org.argeo.osgi.boot";
28 public final static String SYMBOLIC_NAME_EQUINOX
= "org.eclipse.osgi";
30 public final static String PROP_ARGEO_OSGI_DATA_DIR
= "argeo.osgi.data.dir";
32 public final static String PROP_ARGEO_OSGI_START
= "argeo.osgi.start";
33 public final static String PROP_ARGEO_OSGI_BUNDLES
= "argeo.osgi.bundles";
34 public final static String PROP_ARGEO_OSGI_LOCATIONS
= "argeo.osgi.locations";
35 public final static String PROP_ARGEO_OSGI_BASE_URL
= "argeo.osgi.baseUrl";
36 public final static String PROP_ARGEO_OSGI_MODULES_URL
= "argeo.osgi.modulesUrl";
38 public final static String PROP_ARGEO_OSGI_BOOT_DEBUG
= "argeo.osgi.boot.debug";
39 public final static String PROP_ARGEO_OSGI_BOOT_DEFAULT_TIMEOUT
= "argeo.osgi.boot.defaultTimeout";
40 public final static String PROP_ARGEO_OSGI_BOOT_MODULES_URL_SEPARATOR
= "argeo.osgi.boot.modulesUrlSeparator";
41 public final static String PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE
= "argeo.osgi.boot.systemPropertiesFile";
44 public final static String PROP_SLC_OSGI_START
= "slc.osgi.start";
46 public final static String PROP_SLC_OSGI_BUNDLES
= "slc.osgi.bundles";
48 public final static String PROP_SLC_OSGI_LOCATIONS
= "slc.osgi.locations";
50 public final static String PROP_SLC_OSGI_BASE_URL
= "slc.osgi.baseUrl";
52 public final static String PROP_SLC_OSGI_MODULES_URL
= "slc.osgi.modulesUrl";
55 public final static String PROP_SLC_OSGIBOOT_DEBUG
= "slc.osgiboot.debug";
57 public final static String PROP_SLC_OSGIBOOT_DEFAULT_TIMEOUT
= "slc.osgiboot.defaultTimeout";
59 public final static String PROP_SLC_OSGIBOOT_MODULES_URL_SEPARATOR
= "slc.osgiboot.modulesUrlSeparator";
61 public final static String PROP_SLC_OSGIBOOT_SYSTEM_PROPERTIES_FILE
= "slc.osgiboot.systemPropertiesFile";
63 public final static String DEFAULT_BASE_URL
= "reference:file:";
64 public final static String EXCLUDES_SVN_PATTERN
= "**/.svn/**";
66 private boolean debug
= Boolean
.valueOf(
67 System
.getProperty(PROP_ARGEO_OSGI_BOOT_DEBUG
, System
.getProperty(
68 PROP_SLC_OSGIBOOT_DEBUG
, "false"))).booleanValue();
69 /** Default is 10s (set in constructor) */
70 private long defaultTimeout
;
72 private boolean excludeSvn
= true;
73 /** Default is ',' (set in constructor) */
74 private String modulesUrlSeparator
= ",";
76 private final BundleContext bundleContext
;
78 public OsgiBoot(BundleContext bundleContext
) {
79 this.bundleContext
= bundleContext
;
80 defaultTimeout
= Long
.parseLong(getPropertyCompat(
81 PROP_ARGEO_OSGI_BOOT_DEFAULT_TIMEOUT
,
82 PROP_SLC_OSGIBOOT_DEFAULT_TIMEOUT
, "10000"));
83 modulesUrlSeparator
= getPropertyCompat(
84 PROP_ARGEO_OSGI_BOOT_MODULES_URL_SEPARATOR
,
85 PROP_SLC_OSGIBOOT_MODULES_URL_SEPARATOR
, ",");
86 initSystemProperties();
89 protected void initSystemProperties() {
90 String osgiInstanceArea
= System
.getProperty("osgi.instance.area");
91 String osgiInstanceAreaDefault
= System
92 .getProperty("osgi.instance.area.default");
93 String tempDir
= System
.getProperty("java.io.tmpdir");
96 if (osgiInstanceArea
!= null) {
97 // within OSGi with -data specified
98 osgiInstanceArea
= removeFilePrefix(osgiInstanceArea
);
99 dataDir
= new File(osgiInstanceArea
);
100 } else if (osgiInstanceAreaDefault
!= null) {
101 // within OSGi without -data specified
102 osgiInstanceAreaDefault
= removeFilePrefix(osgiInstanceAreaDefault
);
103 dataDir
= new File(osgiInstanceAreaDefault
);
104 } else {// outside OSGi
105 dataDir
= new File(tempDir
+ File
.separator
+ "argeoOsgiData");
108 System
.setProperty(PROP_ARGEO_OSGI_DATA_DIR
, dataDir
.getAbsolutePath());
110 // TODO: Load additional system properties from file
111 // Properties additionalSystemProperties = new Properties();
115 public static String
removeFilePrefix(String url
) {
116 if (url
.startsWith("file:"))
117 return url
.substring("file:".length());
118 else if (url
.startsWith("reference:file:"))
119 return url
.substring("reference:file:".length());
124 public void bootstrap() {
125 long begin
= System
.currentTimeMillis();
126 System
.out
.println();
127 info("OSGi bootstrap starting...");
128 info("Writable data directory : "
129 + System
.getProperty(PROP_ARGEO_OSGI_DATA_DIR
)
130 + " (set as system property " + PROP_ARGEO_OSGI_DATA_DIR
+ ")");
131 installUrls(getBundlesUrls());
132 installUrls(getLocationsUrls());
133 installUrls(getModulesUrls());
136 long duration
= System
.currentTimeMillis() - begin
;
137 info("OSGi bootstrap completed in "
138 + Math
.round(((double) duration
) / 1000) + "s (" + duration
139 + "ms), " + bundleContext
.getBundles().length
+ " bundles");
140 System
.out
.println();
143 public void installUrls(List urls
) {
144 Map installedBundles
= getInstalledBundles();
145 for (int i
= 0; i
< urls
.size(); i
++) {
146 String url
= (String
) urls
.get(i
);
148 if (installedBundles
.containsKey(url
)) {
149 Bundle bundle
= (Bundle
) installedBundles
.get(url
);
152 debug("Bundle " + bundle
.getSymbolicName()
153 + " already installed from " + url
);
155 Bundle bundle
= bundleContext
.installBundle(url
);
157 debug("Installed bundle " + bundle
.getSymbolicName()
160 } catch (BundleException e
) {
161 String message
= e
.getMessage();
162 if ((message
.contains("Bundle \"" + SYMBOLIC_NAME_OSGI_BOOT
163 + "\"") || message
.contains("Bundle \""
164 + SYMBOLIC_NAME_EQUINOX
+ "\""))
165 && message
.contains("has already been installed")) {
166 // silent, in order to avoid warnings: we know that both
167 // have already been installed...
169 warn("Could not install bundle from " + url
+ ": "
179 public void installOrUpdateUrls(Map urls
) {
180 Map installedBundles
= getBundles();
182 for (Iterator modules
= urls
.keySet().iterator(); modules
.hasNext();) {
183 String moduleName
= (String
) modules
.next();
184 String urlStr
= (String
) urls
.get(moduleName
);
185 if (installedBundles
.containsKey(moduleName
)) {
186 Bundle bundle
= (Bundle
) installedBundles
.get(moduleName
);
189 URL url
= new URL(urlStr
);
190 in
= url
.openStream();
192 info("Updated bundle " + moduleName
+ " from " + urlStr
);
193 } catch (Exception e
) {
194 throw new RuntimeException("Cannot update " + moduleName
195 + " from " + urlStr
);
200 } catch (IOException e
) {
205 Bundle bundle
= bundleContext
.installBundle(urlStr
);
207 debug("Installed bundle " + bundle
.getSymbolicName()
208 + " from " + urlStr
);
209 } catch (BundleException e
) {
210 warn("Could not install bundle from " + urlStr
+ ": "
218 public void startBundles() {
219 String bundlesToStart
= getPropertyCompat(PROP_ARGEO_OSGI_START
,
220 PROP_SLC_OSGI_START
);
221 startBundles(bundlesToStart
);
224 public void startBundles(String bundlesToStartStr
) {
225 if (bundlesToStartStr
== null)
228 StringTokenizer st
= new StringTokenizer(bundlesToStartStr
, ",");
229 List bundlesToStart
= new ArrayList();
230 while (st
.hasMoreTokens()) {
231 String name
= st
.nextToken().trim();
232 bundlesToStart
.add(name
);
234 startBundles(bundlesToStart
);
237 public void startBundles(List bundlesToStart
) {
238 if (bundlesToStart
.size() == 0)
241 // used to log the bundles not found
242 List notFoundBundles
= new ArrayList(bundlesToStart
);
244 Bundle
[] bundles
= bundleContext
.getBundles();
245 long startBegin
= System
.currentTimeMillis();
246 for (int i
= 0; i
< bundles
.length
; i
++) {
247 Bundle bundle
= bundles
[i
];
248 String symbolicName
= bundle
.getSymbolicName();
249 if (bundlesToStart
.contains(symbolicName
))
253 } catch (Exception e
) {
254 warn("Start of bundle " + symbolicName
255 + " failed because of " + e
256 + ", maybe bundle is not yet resolved,"
257 + " waiting and trying again.");
258 waitForBundleResolvedOrActive(startBegin
, bundle
);
261 notFoundBundles
.remove(symbolicName
);
262 } catch (Exception e
) {
263 warn("Bundle " + symbolicName
+ " cannot be started: "
267 // was found even if start failed
268 notFoundBundles
.remove(symbolicName
);
272 for (int i
= 0; i
< notFoundBundles
.size(); i
++)
273 warn("Bundle " + notFoundBundles
.get(i
)
274 + " not started because it was not found.");
277 protected void checkUnresolved() {
279 ServiceReference packageAdminRef
= bundleContext
280 .getServiceReference(PackageAdmin
.class.getName());
281 PackageAdmin packageAdmin
= (PackageAdmin
) bundleContext
282 .getService(packageAdminRef
);
283 packageAdmin
.resolveBundles(null);
285 Bundle
[] bundles
= bundleContext
.getBundles();
286 List
/* Bundle */unresolvedBundles
= new ArrayList();
287 for (int i
= 0; i
< bundles
.length
; i
++) {
288 int bundleState
= bundles
[i
].getState();
289 if (!(bundleState
== Bundle
.ACTIVE
290 || bundleState
== Bundle
.RESOLVED
|| bundleState
== Bundle
.STARTING
))
291 unresolvedBundles
.add(bundles
[i
]);
294 if (unresolvedBundles
.size() != 0) {
295 warn("Unresolved bundles " + unresolvedBundles
);
299 protected void waitForBundleResolvedOrActive(long startBegin
, Bundle bundle
)
301 int originalState
= bundle
.getState();
302 if ((originalState
== Bundle
.RESOLVED
)
303 || (originalState
== Bundle
.ACTIVE
))
306 String originalStateStr
= stateAsString(originalState
);
308 int currentState
= bundle
.getState();
309 while (!(currentState
== Bundle
.RESOLVED
|| currentState
== Bundle
.ACTIVE
)) {
310 long now
= System
.currentTimeMillis();
311 if ((now
- startBegin
) > defaultTimeout
)
312 throw new Exception("Bundle " + bundle
.getSymbolicName()
313 + " was not RESOLVED or ACTIVE after "
314 + (now
- startBegin
) + "ms (originalState="
315 + originalStateStr
+ ", currentState="
316 + stateAsString(currentState
) + ")");
320 } catch (InterruptedException e
) {
323 currentState
= bundle
.getState();
327 public static String
stateAsString(int state
) {
329 case Bundle
.UNINSTALLED
:
330 return "UNINSTALLED";
331 case Bundle
.INSTALLED
:
333 case Bundle
.RESOLVED
:
335 case Bundle
.STARTING
:
339 case Bundle
.STOPPING
:
342 return Integer
.toString(state
);
346 /** Key is location */
347 public Map
getInstalledBundles() {
348 Map installedBundles
= new HashMap();
350 Bundle
[] bundles
= bundleContext
.getBundles();
351 for (int i
= 0; i
< bundles
.length
; i
++) {
352 installedBundles
.put(bundles
[i
].getLocation(), bundles
[i
]);
354 return installedBundles
;
357 /** Key is symbolic name */
358 public Map
getBundles() {
359 Map namedBundles
= new HashMap();
360 Bundle
[] bundles
= bundleContext
.getBundles();
361 for (int i
= 0; i
< bundles
.length
; i
++) {
362 namedBundles
.put(bundles
[i
].getSymbolicName(), bundles
[i
]);
367 public List
getLocationsUrls() {
368 String baseUrl
= getPropertyCompat(PROP_ARGEO_OSGI_BASE_URL
,
369 PROP_SLC_OSGI_BASE_URL
, DEFAULT_BASE_URL
);
370 String bundleLocations
= getPropertyCompat(PROP_ARGEO_OSGI_LOCATIONS
,
371 PROP_SLC_OSGI_LOCATIONS
);
372 return getLocationsUrls(baseUrl
, bundleLocations
);
375 public List
getModulesUrls() {
376 List urls
= new ArrayList();
377 String modulesUrlStr
= getPropertyCompat(PROP_ARGEO_OSGI_MODULES_URL
,
378 PROP_SLC_OSGI_MODULES_URL
);
379 if (modulesUrlStr
== null)
382 String baseUrl
= getPropertyCompat(PROP_ARGEO_OSGI_BASE_URL
,
383 PROP_SLC_OSGI_BASE_URL
);
385 Map installedBundles
= getBundles();
387 BufferedReader reader
= null;
389 URL modulesUrl
= new URL(modulesUrlStr
);
390 reader
= new BufferedReader(new InputStreamReader(modulesUrl
393 while ((line
= reader
.readLine()) != null) {
394 StringTokenizer st
= new StringTokenizer(line
,
395 modulesUrlSeparator
);
396 String moduleName
= st
.nextToken();
397 String moduleVersion
= st
.nextToken();
398 String url
= st
.nextToken();
402 if (installedBundles
.containsKey(moduleName
)) {
403 Bundle bundle
= (Bundle
) installedBundles
.get(moduleName
);
404 String bundleVersion
= bundle
.getHeaders().get(
405 Constants
.BUNDLE_VERSION
).toString();
406 int comp
= compareVersions(bundleVersion
, moduleVersion
);
408 warn("Installed version " + bundleVersion
409 + " of bundle " + moduleName
410 + " is newer than provided version "
412 } else if (comp
< 0) {
414 info("Updated bundle " + moduleName
+ " with version "
415 + moduleVersion
+ " (old version was "
416 + bundleVersion
+ ")");
424 } catch (Exception e1
) {
425 throw new RuntimeException("Cannot read url " + modulesUrlStr
, e1
);
430 } catch (IOException e
) {
438 * @return ==0: versions are identical, <0: tested version is newer, >0:
439 * currentVersion is newer.
441 protected int compareVersions(String currentVersion
, String testedVersion
) {
442 List cToks
= new ArrayList();
443 StringTokenizer cSt
= new StringTokenizer(currentVersion
, ".");
444 while (cSt
.hasMoreTokens())
445 cToks
.add(cSt
.nextToken());
446 List tToks
= new ArrayList();
447 StringTokenizer tSt
= new StringTokenizer(currentVersion
, ".");
448 while (tSt
.hasMoreTokens())
449 tToks
.add(tSt
.nextToken());
452 comp
: for (int i
= 0; i
< cToks
.size(); i
++) {
453 if (tToks
.size() <= i
) {
454 // equals until then, tested shorter
459 String c
= (String
) cToks
.get(i
);
460 String t
= (String
) tToks
.get(i
);
463 int cInt
= Integer
.parseInt(c
);
464 int tInt
= Integer
.parseInt(t
);
468 comp
= (cInt
- tInt
);
471 } catch (NumberFormatException e
) {
475 comp
= c
.compareTo(t
);
481 if (comp
== 0 && tToks
.size() > cToks
.size()) {
482 // equals until then, current shorter
489 public List
getLocationsUrls(String baseUrl
, String bundleLocations
) {
490 List urls
= new ArrayList();
492 if (bundleLocations
== null)
494 bundleLocations
= SystemPropertyUtils
495 .resolvePlaceholders(bundleLocations
);
497 debug(PROP_ARGEO_OSGI_LOCATIONS
+ "=" + bundleLocations
);
499 StringTokenizer st
= new StringTokenizer(bundleLocations
,
501 while (st
.hasMoreTokens()) {
502 urls
.add(locationToUrl(baseUrl
, st
.nextToken().trim()));
507 public List
getBundlesUrls() {
508 String baseUrl
= getPropertyCompat(PROP_ARGEO_OSGI_BASE_URL
,
509 PROP_SLC_OSGI_BASE_URL
, DEFAULT_BASE_URL
);
510 String bundlePatterns
= getPropertyCompat(PROP_ARGEO_OSGI_BUNDLES
,
511 PROP_SLC_OSGI_BUNDLES
);
512 return getBundlesUrls(baseUrl
, bundlePatterns
);
515 public List
getBundlesUrls(String baseUrl
, String bundlePatterns
) {
516 List urls
= new ArrayList();
518 List bundlesSets
= new ArrayList();
519 if (bundlePatterns
== null)
521 bundlePatterns
= SystemPropertyUtils
522 .resolvePlaceholders(bundlePatterns
);
524 debug(PROP_ARGEO_OSGI_BUNDLES
+ "=" + bundlePatterns
525 + " (excludeSvn=" + excludeSvn
+ ")");
527 StringTokenizer st
= new StringTokenizer(bundlePatterns
, ",");
528 while (st
.hasMoreTokens()) {
529 bundlesSets
.add(new BundlesSet(st
.nextToken()));
532 List included
= new ArrayList();
533 PathMatcher matcher
= new AntPathMatcher();
534 for (int i
= 0; i
< bundlesSets
.size(); i
++) {
535 BundlesSet bundlesSet
= (BundlesSet
) bundlesSets
.get(i
);
536 for (int j
= 0; j
< bundlesSet
.getIncludes().size(); j
++) {
537 String pattern
= (String
) bundlesSet
.getIncludes().get(j
);
538 match(matcher
, included
, bundlesSet
.getDir(), null, pattern
);
542 List excluded
= new ArrayList();
543 for (int i
= 0; i
< bundlesSets
.size(); i
++) {
544 BundlesSet bundlesSet
= (BundlesSet
) bundlesSets
.get(i
);
545 for (int j
= 0; j
< bundlesSet
.getExcludes().size(); j
++) {
546 String pattern
= (String
) bundlesSet
.getExcludes().get(j
);
547 match(matcher
, excluded
, bundlesSet
.getDir(), null, pattern
);
551 for (int i
= 0; i
< included
.size(); i
++) {
552 String fullPath
= (String
) included
.get(i
);
553 if (!excluded
.contains(fullPath
))
554 urls
.add(locationToUrl(baseUrl
, fullPath
));
560 protected void match(PathMatcher matcher
, List matched
, String base
,
561 String currentPath
, String pattern
) {
562 if (currentPath
== null) {
564 File baseDir
= new File(base
.replace('/', File
.separatorChar
));
565 File
[] files
= baseDir
.listFiles();
568 warn("Base dir " + baseDir
+ " has no children, exists="
569 + baseDir
.exists() + ", isDirectory="
570 + baseDir
.isDirectory());
574 for (int i
= 0; i
< files
.length
; i
++)
575 match(matcher
, matched
, base
, files
[i
].getName(), pattern
);
577 String fullPath
= base
+ '/' + currentPath
;
578 if (matched
.contains(fullPath
))
579 return;// don't try deeper if already matched
581 boolean ok
= matcher
.match(pattern
, currentPath
);
583 debug(currentPath
+ " " + (ok ?
"" : " not ")
584 + " matched with " + pattern
);
586 matched
.add(fullPath
);
589 String newFullPath
= relativeToFullPath(base
, currentPath
);
590 File newFile
= new File(newFullPath
);
591 File
[] files
= newFile
.listFiles();
593 for (int i
= 0; i
< files
.length
; i
++) {
594 String newCurrentPath
= currentPath
+ '/'
595 + files
[i
].getName();
596 if (files
[i
].isDirectory()) {
597 if (matcher
.matchStart(pattern
, newCurrentPath
)) {
598 // recurse only if start matches
599 match(matcher
, matched
, base
, newCurrentPath
,
604 + " does not start match with "
609 boolean nonDirectoryOk
= matcher
.match(pattern
,
612 debug(currentPath
+ " " + (ok ?
"" : " not ")
613 + " matched with " + pattern
);
615 matched
.add(relativeToFullPath(base
,
624 protected String
locationToUrl(String baseUrl
, String location
) {
625 int extInd
= location
.lastIndexOf('.');
628 ext
= location
.substring(extInd
);
630 if (baseUrl
.startsWith("reference:") && ".jar".equals(ext
))
631 return "file:" + location
;
633 return baseUrl
+ location
;
636 /** Transforms a relative path in a full system path. */
637 protected String
relativeToFullPath(String basePath
, String relativePath
) {
638 return (basePath
+ '/' + relativePath
).replace('/', File
.separatorChar
);
641 protected static void info(Object obj
) {
642 System
.out
.println("# OSGiBOOT # " + obj
);
645 protected void debug(Object obj
) {
647 System
.out
.println("# OSGiBOOT DBG # " + obj
);
650 protected void warn(Object obj
) {
651 System
.out
.println("# OSGiBOOT WARN # " + obj
);
652 // Because of a weird bug under Windows when starting it in a forked VM
653 // if (System.getProperty("os.name").contains("Windows"))
654 // System.out.println("# WARN " + obj);
656 // System.err.println("# WARN " + obj);
659 protected String
getProperty(String name
, String defaultValue
) {
661 if (defaultValue
!= null)
662 value
= System
.getProperty(name
, defaultValue
);
664 value
= System
.getProperty(name
);
666 if (value
== null || value
.equals(""))
672 protected String
getProperty(String name
) {
673 return getProperty(name
, null);
676 protected String
getPropertyCompat(String name
, String oldName
) {
677 return getPropertyCompat(name
, oldName
, null);
680 protected String
getPropertyCompat(String name
, String oldName
,
681 String defaultValue
) {
684 if (defaultValue
!= null) {
685 res
= getProperty(name
, defaultValue
);
686 if (res
.equals(defaultValue
)) {
687 res
= getProperty(oldName
, defaultValue
);
688 if (!res
.equals(defaultValue
))
689 warnDeprecated(name
, oldName
);
692 res
= getProperty(name
, null);
694 res
= getProperty(oldName
, null);
696 warnDeprecated(name
, oldName
);
702 protected void warnDeprecated(String name
, String oldName
) {
703 warn("Property '" + oldName
704 + "' is deprecated and will be removed soon, use '" + name
708 public boolean getDebug() {
712 public void setDebug(boolean debug
) {
716 public BundleContext
getBundleContext() {
717 return bundleContext
;
720 /** Whether to exclude Subversion directories (true by default) */
721 public boolean isExcludeSvn() {
725 public void setExcludeSvn(boolean excludeSvn
) {
726 this.excludeSvn
= excludeSvn
;
729 protected class BundlesSet
{
730 private String baseUrl
= "reference:file";// not used yet
731 private final String dir
;
732 private List includes
= new ArrayList();
733 private List excludes
= new ArrayList();
735 public BundlesSet(String def
) {
736 StringTokenizer st
= new StringTokenizer(def
, ";");
738 if (!st
.hasMoreTokens())
739 throw new RuntimeException("Base dir not defined.");
741 String dirPath
= st
.nextToken();
743 if (dirPath
.startsWith("file:"))
744 dirPath
= dirPath
.substring("file:".length());
746 dir
= new File(dirPath
.replace('/', File
.separatorChar
))
749 debug("Base dir: " + dir
);
750 } catch (IOException e
) {
751 throw new RuntimeException("Cannot convert to absolute path", e
);
754 while (st
.hasMoreTokens()) {
755 String tk
= st
.nextToken();
756 StringTokenizer stEq
= new StringTokenizer(tk
, "=");
757 String type
= stEq
.nextToken();
758 String pattern
= stEq
.nextToken();
759 if ("in".equals(type
) || "include".equals(type
)) {
760 includes
.add(pattern
);
761 } else if ("ex".equals(type
) || "exclude".equals(type
)) {
762 excludes
.add(pattern
);
763 } else if ("baseUrl".equals(type
)) {
766 System
.err
.println("Unkown bundles pattern type " + type
);
770 if (excludeSvn
&& !excludes
.contains(EXCLUDES_SVN_PATTERN
)) {
771 excludes
.add(EXCLUDES_SVN_PATTERN
);
775 public String
getDir() {
779 public List
getIncludes() {
783 public List
getExcludes() {
787 public String
getBaseUrl() {
793 public void setDefaultTimeout(long defaultTimeout
) {
794 this.defaultTimeout
= defaultTimeout
;
797 public void setModulesUrlSeparator(String modulesUrlSeparator
) {
798 this.modulesUrlSeparator
= modulesUrlSeparator
;