Lines 63-68
Link Here
|
63 |
import java.util.logging.Logger; |
63 |
import java.util.logging.Logger; |
64 |
import org.netbeans.ModuleInstaller; |
64 |
import org.netbeans.ModuleInstaller; |
65 |
import org.netbeans.Util; |
65 |
import org.netbeans.Util; |
|
|
66 |
import org.openide.filesystems.FileObject; |
67 |
import org.openide.filesystems.FileUtil; |
66 |
import org.openide.modules.Dependency; |
68 |
import org.openide.modules.Dependency; |
67 |
import org.openide.modules.SpecificationVersion; |
69 |
import org.openide.modules.SpecificationVersion; |
68 |
import org.openide.xml.XMLUtil; |
70 |
import org.openide.xml.XMLUtil; |
Lines 87-92
Link Here
|
87 |
*/ |
89 |
*/ |
88 |
public final class AutomaticDependencies { |
90 |
public final class AutomaticDependencies { |
89 |
private static final Logger LOG = Logger.getLogger(AutomaticDependencies.class.getName()); |
91 |
private static final Logger LOG = Logger.getLogger(AutomaticDependencies.class.getName()); |
|
|
92 |
private static AutomaticDependencies INSTANCE; |
90 |
|
93 |
|
91 |
private AutomaticDependencies() {} |
94 |
private AutomaticDependencies() {} |
92 |
|
95 |
|
Lines 98-103
Link Here
|
98 |
return new AutomaticDependencies(); |
101 |
return new AutomaticDependencies(); |
99 |
} |
102 |
} |
100 |
|
103 |
|
|
|
104 |
/** Create default list of transformations. |
105 |
* This is now all handled from declarative configuration files: |
106 |
* in the system filesystem, ModuleAutoDeps/*.xml may be added |
107 |
* according to the DTD "-//NetBeans//DTD Module Automatic Dependencies 1.0//EN". |
108 |
* |
109 |
* @since 1.39 |
110 |
* @return the default list |
111 |
*/ |
112 |
public static AutomaticDependencies getDefault() { |
113 |
if (INSTANCE != null) { |
114 |
return INSTANCE; |
115 |
} |
116 |
|
117 |
FileObject depsFolder = FileUtil.getConfigFile("ModuleAutoDeps"); |
118 |
if (depsFolder != null) { |
119 |
FileObject[] kids = depsFolder.getChildren(); |
120 |
List<URL> urls = new ArrayList<URL>(Math.max(kids.length, 1)); |
121 |
for (FileObject kid : kids) { |
122 |
if (kid.hasExt("xml")) { // NOI18N |
123 |
urls.add(kid.toURL()); |
124 |
} |
125 |
} |
126 |
try { |
127 |
INSTANCE = AutomaticDependencies.parse(urls.toArray(new URL[urls.size()])); |
128 |
} catch (IOException e) { |
129 |
Util.err.log(Level.WARNING, null, e); |
130 |
} catch (SAXException e) { |
131 |
Util.err.log(Level.WARNING, null, e); |
132 |
} |
133 |
} |
134 |
if (INSTANCE == null) { |
135 |
// Parsing failed, or no files. |
136 |
INSTANCE = AutomaticDependencies.empty(); |
137 |
} |
138 |
if (Util.err.isLoggable(Level.FINE)) { |
139 |
Util.err.fine("Auto deps: " + INSTANCE); |
140 |
} |
141 |
return INSTANCE; |
142 |
} |
143 |
|
101 |
/** |
144 |
/** |
102 |
* Create a list of transformations based on some XML files. |
145 |
* Create a list of transformations based on some XML files. |
103 |
* They must be valid (this method may not validate them). |
146 |
* They must be valid (this method may not validate them). |