]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.init/src/org/argeo/init/osgi/BundlesSet.java
1 package org
.argeo
.init
.osgi
;
4 import java
.io
.IOException
;
5 import java
.util
.ArrayList
;
7 import java
.util
.StringTokenizer
;
9 /** Intermediary structure used by path matching */
11 private String baseUrl
= "reference:file";// not used yet
12 private final String dir
;
13 private List
<String
> includes
= new ArrayList
<String
>();
14 private List
<String
> excludes
= new ArrayList
<String
>();
16 public BundlesSet(String def
) {
17 StringTokenizer st
= new StringTokenizer(def
, ";");
19 if (!st
.hasMoreTokens())
20 throw new RuntimeException("Base dir not defined.");
22 String dirPath
= st
.nextToken();
24 if (dirPath
.startsWith("file:"))
25 dirPath
= dirPath
.substring("file:".length());
27 dir
= new File(dirPath
.replace('/', File
.separatorChar
)).getCanonicalPath();
28 if (OsgiBootUtils
.debug
)
29 OsgiBootUtils
.debug("Base dir: " + dir
);
30 } catch (IOException e
) {
31 throw new RuntimeException("Cannot convert to absolute path", e
);
34 while (st
.hasMoreTokens()) {
35 String tk
= st
.nextToken();
36 StringTokenizer stEq
= new StringTokenizer(tk
, "=");
37 String type
= stEq
.nextToken();
38 String pattern
= stEq
.nextToken();
39 if ("in".equals(type
) || "include".equals(type
)) {
40 includes
.add(pattern
);
41 } else if ("ex".equals(type
) || "exclude".equals(type
)) {
42 excludes
.add(pattern
);
43 } else if ("baseUrl".equals(type
)) {
46 System
.err
.println("Unkown bundles pattern type " + type
);
50 // if (excludeSvn && !excludes.contains(EXCLUDES_SVN_PATTERN)) {
51 // excludes.add(EXCLUDES_SVN_PATTERN);
55 public String
getDir() {
59 public List
<String
> getIncludes() {
63 public List
<String
> getExcludes() {
67 public String
getBaseUrl() {