]>
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
;
3 import static java
.lang
.System
.Logger
.Level
.TRACE
;
6 import java
.io
.IOException
;
7 import java
.lang
.System
.Logger
;
8 import java
.util
.ArrayList
;
10 import java
.util
.StringTokenizer
;
12 /** Intermediary structure used by path matching */
14 private final static Logger logger
= System
.getLogger(BundlesSet
.class.getName());
16 private String baseUrl
= "reference:file";// not used yet
17 private final String dir
;
18 private List
<String
> includes
= new ArrayList
<String
>();
19 private List
<String
> excludes
= new ArrayList
<String
>();
21 public BundlesSet(String def
) {
22 StringTokenizer st
= new StringTokenizer(def
, ";");
24 if (!st
.hasMoreTokens())
25 throw new RuntimeException("Base dir not defined.");
27 String dirPath
= st
.nextToken();
29 if (dirPath
.startsWith("file:"))
30 dirPath
= dirPath
.substring("file:".length());
32 dir
= new File(dirPath
.replace('/', File
.separatorChar
)).getCanonicalPath();
33 logger
.log(TRACE
, () -> "Base dir: " + dir
);
34 } catch (IOException e
) {
35 throw new RuntimeException("Cannot convert to absolute path", e
);
38 while (st
.hasMoreTokens()) {
39 String tk
= st
.nextToken();
40 StringTokenizer stEq
= new StringTokenizer(tk
, "=");
41 String type
= stEq
.nextToken();
42 String pattern
= stEq
.nextToken();
43 if ("in".equals(type
) || "include".equals(type
)) {
44 includes
.add(pattern
);
45 } else if ("ex".equals(type
) || "exclude".equals(type
)) {
46 excludes
.add(pattern
);
47 } else if ("baseUrl".equals(type
)) {
50 System
.err
.println("Unkown bundles pattern type " + type
);
54 // if (excludeSvn && !excludes.contains(EXCLUDES_SVN_PATTERN)) {
55 // excludes.add(EXCLUDES_SVN_PATTERN);
59 public String
getDir() {
63 public List
<String
> getIncludes() {
67 public List
<String
> getExcludes() {
71 public String
getBaseUrl() {